From 754c1e5438457385fc8fa52abfcedf8ccd519925 Mon Sep 17 00:00:00 2001 From: Robin Ward <robin.ward@gmail.com> Date: Wed, 5 Jul 2017 14:14:30 -0400 Subject: [PATCH] Upgrade to Babel 6 --- .../admin/components/ip-lookup.js.es6 | 2 +- .../admin/components/permalink-form.js.es6 | 2 +- .../javascripts/admin/models/api-key.js.es6 | 2 +- .../admin/routes/admin-reports.js.es6 | 2 +- app/assets/javascripts/deprecated.js | 2 +- .../discourse-common/resolver.js.es6 | 4 +- app/assets/javascripts/discourse-loader.js | 6 +- app/assets/javascripts/discourse.js.es6 | 6 +- .../components/search-advanced-options.js.es6 | 4 +- .../controllers/discovery/topics.js.es6 | 2 +- .../discourse/controllers/flag.js.es6 | 2 +- .../discourse/controllers/invite.js.es6 | 6 +- .../discourse/controllers/user.js.es6 | 2 +- .../javascripts/discourse/helpers/raw.js.es6 | 2 +- .../initializers/auto-load-modules.js.es6 | 4 +- .../javascripts/discourse/lib/autosize.js.es6 | 10 +- .../discourse/lib/plugin-connectors.js.es6 | 2 +- .../javascripts/discourse/lib/search.js.es6 | 6 +- .../discourse/mapping-router.js.es6 | 2 +- .../javascripts/discourse/models/post.js.es6 | 2 +- .../discourse/routes/application.js.es6 | 2 +- .../ember-computed-decorators.js.es6 | 1 - .../engines/discourse-markdown-it.js.es6 | 2 +- .../engines/discourse-markdown.js.es6 | 4 +- .../wizard/initializers/load-helpers.js.es6 | 2 +- .../javascripts/wizard/test/test_helper.js | 8 +- app/assets/javascripts/wizard/wizard.js.es6 | 2 +- app/models/theme_field.rb | 2 +- .../tilt/es6_module_transpiler_template.rb | 28 +- lib/freedom_patches/raw_handlebars.rb | 10 +- .../lib/details-cooked-test.js.es6 | 2 +- test/javascripts/helpers/qunit-helpers.js.es6 | 2 +- .../initializers/localization-test.js.es6 | 4 +- test/javascripts/mdtest/mdtest.js.es6.erb | 2 +- vendor/assets/javascripts/babel.js | 129871 +++++++-------- 35 files changed, 62713 insertions(+), 67299 deletions(-) diff --git a/app/assets/javascripts/admin/components/ip-lookup.js.es6 b/app/assets/javascripts/admin/components/ip-lookup.js.es6 index 0c9b73d54ac..58b71d73d25 100644 --- a/app/assets/javascripts/admin/components/ip-lookup.js.es6 +++ b/app/assets/javascripts/admin/components/ip-lookup.js.es6 @@ -44,7 +44,7 @@ export default Ember.Component.extend({ self.set("totalOthersWithSameIP", result.total); }); - const AdminUser = require('admin/models/admin-user').default; + const AdminUser = requirejs('admin/models/admin-user').default; AdminUser.findAll("active", data).then(function (users) { self.setProperties({ other_accounts: users, diff --git a/app/assets/javascripts/admin/components/permalink-form.js.es6 b/app/assets/javascripts/admin/components/permalink-form.js.es6 index 2bde845c0c6..321f613589c 100644 --- a/app/assets/javascripts/admin/components/permalink-form.js.es6 +++ b/app/assets/javascripts/admin/components/permalink-form.js.es6 @@ -18,7 +18,7 @@ export default Ember.Component.extend({ actions: { submit: function() { - const Permalink = require('admin/models/permalink').default; + const Permalink = requirejs('admin/models/permalink').default; if (!this.get('formSubmitted')) { const self = this; diff --git a/app/assets/javascripts/admin/models/api-key.js.es6 b/app/assets/javascripts/admin/models/api-key.js.es6 index 2a7cf867783..274b2fd09b3 100644 --- a/app/assets/javascripts/admin/models/api-key.js.es6 +++ b/app/assets/javascripts/admin/models/api-key.js.es6 @@ -37,7 +37,7 @@ ApiKey.reopenClass({ @returns {ApiKey} the ApiKey instance **/ create: function() { - const AdminUser = require('admin/models/admin-user').default; + const AdminUser = requirejs('admin/models/admin-user').default; var result = this._super.apply(this, arguments); if (result.user) { result.user = AdminUser.create(result.user); diff --git a/app/assets/javascripts/admin/routes/admin-reports.js.es6 b/app/assets/javascripts/admin/routes/admin-reports.js.es6 index 47ece705808..fc609296646 100644 --- a/app/assets/javascripts/admin/routes/admin-reports.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-reports.js.es6 @@ -10,7 +10,7 @@ export default Discourse.Route.extend({ queryParams: { mode: {}, "start_date": {}, "end_date": {}, "category_id": {}, "group_id": {} }, model: function(params) { - const Report = require('admin/models/report').default; + const Report = requirejs('admin/models/report').default; return Report.find(params.type, params['start_date'], params['end_date'], params['category_id'], params['group_id']); }, diff --git a/app/assets/javascripts/deprecated.js b/app/assets/javascripts/deprecated.js index 151ed975d0c..a4174c50c84 100644 --- a/app/assets/javascripts/deprecated.js +++ b/app/assets/javascripts/deprecated.js @@ -1,5 +1,5 @@ (function() { - var Discourse = require('discourse').default; + var Discourse = requirejs('discourse').default; Discourse.dialect_deprecated = true; diff --git a/app/assets/javascripts/discourse-common/resolver.js.es6 b/app/assets/javascripts/discourse-common/resolver.js.es6 index b400d0b788a..1bbc1b432bf 100644 --- a/app/assets/javascripts/discourse-common/resolver.js.es6 +++ b/app/assets/javascripts/discourse-common/resolver.js.es6 @@ -38,7 +38,7 @@ export function buildResolver(baseName) { resolveRouter(parsedName) { const routerPath = `${baseName}/router`; if (requirejs.entries[routerPath]) { - const module = require(routerPath, null, null, true); + const module = requirejs(routerPath, null, null, true); return module.default; } return this._super(parsedName); @@ -79,7 +79,7 @@ export function buildResolver(baseName) { var module; if (moduleName) { - module = require(moduleName, null, null, true /* force sync */); + module = requirejs(moduleName, null, null, true /* force sync */); if (module && module['default']) { module = module['default']; } } return module; diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index 2d9f1d9f35f..dee43e5a9c1 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -1,4 +1,4 @@ -var define, require, requirejs; +var define, requirejs; (function() { @@ -54,7 +54,7 @@ var define, require, requirejs; var name = this.name; return this._require || (this._require = function(dep) { - return require(resolve(dep, name)); + return requirejs(resolve(dep, name)); }); }; @@ -127,7 +127,7 @@ var define, require, requirejs; if (!mod) { throw new Error('Could not find module `' + name + '` imported from `' + origin + '`'); } - return require(name); + return requirejs(name); } function missingModule(name) { diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index 5ca85473c5b..1c572af7ba4 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -102,7 +102,7 @@ const Discourse = Ember.Application.extend({ Object.keys(requirejs._eak_seen).forEach(function(key) { if (/\/pre\-initializers\//.test(key)) { - const module = require(key, null, null, true); + const module = requirejs(key, null, null, true); if (!module) { throw new Error(key + ' must export an initializer.'); } const init = module.default; @@ -117,7 +117,7 @@ const Discourse = Ember.Application.extend({ Object.keys(requirejs._eak_seen).forEach(function(key) { if (/\/initializers\//.test(key)) { - const module = require(key, null, null, true); + const module = requirejs(key, null, null, true); if (!module) { throw new Error(key + ' must export an initializer.'); } const init = module.default; @@ -131,7 +131,7 @@ const Discourse = Ember.Application.extend({ }); // Plugins that are registered via `<script>` tags. - const withPluginApi = require('discourse/lib/plugin-api').withPluginApi; + const withPluginApi = requirejs('discourse/lib/plugin-api').withPluginApi; let initCount = 0; _pluginCallbacks.forEach(function(cb) { Discourse.instanceInitializer({ diff --git a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 index 356a2b688ec..7dbba30e1ba 100644 --- a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 +++ b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 @@ -525,12 +525,12 @@ export default Em.Component.extend({ }, groupFinder(term) { - const Group = require('discourse/models/group').default; + const Group = requirejs('discourse/models/group').default; return Group.findAll({search: term, ignore_automatic: false}); }, badgeFinder(term) { - const Badge = require('discourse/models/badge').default; + const Badge = requirejs('discourse/models/badge').default; return Badge.findAll({search: term}); } }); diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index e64351a2915..01b9f87d51b 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -60,7 +60,7 @@ const controllerOpts = { this.topicTrackingState.resetTracking(); this.store.findFiltered('topicList', {filter}).then(list => { - const TopicList = require('discourse/models/topic-list').default; + const TopicList = requirejs('discourse/models/topic-list').default; TopicList.hideUniformCategory(list, this.get('category')); this.setProperties({ model: list }); diff --git a/app/assets/javascripts/discourse/controllers/flag.js.es6 b/app/assets/javascripts/discourse/controllers/flag.js.es6 index b316091285c..01095e6a2d7 100644 --- a/app/assets/javascripts/discourse/controllers/flag.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag.js.es6 @@ -158,7 +158,7 @@ export default Ember.Controller.extend(ModalFunctionality, { fetchUserDetails() { if (Discourse.User.currentProp('staff') && this.get('model.username')) { - const AdminUser = require('admin/models/admin-user').default; + const AdminUser = requirejs('admin/models/admin-user').default; AdminUser.find(this.get('model.user_id')).then(user => this.set('userDetails', user)); } } diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index de971784e29..06964b772a2 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -144,7 +144,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }.property('isPrivateTopic'), groupFinder(term) { - const Group = require('discourse/models/group').default; + const Group = requirejs('discourse/models/group').default; return Group.findAll({search: term, ignore_automatic: true}); }, @@ -191,7 +191,7 @@ export default Ember.Controller.extend(ModalFunctionality, { actions: { createInvite() { - const Invite = require('discourse/models/invite').default; + const Invite = requirejs('discourse/models/invite').default; const self = this; if (this.get('disabled')) { return; } @@ -237,7 +237,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, generateInvitelink() { - const Invite = require('discourse/models/invite').default; + const Invite = requirejs('discourse/models/invite').default; const self = this; if (this.get('disabled')) { return; } diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 0aceb7d13b4..a17f2f53bfd 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -87,7 +87,7 @@ export default Ember.Controller.extend(CanCheckEmails, { adminDelete() { // I really want this deferred, don't want to bring in all this code till used - const AdminUser = require('admin/models/admin-user').default; + const AdminUser = requirejs('admin/models/admin-user').default; AdminUser.find(this.get('model.id')).then(user => user.destroy({deletePosts: true})); }, diff --git a/app/assets/javascripts/discourse/helpers/raw.js.es6 b/app/assets/javascripts/discourse/helpers/raw.js.es6 index 7f3d8b247b0..068e762b077 100644 --- a/app/assets/javascripts/discourse/helpers/raw.js.es6 +++ b/app/assets/javascripts/discourse/helpers/raw.js.es6 @@ -20,7 +20,7 @@ function renderRaw(ctx, container, template, templateName, params) { const module = `discourse/raw-views/${templateName}`; if (requirejs.entries[module]) { - const viewClass = require(module, null, null, true); + const viewClass = requirejs(module, null, null, true); if (viewClass && viewClass.default) { params.view = viewClass.default.create(params, _injections); } diff --git a/app/assets/javascripts/discourse/initializers/auto-load-modules.js.es6 b/app/assets/javascripts/discourse/initializers/auto-load-modules.js.es6 index 4920eca574c..b793cb742c6 100644 --- a/app/assets/javascripts/discourse/initializers/auto-load-modules.js.es6 +++ b/app/assets/javascripts/discourse/initializers/auto-load-modules.js.es6 @@ -3,10 +3,10 @@ import { registerHelpers } from 'discourse-common/lib/helpers'; export function autoLoadModules(container, registry) { Object.keys(requirejs.entries).forEach(entry => { if ((/\/helpers\//).test(entry)) { - require(entry, null, null, true); + requirejs(entry, null, null, true); } if ((/\/widgets\//).test(entry)) { - require(entry, null, null, true); + requirejs(entry, null, null, true); } }); registerHelpers(registry); diff --git a/app/assets/javascripts/discourse/lib/autosize.js.es6 b/app/assets/javascripts/discourse/lib/autosize.js.es6 index dbdb858093c..efb85155c39 100644 --- a/app/assets/javascripts/discourse/lib/autosize.js.es6 +++ b/app/assets/javascripts/discourse/lib/autosize.js.es6 @@ -132,15 +132,9 @@ function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) { set.delete(ta); Object.keys(style).forEach(key => { - ta.style[key] = style[key]; + ta.style[key] = style[key]; }); - }.bind(ta, { - height: ta.style.height, - resize: ta.style.resize, - overflowY: ta.style.overflowY, - overflowX: ta.style.overflowX, - wordWrap: ta.style.wordWrap, - }); + } ta.addEventListener('autosize:destroy', destroy, false); diff --git a/app/assets/javascripts/discourse/lib/plugin-connectors.js.es6 b/app/assets/javascripts/discourse/lib/plugin-connectors.js.es6 index d398031d81e..3b1179c48ba 100644 --- a/app/assets/javascripts/discourse/lib/plugin-connectors.js.es6 +++ b/app/assets/javascripts/discourse/lib/plugin-connectors.js.es6 @@ -50,7 +50,7 @@ function findClass(outletName, uniqueName) { if (!_classPaths) { _classPaths = {}; findOutlets(require._eak_seen, (outlet, res, un) => { - _classPaths[`${outlet}/${un}`] = require(res).default; + _classPaths[`${outlet}/${un}`] = requirejs(res).default; }); } diff --git a/app/assets/javascripts/discourse/lib/search.js.es6 b/app/assets/javascripts/discourse/lib/search.js.es6 index 06c73ebf564..1209e0a34ee 100644 --- a/app/assets/javascripts/discourse/lib/search.js.es6 +++ b/app/assets/javascripts/discourse/lib/search.js.es6 @@ -9,9 +9,9 @@ import { userPath } from 'discourse/lib/url'; export function translateResults(results, opts) { - const User = require('discourse/models/user').default; - const Post = require('discourse/models/post').default; - const Topic = require('discourse/models/topic').default; + const User = requirejs('discourse/models/user').default; + const Post = requirejs('discourse/models/post').default; + const Topic = requirejs('discourse/models/topic').default; if (!opts) opts = {}; diff --git a/app/assets/javascripts/discourse/mapping-router.js.es6 b/app/assets/javascripts/discourse/mapping-router.js.es6 index 140ea94610f..2a9a36b37af 100644 --- a/app/assets/javascripts/discourse/mapping-router.js.es6 +++ b/app/assets/javascripts/discourse/mapping-router.js.es6 @@ -106,7 +106,7 @@ export function mapRoutes() { // can define admin routes. Object.keys(requirejs._eak_seen).forEach(function(key) { if (/route-map$/.test(key)) { - var module = require(key, null, null, true); + var module = requirejs(key, null, null, true); if (!module || !module.default) { throw new Error(key + ' must export a route map.'); } const mapObj = module.default; diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 7800d3be38c..fecbf35c84b 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -104,7 +104,7 @@ const Post = RestModel.extend({ createProperties() { // composer only used once, defer the dependency - const Composer = require('discourse/models/composer').default; + const Composer = requirejs('discourse/models/composer').default; const data = this.getProperties(Composer.serializedFieldsForCreate()); data.reply_to_post_number = this.get('reply_to_post_number'); data.image_sizes = this.get('imageSizes'); diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index 60e895a81b3..3165b7fa2a6 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -58,7 +58,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, { reply = post ? window.location.protocol + "//" + window.location.host + post.get("url") : null; // used only once, one less dependency - const Composer = require('discourse/models/composer').default; + const Composer = requirejs('discourse/models/composer').default; return this.controllerFor('composer').open({ action: Composer.PRIVATE_MESSAGE, usernames: recipient, diff --git a/app/assets/javascripts/ember-addons/ember-computed-decorators.js.es6 b/app/assets/javascripts/ember-addons/ember-computed-decorators.js.es6 index e8d3b7ba88f..3df6ac40182 100644 --- a/app/assets/javascripts/ember-addons/ember-computed-decorators.js.es6 +++ b/app/assets/javascripts/ember-addons/ember-computed-decorators.js.es6 @@ -54,7 +54,6 @@ export var not = macroAlias(Ember.computed.not); export var notEmpty = macroAlias(Ember.computed.notEmpty); export var oneWay = macroAlias(Ember.computed.oneWay); export var or = macroAlias(Ember.computed.or); -export var readOnly = macroAlias(Ember.computed.readOnly); export var reads = macroAlias(Ember.computed.reads); export var setDiff = macroAlias(Ember.computed.setDiff); export var sort = macroAlias(Ember.computed.sort); diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown-it.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown-it.js.es6 index 4228db48e7a..9b9a9718283 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown-it.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown-it.js.es6 @@ -119,7 +119,7 @@ export function setup(opts, siteSettings, state) { Object.keys(require._eak_seen).forEach(entry => { if (check.test(entry)) { - const module = require(entry); + const module = requirejs(entry); if (module && module.setup) { const featureName = entry.split('/').reverse()[0]; diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 index a8667457af0..3303cc34b9d 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 @@ -358,7 +358,7 @@ class DialectHelper { Object.keys(require._eak_seen).forEach(entry => { if (entry.indexOf('discourse-markdown') !== -1) { - const module = require(entry); + const module = requirejs(entry); if (module && module.setup) { const featureName = entry.split('/').reverse()[0]; helper.whiteList = info => whiteListFeature(featureName, info); @@ -397,7 +397,7 @@ export function cook(raw, opts) { if (currentOpts.enableExperimentalMarkdownIt) { result = opts.sanitizer( - require('pretty-text/engines/markdown-it/instance').default(opts).render(raw), + requirejs('pretty-text/engines/markdown-it/instance').default(opts).render(raw), whiteLister ); } else { diff --git a/app/assets/javascripts/wizard/initializers/load-helpers.js.es6 b/app/assets/javascripts/wizard/initializers/load-helpers.js.es6 index b2e05d01810..4ed645f4da7 100644 --- a/app/assets/javascripts/wizard/initializers/load-helpers.js.es6 +++ b/app/assets/javascripts/wizard/initializers/load-helpers.js.es6 @@ -6,7 +6,7 @@ export default { initialize(application) { Object.keys(requirejs.entries).forEach(entry => { if ((/\/helpers\//).test(entry)) { - require(entry, null, null, true); + requirejs(entry, null, null, true); } }); registerHelpers(application); diff --git a/app/assets/javascripts/wizard/test/test_helper.js b/app/assets/javascripts/wizard/test/test_helper.js index 0731b301f8c..91abd402c94 100644 --- a/app/assets/javascripts/wizard/test/test_helper.js +++ b/app/assets/javascripts/wizard/test/test_helper.js @@ -35,7 +35,7 @@ if (window.Logster) { } Ember.Test.adapter = window.QUnitAdapter.create(); -var createPretendServer = require('wizard/test/wizard-pretender', null, null, false).default; +var createPretendServer = requirejs('wizard/test/wizard-pretender', null, null, false).default; var server; QUnit.testStart(function() { @@ -47,12 +47,12 @@ QUnit.testDone(function() { }); -var _testApp = require('wizard/test/helpers/start-app').default(); -var _buildResolver = require('discourse-common/resolver').buildResolver; +var _testApp = requirejs('wizard/test/helpers/start-app').default(); +var _buildResolver = requirejs('discourse-common/resolver').buildResolver; window.setResolver(_buildResolver('wizard').create({ namespace: _testApp })); Object.keys(requirejs.entries).forEach(function(entry) { if ((/\-test/).test(entry)) { - require(entry, null, null, true); + requirejs(entry, null, null, true); } }); diff --git a/app/assets/javascripts/wizard/wizard.js.es6 b/app/assets/javascripts/wizard/wizard.js.es6 index 466b656d83c..7905a1df5b4 100644 --- a/app/assets/javascripts/wizard/wizard.js.es6 +++ b/app/assets/javascripts/wizard/wizard.js.es6 @@ -7,7 +7,7 @@ export default Ember.Application.extend({ start() { Object.keys(requirejs._eak_seen).forEach(key => { if (/\/initializers\//.test(key)) { - const module = require(key, null, null, true); + const module = requirejs(key, null, null, true); if (!module) { throw new Error(key + ' must export an initializer.'); } this.initializer(module.default); } diff --git a/app/models/theme_field.rb b/app/models/theme_field.rb index 928a1756098..34d09eb1898 100644 --- a/app/models/theme_field.rb +++ b/app/models/theme_field.rb @@ -37,7 +37,7 @@ PLUGIN_API_JS name = node["name"] || node["data-template-name"] || "broken" is_raw = name =~ /\.raw$/ if is_raw - template = "require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(node.inner_html)})" + template = "requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(node.inner_html)})" node.replace <<COMPILED <script> (function() { diff --git a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb index b46839a7dd7..0814a968be5 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -28,7 +28,6 @@ module Tilt ctx = MiniRacer::Context.new(timeout: 15000) ctx.eval("var self = this; #{File.read("#{Rails.root}/vendor/assets/javascripts/babel.js")}") ctx.eval("module = {}; exports = {};"); - ctx.load("#{Rails.root}/lib/es6_module_transpiler/support/es6-module-transpiler.js") ctx.attach("rails.logger.info", proc{|err| Rails.logger.info(err.to_s)}) ctx.attach("rails.logger.error", proc{|err| Rails.logger.error(err.to_s)}) ctx.eval <<JS @@ -105,12 +104,8 @@ JS klass = self.class klass.protect do klass.v8.eval("console.prefix = 'BABEL: babel-eval: ';") - - transpiled = babel_source(source) - - compiler_source = "new module.exports.Compiler(#{transpiled}, '#{module_name(root_path, logical_path)}', #{compiler_options}).#{compiler_method}()" - - @output = klass.v8.eval(compiler_source) + transpiled = babel_source(source, module_name: module_name(root_path, logical_path)) + @output = klass.v8.eval(transpiled) end end @@ -120,7 +115,7 @@ JS klass = self.class klass.protect do klass.v8.eval("console.prefix = 'BABEL: #{scope.logical_path}: ';") - @output = klass.v8.eval(generate_source(scope)) + @output = klass.v8.eval(babel_source(data, module_name: module_name(scope.root_path, scope.logical_path))) end # For backwards compatibility with plugins, for now export the Global format too. @@ -159,18 +154,21 @@ JS @output end - def babel_source(source) + def babel_source(source, opts=nil) + + opts ||= {} + js_source = ::JSON.generate(source, quirks_mode: true) - "babel.transform(#{js_source}, {ast: false, whitelist: ['es6.constants', 'es6.properties.shorthand', 'es6.arrowFunctions', 'es6.blockScoping', 'es6.destructuring', 'es6.spread', 'es6.parameters', 'es6.templateLiterals', 'es6.regex.unicode', 'es7.decorators', 'es6.classes']})['code']" + + if opts[:module_name] + "Babel.transform(#{js_source}, { moduleId: '#{opts[:module_name]}', ast: false, presets: ['es2015'], plugins: [['transform-es2015-modules-amd', {noInterop: true}], 'transform-decorators-legacy'] }).code" + else + "Babel.transform(#{js_source}, { ast: false, plugins: ['check-es2015-constants', 'transform-es2015-arrow-functions', 'transform-es2015-block-scoped-functions', 'transform-es2015-block-scoping', 'transform-es2015-classes', 'transform-es2015-computed-properties', 'transform-es2015-destructuring', 'transform-es2015-duplicate-keys', 'transform-es2015-for-of', 'transform-es2015-function-name', 'transform-es2015-literals', 'transform-es2015-object-super', 'transform-es2015-parameters', 'transform-es2015-shorthand-properties', 'transform-es2015-spread', 'transform-es2015-sticky-regex', 'transform-es2015-template-literals', 'transform-es2015-typeof-symbol', 'transform-es2015-unicode-regex', 'transform-regenerator', 'transform-decorators-legacy'] }).code" + end end private - def generate_source(scope) - js_source = babel_source(data) - "new module.exports.Compiler(#{js_source}, '#{module_name(scope.root_path, scope.logical_path)}', #{compiler_options}).#{compiler_method}()" - end - def module_name(root_path, logical_path) path = nil diff --git a/lib/freedom_patches/raw_handlebars.rb b/lib/freedom_patches/raw_handlebars.rb index 888e99e4138..a3bd47c8a7f 100644 --- a/lib/freedom_patches/raw_handlebars.rb +++ b/lib/freedom_patches/raw_handlebars.rb @@ -14,7 +14,7 @@ class Barber::Precompiler transpiled = template.babel_transpile(source) # very hacky but lets us use ES6. I'm ashamed of this code -RW - transpiled.gsub!(/^export .*$/, '') + transpiled = transpiled[0...transpiled.index('export ')] @precompiler = StringIO.new <<END var __RawHandlebars; @@ -40,11 +40,11 @@ module Discourse module Handlebars module Helper def precompile_handlebars(string) - "require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});" + "requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});" end def compile_handlebars(string) - "require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});" + "requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});" end end end @@ -55,11 +55,11 @@ class Ember::Handlebars::Template include Discourse::Ember::Handlebars::Helper def precompile_handlebars(string, input=nil) - "require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});" + "requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});" end def compile_handlebars(string, input=nil) - "require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});" + "requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});" end def global_template_target(namespace, module_name, config) diff --git a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 index cd490665335..a1bd26c43d6 100644 --- a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 +++ b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 @@ -1,6 +1,6 @@ import { default as PrettyText, buildOptions } from 'pretty-text/pretty-text'; -module("lib:details-cooked-test"); +QUnit.module("lib:details-cooked-test"); const defaultOpts = buildOptions({ siteSettings: { diff --git a/test/javascripts/helpers/qunit-helpers.js.es6 b/test/javascripts/helpers/qunit-helpers.js.es6 index 2640e806b34..6706389e441 100644 --- a/test/javascripts/helpers/qunit-helpers.js.es6 +++ b/test/javascripts/helpers/qunit-helpers.js.es6 @@ -40,7 +40,7 @@ window.bootbox.$body = $('#ember-testing'); $.fn.modal = AcceptanceModal; function acceptance(name, options) { - module("Acceptance: " + name, { + QUnit.module("Acceptance: " + name, { beforeEach() { resetMobile(); diff --git a/test/javascripts/initializers/localization-test.js.es6 b/test/javascripts/initializers/localization-test.js.es6 index 45f60724a52..0113be6c716 100644 --- a/test/javascripts/initializers/localization-test.js.es6 +++ b/test/javascripts/initializers/localization-test.js.es6 @@ -34,10 +34,10 @@ QUnit.module("initializer:localization", { } }); -QUnit.test("translation overrides", assert => { +QUnit.test("translation overrides", function(assert) { PreloadStore.store('translationOverrides', {"js.composer.reply":"WAT","js.topic.reply.help":"foobar"}); LocalizationInitializer.initialize(this.registry); assert.equal(I18n.t("composer.reply"), "WAT", "overrides existing translation in current locale"); assert.equal(I18n.t("topic.reply.help"), "foobar", "overrides translation in default locale"); -}); \ No newline at end of file +}); diff --git a/test/javascripts/mdtest/mdtest.js.es6.erb b/test/javascripts/mdtest/mdtest.js.es6.erb index 314affd7a43..416acd1a0a1 100644 --- a/test/javascripts/mdtest/mdtest.js.es6.erb +++ b/test/javascripts/mdtest/mdtest.js.es6.erb @@ -3,7 +3,7 @@ import { default as PrettyText, buildOptions } from 'pretty-text/pretty-text'; import { hashString } from 'discourse/lib/hash'; // Run the MDTest spec -module("MDTest"); +QUnit.module("MDTest"); // This is cheating, but the trivial differences between sanitization // do not affect formatting. diff --git a/vendor/assets/javascripts/babel.js b/vendor/assets/javascripts/babel.js index 1844eb5a9ce..8a341e11749 100644 --- a/vendor/assets/javascripts/babel.js +++ b/vendor/assets/javascripts/babel.js @@ -1,58699 +1,57684 @@ - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.babel = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["Babel"] = factory(); + else + root["Babel"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ((function(modules) { + // Check all modules for deduplicated modules + for(var i in modules) { + if(Object.prototype.hasOwnProperty.call(modules, i)) { + switch(typeof modules[i]) { + case "function": break; + case "object": + // Module can be created from a template + modules[i] = (function(_m) { + var args = _m.slice(1), fn = modules[_m[0]]; + return function (a,b,c) { + fn.apply(this, [a,b,c].concat(args)); + }; + }(modules[i])); + break; + default: + // Module is a copy of another module + modules[i] = modules[modules[i]]; + break; + } + } + } + return modules; +}([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { -},{}],2:[function(_dereq_,module,exports){ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = _dereq_(13); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && !isFinite(value)) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) { - return a === b; - } - var aIsArgs = isArguments(a), - bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"13":13}],3:[function(_dereq_,module,exports){ -(function (global){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> - * @license MIT - */ -/* eslint-disable no-proto */ - -var base64 = _dereq_(4) -var ieee754 = _dereq_(5) -var isArray = _dereq_(6) - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 -Buffer.poolSize = 8192 // not used by this implementation - -var rootParent = {} - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property - * on objects. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -function typedArraySupport () { - function Bar () {} - try { - var arr = new Uint8Array(1) - arr.foo = function () { return 42 } - arr.constructor = Bar - return arr.foo() === 42 && // typed array instances can be augmented - arr.constructor === Bar && // constructor can be set - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -/** - * Class: Buffer - * ============= - * - * The Buffer constructor returns instances of `Uint8Array` that are augmented - * with function properties for all the node `Buffer` API functions. We use - * `Uint8Array` so that square bracket notation works as expected -- it returns - * a single octet. - * - * By augmenting the instances, we can avoid modifying the `Uint8Array` - * prototype. - */ -function Buffer (arg) { - if (!(this instanceof Buffer)) { - // Avoid going through an ArgumentsAdaptorTrampoline in the common case. - if (arguments.length > 1) return new Buffer(arg, arguments[1]) - return new Buffer(arg) - } - - this.length = 0 - this.parent = undefined - - // Common case. - if (typeof arg === 'number') { - return fromNumber(this, arg) - } - - // Slightly less common case. - if (typeof arg === 'string') { - return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8') - } - - // Unusual. - return fromObject(this, arg) -} - -function fromNumber (that, length) { - that = allocate(that, length < 0 ? 0 : checked(length) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < length; i++) { - that[i] = 0 - } - } - return that -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8' - - // Assumption: byteLength() return value is always < kMaxLength. - var length = byteLength(string, encoding) | 0 - that = allocate(that, length) - - that.write(string, encoding) - return that -} - -function fromObject (that, object) { - if (Buffer.isBuffer(object)) return fromBuffer(that, object) - - if (isArray(object)) return fromArray(that, object) - - if (object == null) { - throw new TypeError('must start with number, buffer, array or string') - } - - if (typeof ArrayBuffer !== 'undefined') { - if (object.buffer instanceof ArrayBuffer) { - return fromTypedArray(that, object) - } - if (object instanceof ArrayBuffer) { - return fromArrayBuffer(that, object) - } - } - - if (object.length) return fromArrayLike(that, object) - - return fromJsonObject(that, object) -} - -function fromBuffer (that, buffer) { - var length = checked(buffer.length) | 0 - that = allocate(that, length) - buffer.copy(that, 0, 0, length) - return that -} - -function fromArray (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -// Duplicate of fromArray() to keep fromArray() monomorphic. -function fromTypedArray (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - // Truncating the elements is probably not what people expect from typed - // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior - // of the old Buffer constructor. - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array) { - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - array.byteLength - that = Buffer._augment(new Uint8Array(array)) - } else { - // Fallback: Return an object instance of the Buffer class - that = fromTypedArray(that, new Uint8Array(array)) - } - return that -} - -function fromArrayLike (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object. -// Returns a zero-length buffer for inputs that don't conform to the spec. -function fromJsonObject (that, object) { - var array - var length = 0 - - if (object.type === 'Buffer' && isArray(object.data)) { - array = object.data - length = checked(array.length) | 0 - } - that = allocate(that, length) - - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array -} - -function allocate (that, length) { - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = Buffer._augment(new Uint8Array(length)) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that.length = length - that._isBuffer = true - } - - var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1 - if (fromPool) that.parent = rootParent - - return that -} - -function checked (length) { - // Note: cannot use `length < kMaxLength` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (subject, encoding) { - if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding) - - var buf = new Buffer(subject, encoding) - delete buf.parent - return buf -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - var i = 0 - var len = Math.min(x, y) - while (i < len) { - if (a[i] !== b[i]) break - - ++i - } - - if (i !== len) { - x = a[i] - y = b[i] - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'binary': - case 'base64': - case 'raw': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.') - - if (list.length === 0) { - return new Buffer(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; i++) { - length += list[i].length - } - } - - var buf = new Buffer(length) - var pos = 0 - for (i = 0; i < list.length; i++) { - var item = list[i] - item.copy(buf, pos) - pos += item.length - } - return buf -} - -function byteLength (string, encoding) { - if (typeof string !== 'string') string = '' + string - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'binary': - // Deprecated - case 'raw': - case 'raws': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -// pre-set for values that may exist in the future -Buffer.prototype.length = undefined -Buffer.prototype.parent = undefined - -function slowToString (encoding, start, end) { - var loweredCase = false - - start = start | 0 - end = end === undefined || end === Infinity ? this.length : end | 0 - - if (!encoding) encoding = 'utf8' - if (start < 0) start = 0 - if (end > this.length) end = this.length - if (end <= start) return '' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'binary': - return binarySlice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '<Buffer ' + str + '>' -} - -Buffer.prototype.compare = function compare (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return 0 - return Buffer.compare(this, b) -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset) { - if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff - else if (byteOffset < -0x80000000) byteOffset = -0x80000000 - byteOffset >>= 0 - - if (this.length === 0) return -1 - if (byteOffset >= this.length) return -1 - - // Negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0) - - if (typeof val === 'string') { - if (val.length === 0) return -1 // special case: looking for empty string always fails - return String.prototype.indexOf.call(this, val, byteOffset) - } - if (Buffer.isBuffer(val)) { - return arrayIndexOf(this, val, byteOffset) - } - if (typeof val === 'number') { - if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') { - return Uint8Array.prototype.indexOf.call(this, val, byteOffset) - } - return arrayIndexOf(this, [ val ], byteOffset) - } - - function arrayIndexOf (arr, val, byteOffset) { - var foundIndex = -1 - for (var i = 0; byteOffset + i < arr.length; i++) { - if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex - } else { - foundIndex = -1 - } - } - return -1 - } - - throw new TypeError('val must be string, number or Buffer') -} - -// `get` is deprecated -Buffer.prototype.get = function get (offset) { - console.log('.get() is deprecated. Access using array indexes instead.') - return this.readUInt8(offset) -} - -// `set` is deprecated -Buffer.prototype.set = function set (v, offset) { - console.log('.set() is deprecated. Access using array indexes instead.') - return this.writeUInt8(v, offset) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new Error('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; i++) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) throw new Error('Invalid hex string') - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function binaryWrite (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - var swap = encoding - encoding = offset - offset = length | 0 - length = swap - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'binary': - return binaryWrite(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; i++) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function binarySlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; i++) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; i++) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = Buffer._augment(this.subarray(start, end)) - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; i++) { - newBuf[i] = this[i + start] - } - } - - if (newBuf.length) newBuf.parent = this.parent || this - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance') - if (value > max || value < min) throw new RangeError('value is out of bounds') - if (offset + ext > buf.length) throw new RangeError('index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = value < 0 ? 1 : 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = value < 0 ? 1 : 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (value > max || value < min) throw new RangeError('value is out of bounds') - if (offset + ext > buf.length) throw new RangeError('index out of range') - if (offset < 0) throw new RangeError('index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; i--) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; i++) { - target[i + targetStart] = this[i + start] - } - } else { - target._set(this.subarray(start, start + len), targetStart) - } - - return len -} - -// fill(value, start=0, end=buffer.length) -Buffer.prototype.fill = function fill (value, start, end) { - if (!value) value = 0 - if (!start) start = 0 - if (!end) end = this.length - - if (end < start) throw new RangeError('end < start') - - // Fill 0 bytes; we're done - if (end === start) return - if (this.length === 0) return - - if (start < 0 || start >= this.length) throw new RangeError('start out of bounds') - if (end < 0 || end > this.length) throw new RangeError('end out of bounds') - - var i - if (typeof value === 'number') { - for (i = start; i < end; i++) { - this[i] = value - } - } else { - var bytes = utf8ToBytes(value.toString()) - var len = bytes.length - for (i = start; i < end; i++) { - this[i] = bytes[i % len] - } - } - - return this -} - -/** - * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. - * Added in Node 0.12. Only available in browsers that support ArrayBuffer. - */ -Buffer.prototype.toArrayBuffer = function toArrayBuffer () { - if (typeof Uint8Array !== 'undefined') { - if (Buffer.TYPED_ARRAY_SUPPORT) { - return (new Buffer(this)).buffer - } else { - var buf = new Uint8Array(this.length) - for (var i = 0, len = buf.length; i < len; i += 1) { - buf[i] = this[i] - } - return buf.buffer - } - } else { - throw new TypeError('Buffer.toArrayBuffer not supported in this browser') - } -} - -// HELPER FUNCTIONS -// ================ - -var BP = Buffer.prototype - -/** - * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods - */ -Buffer._augment = function _augment (arr) { - arr.constructor = Buffer - arr._isBuffer = true - - // save reference to original Uint8Array set method before overwriting - arr._set = arr.set - - // deprecated - arr.get = BP.get - arr.set = BP.set - - arr.write = BP.write - arr.toString = BP.toString - arr.toLocaleString = BP.toString - arr.toJSON = BP.toJSON - arr.equals = BP.equals - arr.compare = BP.compare - arr.indexOf = BP.indexOf - arr.copy = BP.copy - arr.slice = BP.slice - arr.readUIntLE = BP.readUIntLE - arr.readUIntBE = BP.readUIntBE - arr.readUInt8 = BP.readUInt8 - arr.readUInt16LE = BP.readUInt16LE - arr.readUInt16BE = BP.readUInt16BE - arr.readUInt32LE = BP.readUInt32LE - arr.readUInt32BE = BP.readUInt32BE - arr.readIntLE = BP.readIntLE - arr.readIntBE = BP.readIntBE - arr.readInt8 = BP.readInt8 - arr.readInt16LE = BP.readInt16LE - arr.readInt16BE = BP.readInt16BE - arr.readInt32LE = BP.readInt32LE - arr.readInt32BE = BP.readInt32BE - arr.readFloatLE = BP.readFloatLE - arr.readFloatBE = BP.readFloatBE - arr.readDoubleLE = BP.readDoubleLE - arr.readDoubleBE = BP.readDoubleBE - arr.writeUInt8 = BP.writeUInt8 - arr.writeUIntLE = BP.writeUIntLE - arr.writeUIntBE = BP.writeUIntBE - arr.writeUInt16LE = BP.writeUInt16LE - arr.writeUInt16BE = BP.writeUInt16BE - arr.writeUInt32LE = BP.writeUInt32LE - arr.writeUInt32BE = BP.writeUInt32BE - arr.writeIntLE = BP.writeIntLE - arr.writeIntBE = BP.writeIntBE - arr.writeInt8 = BP.writeInt8 - arr.writeInt16LE = BP.writeInt16LE - arr.writeInt16BE = BP.writeInt16BE - arr.writeInt32LE = BP.writeInt32LE - arr.writeInt32BE = BP.writeInt32BE - arr.writeFloatLE = BP.writeFloatLE - arr.writeFloatBE = BP.writeFloatBE - arr.writeDoubleLE = BP.writeDoubleLE - arr.writeDoubleBE = BP.writeDoubleBE - arr.fill = BP.fill - arr.inspect = BP.inspect - arr.toArrayBuffer = BP.toArrayBuffer - - return arr -} - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; i++) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; i++) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; i++) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; i++) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"4":4,"5":5,"6":6}],4:[function(_dereq_,module,exports){ -var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -;(function (exports) { 'use strict'; - var Arr = (typeof Uint8Array !== 'undefined') - ? Uint8Array - : Array - - var PLUS = '+'.charCodeAt(0) - var SLASH = '/'.charCodeAt(0) - var NUMBER = '0'.charCodeAt(0) - var LOWER = 'a'.charCodeAt(0) - var UPPER = 'A'.charCodeAt(0) - var PLUS_URL_SAFE = '-'.charCodeAt(0) - var SLASH_URL_SAFE = '_'.charCodeAt(0) - - function decode (elt) { - var code = elt.charCodeAt(0) - if (code === PLUS || - code === PLUS_URL_SAFE) - return 62 // '+' - if (code === SLASH || - code === SLASH_URL_SAFE) - return 63 // '/' - if (code < NUMBER) - return -1 //no match - if (code < NUMBER + 10) - return code - NUMBER + 26 + 26 - if (code < UPPER + 26) - return code - UPPER - if (code < LOWER + 26) - return code - LOWER + 26 - } - - function b64ToByteArray (b64) { - var i, j, l, tmp, placeHolders, arr - - if (b64.length % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - var len = b64.length - placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 - - // base64 is 4/3 + up to two characters of the original data - arr = new Arr(b64.length * 3 / 4 - placeHolders) - - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? b64.length - 4 : b64.length - - var L = 0 - - function push (v) { - arr[L++] = v - } - - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) - push((tmp & 0xFF0000) >> 16) - push((tmp & 0xFF00) >> 8) - push(tmp & 0xFF) - } - - if (placeHolders === 2) { - tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) - push(tmp & 0xFF) - } else if (placeHolders === 1) { - tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) - push((tmp >> 8) & 0xFF) - push(tmp & 0xFF) - } - - return arr - } - - function uint8ToBase64 (uint8) { - var i, - extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes - output = "", - temp, length - - function encode (num) { - return lookup.charAt(num) - } - - function tripletToBase64 (num) { - return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) - } - - // go through the array every three bytes, we'll deal with trailing stuff later - for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { - temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output += tripletToBase64(temp) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - switch (extraBytes) { - case 1: - temp = uint8[uint8.length - 1] - output += encode(temp >> 2) - output += encode((temp << 4) & 0x3F) - output += '==' - break - case 2: - temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) - output += encode(temp >> 10) - output += encode((temp >> 4) & 0x3F) - output += encode((temp << 2) & 0x3F) - output += '=' - break - } - - return output - } - - exports.toByteArray = b64ToByteArray - exports.fromByteArray = uint8ToBase64 -}(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) - -},{}],5:[function(_dereq_,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],6:[function(_dereq_,module,exports){ - -/** - * isArray - */ - -var isArray = Array.isArray; - -/** - * toString - */ - -var str = Object.prototype.toString; - -/** - * Whether or not the given `val` - * is an array. - * - * example: - * - * isArray([]); - * // > true - * isArray(arguments); - * // > false - * isArray(''); - * // > false - * - * @param {mixed} val - * @return {bool} - */ - -module.exports = isArray || function (val) { - return !! val && '[object Array]' == str.call(val); -}; - -},{}],7:[function(_dereq_,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],8:[function(_dereq_,module,exports){ -exports.endianness = function () { return 'LE' }; - -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname - } - else return ''; -}; - -exports.loadavg = function () { return [] }; - -exports.uptime = function () { return 0 }; - -exports.freemem = function () { - return Number.MAX_VALUE; -}; - -exports.totalmem = function () { - return Number.MAX_VALUE; -}; - -exports.cpus = function () { return [] }; - -exports.type = function () { return 'Browser' }; - -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; - -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; - -exports.arch = function () { return 'javascript' }; - -exports.platform = function () { return 'browser' }; - -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; - -exports.EOL = '\n'; - -},{}],9:[function(_dereq_,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPath(path)[3]; -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,_dereq_(10)) -},{"10":10}],10:[function(_dereq_,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = setTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - clearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - setTimeout(drainQueue, 0); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],11:[function(_dereq_,module,exports){ -exports.isatty = function () { return false; }; - -function ReadStream() { - throw new Error('tty.ReadStream is not implemented'); -} -exports.ReadStream = ReadStream; - -function WriteStream() { - throw new Error('tty.ReadStream is not implemented'); -} -exports.WriteStream = WriteStream; - -},{}],12:[function(_dereq_,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],13:[function(_dereq_,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = _dereq_(12); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = _dereq_(7); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,_dereq_(10),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"10":10,"12":12,"7":7}],14:[function(_dereq_,module,exports){ -(function (global){ -/* eslint no-new-func: 0 */ - -"use strict"; - -_dereq_(15); -var transform = module.exports = _dereq_(66); - -/** - * Add `options` and `version` to `babel` global. - */ - -transform.options = _dereq_(49); -transform.version = _dereq_(611).version; - -/** - * Add `transform` api to `babel` global. - */ - -transform.transform = transform; - -/** - * Tranform and execute script, adding in inline sourcemaps. - */ - -transform.run = function (code) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.sourceMaps = "inline"; - return new Function(transform(code, opts).code)(); -}; - -/** - * Load scripts via xhr, and `transform` when complete (optional). - */ - -transform.load = function (url, callback, opts, hold) { - if (opts === undefined) opts = {}; - - opts.filename = opts.filename || url; - - var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); - xhr.open("GET", url, true); - if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain"); - - /** - * When successfully loaded, transform (optional), and call `callback`. - */ - - xhr.onreadystatechange = function () { - if (xhr.readyState !== 4) return; - - var status = xhr.status; - if (status === 0 || status === 200) { - var param = [xhr.responseText, opts]; - if (!hold) transform.run.apply(transform, param); - if (callback) callback(param); - } else { - throw new Error("Could not load " + url); - } - }; - - xhr.send(null); -}; - -/** - * Load and transform all scripts of `types`. - * - * @example - * <script type="module"></script> - */ - -var runScripts = function runScripts() { - var scripts = []; - var types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; - var index = 0; - - /** - * Transform and execute script. Ensures correct load order. - */ - - var exec = function exec() { - var param = scripts[index]; - if (param instanceof Array) { - transform.run.apply(transform, param); - index++; - exec(); - } - }; - - /** - * Load, transform, and execute all scripts. - */ - - var run = function run(script, i) { - var opts = {}; - - if (script.src) { - transform.load(script.src, function (param) { - scripts[i] = param; - exec(); - }, opts, true); - } else { - opts.filename = "embedded"; - scripts[i] = [script.innerHTML, opts]; - } - }; - - // Collect scripts with Babel `types`. - - var _scripts = global.document.getElementsByTagName("script"); - - for (var i = 0; i < _scripts.length; ++i) { - var _script = _scripts[i]; - if (types.indexOf(_script.type) >= 0) scripts.push(_script); - } - - for (i in scripts) { - run(scripts[i], i); - } - - exec(); -}; - -/** - * Register load event to transform and execute scripts. - */ - -if (global.addEventListener) { - global.addEventListener("DOMContentLoaded", runScripts, false); -} else if (global.attachEvent) { - global.attachEvent("onload", runScripts); -} -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"15":15,"49":49,"611":611,"66":66}],15:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.register = register; -exports.polyfill = polyfill; -exports.transformFile = transformFile; -exports.transformFileSync = transformFileSync; -exports.parse = parse; -// istanbul ignore next - -function _interopRequire(obj) { return obj && obj.__esModule ? obj["default"] : obj; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashLangIsFunction = _dereq_(508); - -var _lodashLangIsFunction2 = _interopRequireDefault(_lodashLangIsFunction); - -var _transformation = _dereq_(66); - -var _transformation2 = _interopRequireDefault(_transformation); - -var _babylon = _dereq_(613); - -var babylon = _interopRequireWildcard(_babylon); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _fs = _dereq_(1); - -var _fs2 = _interopRequireDefault(_fs); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -exports.util = util; -exports.acorn = babylon; -exports.transform = _transformation2["default"]; -exports.pipeline = _transformation.pipeline; -exports.canCompile = _util.canCompile; - -var _transformationFile = _dereq_(46); - -exports.File = _interopRequire(_transformationFile); - -var _transformationFileOptionsConfig = _dereq_(48); - -exports.options = _interopRequire(_transformationFileOptionsConfig); - -var _transformationPlugin = _dereq_(82); - -exports.Plugin = _interopRequire(_transformationPlugin); - -var _transformationTransformer = _dereq_(83); - -exports.Transformer = _interopRequire(_transformationTransformer); - -var _transformationPipeline = _dereq_(80); - -exports.Pipeline = _interopRequire(_transformationPipeline); - -var _traversal = _dereq_(148); - -exports.traverse = _interopRequire(_traversal); - -var _toolsBuildExternalHelpers = _dereq_(45); - -exports.buildExternalHelpers = _interopRequire(_toolsBuildExternalHelpers); - -var _package = _dereq_(611); - -exports.version = _package.version; -exports.types = t; - -/** - * Register Babel and polyfill globally. - */ - -function register(opts) { - var callback = _dereq_(17); - if (opts != null) callback(opts); - return callback; -} - -/** - * Register polyfill globally. - */ - -function polyfill() { - _dereq_(44); -} - -/** - * Asynchronously transform `filename` with optional `opts`, calls `callback` when complete. - */ - -function transformFile(filename, opts, callback) { - if (_lodashLangIsFunction2["default"](opts)) { - callback = opts; - opts = {}; - } - - opts.filename = filename; - - _fs2["default"].readFile(filename, function (err, code) { - if (err) return callback(err); - - var result; - - try { - result = _transformation2["default"](code, opts); - } catch (err) { - return callback(err); - } - - callback(null, result); - }); -} - -/** - * Synchronous form of `transformFile`. - */ - -function transformFileSync(filename) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.filename = filename; - return _transformation2["default"](_fs2["default"].readFileSync(filename, "utf8"), opts); -} - -/** - * Parse script with Babel's parser. - */ - -function parse(code) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.allowHashBang = true; - opts.sourceType = "module"; - opts.ecmaVersion = Infinity; - opts.plugins = { - jsx: true, - flow: true - }; - opts.features = {}; - - for (var key in _transformation2["default"].pipeline.transformers) { - opts.features[key] = true; - } - - var ast = babylon.parse(code, opts); - - if (opts.onToken) { - // istanbul ignore next - - var _opts$onToken; - - (_opts$onToken = opts.onToken).push.apply(_opts$onToken, ast.tokens); - } - - if (opts.onComment) { - // istanbul ignore next - - var _opts$onComment; - - (_opts$onComment = opts.onComment).push.apply(_opts$onComment, ast.comments); - } - - return ast.program; -} -},{"1":1,"148":148,"17":17,"179":179,"182":182,"44":44,"45":45,"46":46,"48":48,"508":508,"611":611,"613":613,"66":66,"80":80,"82":82,"83":83}],16:[function(_dereq_,module,exports){ -// required to safely use babel/register within a browserify codebase - -"use strict"; - -exports.__esModule = true; - -_dereq_(44); - -exports["default"] = function () {}; - -module.exports = exports["default"]; -},{"44":44}],17:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequire(obj) { return obj && obj.__esModule ? obj["default"] : obj; } - -_dereq_(44); - -var _node = _dereq_(16); - -exports["default"] = _interopRequire(_node); -module.exports = exports["default"]; -},{"16":16,"44":44}],18:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _repeating = _dereq_(592); - -var _repeating2 = _interopRequireDefault(_repeating); - -var _trimRight = _dereq_(609); - -var _trimRight2 = _interopRequireDefault(_trimRight); - -var _lodashLangIsBoolean = _dereq_(506); - -var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean); - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _lodashLangIsNumber = _dereq_(510); - -var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber); - -/** - * Buffer for collecting generated output. - */ - -var Buffer = (function () { - function Buffer(position, format) { - _classCallCheck(this, Buffer); - - this.parenPushNewlineState = null; - - this.position = position; - this._indent = format.indent.base; - this.format = format; - this.buf = ""; - } - - /** - * Get the current trimmed buffer. - */ - - Buffer.prototype.get = function get() { - return _trimRight2["default"](this.buf); - }; - - /** - * Get the current indent. - */ - - Buffer.prototype.getIndent = function getIndent() { - if (this.format.compact || this.format.concise) { - return ""; - } else { - return _repeating2["default"](this.format.indent.style, this._indent); - } - }; - - /** - * Get the current indent size. - */ - - Buffer.prototype.indentSize = function indentSize() { - return this.getIndent().length; - }; - - /** - * Increment indent size. - */ - - Buffer.prototype.indent = function indent() { - this._indent++; - }; - - /** - * Decrement indent size. - */ - - Buffer.prototype.dedent = function dedent() { - this._indent--; - }; - - /** - * Add a semicolon to the buffer. - */ - - Buffer.prototype.semicolon = function semicolon() { - this.push(";"); - }; - - /** - * Ensure last character is a semicolon. - */ - - Buffer.prototype.ensureSemicolon = function ensureSemicolon() { - if (!this.isLast(";")) this.semicolon(); - }; - - /** - * Add a right brace to the buffer. - */ - - Buffer.prototype.rightBrace = function rightBrace() { - this.newline(true); - //if (this.format.compact) this._removeLast(";"); - this.push("}"); - }; - - /** - * Add a keyword to the buffer. - */ - - Buffer.prototype.keyword = function keyword(name) { - this.push(name); - this.space(); - }; - - /** - * Add a space to the buffer unless it is compact (override with force). - */ - - Buffer.prototype.space = function space(force) { - if (!force && this.format.compact) return; - - if (force || this.buf && !this.isLast(" ") && !this.isLast("\n")) { - this.push(" "); - } - }; - - /** - * Remove the last character. - */ - - Buffer.prototype.removeLast = function removeLast(cha) { - if (this.format.compact) return; - return this._removeLast(cha); - }; - - Buffer.prototype._removeLast = function _removeLast(cha) { - if (!this._isLast(cha)) return; - this.buf = this.buf.substr(0, this.buf.length - 1); - this.position.unshift(cha); - }; - - /** - * Set some state that will be modified if a newline has been inserted before any - * non-space characters. - * - * This is to prevent breaking semantics for terminatorless separator nodes. eg: - * - * return foo; - * - * returns `foo`. But if we do: - * - * return - * foo; - * - * `undefined` will be returned and not `foo` due to the terminator. - */ - - Buffer.prototype.startTerminatorless = function startTerminatorless() { - return this.parenPushNewlineState = { - printed: false - }; - }; - - /** - * Print an ending parentheses if a starting one has been printed. - */ - - Buffer.prototype.endTerminatorless = function endTerminatorless(state) { - if (state.printed) { - this.dedent(); - this.newline(); - this.push(")"); - } - }; - - /** - * Add a newline (or many newlines), maintaining formatting. - * Strips multiple newlines if removeLast is true. - */ - - Buffer.prototype.newline = function newline(i, removeLast) { - if (this.format.compact || this.format.retainLines) return; - - if (this.format.concise) { - this.space(); - return; - } - - removeLast = removeLast || false; - - if (_lodashLangIsNumber2["default"](i)) { - i = Math.min(2, i); - - if (this.endsWith("{\n") || this.endsWith(":\n")) i--; - if (i <= 0) return; - - while (i > 0) { - this._newline(removeLast); - i--; - } - return; - } - - if (_lodashLangIsBoolean2["default"](i)) { - removeLast = i; - } - - this._newline(removeLast); - }; - - /** - * Adds a newline unless there is already two previous newlines. - */ - - Buffer.prototype._newline = function _newline(removeLast) { - // never allow more than two lines - if (this.endsWith("\n\n")) return; - - // remove the last newline - if (removeLast && this.isLast("\n")) this.removeLast("\n"); - - this.removeLast(" "); - this._removeSpacesAfterLastNewline(); - this._push("\n"); - }; - - /** - * If buffer ends with a newline and some spaces after it, trim those spaces. - */ - - Buffer.prototype._removeSpacesAfterLastNewline = function _removeSpacesAfterLastNewline() { - var lastNewlineIndex = this.buf.lastIndexOf("\n"); - if (lastNewlineIndex === -1) { - return; - } - - var index = this.buf.length - 1; - while (index > lastNewlineIndex) { - if (this.buf[index] !== " ") { - break; - } - - index--; - } - - if (index === lastNewlineIndex) { - this.buf = this.buf.substring(0, index + 1); - } - }; - - /** - * Push a string to the buffer, maintaining indentation and newlines. - */ - - Buffer.prototype.push = function push(str, noIndent) { - if (!this.format.compact && this._indent && !noIndent && str !== "\n") { - // we have an indent level and we aren't pushing a newline - var indent = this.getIndent(); - - // replace all newlines with newlines with the indentation - str = str.replace(/\n/g, "\n" + indent); - - // we've got a newline before us so prepend on the indentation - if (this.isLast("\n")) this._push(indent); - } - - this._push(str); - }; - - /** - * Push a string to the buffer. - */ - - Buffer.prototype._push = function _push(str) { - // see startTerminatorless() instance method - var parenPushNewlineState = this.parenPushNewlineState; - if (parenPushNewlineState) { - for (var i = 0; i < str.length; i++) { - var cha = str[i]; - - // we can ignore spaces since they wont interupt a terminatorless separator - if (cha === " ") continue; - - this.parenPushNewlineState = null; - - if (cha === "\n" || cha === "/") { - // we're going to break this terminator expression so we need to add a parentheses - this._push("("); - this.indent(); - parenPushNewlineState.printed = true; - } - - break; - } - } - - // - this.position.push(str); - this.buf += str; - }; - - /** - * Test if the buffer ends with a string. - */ - - Buffer.prototype.endsWith = function endsWith(str) { - var buf = arguments.length <= 1 || arguments[1] === undefined ? this.buf : arguments[1]; - - if (str.length === 1) { - return buf[buf.length - 1] === str; - } else { - return buf.slice(-str.length) === str; - } - }; - - /** - * Test if a character is last in the buffer. - */ - - Buffer.prototype.isLast = function isLast(cha) { - if (this.format.compact) return false; - return this._isLast(cha); - }; - - Buffer.prototype._isLast = function _isLast(cha) { - var buf = this.buf; - var last = buf[buf.length - 1]; - - if (Array.isArray(cha)) { - return _lodashCollectionIncludes2["default"](cha, last); - } else { - return cha === last; - } - }; - - return Buffer; -})(); - -exports["default"] = Buffer; -module.exports = exports["default"]; -},{"421":421,"506":506,"510":510,"592":592,"609":609}],19:[function(_dereq_,module,exports){ -/** - * Print File.program - */ - -"use strict"; - -exports.__esModule = true; -exports.File = File; -exports.Program = Program; -exports.BlockStatement = BlockStatement; -exports.Noop = Noop; - -function File(node, print) { - print.plain(node.program); -} - -/** - * Print all nodes in a Program.body. - */ - -function Program(node, print) { - print.sequence(node.body); -} - -/** - * Print BlockStatement, collapses empty blocks, prints body. - */ - -function BlockStatement(node, print) { - this.push("{"); - if (node.body.length) { - this.newline(); - print.sequence(node.body, { indent: true }); - if (!this.format.retainLines) this.removeLast("\n"); - this.rightBrace(); - } else { - print.printInnerComments(); - this.push("}"); - } -} - -/** - * What is my purpose? - * Why am I here? - * Why are any of us here? - * Does any of this really matter? - */ - -function Noop() {} -},{}],20:[function(_dereq_,module,exports){ -/** - * Print ClassDeclaration, prints decorators, typeParameters, extends, implements, and body. - */ - -"use strict"; - -exports.__esModule = true; -exports.ClassDeclaration = ClassDeclaration; -exports.ClassBody = ClassBody; -exports.ClassProperty = ClassProperty; -exports.MethodDefinition = MethodDefinition; - -function ClassDeclaration(node, print) { - print.list(node.decorators, { separator: "" }); - this.push("class"); - - if (node.id) { - this.push(" "); - print.plain(node.id); - } - - print.plain(node.typeParameters); - - if (node.superClass) { - this.push(" extends "); - print.plain(node.superClass); - print.plain(node.superTypeParameters); - } - - if (node["implements"]) { - this.push(" implements "); - print.join(node["implements"], { separator: ", " }); - } - - this.space(); - print.plain(node.body); -} - -/** - * Alias ClassDeclaration printer as ClassExpression. - */ - -exports.ClassExpression = ClassDeclaration; - -/** - * Print ClassBody, collapses empty blocks, prints body. - */ - -function ClassBody(node, print) { - this.push("{"); - if (node.body.length === 0) { - print.printInnerComments(); - this.push("}"); - } else { - this.newline(); - - this.indent(); - print.sequence(node.body); - this.dedent(); - - this.rightBrace(); - } -} - -/** - * Print ClassProperty, prints decorators, static, key, typeAnnotation, and value. - * Also: semicolons, deal with it. - */ - -function ClassProperty(node, print) { - print.list(node.decorators, { separator: "" }); - - if (node["static"]) this.push("static "); - print.plain(node.key); - print.plain(node.typeAnnotation); - if (node.value) { - this.space(); - this.push("="); - this.space(); - print.plain(node.value); - } - this.semicolon(); -} - -/** - * Print MethodDefinition, prints decorations, static, and method. - */ - -function MethodDefinition(node, print) { - print.list(node.decorators, { separator: "" }); - - if (node["static"]) { - this.push("static "); - } - - this._method(node, print); -} -},{}],21:[function(_dereq_,module,exports){ -/** - * Prints ComprehensionBlock, prints left and right. - */ - -"use strict"; - -exports.__esModule = true; -exports.ComprehensionBlock = ComprehensionBlock; -exports.ComprehensionExpression = ComprehensionExpression; - -function ComprehensionBlock(node, print) { - this.keyword("for"); - this.push("("); - print.plain(node.left); - this.push(" of "); - print.plain(node.right); - this.push(")"); -} - -/** - * Prints ComprehensionExpression, prints blocks, filter, and body. Handles generators. - */ - -function ComprehensionExpression(node, print) { - this.push(node.generator ? "(" : "["); - - print.join(node.blocks, { separator: " " }); - this.space(); - - if (node.filter) { - this.keyword("if"); - this.push("("); - print.plain(node.filter); - this.push(")"); - this.space(); - } - - print.plain(node.body); - - this.push(node.generator ? ")" : "]"); -} -},{}],22:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.UnaryExpression = UnaryExpression; -exports.DoExpression = DoExpression; -exports.ParenthesizedExpression = ParenthesizedExpression; -exports.UpdateExpression = UpdateExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.NewExpression = NewExpression; -exports.SequenceExpression = SequenceExpression; -exports.ThisExpression = ThisExpression; -exports.Super = Super; -exports.Decorator = Decorator; -exports.CallExpression = CallExpression; -exports.EmptyStatement = EmptyStatement; -exports.ExpressionStatement = ExpressionStatement; -exports.AssignmentPattern = AssignmentPattern; -exports.AssignmentExpression = AssignmentExpression; -exports.BindExpression = BindExpression; -exports.MemberExpression = MemberExpression; -exports.MetaProperty = MetaProperty; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _isInteger = _dereq_(406); - -var _isInteger2 = _interopRequireDefault(_isInteger); - -var _lodashLangIsNumber = _dereq_(510); - -var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber); - -var _node = _dereq_(31); - -var _node2 = _interopRequireDefault(_node); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * RegExp for testing scientific notation in literals. - */ - -var SCIENTIFIC_NOTATION = /e/i; -var ZERO_DECIMAL_INTEGER = /\.0+$/; - -/** - * RegExp for testing if a numeric literal is - * a BinaryIntegerLiteral, OctalIntegerLiteral or HexIntegerLiteral. - */ - -var NON_DECIMAL_NUMERIC_LITERAL = /^0(b|o|x)/i; - -/** - * Prints UnaryExpression, prints operator and argument. - */ - -function UnaryExpression(node, print) { - var needsSpace = /[a-z]$/.test(node.operator); - var arg = node.argument; - - if (t.isUpdateExpression(arg) || t.isUnaryExpression(arg)) { - needsSpace = true; - } - - if (t.isUnaryExpression(arg) && arg.operator === "!") { - needsSpace = false; - } - - this.push(node.operator); - if (needsSpace) this.push(" "); - print.plain(node.argument); -} - -/** - * Prints DoExpression, prints body. - */ - -function DoExpression(node, print) { - this.push("do"); - this.space(); - print.plain(node.body); -} - -/** - * Prints ParenthesizedExpression, prints expression. - */ - -function ParenthesizedExpression(node, print) { - this.push("("); - print.plain(node.expression); - this.push(")"); -} - -/** - * Prints UpdateExpression, prints operator and argument. - */ - -function UpdateExpression(node, print) { - if (node.prefix) { - this.push(node.operator); - print.plain(node.argument); - } else { - print.plain(node.argument); - this.push(node.operator); - } -} - -/** - * Prints ConditionalExpression, prints test, consequent, and alternate. - */ - -function ConditionalExpression(node, print) { - print.plain(node.test); - this.space(); - this.push("?"); - this.space(); - print.plain(node.consequent); - this.space(); - this.push(":"); - this.space(); - print.plain(node.alternate); -} - -/** - * Prints NewExpression, prints callee and arguments. - */ - -function NewExpression(node, print) { - this.push("new "); - print.plain(node.callee); - this.push("("); - print.list(node.arguments); - this.push(")"); -} - -/** - * Prints SequenceExpression.expressions. - */ - -function SequenceExpression(node, print) { - print.list(node.expressions); -} - -/** - * Prints ThisExpression. - */ - -function ThisExpression() { - this.push("this"); -} - -/** - * Prints Super. - */ - -function Super() { - this.push("super"); -} - -/** - * Prints Decorator, prints expression. - */ - -function Decorator(node, print) { - this.push("@"); - print.plain(node.expression); - this.newline(); -} - -/** - * Prints CallExpression, prints callee and arguments. - */ - -function CallExpression(node, print) { - print.plain(node.callee); - - this.push("("); - - var isPrettyCall = node._prettyCall && !this.format.retainLines && !this.format.compact; - - var separator; - if (isPrettyCall) { - separator = ",\n"; - this.newline(); - this.indent(); - } - - print.list(node.arguments, { separator: separator }); - - if (isPrettyCall) { - this.newline(); - this.dedent(); - } - - this.push(")"); -} - -/** - * Builds yield or await expression printer. - * Prints delegate, all, and argument. - */ - -var buildYieldAwait = function buildYieldAwait(keyword) { - return function (node, print) { - this.push(keyword); - - if (node.delegate || node.all) { - this.push("*"); - } - - if (node.argument) { - this.push(" "); - var terminatorState = this.startTerminatorless(); - print.plain(node.argument); - this.endTerminatorless(terminatorState); - } - }; -}; - -/** - * Create YieldExpression and AwaitExpression printers. - */ - -var YieldExpression = buildYieldAwait("yield"); -exports.YieldExpression = YieldExpression; -var AwaitExpression = buildYieldAwait("await"); - -exports.AwaitExpression = AwaitExpression; -/** - * Prints EmptyStatement. - */ - -function EmptyStatement() { - this.semicolon(); -} - -/** - * Prints ExpressionStatement, prints expression. - */ - -function ExpressionStatement(node, print) { - print.plain(node.expression); - this.semicolon(); -} - -/** - * Prints AssignmentPattern, prints left and right. - */ - -function AssignmentPattern(node, print) { - print.plain(node.left); - this.push(" = "); - print.plain(node.right); -} - -/** - * Prints AssignmentExpression, prints left, operator, and right. - */ - -function AssignmentExpression(node, print, parent) { - // Somewhere inside a for statement `init` node but doesn't usually - // needs a paren except for `in` expressions: `for (a in b ? a : b;;)` - var parens = this._inForStatementInit && node.operator === "in" && !_node2["default"].needsParens(node, parent); - - if (parens) { - this.push("("); - } - - // todo: add cases where the spaces can be dropped when in compact mode - print.plain(node.left); - - var spaces = node.operator === "in" || node.operator === "instanceof"; - spaces = true; // todo: https://github.com/babel/babel/issues/1835 - this.space(spaces); - - this.push(node.operator); - - if (!spaces) { - // space is mandatory to avoid outputting <!-- - // http://javascript.spec.whatwg.org/#comment-syntax - spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" }); - } - - this.space(spaces); - - print.plain(node.right); - - if (parens) { - this.push(")"); - } -} - -/** - * Prints BindExpression, prints object and callee. - */ - -function BindExpression(node, print) { - print.plain(node.object); - this.push("::"); - print.plain(node.callee); -} - -/** - * Alias ClassDeclaration printer as ClassExpression, - * and AssignmentExpression printer as LogicalExpression. - */ - -exports.BinaryExpression = AssignmentExpression; -exports.LogicalExpression = AssignmentExpression; - -/** - * Print MemberExpression, prints object, property, and value. Handles computed. - */ - -function MemberExpression(node, print) { - var obj = node.object; - print.plain(obj); - - if (!node.computed && t.isMemberExpression(node.property)) { - throw new TypeError("Got a MemberExpression for MemberExpression property"); - } - - var computed = node.computed; - if (t.isLiteral(node.property) && _lodashLangIsNumber2["default"](node.property.value)) { - computed = true; - } - - if (computed) { - this.push("["); - print.plain(node.property); - this.push("]"); - } else { - if (t.isLiteral(node.object)) { - var val = this._Literal(node.object); - if (_isInteger2["default"](+val) && !ZERO_DECIMAL_INTEGER.test(val) && !SCIENTIFIC_NOTATION.test(val) && !this.endsWith(".") && !NON_DECIMAL_NUMERIC_LITERAL.test(val)) { - this.push("."); - } - } - - this.push("."); - print.plain(node.property); - } -} - -/** - * Print MetaProperty, prints meta and property. - */ - -function MetaProperty(node, print) { - print.plain(node.meta); - this.push("."); - print.plain(node.property); -} -},{"179":179,"31":31,"406":406,"510":510}],23:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.AnyTypeAnnotation = AnyTypeAnnotation; -exports.ArrayTypeAnnotation = ArrayTypeAnnotation; -exports.BooleanTypeAnnotation = BooleanTypeAnnotation; -exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; -exports.DeclareClass = DeclareClass; -exports.DeclareFunction = DeclareFunction; -exports.DeclareModule = DeclareModule; -exports.DeclareVariable = DeclareVariable; -exports.FunctionTypeAnnotation = FunctionTypeAnnotation; -exports.FunctionTypeParam = FunctionTypeParam; -exports.InterfaceExtends = InterfaceExtends; -exports._interfaceish = _interfaceish; -exports.InterfaceDeclaration = InterfaceDeclaration; -exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; -exports.MixedTypeAnnotation = MixedTypeAnnotation; -exports.NullableTypeAnnotation = NullableTypeAnnotation; -exports.NumberTypeAnnotation = NumberTypeAnnotation; -exports.StringLiteralTypeAnnotation = StringLiteralTypeAnnotation; -exports.StringTypeAnnotation = StringTypeAnnotation; -exports.TupleTypeAnnotation = TupleTypeAnnotation; -exports.TypeofTypeAnnotation = TypeofTypeAnnotation; -exports.TypeAlias = TypeAlias; -exports.TypeAnnotation = TypeAnnotation; -exports.TypeParameterInstantiation = TypeParameterInstantiation; -exports.ObjectTypeAnnotation = ObjectTypeAnnotation; -exports.ObjectTypeCallProperty = ObjectTypeCallProperty; -exports.ObjectTypeIndexer = ObjectTypeIndexer; -exports.ObjectTypeProperty = ObjectTypeProperty; -exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; -exports.UnionTypeAnnotation = UnionTypeAnnotation; -exports.TypeCastExpression = TypeCastExpression; -exports.VoidTypeAnnotation = VoidTypeAnnotation; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints AnyTypeAnnotation. - */ - -function AnyTypeAnnotation() { - this.push("any"); -} - -/** - * Prints ArrayTypeAnnotation, prints elementType. - */ - -function ArrayTypeAnnotation(node, print) { - print.plain(node.elementType); - this.push("["); - this.push("]"); -} - -/** - * Prints BooleanTypeAnnotation. - */ - -function BooleanTypeAnnotation() { - this.push("bool"); -} - -/** - * Prints BooleanLiteralTypeAnnotation. - */ - -function BooleanLiteralTypeAnnotation(node) { - this.push(node.value ? "true" : "false"); -} - -/** - * Prints DeclareClass, prints node. - */ - -function DeclareClass(node, print) { - this.push("declare class "); - this._interfaceish(node, print); -} - -/** - * Prints DeclareFunction, prints id and id.typeAnnotation. - */ - -function DeclareFunction(node, print) { - this.push("declare function "); - print.plain(node.id); - print.plain(node.id.typeAnnotation.typeAnnotation); - this.semicolon(); -} - -/** - * Prints DeclareModule, prints id and body. - */ - -function DeclareModule(node, print) { - this.push("declare module "); - print.plain(node.id); - this.space(); - print.plain(node.body); -} - -/** - * Prints DeclareVariable, prints id and id.typeAnnotation. - */ - -function DeclareVariable(node, print) { - this.push("declare var "); - print.plain(node.id); - print.plain(node.id.typeAnnotation); - this.semicolon(); -} - -/** - * Prints FunctionTypeAnnotation, prints typeParameters, params, and rest. - */ - -function FunctionTypeAnnotation(node, print, parent) { - print.plain(node.typeParameters); - this.push("("); - print.list(node.params); - - if (node.rest) { - if (node.params.length) { - this.push(","); - this.space(); - } - this.push("..."); - print.plain(node.rest); - } - - this.push(")"); - - // this node type is overloaded, not sure why but it makes it EXTREMELY annoying - if (parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") { - this.push(":"); - } else { - this.space(); - this.push("=>"); - } - - this.space(); - print.plain(node.returnType); -} - -/** - * Prints FunctionTypeParam, prints name and typeAnnotation, handles optional. - */ - -function FunctionTypeParam(node, print) { - print.plain(node.name); - if (node.optional) this.push("?"); - this.push(":"); - this.space(); - print.plain(node.typeAnnotation); -} - -/** - * Prints InterfaceExtends, prints id and typeParameters. - */ - -function InterfaceExtends(node, print) { - print.plain(node.id); - print.plain(node.typeParameters); -} - -/** - * Alias InterfaceExtends printer as ClassImplements, - * and InterfaceExtends printer as GenericTypeAnnotation. - */ - -exports.ClassImplements = InterfaceExtends; -exports.GenericTypeAnnotation = InterfaceExtends; - -/** - * Prints interface-like node, prints id, typeParameters, extends, and body. - */ - -function _interfaceish(node, print) { - print.plain(node.id); - print.plain(node.typeParameters); - if (node["extends"].length) { - this.push(" extends "); - print.join(node["extends"], { separator: ", " }); - } - this.space(); - print.plain(node.body); -} - -/** - * Prints InterfaceDeclaration, prints node. - */ - -function InterfaceDeclaration(node, print) { - this.push("interface "); - this._interfaceish(node, print); -} - -/** - * Prints IntersectionTypeAnnotation, prints types. - */ - -function IntersectionTypeAnnotation(node, print) { - print.join(node.types, { separator: " & " }); -} - -/** - * Prints MixedTypeAnnotation. - */ - -function MixedTypeAnnotation() { - this.push("mixed"); -} - -/** - * Prints NullableTypeAnnotation, prints typeAnnotation. - */ - -function NullableTypeAnnotation(node, print) { - this.push("?"); - print.plain(node.typeAnnotation); -} - -/** - * Prints NumberLiteralTypeAnnotation, prints value. - */ - -var _types2 = _dereq_(29); - -exports.NumberLiteralTypeAnnotation = _types2.Literal; - -/** - * Prints NumberTypeAnnotation. - */ - -function NumberTypeAnnotation() { - this.push("number"); -} - -/** - * Prints StringLiteralTypeAnnotation, prints value. - */ - -function StringLiteralTypeAnnotation(node) { - this.push(this._stringLiteral(node.value)); -} - -/** - * Prints StringTypeAnnotation. - */ - -function StringTypeAnnotation() { - this.push("string"); -} - -/** - * Prints TupleTypeAnnotation, prints types. - */ - -function TupleTypeAnnotation(node, print) { - this.push("["); - print.join(node.types, { separator: ", " }); - this.push("]"); -} - -/** - * Prints TypeofTypeAnnotation, prints argument. - */ - -function TypeofTypeAnnotation(node, print) { - this.push("typeof "); - print.plain(node.argument); -} - -/** - * Prints TypeAlias, prints id, typeParameters, and right. - */ - -function TypeAlias(node, print) { - this.push("type "); - print.plain(node.id); - print.plain(node.typeParameters); - this.space(); - this.push("="); - this.space(); - print.plain(node.right); - this.semicolon(); -} - -/** - * Prints TypeAnnotation, prints typeAnnotation, handles optional. - */ - -function TypeAnnotation(node, print) { - this.push(":"); - this.space(); - if (node.optional) this.push("?"); - print.plain(node.typeAnnotation); -} - -/** - * Prints TypeParameterInstantiation, prints params. - */ - -function TypeParameterInstantiation(node, print) { - this.push("<"); - print.join(node.params, { - separator: ", ", - iterator: function iterator(node) { - print.plain(node.typeAnnotation); - } - }); - this.push(">"); -} - -/** - * Alias TypeParameterInstantiation printer as TypeParameterDeclaration - */ - -exports.TypeParameterDeclaration = TypeParameterInstantiation; - -/** - * Prints ObjectTypeAnnotation, prints properties, callProperties, and indexers. - */ - -function ObjectTypeAnnotation(node, print) { - // istanbul ignore next - - var _this = this; - - this.push("{"); - var props = node.properties.concat(node.callProperties, node.indexers); - - if (props.length) { - this.space(); - - print.list(props, { - separator: false, - indent: true, - iterator: function iterator() { - if (props.length !== 1) { - _this.semicolon(); - _this.space(); - } - } - }); - - this.space(); - } - - this.push("}"); -} - -/** - * Prints ObjectTypeCallProperty, prints value, handles static. - */ - -function ObjectTypeCallProperty(node, print) { - if (node["static"]) this.push("static "); - print.plain(node.value); -} - -/** - * Prints ObjectTypeIndexer, prints id, key, and value, handles static. - */ - -function ObjectTypeIndexer(node, print) { - if (node["static"]) this.push("static "); - this.push("["); - print.plain(node.id); - this.push(":"); - this.space(); - print.plain(node.key); - this.push("]"); - this.push(":"); - this.space(); - print.plain(node.value); -} - -/** - * Prints ObjectTypeProperty, prints static, key, and value. - */ - -function ObjectTypeProperty(node, print) { - if (node["static"]) this.push("static "); - print.plain(node.key); - if (node.optional) this.push("?"); - if (!t.isFunctionTypeAnnotation(node.value)) { - this.push(":"); - this.space(); - } - print.plain(node.value); -} - -/** - * Prints QualifiedTypeIdentifier, prints qualification and id. - */ - -function QualifiedTypeIdentifier(node, print) { - print.plain(node.qualification); - this.push("."); - print.plain(node.id); -} - -/** - * Prints UnionTypeAnnotation, prints types. - */ - -function UnionTypeAnnotation(node, print) { - print.join(node.types, { separator: " | " }); -} - -/** - * Prints TypeCastExpression, prints expression and typeAnnotation. - */ - -function TypeCastExpression(node, print) { - this.push("("); - print.plain(node.expression); - print.plain(node.typeAnnotation); - this.push(")"); -} - -/** - * Prints VoidTypeAnnotation. - */ - -function VoidTypeAnnotation() { - this.push("void"); -} -},{"179":179,"29":29}],24:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.JSXAttribute = JSXAttribute; -exports.JSXIdentifier = JSXIdentifier; -exports.JSXNamespacedName = JSXNamespacedName; -exports.JSXMemberExpression = JSXMemberExpression; -exports.JSXSpreadAttribute = JSXSpreadAttribute; -exports.JSXExpressionContainer = JSXExpressionContainer; -exports.JSXElement = JSXElement; -exports.JSXOpeningElement = JSXOpeningElement; -exports.JSXClosingElement = JSXClosingElement; -exports.JSXEmptyExpression = JSXEmptyExpression; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints JSXAttribute, prints name and value. - */ - -function JSXAttribute(node, print) { - print.plain(node.name); - if (node.value) { - this.push("="); - print.plain(node.value); - } -} - -/** - * Prints JSXIdentifier, prints name. - */ - -function JSXIdentifier(node) { - this.push(node.name); -} - -/** - * Prints JSXNamespacedName, prints namespace and name. - */ - -function JSXNamespacedName(node, print) { - print.plain(node.namespace); - this.push(":"); - print.plain(node.name); -} - -/** - * Prints JSXMemberExpression, prints object and property. - */ - -function JSXMemberExpression(node, print) { - print.plain(node.object); - this.push("."); - print.plain(node.property); -} - -/** - * Prints JSXSpreadAttribute, prints argument. - */ - -function JSXSpreadAttribute(node, print) { - this.push("{..."); - print.plain(node.argument); - this.push("}"); -} - -/** - * Prints JSXExpressionContainer, prints expression. - */ - -function JSXExpressionContainer(node, print) { - this.push("{"); - print.plain(node.expression); - this.push("}"); -} - -/** - * Prints JSXElement, prints openingElement, children, and closingElement. - */ - -function JSXElement(node, print) { - var open = node.openingElement; - print.plain(open); - if (open.selfClosing) return; - - this.indent(); - var _arr = node.children; - for (var _i = 0; _i < _arr.length; _i++) { - var child = _arr[_i]; - if (t.isLiteral(child)) { - this.push(child.value, true); - } else { - print.plain(child); - } - } - this.dedent(); - - print.plain(node.closingElement); -} - -/** - * Prints JSXOpeningElement, prints name and attributes, handles selfClosing. - */ - -function JSXOpeningElement(node, print) { - this.push("<"); - print.plain(node.name); - if (node.attributes.length > 0) { - this.push(" "); - print.join(node.attributes, { separator: " " }); - } - this.push(node.selfClosing ? " />" : ">"); -} - -/** - * Prints JSXClosingElement, prints name. - */ - -function JSXClosingElement(node, print) { - this.push("</"); - print.plain(node.name); - this.push(">"); -} - -/** - * Prints JSXEmptyExpression. - */ - -function JSXEmptyExpression() {} -},{"179":179}],25:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports._params = _params; -exports._method = _method; -exports.FunctionExpression = FunctionExpression; -exports.ArrowFunctionExpression = ArrowFunctionExpression; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints nodes with params, prints typeParameters, params, and returnType, handles optional params. - */ - -function _params(node, print) { - // istanbul ignore next - - var _this = this; - - print.plain(node.typeParameters); - this.push("("); - print.list(node.params, { - iterator: function iterator(node) { - if (node.optional) _this.push("?"); - print.plain(node.typeAnnotation); - } - }); - this.push(")"); - - if (node.returnType) { - print.plain(node.returnType); - } -} - -/** - * Prints method-like nodes, prints key, value, and body, handles async, generator, computed, and get or set. - */ - -function _method(node, print) { - var value = node.value; - var kind = node.kind; - var key = node.key; - - if (kind === "method" || kind === "init") { - if (value.generator) { - this.push("*"); - } - } - - if (kind === "get" || kind === "set") { - this.push(kind + " "); - } - - if (value.async) this.push("async "); - - if (node.computed) { - this.push("["); - print.plain(key); - this.push("]"); - } else { - print.plain(key); - } - - this._params(value, print); - this.space(); - print.plain(value.body); -} - -/** - * Prints FunctionExpression, prints id and body, handles async and generator. - */ - -function FunctionExpression(node, print) { - if (node.async) this.push("async "); - this.push("function"); - if (node.generator) this.push("*"); - - if (node.id) { - this.push(" "); - print.plain(node.id); - } else { - this.space(); - } - - this._params(node, print); - this.space(); - print.plain(node.body); -} - -/** - * Alias FunctionExpression printer as FunctionDeclaration. - */ - -exports.FunctionDeclaration = FunctionExpression; - -/** - * Prints ArrowFunctionExpression, prints params and body, handles async. - * Leaves out parentheses when single param. - */ - -function ArrowFunctionExpression(node, print) { - if (node.async) this.push("async "); - - if (node.params.length === 1 && t.isIdentifier(node.params[0])) { - print.plain(node.params[0]); - } else { - this._params(node, print); - } - - this.push(" => "); - - var bodyNeedsParens = t.isObjectExpression(node.body); - - if (bodyNeedsParens) { - this.push("("); - } - - print.plain(node.body); - - if (bodyNeedsParens) { - this.push(")"); - } -} -},{"179":179}],26:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.ImportSpecifier = ImportSpecifier; -exports.ImportDefaultSpecifier = ImportDefaultSpecifier; -exports.ExportDefaultSpecifier = ExportDefaultSpecifier; -exports.ExportSpecifier = ExportSpecifier; -exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; -exports.ExportAllDeclaration = ExportAllDeclaration; -exports.ExportNamedDeclaration = ExportNamedDeclaration; -exports.ExportDefaultDeclaration = ExportDefaultDeclaration; -exports.ImportDeclaration = ImportDeclaration; -exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints ImportSpecifier, prints imported and local. - */ - -function ImportSpecifier(node, print) { - print.plain(node.imported); - if (node.local && node.local.name !== node.imported.name) { - this.push(" as "); - print.plain(node.local); - } -} - -/** - * Prints ImportDefaultSpecifier, prints local. - */ - -function ImportDefaultSpecifier(node, print) { - print.plain(node.local); -} - -/** - * Prints ExportDefaultSpecifier, prints exported. - */ - -function ExportDefaultSpecifier(node, print) { - print.plain(node.exported); -} - -/** - * Prints ExportSpecifier, prints local and exported. - */ - -function ExportSpecifier(node, print) { - print.plain(node.local); - if (node.exported && node.local.name !== node.exported.name) { - this.push(" as "); - print.plain(node.exported); - } -} - -/** - * Prints ExportNamespaceSpecifier, prints exported. - */ - -function ExportNamespaceSpecifier(node, print) { - this.push("* as "); - print.plain(node.exported); -} - -/** - * Prints ExportAllDeclaration, prints exported and source. - */ - -function ExportAllDeclaration(node, print) { - this.push("export *"); - if (node.exported) { - this.push(" as "); - print.plain(node.exported); - } - this.push(" from "); - print.plain(node.source); - this.semicolon(); -} - -/** - * Prints ExportNamedDeclaration, delegates to ExportDeclaration. - */ - -function ExportNamedDeclaration(node, print) { - this.push("export "); - ExportDeclaration.call(this, node, print); -} - -/** - * Prints ExportDefaultDeclaration, delegates to ExportDeclaration. - */ - -function ExportDefaultDeclaration(node, print) { - this.push("export default "); - ExportDeclaration.call(this, node, print); -} - -/** - * Prints ExportDeclaration, prints specifiers, declration, and source. - */ - -function ExportDeclaration(node, print) { - var specifiers = node.specifiers; - - if (node.declaration) { - var declar = node.declaration; - print.plain(declar); - if (t.isStatement(declar) || t.isFunction(declar) || t.isClass(declar)) return; - } else { - if (node.exportKind === "type") { - this.push("type "); - } - - var first = specifiers[0]; - var hasSpecial = false; - if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) { - hasSpecial = true; - print.plain(specifiers.shift()); - if (specifiers.length) { - this.push(", "); - } - } - - if (specifiers.length || !specifiers.length && !hasSpecial) { - this.push("{"); - if (specifiers.length) { - this.space(); - print.join(specifiers, { separator: ", " }); - this.space(); - } - this.push("}"); - } - - if (node.source) { - this.push(" from "); - print.plain(node.source); - } - } - - this.ensureSemicolon(); -} - -/** - * Prints ImportDeclaration, prints specifiers and source, handles isType. - */ - -function ImportDeclaration(node, print) { - this.push("import "); - - if (node.importKind === "type" || node.importKind === "typeof") { - this.push(node.importKind + " "); - } - - var specfiers = node.specifiers; - if (specfiers && specfiers.length) { - var first = node.specifiers[0]; - if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) { - print.plain(node.specifiers.shift()); - if (node.specifiers.length) { - this.push(", "); - } - } - - if (node.specifiers.length) { - this.push("{"); - this.space(); - print.join(node.specifiers, { separator: ", " }); - this.space(); - this.push("}"); - } - - this.push(" from "); - } - - print.plain(node.source); - this.semicolon(); -} - -/** - * Prints ImportNamespaceSpecifier, prints local. - */ - -function ImportNamespaceSpecifier(node, print) { - this.push("* as "); - print.plain(node.local); -} -},{"179":179}],27:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.WithStatement = WithStatement; -exports.IfStatement = IfStatement; -exports.ForStatement = ForStatement; -exports.WhileStatement = WhileStatement; -exports.DoWhileStatement = DoWhileStatement; -exports.LabeledStatement = LabeledStatement; -exports.TryStatement = TryStatement; -exports.CatchClause = CatchClause; -exports.SwitchStatement = SwitchStatement; -exports.SwitchCase = SwitchCase; -exports.DebuggerStatement = DebuggerStatement; -exports.VariableDeclaration = VariableDeclaration; -exports.VariableDeclarator = VariableDeclarator; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _repeating = _dereq_(592); - -var _repeating2 = _interopRequireDefault(_repeating); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints WithStatement, prints object and body. - */ - -function WithStatement(node, print) { - this.keyword("with"); - this.push("("); - print.plain(node.object); - this.push(")"); - print.block(node.body); -} - -/** - * Prints IfStatement, prints test, consequent, and alternate. - */ - -function IfStatement(node, print) { - this.keyword("if"); - this.push("("); - print.plain(node.test); - this.push(")"); - this.space(); - - print.indentOnComments(node.consequent); - - if (node.alternate) { - if (this.isLast("}")) this.space(); - this.push("else "); - print.indentOnComments(node.alternate); - } -} - -/** - * Prints ForStatement, prints init, test, update, and body. - */ - -function ForStatement(node, print) { - this.keyword("for"); - this.push("("); - - this._inForStatementInit = true; - print.plain(node.init); - this._inForStatementInit = false; - this.push(";"); - - if (node.test) { - this.space(); - print.plain(node.test); - } - this.push(";"); - - if (node.update) { - this.space(); - print.plain(node.update); - } - - this.push(")"); - print.block(node.body); -} - -/** - * Prints WhileStatement, prints test and body. - */ - -function WhileStatement(node, print) { - this.keyword("while"); - this.push("("); - print.plain(node.test); - this.push(")"); - print.block(node.body); -} - -/** - * Builds ForIn or ForOf statement printers. - * Prints left, right, and body. - */ - -var buildForXStatement = function buildForXStatement(op) { - return function (node, print) { - this.keyword("for"); - this.push("("); - print.plain(node.left); - this.push(" " + op + " "); - print.plain(node.right); - this.push(")"); - print.block(node.body); - }; -}; - -/** - * Create ForInStatement and ForOfStatement printers. - */ - -var ForInStatement = buildForXStatement("in"); -exports.ForInStatement = ForInStatement; -var ForOfStatement = buildForXStatement("of"); - -exports.ForOfStatement = ForOfStatement; -/** - * Prints DoWhileStatement, prints body and test. - */ - -function DoWhileStatement(node, print) { - this.push("do "); - print.plain(node.body); - this.space(); - this.keyword("while"); - this.push("("); - print.plain(node.test); - this.push(");"); -} - -/** - * Builds continue, return, or break statement printers. - * Prints label (or key). - */ - -var buildLabelStatement = function buildLabelStatement(prefix) { - var key = arguments.length <= 1 || arguments[1] === undefined ? "label" : arguments[1]; - - return function (node, print) { - this.push(prefix); - - var label = node[key]; - if (label) { - this.push(" "); - var terminatorState = this.startTerminatorless(); - print.plain(label); - this.endTerminatorless(terminatorState); - } - - this.semicolon(); - }; -}; - -/** - * Create ContinueStatement, ReturnStatement, and BreakStatement printers. - */ - -var ContinueStatement = buildLabelStatement("continue"); -exports.ContinueStatement = ContinueStatement; -var ReturnStatement = buildLabelStatement("return", "argument"); -exports.ReturnStatement = ReturnStatement; -var BreakStatement = buildLabelStatement("break"); -exports.BreakStatement = BreakStatement; -var ThrowStatement = buildLabelStatement("throw", "argument"); - -exports.ThrowStatement = ThrowStatement; -/** - * Prints LabeledStatement, prints label and body. - */ - -function LabeledStatement(node, print) { - print.plain(node.label); - this.push(": "); - print.plain(node.body); -} - -/** - * Prints TryStatement, prints block, handlers, and finalizer. - */ - -function TryStatement(node, print) { - this.keyword("try"); - print.plain(node.block); - this.space(); - - // Esprima bug puts the catch clause in a `handlers` array. - // see https://code.google.com/p/esprima/issues/detail?id=433 - // We run into this from regenerator generated ast. - if (node.handlers) { - print.plain(node.handlers[0]); - } else { - print.plain(node.handler); - } - - if (node.finalizer) { - this.space(); - this.push("finally "); - print.plain(node.finalizer); - } -} - -/** - * Prints CatchClause, prints param and body. - */ - -function CatchClause(node, print) { - this.keyword("catch"); - this.push("("); - print.plain(node.param); - this.push(") "); - print.plain(node.body); -} - -/** - * Prints SwitchStatement, prints discriminant and cases. - */ - -function SwitchStatement(node, print) { - this.keyword("switch"); - this.push("("); - print.plain(node.discriminant); - this.push(")"); - this.space(); - this.push("{"); - - print.sequence(node.cases, { - indent: true, - addNewlines: function addNewlines(leading, cas) { - if (!leading && node.cases[node.cases.length - 1] === cas) return -1; - } - }); - - this.push("}"); -} - -/** - * Prints SwitchCase, prints test and consequent. - */ - -function SwitchCase(node, print) { - if (node.test) { - this.push("case "); - print.plain(node.test); - this.push(":"); - } else { - this.push("default:"); - } - - if (node.consequent.length) { - this.newline(); - print.sequence(node.consequent, { indent: true }); - } -} - -/** - * Prints DebuggerStatement. - */ - -function DebuggerStatement() { - this.push("debugger;"); -} - -/** - * Prints VariableDeclaration, prints declarations, handles kind and format. - */ - -function VariableDeclaration(node, print, parent) { - this.push(node.kind + " "); - - var hasInits = false; - // don't add whitespace to loop heads - if (!t.isFor(parent)) { - var _arr = node.declarations; - - for (var _i = 0; _i < _arr.length; _i++) { - var declar = _arr[_i]; - if (declar.init) { - // has an init so let's split it up over multiple lines - hasInits = true; - } - } - } - - // - // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on - // this will format declarations like: - // - // var foo = "bar", bar = "foo"; - // - // into - // - // var foo = "bar", - // bar = "foo"; - // - - var sep; - if (!this.format.compact && !this.format.concise && hasInits && !this.format.retainLines) { - sep = ",\n" + _repeating2["default"](" ", node.kind.length + 1); - } - - // - - print.list(node.declarations, { separator: sep }); - - if (t.isFor(parent)) { - // don't give semicolons to these nodes since they'll be inserted in the parent generator - if (parent.left === node || parent.init === node) return; - } - - this.semicolon(); -} - -/** - * Prints VariableDeclarator, handles id, id.typeAnnotation, and init. - */ - -function VariableDeclarator(node, print) { - print.plain(node.id); - print.plain(node.id.typeAnnotation); - if (node.init) { - this.space(); - this.push("="); - this.space(); - print.plain(node.init); - } -} -},{"179":179,"592":592}],28:[function(_dereq_,module,exports){ -/** - * Prints TaggedTemplateExpression, prints tag and quasi. - */ - -"use strict"; - -exports.__esModule = true; -exports.TaggedTemplateExpression = TaggedTemplateExpression; -exports.TemplateElement = TemplateElement; -exports.TemplateLiteral = TemplateLiteral; - -function TaggedTemplateExpression(node, print) { - print.plain(node.tag); - print.plain(node.quasi); -} - -/** - * Prints TemplateElement, prints value. - */ - -function TemplateElement(node) { - this._push(node.value.raw); -} - -/** - * Prints TemplateLiteral, prints quasis, and expressions. - */ - -function TemplateLiteral(node, print) { - this.push("`"); - - var quasis = node.quasis; - var len = quasis.length; - - for (var i = 0; i < len; i++) { - print.plain(quasis[i]); - - if (i + 1 < len) { - this.push("${ "); - print.plain(node.expressions[i]); - this.push(" }"); - } - } - - this._push("`"); -} -},{}],29:[function(_dereq_,module,exports){ -/* eslint quotes: 0 */ - -"use strict"; - -exports.__esModule = true; -exports.Identifier = Identifier; -exports.RestElement = RestElement; -exports.ObjectExpression = ObjectExpression; -exports.Property = Property; -exports.ArrayExpression = ArrayExpression; -exports.Literal = Literal; -exports._Literal = _Literal; -exports._stringLiteral = _stringLiteral; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Prints Identifier, prints name. - */ - -function Identifier(node) { - this.push(node.name); -} - -/** - * Prints RestElement, prints argument. - */ - -function RestElement(node, print) { - this.push("..."); - print.plain(node.argument); -} - -/** - * Alias RestElement printer as SpreadElement, - * and RestElement printer as SpreadProperty. - */ - -exports.SpreadElement = RestElement; -exports.SpreadProperty = RestElement; - -/** - * Prints ObjectExpression, prints properties. - */ - -function ObjectExpression(node, print) { - var props = node.properties; - - this.push("{"); - print.printInnerComments(); - - if (props.length) { - this.space(); - print.list(props, { indent: true }); - this.space(); - } - - this.push("}"); -} - -/** - * Alias ObjectExpression printer as ObjectPattern. - */ - -exports.ObjectPattern = ObjectExpression; - -/** - * Prints Property, prints decorators, key, and value, handles kind, computed, and shorthand. - */ - -function Property(node, print) { - print.list(node.decorators, { separator: "" }); - - if (node.method || node.kind === "get" || node.kind === "set") { - this._method(node, print); - } else { - if (node.computed) { - this.push("["); - print.plain(node.key); - this.push("]"); - } else { - // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});` - if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) { - print.plain(node.value); - return; - } - - print.plain(node.key); - - // shorthand! - if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) { - return; - } - } - - this.push(":"); - this.space(); - print.plain(node.value); - } -} - -/** - * Prints ArrayExpression, prints elements. - */ - -function ArrayExpression(node, print) { - var elems = node.elements; - var len = elems.length; - - this.push("["); - print.printInnerComments(); - - for (var i = 0; i < elems.length; i++) { - var elem = elems[i]; - if (elem) { - if (i > 0) this.space(); - print.plain(elem); - if (i < len - 1) this.push(","); - } else { - // If the array expression ends with a hole, that hole - // will be ignored by the interpreter, but if it ends with - // two (or more) holes, we need to write out two (or more) - // commas so that the resulting code is interpreted with - // both (all) of the holes. - this.push(","); - } - } - - this.push("]"); -} - -/** - * Alias ArrayExpression printer as ArrayPattern. - */ - -exports.ArrayPattern = ArrayExpression; - -/** - * Prints Literal, prints value, regex, raw, handles val type. - */ - -function Literal(node) { - this.push(""); // hack: catch up indentation - this._push(this._Literal(node)); -} - -function _Literal(node) { - var val = node.value; - - if (node.regex) { - return "/" + node.regex.pattern + "/" + node.regex.flags; - } - - // just use the raw property if our current value is equivalent to the one we got - // when we populated raw - if (node.raw != null && node.rawValue != null && val === node.rawValue) { - return node.raw; - } - - switch (typeof val) { - case "string": - return this._stringLiteral(val); - - case "number": - return val + ""; - - case "boolean": - return val ? "true" : "false"; - - default: - if (val === null) { - return "null"; - } else { - throw new Error("Invalid Literal type"); - } - } -} - -/** - * Prints string literals, handles format. - */ - -function _stringLiteral(val) { - val = JSON.stringify(val); - - // escape illegal js but valid json unicode characters - val = val.replace(/[\u000A\u000D\u2028\u2029]/g, function (c) { - return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4); - }); - - if (this.format.quotes === "single") { - // remove double quotes - val = val.slice(1, -1); - - // unescape double quotes - val = val.replace(/\\"/g, '"'); - - // escape single quotes - val = val.replace(/'/g, "\\'"); - - // add single quotes - val = "'" + val + "'"; - } - - return val; -} -},{"179":179}],30:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _detectIndent = _dereq_(399); - -var _detectIndent2 = _interopRequireDefault(_detectIndent); - -var _whitespace = _dereq_(37); - -var _whitespace2 = _interopRequireDefault(_whitespace); - -var _nodePrinter = _dereq_(33); - -var _nodePrinter2 = _interopRequireDefault(_nodePrinter); - -var _repeating = _dereq_(592); - -var _repeating2 = _interopRequireDefault(_repeating); - -var _sourceMap = _dereq_(36); - -var _sourceMap2 = _interopRequireDefault(_sourceMap); - -var _position = _dereq_(35); - -var _position2 = _interopRequireDefault(_position); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _buffer = _dereq_(18); - -var _buffer2 = _interopRequireDefault(_buffer); - -var _lodashObjectExtend = _dereq_(519); - -var _lodashObjectExtend2 = _interopRequireDefault(_lodashObjectExtend); - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _node2 = _dereq_(31); - -var _node3 = _interopRequireDefault(_node2); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Babel's code generator, turns an ast into code, maintaining sourcemaps, - * user preferences, and valid output. - */ - -var CodeGenerator = (function () { - function CodeGenerator(ast, opts, code) { - _classCallCheck(this, CodeGenerator); - - opts = opts || {}; - - this.comments = ast.comments || []; - this.tokens = ast.tokens || []; - this.format = CodeGenerator.normalizeOptions(code, opts, this.tokens); - this.opts = opts; - this.ast = ast; - - this.whitespace = new _whitespace2["default"](this.tokens); - this.position = new _position2["default"](); - this.map = new _sourceMap2["default"](this.position, opts, code); - this.buffer = new _buffer2["default"](this.position, this.format); - } - - /** - * [Please add a description.] - */ - - /** - * Normalize generator options, setting defaults. - * - * - Detects code indentation. - * - If `opts.compact = "auto"` and the code is over 100KB, `compact` will be set to `true`. - */ - - CodeGenerator.normalizeOptions = function normalizeOptions(code, opts, tokens) { - var style = " "; - if (code) { - var indent = _detectIndent2["default"](code).indent; - if (indent && indent !== " ") style = indent; - } - - var format = { - shouldPrintComment: opts.shouldPrintComment, - retainLines: opts.retainLines, - comments: opts.comments == null || opts.comments, - compact: opts.compact, - quotes: CodeGenerator.findCommonStringDelimiter(code, tokens), - indent: { - adjustMultilineComment: true, - style: style, - base: 0 - } - }; - - if (format.compact === "auto") { - format.compact = code.length > 100000; // 100KB - - if (format.compact) { - console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "100KB")); - } - } - - if (format.compact) { - format.indent.adjustMultilineComment = false; - } - - return format; - }; - - /** - * Determine if input code uses more single or double quotes. - */ - - CodeGenerator.findCommonStringDelimiter = function findCommonStringDelimiter(code, tokens) { - var occurences = { - single: 0, - double: 0 - }; - - var checked = 0; - - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type.label !== "string") continue; - - var raw = code.slice(token.start, token.end); - if (raw[0] === "'") { - occurences.single++; - } else { - occurences.double++; - } - - checked++; - if (checked >= 3) break; - } - if (occurences.single > occurences.double) { - return "single"; - } else { - return "double"; - } - }; - - /** - * All node generators. - */ - - /** - * Generate code and sourcemap from ast. - * - * Appends comments that weren't attached to any node to the end of the generated output. - */ - - CodeGenerator.prototype.generate = function generate() { - var ast = this.ast; - - this.print(ast); - - if (ast.comments) { - var comments = []; - var _arr = ast.comments; - for (var _i = 0; _i < _arr.length; _i++) { - var comment = _arr[_i]; - if (!comment._displayed) comments.push(comment); - } - this._printComments(comments); - } - - return { - map: this.map.get(), - code: this.buffer.get() - }; - }; - - /** - * Build NodePrinter. - */ - - CodeGenerator.prototype.buildPrint = function buildPrint(parent) { - return new _nodePrinter2["default"](this, parent); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.catchUp = function catchUp(node) { - // catch up to this nodes newline if we're behind - if (node.loc && this.format.retainLines && this.buffer.buf) { - while (this.position.line < node.loc.start.line) { - this._push("\n"); - } - } - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype._printNewline = function _printNewline(leading, node, parent, opts) { - if (!opts.statement && !_node3["default"].isUserWhitespacable(node, parent)) { - return; - } - - var lines = 0; - - if (node.start != null && !node._ignoreUserWhitespace) { - // user node - if (leading) { - lines = this.whitespace.getNewlinesBefore(node); - } else { - lines = this.whitespace.getNewlinesAfter(node); - } - } else { - // generated node - if (!leading) lines++; // always include at least a single line after - if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; - - var needs = _node3["default"].needsWhitespaceAfter; - if (leading) needs = _node3["default"].needsWhitespaceBefore; - if (needs(node, parent)) lines++; - - // generated nodes can't add starting file whitespace - if (!this.buffer.buf) lines = 0; - } - - this.newline(lines); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.print = function print(node, parent) { - var opts = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - if (!node) return; - - if (parent && parent._compact) { - node._compact = true; - } - - var oldConcise = this.format.concise; - if (node._compact) { - this.format.concise = true; - } - - if (!this[node.type]) { - throw new ReferenceError("unknown node of type " + JSON.stringify(node.type) + " with constructor " + JSON.stringify(node && node.constructor.name)); - } - - var needsParens = _node3["default"].needsParens(node, parent); - if (needsParens) this.push("("); - - this.printLeadingComments(node, parent); - - this.catchUp(node); - - this._printNewline(true, node, parent, opts); - - if (opts.before) opts.before(); - this.map.mark(node, "start"); - - this[node.type](node, this.buildPrint(node), parent); - - if (needsParens) this.push(")"); - - this.map.mark(node, "end"); - if (opts.after) opts.after(); - - this.format.concise = oldConcise; - - this._printNewline(false, node, parent, opts); - - this.printTrailingComments(node, parent); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.printJoin = function printJoin(print, nodes) { - // istanbul ignore next - - var _this = this; - - var opts = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - if (!nodes || !nodes.length) return; - - var len = nodes.length; - - if (opts.indent) this.indent(); - - var printOpts = { - statement: opts.statement, - addNewlines: opts.addNewlines, - after: function after() { - if (opts.iterator) { - opts.iterator(node, i); - } - - if (opts.separator && i < len - 1) { - _this.push(opts.separator); - } - } - }; - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - print.plain(node, printOpts); - } - - if (opts.indent) this.dedent(); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.printAndIndentOnComments = function printAndIndentOnComments(print, node) { - var indent = !!node.leadingComments; - if (indent) this.indent(); - print.plain(node); - if (indent) this.dedent(); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.printBlock = function printBlock(print, node) { - if (t.isEmptyStatement(node)) { - this.semicolon(); - } else { - this.push(" "); - print.plain(node); - } - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.generateComment = function generateComment(comment) { - var val = comment.value; - if (comment.type === "CommentLine") { - val = "//" + val; - } else { - val = "/*" + val + "*/"; - } - return val; - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.printTrailingComments = function printTrailingComments(node, parent) { - this._printComments(this.getComments("trailingComments", node, parent)); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.printLeadingComments = function printLeadingComments(node, parent) { - this._printComments(this.getComments("leadingComments", node, parent)); - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.getComments = function getComments(key, node, parent) { - if (t.isExpressionStatement(parent)) { - return []; - } - - var comments = []; - var nodes = [node]; - - if (t.isExpressionStatement(node)) { - nodes.push(node.argument); - } - - var _arr2 = nodes; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var _node = _arr2[_i2]; - comments = comments.concat(this._getComments(key, _node)); - } - - return comments; - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype._getComments = function _getComments(key, node) { - return node && node[key] || []; - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype.shouldPrintComment = function shouldPrintComment(comment) { - if (this.format.shouldPrintComment) { - return this.format.shouldPrintComment(comment.value); - } else { - if (comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) { - return true; - } else { - return this.format.comments; - } - } - }; - - /** - * [Please add a description.] - */ - - CodeGenerator.prototype._printComments = function _printComments(comments) { - if (!comments || !comments.length) return; - - var _arr3 = comments; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var comment = _arr3[_i3]; - if (!this.shouldPrintComment(comment)) continue; - if (comment._displayed) continue; - comment._displayed = true; - - this.catchUp(comment); - - // whitespace before - this.newline(this.whitespace.getNewlinesBefore(comment)); - - var column = this.position.column; - var val = this.generateComment(comment); - - if (column && !this.isLast(["\n", " ", "[", "{"])) { - this._push(" "); - column++; - } - - // - if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) { - var offset = comment.loc && comment.loc.start.column; - if (offset) { - var newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); - val = val.replace(newlineRegex, "\n"); - } - - var indent = Math.max(this.indentSize(), column); - val = val.replace(/\n/g, "\n" + _repeating2["default"](" ", indent)); - } - - if (column === 0) { - val = this.getIndent() + val; - } - - // force a newline for line comments when retainLines is set in case the next printed node - // doesn't catch up - if ((this.format.compact || this.format.retainLines) && comment.type === "CommentLine") { - val += "\n"; - } - - // - this._push(val); - - // whitespace after - this.newline(this.whitespace.getNewlinesAfter(comment)); - } - }; - - _createClass(CodeGenerator, null, [{ - key: "generators", - value: { - templateLiterals: _dereq_(28), - comprehensions: _dereq_(21), - expressions: _dereq_(22), - statements: _dereq_(27), - classes: _dereq_(20), - methods: _dereq_(25), - modules: _dereq_(26), - types: _dereq_(29), - flow: _dereq_(23), - base: _dereq_(19), - jsx: _dereq_(24) - }, - enumerable: true - }]); - - return CodeGenerator; -})(); - -_lodashCollectionEach2["default"](_buffer2["default"].prototype, function (fn, key) { - CodeGenerator.prototype[key] = function () { - return fn.apply(this.buffer, arguments); - }; -}); - -/** - * [Please add a description.] - */ - -_lodashCollectionEach2["default"](CodeGenerator.generators, function (generator) { - _lodashObjectExtend2["default"](CodeGenerator.prototype, generator); -}); - -/** - * [Please add a description.] - */ - -module.exports = function (ast, opts, code) { - var gen = new CodeGenerator(ast, opts, code); - return gen.generate(); -}; - -module.exports.CodeGenerator = CodeGenerator; -},{"179":179,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"31":31,"33":33,"35":35,"36":36,"37":37,"399":399,"419":419,"43":43,"519":519,"592":592}],31:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _whitespace = _dereq_(34); - -var _whitespace2 = _interopRequireDefault(_whitespace); - -var _parentheses = _dereq_(32); - -var parens = _interopRequireWildcard(_parentheses); - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _lodashCollectionSome = _dereq_(424); - -var _lodashCollectionSome2 = _interopRequireDefault(_lodashCollectionSome); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Test if node matches a set of type-matcher pairs. - * @example - * find({ - * VariableDeclaration(node, parent) { - * return true; - * } - * }, node, parent); - */ - -var find = function find(obj, node, parent) { - if (!obj) return; - var result; - - var types = Object.keys(obj); - for (var i = 0; i < types.length; i++) { - var type = types[i]; - - if (t.is(type, node)) { - var fn = obj[type]; - result = fn(node, parent); - if (result != null) break; - } - } - - return result; -}; - -/** - * Whitespace and Parenthesis related methods for nodes. - */ - -var Node = (function () { - function Node(node, parent) { - _classCallCheck(this, Node); - - this.parent = parent; - this.node = node; - } - - /** - * Add all static methods from `Node` to `Node.prototype`. - */ - - /** - * Test if `node` can have whitespace set by the user. - */ - - Node.isUserWhitespacable = function isUserWhitespacable(node) { - return t.isUserWhitespacable(node); - }; - - /** - * Test if a `node` requires whitespace. - */ - - Node.needsWhitespace = function needsWhitespace(node, parent, type) { - if (!node) return 0; - - if (t.isExpressionStatement(node)) { - node = node.expression; - } - - var linesInfo = find(_whitespace2["default"].nodes, node, parent); - - if (!linesInfo) { - var items = find(_whitespace2["default"].list, node, parent); - if (items) { - for (var i = 0; i < items.length; i++) { - linesInfo = Node.needsWhitespace(items[i], node, type); - if (linesInfo) break; - } - } - } - - return linesInfo && linesInfo[type] || 0; - }; - - /** - * Test if a `node` requires whitespace before it. - */ - - Node.needsWhitespaceBefore = function needsWhitespaceBefore(node, parent) { - return Node.needsWhitespace(node, parent, "before"); - }; - - /** - * Test if a `note` requires whitespace after it. - */ - - Node.needsWhitespaceAfter = function needsWhitespaceAfter(node, parent) { - return Node.needsWhitespace(node, parent, "after"); - }; - - /** - * Test if a `node` needs parentheses around it. - */ - - Node.needsParens = function needsParens(node, parent) { - if (!parent) return false; - - if (t.isNewExpression(parent) && parent.callee === node) { - if (t.isCallExpression(node)) return true; - - var hasCall = _lodashCollectionSome2["default"](node, function (val) { - return t.isCallExpression(val); - }); - if (hasCall) return true; - } - - return find(parens, node, parent); - }; - - return Node; -})(); - -exports["default"] = Node; -_lodashCollectionEach2["default"](Node, function (fn, key) { - Node.prototype[key] = function () { - // Avoid leaking arguments to prevent deoptimization - var args = new Array(arguments.length + 2); - - args[0] = this.node; - args[1] = this.parent; - - for (var i = 0; i < args.length; i++) { - args[i + 2] = arguments[i]; - } - - return Node[key].apply(null, args); - }; -}); -module.exports = exports["default"]; -},{"179":179,"32":32,"34":34,"419":419,"424":424}],32:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.NullableTypeAnnotation = NullableTypeAnnotation; -exports.UpdateExpression = UpdateExpression; -exports.ObjectExpression = ObjectExpression; -exports.Binary = Binary; -exports.BinaryExpression = BinaryExpression; -exports.SequenceExpression = SequenceExpression; -exports.YieldExpression = YieldExpression; -exports.ClassExpression = ClassExpression; -exports.UnaryLike = UnaryLike; -exports.FunctionExpression = FunctionExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.AssignmentExpression = AssignmentExpression; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Create a mapping of operators to precendence. - * - * @example - * { "==": 6, "+": 9 } - */ -var PRECEDENCE = {}; - -_lodashCollectionEach2["default"]([["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]], function (tier, i) { - _lodashCollectionEach2["default"](tier, function (op) { - PRECEDENCE[op] = i; - }); -}); - -/** - * Test if NullableTypeAnnotation needs parentheses. - */ - -function NullableTypeAnnotation(node, parent) { - return t.isArrayTypeAnnotation(parent); -} - -/** - * Alias NullableTypeAnnotation test as FunctionTypeAnnotation. - */ - -exports.FunctionTypeAnnotation = NullableTypeAnnotation; - -/** - * Test if UpdateExpression needs parentheses. - */ - -function UpdateExpression(node, parent) { - if (t.isMemberExpression(parent) && parent.object === node) { - // (foo++).test() - return true; - } -} - -/** - * Test if ObjectExpression needs parentheses. - */ - -function ObjectExpression(node, parent) { - if (t.isExpressionStatement(parent)) { - // ({ foo: "bar" }); - return true; - } - - if (t.isMemberExpression(parent) && parent.object === node) { - // ({ foo: "bar" }).foo - return true; - } - - return false; -} - -/** - * Test if Binary needs parentheses. - */ - -function Binary(node, parent) { - if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) { - return true; - } - - if (t.isUnaryLike(parent)) { - return true; - } - - if (t.isMemberExpression(parent) && parent.object === node) { - return true; - } - - if (t.isBinary(parent)) { - var parentOp = parent.operator; - var parentPos = PRECEDENCE[parentOp]; - - var nodeOp = node.operator; - var nodePos = PRECEDENCE[nodeOp]; - - if (parentPos > nodePos) { - return true; - } - - // Logical expressions with the same precedence don't need parens. - if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) { - return true; - } - } -} - -/** - * Test if BinaryExpression needs parentheses. - */ - -function BinaryExpression(node, parent) { - if (node.operator === "in") { - // var i = (1 in []); - if (t.isVariableDeclarator(parent)) { - return true; - } - - // for ((1 in []);;); - if (t.isFor(parent)) { - return true; - } - } -} - -/** - * Test if SequenceExpression needs parentheses. - */ - -function SequenceExpression(node, parent) { - if (t.isForStatement(parent)) { - // Although parentheses wouldn't hurt around sequence - // expressions in the head of for loops, traditional style - // dictates that e.g. i++, j++ should not be wrapped with - // parentheses. - return false; - } - - if (t.isExpressionStatement(parent) && parent.expression === node) { - return false; - } - - if (t.isReturnStatement(parent)) { - return false; - } - - // Otherwise err on the side of overparenthesization, adding - // explicit exceptions above if this proves overzealous. - return true; -} - -/** - * Test if YieldExpression needs parentheses. - */ - -function YieldExpression(node, parent) { - return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isConditionalExpression(parent) || t.isYieldExpression(parent); -} - -/** - * Test if ClassExpression needs parentheses. - */ - -function ClassExpression(node, parent) { - return t.isExpressionStatement(parent); -} - -/** - * Test if UnaryLike needs parentheses. - */ - -function UnaryLike(node, parent) { - return t.isMemberExpression(parent) && parent.object === node; -} - -/** - * Test if FunctionExpression needs parentheses. - */ - -function FunctionExpression(node, parent) { - // function () {}; - if (t.isExpressionStatement(parent)) { - return true; - } - - // (function test() {}).name; - if (t.isMemberExpression(parent) && parent.object === node) { - return true; - } - - // (function () {})(); - if (t.isCallExpression(parent) && parent.callee === node) { - return true; - } -} - -/** - * Test if ConditionalExpression needs parentheses. - */ - -function ConditionalExpression(node, parent) { - if (t.isUnaryLike(parent)) { - return true; - } - - if (t.isBinary(parent)) { - return true; - } - - if (t.isCallExpression(parent) || t.isNewExpression(parent)) { - if (parent.callee === node) { - return true; - } - } - - if (t.isConditionalExpression(parent) && parent.test === node) { - return true; - } - - if (t.isMemberExpression(parent) && parent.object === node) { - return true; - } - - return false; -} - -/** - * Test if AssignmentExpression needs parentheses. - */ - -function AssignmentExpression(node) { - if (t.isObjectPattern(node.left)) { - return true; - } else { - return ConditionalExpression.apply(undefined, arguments); - } -} -},{"179":179,"419":419}],33:[function(_dereq_,module,exports){ -/** - * Printer for nodes, needs a `generator` and a `parent`. - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var NodePrinter = (function () { - function NodePrinter(generator, parent) { - _classCallCheck(this, NodePrinter); - - this.generator = generator; - this.parent = parent; - } - - /** - * Description - */ - - NodePrinter.prototype.printInnerComments = function printInnerComments() { - if (!this.parent.innerComments) return; - var gen = this.generator; - gen.indent(); - gen._printComments(this.parent.innerComments); - gen.dedent(); - }; - - /** - * Print a plain node. - */ - - NodePrinter.prototype.plain = function plain(node, opts) { - return this.generator.print(node, this.parent, opts); - }; - - /** - * Print a sequence of nodes as statements. - */ - - NodePrinter.prototype.sequence = function sequence(nodes) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.statement = true; - return this.generator.printJoin(this, nodes, opts); - }; - - /** - * Print a sequence of nodes as expressions. - */ - - NodePrinter.prototype.join = function join(nodes, opts) { - return this.generator.printJoin(this, nodes, opts); - }; - - /** - * Print a list of nodes, with a customizable separator (defaults to ","). - */ - - NodePrinter.prototype.list = function list(items) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - if (opts.separator == null) { - opts.separator = ","; - if (!this.generator.format.compact) opts.separator += " "; - } - - return this.join(items, opts); - }; - - /** - * Print a block-like node. - */ - - NodePrinter.prototype.block = function block(node) { - return this.generator.printBlock(this, node); - }; - - /** - * Print node and indent comments. - */ - - NodePrinter.prototype.indentOnComments = function indentOnComments(node) { - return this.generator.printAndIndentOnComments(this, node); - }; - - return NodePrinter; -})(); - -exports["default"] = NodePrinter; -module.exports = exports["default"]; -},{}],34:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashLangIsBoolean = _dereq_(506); - -var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean); - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _lodashCollectionMap = _dereq_(422); - -var _lodashCollectionMap2 = _interopRequireDefault(_lodashCollectionMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Crawl a node to test if it contains a CallExpression, a Function, or a Helper. - * - * @example - * crawl(node) - * // { hasCall: false, hasFunction: true, hasHelper: false } - */ - -function crawl(node) { - var state = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - if (t.isMemberExpression(node)) { - crawl(node.object, state); - if (node.computed) crawl(node.property, state); - } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { - crawl(node.left, state); - crawl(node.right, state); - } else if (t.isCallExpression(node)) { - state.hasCall = true; - crawl(node.callee, state); - } else if (t.isFunction(node)) { - state.hasFunction = true; - } else if (t.isIdentifier(node)) { - state.hasHelper = state.hasHelper || isHelper(node.callee); - } - - return state; -} - -/** - * Test if a node is or has a helper. - */ - -function isHelper(node) { - if (t.isMemberExpression(node)) { - return isHelper(node.object) || isHelper(node.property); - } else if (t.isIdentifier(node)) { - return node.name === "require" || node.name[0] === "_"; - } else if (t.isCallExpression(node)) { - return isHelper(node.callee); - } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { - return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right); - } else { - return false; - } -} - -/** - * [Please add a description.] - */ - -function isType(node) { - return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node); -} - -/** - * Tests for node types that need whitespace. - */ - -exports.nodes = { - - /** - * Test if AssignmentExpression needs whitespace. - */ - - AssignmentExpression: function AssignmentExpression(node) { - var state = crawl(node.right); - if (state.hasCall && state.hasHelper || state.hasFunction) { - return { - before: state.hasFunction, - after: true - }; - } - }, - - /** - * Test if SwitchCase needs whitespace. - */ - - SwitchCase: function SwitchCase(node, parent) { - return { - before: node.consequent.length || parent.cases[0] === node - }; - }, - - /** - * Test if LogicalExpression needs whitespace. - */ - - LogicalExpression: function LogicalExpression(node) { - if (t.isFunction(node.left) || t.isFunction(node.right)) { - return { - after: true - }; - } - }, - - /** - * Test if Literal needs whitespace. - */ - - Literal: function Literal(node) { - if (node.value === "use strict") { - return { - after: true - }; - } - }, - - /** - * Test if CallExpression needs whitespace. - */ - - CallExpression: function CallExpression(node) { - if (t.isFunction(node.callee) || isHelper(node)) { - return { - before: true, - after: true - }; - } - }, - - /** - * Test if VariableDeclaration needs whitespace. - */ - - VariableDeclaration: function VariableDeclaration(node) { - for (var i = 0; i < node.declarations.length; i++) { - var declar = node.declarations[i]; - - var enabled = isHelper(declar.id) && !isType(declar.init); - if (!enabled) { - var state = crawl(declar.init); - enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; - } - - if (enabled) { - return { - before: true, - after: true - }; - } - } - }, - - /** - * Test if IfStatement needs whitespace. - */ - - IfStatement: function IfStatement(node) { - if (t.isBlockStatement(node.consequent)) { - return { - before: true, - after: true - }; - } - } -}; - -/** - * Test if Property or SpreadProperty needs whitespace. - */ - -exports.nodes.Property = exports.nodes.SpreadProperty = function (node, parent) { - if (parent.properties[0] === node) { - return { - before: true - }; - } -}; - -/** - * Returns lists from node types that need whitespace. - */ - -exports.list = { - - /** - * Return VariableDeclaration declarations init properties. - */ - - VariableDeclaration: function VariableDeclaration(node) { - return _lodashCollectionMap2["default"](node.declarations, "init"); - }, - - /** - * Return VariableDeclaration elements. - */ - - ArrayExpression: function ArrayExpression(node) { - return node.elements; - }, - - /** - * Return VariableDeclaration properties. - */ - - ObjectExpression: function ObjectExpression(node) { - return node.properties; - } -}; - -/** - * Add whitespace tests for nodes and their aliases. - */ - -_lodashCollectionEach2["default"]({ - Function: true, - Class: true, - Loop: true, - LabeledStatement: true, - SwitchStatement: true, - TryStatement: true -}, function (amounts, type) { - if (_lodashLangIsBoolean2["default"](amounts)) { - amounts = { after: amounts, before: amounts }; - } - - _lodashCollectionEach2["default"]([type].concat(t.FLIPPED_ALIAS_KEYS[type] || []), function (type) { - exports.nodes[type] = function () { - return amounts; - }; - }); -}); -},{"179":179,"419":419,"422":422,"506":506}],35:[function(_dereq_,module,exports){ -/** - * Track current position in code generation. - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Position = (function () { - function Position() { - _classCallCheck(this, Position); - - this.line = 1; - this.column = 0; - } - - /** - * Push a string to the current position, mantaining the current line and column. - */ - - Position.prototype.push = function push(str) { - for (var i = 0; i < str.length; i++) { - if (str[i] === "\n") { - this.line++; - this.column = 0; - } else { - this.column++; - } - } - }; - - /** - * Unshift a string from the current position, mantaining the current line and column. - */ - - Position.prototype.unshift = function unshift(str) { - for (var i = 0; i < str.length; i++) { - if (str[i] === "\n") { - this.line--; - } else { - this.column--; - } - } - }; - - return Position; -})(); - -exports["default"] = Position; -module.exports = exports["default"]; -},{}],36:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _sourceMap = _dereq_(607); - -var _sourceMap2 = _interopRequireDefault(_sourceMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Build a sourcemap. - */ - -var SourceMap = (function () { - function SourceMap(position, opts, code) { - _classCallCheck(this, SourceMap); - - this.position = position; - this.opts = opts; - - if (opts.sourceMaps) { - this.map = new _sourceMap2["default"].SourceMapGenerator({ - file: opts.sourceMapTarget, - sourceRoot: opts.sourceRoot - }); - - this.map.setSourceContent(opts.sourceFileName, code); - } else { - this.map = null; - } - } - - /** - * Get the sourcemap. - */ - - SourceMap.prototype.get = function get() { - var map = this.map; - if (map) { - return map.toJSON(); - } else { - return map; - } - }; - - /** - * Mark a node's generated position, and add it to the sourcemap. - */ - - SourceMap.prototype.mark = function mark(node, type) { - var loc = node.loc; - if (!loc) return; // no location info - - var map = this.map; - if (!map) return; // no source map - - if (t.isProgram(node) || t.isFile(node)) return; // illegal mapping nodes - - var position = this.position; - - var generated = { - line: position.line, - column: position.column - }; - - var original = loc[type]; - - map.addMapping({ - source: this.opts.sourceFileName, - generated: generated, - original: original - }); - }; - - return SourceMap; -})(); - -exports["default"] = SourceMap; -module.exports = exports["default"]; -},{"179":179,"607":607}],37:[function(_dereq_,module,exports){ -/** - * Returns `i`th number from `base`, continuing from 0 when `max` is reached. - * Useful for shifting `for` loop by a fixed number but going over all items. - * - * @param {Number} i Current index in the loop - * @param {Number} base Start index for which to return 0 - * @param {Number} max Array length - * @returns {Number} shiftedIndex - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function getLookupIndex(i, base, max) { - i += base; - - if (i >= max) { - i -= max; - } - - return i; -} - -/** - * Get whitespace around tokens. - */ - -var Whitespace = (function () { - function Whitespace(tokens) { - _classCallCheck(this, Whitespace); - - this.tokens = tokens; - this.used = {}; - - // Profiling this code shows that while generator passes over it, indexes - // returned by `getNewlinesBefore` and `getNewlinesAfter` are always increasing. - - // We use this implementation detail for an optimization: instead of always - // starting to look from `this.tokens[0]`, we will start `for` loops from the - // previous successful match. We will enumerate all tokens—but the common - // case will be much faster. - - this._lastFoundIndex = 0; - } - - /** - * Count all the newlines before a node. - */ - - Whitespace.prototype.getNewlinesBefore = function getNewlinesBefore(node) { - var startToken; - var endToken; - var tokens = this.tokens; - - for (var j = 0; j < tokens.length; j++) { - // optimize for forward traversal by shifting for loop index - var i = getLookupIndex(j, this._lastFoundIndex, this.tokens.length); - var token = tokens[i]; - - // this is the token this node starts with - if (node.start === token.start) { - startToken = tokens[i - 1]; - endToken = token; - - this._lastFoundIndex = i; - break; - } - } - - return this.getNewlinesBetween(startToken, endToken); - }; - - /** - * Count all the newlines after a node. - */ - - Whitespace.prototype.getNewlinesAfter = function getNewlinesAfter(node) { - var startToken; - var endToken; - var tokens = this.tokens; - - for (var j = 0; j < tokens.length; j++) { - // optimize for forward traversal by shifting for loop index - var i = getLookupIndex(j, this._lastFoundIndex, this.tokens.length); - var token = tokens[i]; - - // this is the token this node ends with - if (node.end === token.end) { - startToken = token; - endToken = tokens[i + 1]; - if (endToken.type.label === ",") endToken = tokens[i + 2]; - - this._lastFoundIndex = i; - break; - } - } - - if (endToken && endToken.type.label === "eof") { - return 1; - } else { - var lines = this.getNewlinesBetween(startToken, endToken); - if (node.type === "CommentLine" && !lines) { - // line comment - return 1; - } else { - return lines; - } - } - }; - - /** - * Count all the newlines between two tokens. - */ - - Whitespace.prototype.getNewlinesBetween = function getNewlinesBetween(startToken, endToken) { - if (!endToken || !endToken.loc) return 0; - - var start = startToken ? startToken.loc.end.line : 1; - var end = endToken.loc.start.line; - var lines = 0; - - for (var line = start; line < end; line++) { - if (typeof this.used[line] === "undefined") { - this.used[line] = true; - lines++; - } - } - - return lines; - }; - - return Whitespace; -})(); - -exports["default"] = Whitespace; -module.exports = exports["default"]; -},{}],38:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lineNumbers = _dereq_(411); - -var _lineNumbers2 = _interopRequireDefault(_lineNumbers); - -var _repeating = _dereq_(592); - -var _repeating2 = _interopRequireDefault(_repeating); - -var _jsTokens = _dereq_(409); - -var _jsTokens2 = _interopRequireDefault(_jsTokens); - -var _esutils = _dereq_(403); - -var _esutils2 = _interopRequireDefault(_esutils); - -var _chalk = _dereq_(200); - -var _chalk2 = _interopRequireDefault(_chalk); - -/** - * Chalk styles for token types. - */ - -var defs = { - string: _chalk2["default"].red, - punctuator: _chalk2["default"].bold, - curly: _chalk2["default"].green, - parens: _chalk2["default"].blue.bold, - square: _chalk2["default"].yellow, - keyword: _chalk2["default"].cyan, - number: _chalk2["default"].magenta, - regex: _chalk2["default"].magenta, - comment: _chalk2["default"].grey, - invalid: _chalk2["default"].inverse -}; - -/** - * RegExp to test for newlines in terminal. - */ - -var NEWLINE = /\r\n|[\n\r\u2028\u2029]/; - -/** - * Get the type of token, specifying punctuator type. - */ - -function getTokenType(match) { - var token = _jsTokens2["default"].matchToToken(match); - if (token.type === "name" && _esutils2["default"].keyword.isReservedWordES6(token.value)) { - return "keyword"; - } - - if (token.type === "punctuator") { - switch (token.value) { - case "{": - case "}": - return "curly"; - case "(": - case ")": - return "parens"; - case "[": - case "]": - return "square"; - } - } - - return token.type; -} - -/** - * Highlight `text`. - */ - -function highlight(text) { - return text.replace(_jsTokens2["default"], function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var type = getTokenType(args); - var colorize = defs[type]; - if (colorize) { - return args[0].split(NEWLINE).map(function (str) { - return colorize(str); - }).join("\n"); - } else { - return args[0]; - } - }); -} - -/** - * Create a code frame, adding line numbers, code highlighting, and pointing to a given position. - */ - -exports["default"] = function (lines, lineNumber, colNumber) { - var opts = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; - - colNumber = Math.max(colNumber, 0); - - var highlighted = opts.highlightCode && _chalk2["default"].supportsColor; - if (highlighted) lines = highlight(lines); - - lines = lines.split(NEWLINE); - - var start = Math.max(lineNumber - 3, 0); - var end = Math.min(lines.length, lineNumber + 3); - - if (!lineNumber && !colNumber) { - start = 0; - end = lines.length; - } - - var frame = _lineNumbers2["default"](lines.slice(start, end), { - start: start + 1, - before: " ", - after: " | ", - transform: function transform(params) { - if (params.number !== lineNumber) { - return; - } - - if (colNumber) { - params.line += "\n" + params.before + _repeating2["default"](" ", params.width) + params.after + _repeating2["default"](" ", colNumber - 1) + "^"; - } - - params.before = params.before.replace(/^./, ">"); - } - }).join("\n"); - - if (highlighted) { - return _chalk2["default"].reset(frame); - } else { - return frame; - } -}; - -module.exports = exports["default"]; -},{"200":200,"403":403,"409":409,"411":411,"592":592}],39:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashObjectMerge = _dereq_(523); - -var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge); - -/** - * Merge options. - */ - -exports["default"] = function (dest, src) { - if (!dest || !src) return; - - return _lodashObjectMerge2["default"](dest, src, function (a, b) { - if (b && Array.isArray(a)) { - var c = a.slice(0); - for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var v = _ref; - - if (a.indexOf(v) < 0) { - c.push(v); - } - } - return c; - } - }); -}; - -module.exports = exports["default"]; -},{"523":523}],40:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Normalize an AST. - * - * - Wrap `Program` node with a `File` node. - */ - -exports["default"] = function (ast, comments, tokens) { - if (ast && ast.type === "Program") { - return t.file(ast, comments || [], tokens || []); - } else { - throw new Error("Not a valid ast?"); - } -}; - -module.exports = exports["default"]; -},{"179":179}],41:[function(_dereq_,module,exports){ -/** - * Create an object with a `null` prototype. - */ - -"use strict"; - -exports.__esModule = true; - -exports["default"] = function () { - return Object.create(null); -}; - -module.exports = exports["default"]; -},{}],42:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _babylon = _dereq_(613); - -var babylon = _interopRequireWildcard(_babylon); - -/** - * Parse `code` with normalized options, collecting tokens and comments. - */ - -exports["default"] = function (code) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var parseOpts = { - allowImportExportEverywhere: opts.looseModules, - allowReturnOutsideFunction: opts.looseModules, - allowHashBang: true, - ecmaVersion: 6, - strictMode: opts.strictMode, - sourceType: opts.sourceType, - locations: true, - features: opts.features || {}, - plugins: opts.plugins || {} - }; - - if (opts.nonStandard) { - parseOpts.plugins.jsx = true; - parseOpts.plugins.flow = true; - } - - return babylon.parse(code, parseOpts); -}; - -module.exports = exports["default"]; -},{"613":613}],43:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.get = get; -exports.parseArgs = parseArgs; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _util = _dereq_(13); - -var util = _interopRequireWildcard(_util); - -/** - * Mapping of messages to be used in Babel. - * Messages can include $0-style placeholders. - */ - -var MESSAGES = { - tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence", - JSXNamespacedTags: "Namespace tags are not supported. ReactJSX is not XML.", - classesIllegalBareSuper: "Illegal use of bare super", - classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead", - scopeDuplicateDeclaration: "Duplicate declaration $1", - settersNoRest: "Setters aren't allowed to have a rest", - noAssignmentsInForHead: "No assignments allowed in for-in/of head", - expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier", - invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue", - readOnly: "$1 is read-only", - unknownForHead: "Unknown node type $1 in ForStatement", - didYouMean: "Did you mean $1?", - codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.", - missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues", - unsupportedOutputType: "Unsupported output type $1", - illegalMethodName: "Illegal method name $1", - lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated", - - modulesIllegalExportName: "Illegal export $1", - modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes", - - undeclaredVariable: "Reference to undeclared variable $1", - undeclaredVariableType: "Referencing a type alias outside of a type annotation", - undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?", - - traverseNeedsParent: "You must pass a scope and parentPath unless traversing a Program/File got a $1 node", - traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?", - traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2", - traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type", - - pluginIllegalKind: "Illegal kind $1 for plugin $2", - pluginIllegalPosition: "Illegal position $1 for plugin $2", - pluginKeyCollision: "The plugin $1 collides with another of the same name", - pluginNotTransformer: "The plugin $1 didn't export a Plugin instance", - pluginUnknown: "Unknown plugin $1", - - pluginNotFile: "Plugin $1 is resolving to a different Babel version than what is performing the transformation.", - - pluginInvalidProperty: "Plugin $1 provided an invalid property of $2.", - pluginInvalidPropertyVisitor: "Define your visitor methods inside a `visitor` property like so:\n\n new Plugin(\"foobar\", {\n visitor: {\n // define your visitor methods here!\n }\n });\n" -}; - -exports.MESSAGES = MESSAGES; -/** - * Get a message with $0 placeholders replaced by arguments. - */ - -function get(key) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var msg = MESSAGES[key]; - if (!msg) throw new ReferenceError("Unknown message " + JSON.stringify(key)); - - // stringify args - args = parseArgs(args); - - // replace $0 placeholders with args - return msg.replace(/\$(\d+)/g, function (str, i) { - return args[--i]; - }); -} - -/** - * Stingify arguments to be used inside messages. - */ - -function parseArgs(args) { - return args.map(function (val) { - if (val != null && val.inspect) { - return val.inspect(); - } else { - try { - return JSON.stringify(val) || val + ""; - } catch (e) { - return util.inspect(val); - } - } - }); -} -},{"13":13}],44:[function(_dereq_,module,exports){ -(function (global){ -"use strict"; - -_dereq_(395); - -_dereq_(585); - -if (global._babelPolyfill) { - throw new Error("only one instance of babel/polyfill is allowed"); -} -global._babelPolyfill = true; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"395":395,"585":585}],45:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _generation = _dereq_(30); - -var _generation2 = _interopRequireDefault(_generation); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _transformationFile = _dereq_(46); - -var _transformationFile2 = _interopRequireDefault(_transformationFile); - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function buildGlobal(namespace, builder) { - var body = []; - var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); - var tree = t.program([t.expressionStatement(t.callExpression(container, [util.template("helper-self-global")]))]); - - body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))])); - - builder(body); - - return tree; -} - -/** - * [Please add a description.] - */ - -function buildUmd(namespace, builder) { - var body = []; - body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))])); - - builder(body); - - var container = util.template("umd-commonjs-strict", { - FACTORY_PARAMETERS: t.identifier("global"), - BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression({})), - COMMON_ARGUMENTS: t.identifier("exports"), - AMD_ARGUMENTS: t.arrayExpression([t.literal("exports")]), - FACTORY_BODY: body, - UMD_ROOT: t.identifier("this") - }); - return t.program([container]); -} - -/** - * [Please add a description.] - */ - -function buildVar(namespace, builder) { - var body = []; - body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression({}))])); - builder(body); - return t.program(body); -} - -/** - * [Please add a description.] - */ - -function buildHelpers(body, namespace, whitelist) { - _lodashCollectionEach2["default"](_transformationFile2["default"].helpers, function (name) { - if (whitelist && whitelist.indexOf(name) === -1) return; - - var key = t.identifier(t.toIdentifier(name)); - body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), util.template("helper-" + name)))); - }); -} - -/** - * [Please add a description.] - */ - -exports["default"] = function (whitelist) { - var outputType = arguments.length <= 1 || arguments[1] === undefined ? "global" : arguments[1]; - - var namespace = t.identifier("babelHelpers"); - - var builder = function builder(body) { - return buildHelpers(body, namespace, whitelist); - }; - - var tree; - - var build = ({ - global: buildGlobal, - umd: buildUmd, - "var": buildVar - })[outputType]; - - if (build) { - tree = build(namespace, builder); - } else { - throw new Error(messages.get("unsupportedOutputType", outputType)); - } - - return _generation2["default"](tree).code; -}; - -module.exports = exports["default"]; -},{"179":179,"182":182,"30":30,"419":419,"43":43,"46":46}],46:[function(_dereq_,module,exports){ -(function (process){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _convertSourceMap = _dereq_(208); - -var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap); - -var _modules = _dereq_(74); - -var _modules2 = _interopRequireDefault(_modules); - -var _optionsOptionManager = _dereq_(50); - -var _optionsOptionManager2 = _interopRequireDefault(_optionsOptionManager); - -var _pluginManager = _dereq_(52); - -var _pluginManager2 = _interopRequireDefault(_pluginManager); - -var _shebangRegex = _dereq_(595); - -var _shebangRegex2 = _interopRequireDefault(_shebangRegex); - -var _traversalPath = _dereq_(155); - -var _traversalPath2 = _interopRequireDefault(_traversalPath); - -var _lodashLangIsFunction = _dereq_(508); - -var _lodashLangIsFunction2 = _interopRequireDefault(_lodashLangIsFunction); - -var _sourceMap = _dereq_(607); - -var _sourceMap2 = _interopRequireDefault(_sourceMap); - -var _generation = _dereq_(30); - -var _generation2 = _interopRequireDefault(_generation); - -var _helpersCodeFrame = _dereq_(38); - -var _helpersCodeFrame2 = _interopRequireDefault(_helpersCodeFrame); - -var _lodashObjectDefaults = _dereq_(518); - -var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults); - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _tryResolve = _dereq_(610); - -var _tryResolve2 = _interopRequireDefault(_tryResolve); - -var _logger = _dereq_(47); - -var _logger2 = _interopRequireDefault(_logger); - -var _plugin = _dereq_(82); - -var _plugin2 = _interopRequireDefault(_plugin); - -var _helpersParse = _dereq_(42); - -var _helpersParse2 = _interopRequireDefault(_helpersParse); - -var _traversalHub = _dereq_(147); - -var _traversalHub2 = _interopRequireDefault(_traversalHub); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _path = _dereq_(9); - -var _path2 = _interopRequireDefault(_path); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var File = (function () { - function File(opts, pipeline) { - if (opts === undefined) opts = {}; - - _classCallCheck(this, File); - - this.transformerDependencies = {}; - this.dynamicImportTypes = {}; - this.dynamicImportIds = {}; - this.dynamicImports = []; - this.declarations = {}; - this.usedHelpers = {}; - this.dynamicData = {}; - this.data = {}; - this.ast = {}; - this.metadata = { - modules: { - imports: [], - exports: { - exported: [], - specifiers: [] - } - } - }; - this.hub = new _traversalHub2["default"](this); - - this.pipeline = pipeline; - - this.log = new _logger2["default"](this, opts.filename || "unknown"); - this.opts = this.initOptions(opts); - - this.buildTransformers(); - } - - /** - * [Please add a description.] - */ - - File.prototype.initOptions = function initOptions(opts) { - opts = new _optionsOptionManager2["default"](this.log, this.pipeline).init(opts); - - if (opts.inputSourceMap) { - opts.sourceMaps = true; - } - - if (opts.moduleId) { - opts.moduleIds = true; - } - - opts.basename = _path2["default"].basename(opts.filename, _path2["default"].extname(opts.filename)); - - opts.ignore = util.arrayify(opts.ignore, util.regexify); - - if (opts.only) opts.only = util.arrayify(opts.only, util.regexify); - - _lodashObjectDefaults2["default"](opts, { - moduleRoot: opts.sourceRoot - }); - - _lodashObjectDefaults2["default"](opts, { - sourceRoot: opts.moduleRoot - }); - - _lodashObjectDefaults2["default"](opts, { - filenameRelative: opts.filename - }); - - _lodashObjectDefaults2["default"](opts, { - sourceFileName: opts.filenameRelative, - sourceMapTarget: opts.filenameRelative - }); - - // - - if (opts.externalHelpers) { - this.set("helpersNamespace", t.identifier("babelHelpers")); - } - - return opts; - }; - - /** - * [Please add a description.] - */ - - File.prototype.isLoose = function isLoose(key) { - return _lodashCollectionIncludes2["default"](this.opts.loose, key); - }; - - /** - * [Please add a description.] - */ - - File.prototype.buildTransformers = function buildTransformers() { - var file = this; - - var transformers = this.transformers = {}; - - var secondaryStack = []; - var stack = []; - - // build internal transformers - for (var key in this.pipeline.transformers) { - var transformer = this.pipeline.transformers[key]; - var pass = transformers[key] = transformer.buildPass(file); - - if (pass.canTransform()) { - stack.push(pass); - - if (transformer.metadata.secondPass) { - secondaryStack.push(pass); - } - - if (transformer.manipulateOptions) { - transformer.manipulateOptions(file.opts, file); - } - } - } - - // init plugins! - var beforePlugins = []; - var afterPlugins = []; - var pluginManager = new _pluginManager2["default"]({ - file: this, - transformers: this.transformers, - before: beforePlugins, - after: afterPlugins - }); - for (var i = 0; i < file.opts.plugins.length; i++) { - pluginManager.add(file.opts.plugins[i]); - } - stack = beforePlugins.concat(stack, afterPlugins); - - // build transformer stack - this.uncollapsedTransformerStack = stack = stack.concat(secondaryStack); - - // build dependency graph - var _arr = stack; - for (var _i = 0; _i < _arr.length; _i++) { - var pass = _arr[_i];var _arr2 = pass.plugin.dependencies; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var dep = _arr2[_i2]; - this.transformerDependencies[dep] = pass.key; - } - } - - // collapse stack categories - this.transformerStack = this.collapseStack(stack); - }; - - /** - * [Please add a description.] - */ - - File.prototype.collapseStack = function collapseStack(_stack) { - var stack = []; - var ignore = []; - - var _arr3 = _stack; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var pass = _arr3[_i3]; - // been merged - if (ignore.indexOf(pass) >= 0) continue; - - var group = pass.plugin.metadata.group; - - // can't merge - if (!pass.canTransform() || !group) { - stack.push(pass); - continue; - } - - var mergeStack = []; - var _arr4 = _stack; - for (var _i4 = 0; _i4 < _arr4.length; _i4++) { - var _pass = _arr4[_i4]; - if (_pass.plugin.metadata.group === group) { - mergeStack.push(_pass); - ignore.push(_pass); - } - } - - var visitors = []; - var _arr5 = mergeStack; - for (var _i5 = 0; _i5 < _arr5.length; _i5++) { - var _pass2 = _arr5[_i5]; - visitors.push(_pass2.plugin.visitor); - } - var visitor = _traversal2["default"].visitors.merge(visitors); - var mergePlugin = new _plugin2["default"](group, { visitor: visitor }); - stack.push(mergePlugin.buildPass(this)); - } - - return stack; - }; - - /** - * [Please add a description.] - */ - - File.prototype.set = function set(key, val) { - return this.data[key] = val; - }; - - /** - * [Please add a description.] - */ - - File.prototype.setDynamic = function setDynamic(key, fn) { - this.dynamicData[key] = fn; - }; - - /** - * [Please add a description.] - */ - - File.prototype.get = function get(key) { - var data = this.data[key]; - if (data) { - return data; - } else { - var dynamic = this.dynamicData[key]; - if (dynamic) { - return this.set(key, dynamic()); - } - } - }; - - /** - * [Please add a description.] - */ - - File.prototype.resolveModuleSource = function resolveModuleSource(source) { - var resolveModuleSource = this.opts.resolveModuleSource; - if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename); - return source; - }; - - /** - * [Please add a description.] - */ - - File.prototype.addImport = function addImport(source, name, type) { - name = name || source; - var id = this.dynamicImportIds[name]; - - if (!id) { - source = this.resolveModuleSource(source); - id = this.dynamicImportIds[name] = this.scope.generateUidIdentifier(name); - - var specifiers = [t.importDefaultSpecifier(id)]; - var declar = t.importDeclaration(specifiers, t.literal(source)); - declar._blockHoist = 3; - - if (type) { - var modules = this.dynamicImportTypes[type] = this.dynamicImportTypes[type] || []; - modules.push(declar); - } - - if (this.transformers["es6.modules"].canTransform()) { - this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports, this.scope); - this.moduleFormatter.hasLocalImports = true; - } else { - this.dynamicImports.push(declar); - } - } - - return id; - }; - - /** - * [Please add a description.] - */ - - File.prototype.attachAuxiliaryComment = function attachAuxiliaryComment(node) { - var beforeComment = this.opts.auxiliaryCommentBefore; - if (beforeComment) { - node.leadingComments = node.leadingComments || []; - node.leadingComments.push({ - type: "CommentLine", - value: " " + beforeComment - }); - } - - var afterComment = this.opts.auxiliaryCommentAfter; - if (afterComment) { - node.trailingComments = node.trailingComments || []; - node.trailingComments.push({ - type: "CommentLine", - value: " " + afterComment - }); - } - - return node; - }; - - /** - * [Please add a description.] - */ - - File.prototype.addHelper = function addHelper(name) { - var isSolo = _lodashCollectionIncludes2["default"](File.soloHelpers, name); - - if (!isSolo && !_lodashCollectionIncludes2["default"](File.helpers, name)) { - throw new ReferenceError("Unknown helper " + name); - } - - var declar = this.declarations[name]; - if (declar) return declar; - - this.usedHelpers[name] = true; - - if (!isSolo) { - var generator = this.get("helperGenerator"); - var runtime = this.get("helpersNamespace"); - if (generator) { - return generator(name); - } else if (runtime) { - var id = t.identifier(t.toIdentifier(name)); - return t.memberExpression(runtime, id); - } - } - - var ref = util.template("helper-" + name); - - var uid = this.declarations[name] = this.scope.generateUidIdentifier(name); - - if (t.isFunctionExpression(ref) && !ref.id) { - ref.body._compact = true; - ref._generated = true; - ref.id = uid; - ref.type = "FunctionDeclaration"; - this.attachAuxiliaryComment(ref); - this.path.unshiftContainer("body", ref); - } else { - ref._compact = true; - this.scope.push({ - id: uid, - init: ref, - unique: true - }); - } - - return uid; - }; - - File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) { - // Generate a unique name based on the string literals so we dedupe - // identical strings used in the program. - var stringIds = raw.elements.map(function (string) { - return string.value; - }); - var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(","); - - var declar = this.declarations[name]; - if (declar) return declar; - - var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); - - var helperId = this.addHelper(helperName); - var init = t.callExpression(helperId, [strings, raw]); - init._compact = true; - this.scope.push({ - id: uid, - init: init, - _blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers - }); - return uid; - }; - - /** - * [Please add a description.] - */ - - File.prototype.errorWithNode = function errorWithNode(node, msg) { - var Error = arguments.length <= 2 || arguments[2] === undefined ? SyntaxError : arguments[2]; - - var err; - var loc = node && (node.loc || node._loc); - if (loc) { - err = new Error("Line " + loc.start.line + ": " + msg); - err.loc = loc.start; - } else { - // todo: find errors with nodes inside to at least point to something - err = new Error("There's been an error on a dynamic node. This is almost certainly an internal error. Please report it."); - } - return err; - }; - - /** - * [Please add a description.] - */ - - File.prototype.mergeSourceMap = function mergeSourceMap(map) { - var opts = this.opts; - - var inputMap = opts.inputSourceMap; - - if (inputMap) { - map.sources[0] = inputMap.file; - - var inputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(inputMap); - var outputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(map); - var outputMapGenerator = _sourceMap2["default"].SourceMapGenerator.fromSourceMap(outputMapConsumer); - outputMapGenerator.applySourceMap(inputMapConsumer); - - var mergedMap = outputMapGenerator.toJSON(); - mergedMap.sources = inputMap.sources; - mergedMap.file = inputMap.file; - return mergedMap; - } - - return map; - }; - - /** - * [Please add a description.] - */ - - File.prototype.getModuleFormatter = function getModuleFormatter(type) { - if (_lodashLangIsFunction2["default"](type) || !_modules2["default"][type]) { - this.log.deprecate("Custom module formatters are deprecated and will be removed in the next major. Please use Babel plugins instead."); - } - - var ModuleFormatter = _lodashLangIsFunction2["default"](type) ? type : _modules2["default"][type]; - - if (!ModuleFormatter) { - var loc = _tryResolve2["default"].relative(type); - if (loc) ModuleFormatter = _dereq_(loc); - } - - if (!ModuleFormatter) { - throw new ReferenceError("Unknown module formatter type " + JSON.stringify(type)); - } - - return new ModuleFormatter(this); - }; - - /** - * [Please add a description.] - */ - - File.prototype.parse = function parse(code) { - var opts = this.opts; - - // - - var parseOpts = { - highlightCode: opts.highlightCode, - nonStandard: opts.nonStandard, - sourceType: opts.sourceType, - filename: opts.filename, - plugins: {} - }; - - var features = parseOpts.features = {}; - for (var key in this.transformers) { - var transformer = this.transformers[key]; - features[key] = transformer.canTransform(); - } - - parseOpts.looseModules = this.isLoose("es6.modules"); - parseOpts.strictMode = features.strict; - - this.log.debug("Parse start"); - var ast = _helpersParse2["default"](code, parseOpts); - this.log.debug("Parse stop"); - return ast; - }; - - /** - * [Please add a description.] - */ - - File.prototype._addAst = function _addAst(ast) { - this.path = _traversalPath2["default"].get({ - hub: this.hub, - parentPath: null, - parent: ast, - container: ast, - key: "program" - }).setContext(); - this.scope = this.path.scope; - this.ast = ast; - }; - - /** - * [Please add a description.] - */ - - File.prototype.addAst = function addAst(ast) { - this.log.debug("Start set AST"); - this._addAst(ast); - this.log.debug("End set AST"); - - this.log.debug("Start module formatter init"); - var modFormatter = this.moduleFormatter = this.getModuleFormatter(this.opts.modules); - if (modFormatter.init && this.transformers["es6.modules"].canTransform()) { - modFormatter.init(); - } - this.log.debug("End module formatter init"); - }; - - /** - * [Please add a description.] - */ - - File.prototype.transform = function transform() { - this.call("pre"); - var _arr6 = this.transformerStack; - for (var _i6 = 0; _i6 < _arr6.length; _i6++) { - var pass = _arr6[_i6]; - pass.transform(); - } - this.call("post"); - - return this.generate(); - }; - - /** - * [Please add a description.] - */ - - File.prototype.wrap = function wrap(code, callback) { - code = code + ""; - - try { - if (this.shouldIgnore()) { - return this.makeResult({ code: code, ignored: true }); - } else { - return callback(); - } - } catch (err) { - if (err._babel) { - throw err; - } else { - err._babel = true; - } - - var message = err.message = this.opts.filename + ": " + err.message; - - var loc = err.loc; - if (loc) { - err.codeFrame = _helpersCodeFrame2["default"](code, loc.line, loc.column + 1, this.opts); - message += "\n" + err.codeFrame; - } - - if (process.browser) { - // chrome has it's own pretty stringifier which doesn't use the stack property - // https://github.com/babel/babel/issues/2175 - err.message = message; - } - - if (err.stack) { - var newStack = err.stack.replace(err.message, message); - try { - err.stack = newStack; - } catch (e) { - // `err.stack` may be a readonly property in some environments - } - } - - throw err; - } - }; - - /** - * [Please add a description.] - */ - - File.prototype.addCode = function addCode(code) { - code = (code || "") + ""; - code = this.parseInputSourceMap(code); - this.code = code; - }; - - /** - * [Please add a description.] - */ - - File.prototype.parseCode = function parseCode() { - this.parseShebang(); - var ast = this.parse(this.code); - this.addAst(ast); - }; - - /** - * [Please add a description.] - */ - - File.prototype.shouldIgnore = function shouldIgnore() { - var opts = this.opts; - return util.shouldIgnore(opts.filename, opts.ignore, opts.only); - }; - - /** - * [Please add a description.] - */ - - File.prototype.call = function call(key) { - var _arr7 = this.uncollapsedTransformerStack; - - for (var _i7 = 0; _i7 < _arr7.length; _i7++) { - var pass = _arr7[_i7]; - var fn = pass.plugin[key]; - if (fn) fn(this); - } - }; - - /** - * [Please add a description.] - */ - - File.prototype.parseInputSourceMap = function parseInputSourceMap(code) { - var opts = this.opts; - - if (opts.inputSourceMap !== false) { - var inputMap = _convertSourceMap2["default"].fromSource(code); - if (inputMap) { - opts.inputSourceMap = inputMap.toObject(); - code = _convertSourceMap2["default"].removeComments(code); - } - } - - return code; - }; - - /** - * [Please add a description.] - */ - - File.prototype.parseShebang = function parseShebang() { - var shebangMatch = _shebangRegex2["default"].exec(this.code); - if (shebangMatch) { - this.shebang = shebangMatch[0]; - this.code = this.code.replace(_shebangRegex2["default"], ""); - } - }; - - /** - * [Please add a description.] - */ - - File.prototype.makeResult = function makeResult(_ref) { - var code = _ref.code; - var _ref$map = _ref.map; - var map = _ref$map === undefined ? null : _ref$map; - var ast = _ref.ast; - var ignored = _ref.ignored; - - var result = { - metadata: null, - ignored: !!ignored, - code: null, - ast: null, - map: map - }; - - if (this.opts.code) { - result.code = code; - } - - if (this.opts.ast) { - result.ast = ast; - } - - if (this.opts.metadata) { - result.metadata = this.metadata; - result.metadata.usedHelpers = Object.keys(this.usedHelpers); - } - - return result; - }; - - /** - * [Please add a description.] - */ - - File.prototype.generate = function generate() { - var opts = this.opts; - var ast = this.ast; - - var result = { ast: ast }; - if (!opts.code) return this.makeResult(result); - - this.log.debug("Generation start"); - - var _result = _generation2["default"](ast, opts, this.code); - result.code = _result.code; - result.map = _result.map; - - this.log.debug("Generation end"); - - if (this.shebang) { - // add back shebang - result.code = this.shebang + "\n" + result.code; - } - - if (result.map) { - result.map = this.mergeSourceMap(result.map); - } - - if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { - result.code += "\n" + _convertSourceMap2["default"].fromObject(result.map).toComment(); - } - - if (opts.sourceMaps === "inline") { - result.map = null; - } - - return this.makeResult(result); - }; - - _createClass(File, null, [{ - key: "helpers", - - /** - * [Please add a description.] - */ - - value: ["inherits", "defaults", "create-class", "create-decorated-class", "create-decorated-object", "define-decorated-property-descriptor", "tagged-template-literal", "tagged-template-literal-loose", "to-array", "to-consumable-array", "sliced-to-array", "sliced-to-array-loose", "object-without-properties", "has-own", "slice", "bind", "define-property", "async-to-generator", "interop-export-wildcard", "interop-require-wildcard", "interop-require-default", "typeof", "extends", "get", "set", "new-arrow-check", "class-call-check", "object-destructuring-empty", "temporal-undefined", "temporal-assert-defined", "self-global", "typeof-react-element", "default-props", "instanceof", - - // legacy - "interop-require"], - - /** - * [Please add a description.] - */ - - enumerable: true - }, { - key: "soloHelpers", - value: [], - enumerable: true - }]); - - return File; -})(); - -exports["default"] = File; -module.exports = exports["default"]; -}).call(this,_dereq_(10)) -},{"10":10,"147":147,"148":148,"155":155,"179":179,"182":182,"208":208,"30":30,"38":38,"42":42,"421":421,"47":47,"50":50,"508":508,"518":518,"52":52,"595":595,"607":607,"610":610,"74":74,"82":82,"9":9}],47:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _debugNode = _dereq_(397); - -var _debugNode2 = _interopRequireDefault(_debugNode); - -var verboseDebug = _debugNode2["default"]("babel:verbose"); -var generalDebug = _debugNode2["default"]("babel"); - -var seenDeprecatedMessages = []; - -/** - * [Please add a description.] - */ - -var Logger = (function () { - function Logger(file, filename) { - _classCallCheck(this, Logger); - - this.filename = filename; - this.file = file; - } - - /** - * [Please add a description.] - */ - - Logger.prototype._buildMessage = function _buildMessage(msg) { - var parts = "[BABEL] " + this.filename; - if (msg) parts += ": " + msg; - return parts; - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.warn = function warn(msg) { - console.warn(this._buildMessage(msg)); - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.error = function error(msg) { - var Constructor = arguments.length <= 1 || arguments[1] === undefined ? Error : arguments[1]; - - throw new Constructor(this._buildMessage(msg)); - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.deprecate = function deprecate(msg) { - if (this.file.opts && this.file.opts.suppressDeprecationMessages) return; - - msg = this._buildMessage(msg); - - // already seen this message - if (seenDeprecatedMessages.indexOf(msg) >= 0) return; - - // make sure we don't see it again - seenDeprecatedMessages.push(msg); - - console.error(msg); - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.verbose = function verbose(msg) { - if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg)); - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.debug = function debug(msg) { - if (generalDebug.enabled) generalDebug(this._buildMessage(msg)); - }; - - /** - * [Please add a description.] - */ - - Logger.prototype.deopt = function deopt(node, msg) { - this.debug(msg); - }; - - return Logger; -})(); - -exports["default"] = Logger; -module.exports = exports["default"]; -},{"397":397}],48:[function(_dereq_,module,exports){ -module.exports={ - "filename": { - "type": "filename", - "description": "filename to use when reading from stdin - this will be used in source-maps, errors etc", - "default": "unknown", - "shorthand": "f" - }, - - "filenameRelative": { - "hidden": true, - "type": "string" - }, - - "inputSourceMap": { - "hidden": true - }, - - "extra": { - "hidden": true, - "default": {} - }, - - "env": { - "hidden": true, - "default": {} - }, - - "moduleId": { - "description": "specify a custom name for module ids", - "type": "string" - }, - - "getModuleId": { - "hidden": true - }, - - "retainLines": { - "type": "boolean", - "default": false, - "description": "retain line numbers - will result in really ugly code" - }, - - "nonStandard": { - "type": "boolean", - "default": true, - "description": "enable/disable support for JSX and Flow (on by default)" - }, - - "experimental": { - "type": "boolean", - "description": "allow use of experimental transformers", - "default": false - }, - - "highlightCode": { - "description": "enable/disable ANSI syntax highlighting of code frames (on by default)", - "type": "boolean", - "default": true - }, - - "suppressDeprecationMessages": { - "type": "boolean", - "default": false, - "hidden": true - }, - - "resolveModuleSource": { - "hidden": true - }, - - "stage": { - "description": "ECMAScript proposal stage version to allow [0-4]", - "shorthand": "e", - "type": "number", - "default": 2 - }, - - "blacklist": { - "type": "transformerList", - "description": "blacklist of transformers to NOT use", - "shorthand": "b", - "default": [] - }, - - "whitelist": { - "type": "transformerList", - "optional": true, - "description": "whitelist of transformers to ONLY use", - "shorthand": "l" - }, - - "optional": { - "type": "transformerList", - "description": "list of optional transformers to enable", - "default": [] - }, - - "modules": { - "type": "string", - "description": "module formatter type to use [common]", - "default": "common", - "shorthand": "m" - }, - - "moduleIds": { - "type": "boolean", - "default": false, - "shorthand": "M", - "description": "insert an explicit id for modules" - }, - - "loose": { - "type": "transformerList", - "description": "list of transformers to enable loose mode ON", - "shorthand": "L" - }, - - "jsxPragma": { - "type": "string", - "description": "custom pragma to use with JSX (same functionality as @jsx comments)", - "default": "React.createElement", - "shorthand": "P" - }, - - "plugins": { - "type": "list", - "description": "", - "default": [] - }, - - "ignore": { - "type": "list", - "description": "list of glob paths to **not** compile", - "default": [] - }, - - "only": { - "type": "list", - "description": "list of glob paths to **only** compile" - }, - - "code": { - "hidden": true, - "default": true, - "type": "boolean" - }, - - "metadata": { - "hidden": true, - "default": true, - "type": "boolean" - }, - - "ast": { - "hidden": true, - "default": true, - "type": "boolean" - }, - - "comments": { - "type": "boolean", - "default": true, - "description": "strip/output comments in generated output (on by default)" - }, - - "shouldPrintComment": { - "hidden": true, - "description": "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored" - }, - - "compact": { - "type": "booleanString", - "default": "auto", - "description": "do not include superfluous whitespace characters and line terminators [true|false|auto]" - }, - - "keepModuleIdExtensions": { - "type": "boolean", - "description": "keep extensions when generating module ids", - "default": false, - "shorthand": "k" - }, - - "auxiliaryComment": { - "deprecated": "renamed to auxiliaryCommentBefore", - "shorthand": "a", - "alias": "auxiliaryCommentBefore" - }, - - "auxiliaryCommentBefore": { - "type": "string", - "default": "", - "description": "attach a comment before all helper declarations and auxiliary code" - }, - - "auxiliaryCommentAfter": { - "type": "string", - "default": "", - "description": "attach a comment after all helper declarations and auxiliary code" - }, - - "externalHelpers": { - "type": "boolean", - "default": false, - "shorthand": "r", - "description": "uses a reference to `babelHelpers` instead of placing helpers at the top of your code." - }, - - "metadataUsedHelpers": { - "deprecated": "Not required anymore as this is enabled by default", - "type": "boolean", - "default": false, - "hidden": true - }, - - "sourceMap": { - "alias": "sourceMaps", - "hidden": true - }, - - "sourceMaps": { - "type": "booleanString", - "description": "[true|false|inline]", - "default": false, - "shorthand": "s" - }, - - "sourceMapName": { - "alias": "sourceMapTarget", - "description": "DEPRECATED - Please use sourceMapTarget" - }, - - "sourceMapTarget": { - "type": "string", - "description": "set `file` on returned source map" - }, - - "sourceFileName": { - "type": "string", - "description": "set `sources[0]` on returned source map" - }, - - "sourceRoot": { - "type": "filename", - "description": "the root from which all sources are relative" - }, - - "moduleRoot": { - "type": "filename", - "description": "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions" - }, - - "breakConfig": { - "type": "boolean", - "default": false, - "hidden": true, - "description": "stop trying to load .babelrc files" - }, - - "babelrc": { - "description": "Specify a custom list of babelrc files to use", - "type": "list" - }, - - "sourceType": { - "description": "", - "default": "module" - } -} - -},{}],49:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.validateOption = validateOption; -exports.normaliseOptions = normaliseOptions; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _parsers = _dereq_(51); - -var parsers = _interopRequireWildcard(_parsers); - -var _config = _dereq_(48); - -var _config2 = _interopRequireDefault(_config); - -exports.config = _config2["default"]; - -/** - * Validate an option. - */ - -function validateOption(key, val, pipeline) { - var opt = _config2["default"][key]; - var parser = opt && parsers[opt.type]; - if (parser && parser.validate) { - return parser.validate(key, val, pipeline); - } else { - return val; - } -} - -/** - * Normalize all options. - */ - -function normaliseOptions() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - for (var key in options) { - var val = options[key]; - if (val == null) continue; - - var opt = _config2["default"][key]; - if (!opt) continue; - - var parser = parsers[opt.type]; - if (parser) val = parser(val); - - options[key] = val; - } - - return options; -} -},{"48":48,"51":51}],50:[function(_dereq_,module,exports){ -(function (process){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _index = _dereq_(49); - -var _json5 = _dereq_(410); - -var _json52 = _interopRequireDefault(_json5); - -var _pathIsAbsolute = _dereq_(535); - -var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute); - -var _pathExists = _dereq_(534); - -var _pathExists2 = _interopRequireDefault(_pathExists); - -var _lodashLangClone = _dereq_(502); - -var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone); - -var _helpersMerge = _dereq_(39); - -var _helpersMerge2 = _interopRequireDefault(_helpersMerge); - -var _config = _dereq_(48); - -var _config2 = _interopRequireDefault(_config); - -var _path = _dereq_(9); - -var _path2 = _interopRequireDefault(_path); - -var _fs = _dereq_(1); - -var _fs2 = _interopRequireDefault(_fs); - -var existsCache = {}; -var jsonCache = {}; - -var BABELIGNORE_FILENAME = ".babelignore"; -var BABELRC_FILENAME = ".babelrc"; -var PACKAGE_FILENAME = "package.json"; - -function exists(filename) { - var cached = existsCache[filename]; - if (cached != null) { - return cached; - } else { - return existsCache[filename] = _pathExists2["default"].sync(filename); - } -} - -var OptionManager = (function () { - function OptionManager(log, pipeline) { - _classCallCheck(this, OptionManager); - - this.resolvedConfigs = []; - this.options = OptionManager.createBareOptions(); - this.pipeline = pipeline; - this.log = log; - } - - /** - * [Please add a description.] - */ - - OptionManager.createBareOptions = function createBareOptions() { - var opts = {}; - - for (var key in _config2["default"]) { - var opt = _config2["default"][key]; - opts[key] = _lodashLangClone2["default"](opt["default"]); - } - - return opts; - }; - - /** - * [Please add a description.] - */ - - OptionManager.prototype.addConfig = function addConfig(loc, key) { - var json = arguments.length <= 2 || arguments[2] === undefined ? _json52["default"] : arguments[2]; - - if (this.resolvedConfigs.indexOf(loc) >= 0) return; - - var content = _fs2["default"].readFileSync(loc, "utf8"); - var opts; - - try { - opts = jsonCache[content] = jsonCache[content] || json.parse(content); - if (key) opts = opts[key]; - } catch (err) { - err.message = loc + ": Error while parsing JSON - " + err.message; - throw err; - } - - this.mergeOptions(opts, loc); - this.resolvedConfigs.push(loc); - }; - - /** - * [Please add a description.] - */ - - OptionManager.prototype.mergeOptions = function mergeOptions(opts) { - var alias = arguments.length <= 1 || arguments[1] === undefined ? "foreign" : arguments[1]; - - if (!opts) return; - - for (var key in opts) { - if (key[0] === "_") continue; - - var option = _config2["default"][key]; - - // check for an unknown option - if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError); - } - - // normalise options - _index.normaliseOptions(opts); - - // merge them into this current files options - _helpersMerge2["default"](this.options, opts); - }; - - /** - * [Please add a description.] - */ - - OptionManager.prototype.addIgnoreConfig = function addIgnoreConfig(loc) { - var file = _fs2["default"].readFileSync(loc, "utf8"); - var lines = file.split("\n"); - - lines = lines.map(function (line) { - return line.replace(/#(.*?)$/, "").trim(); - }).filter(function (line) { - return !!line; - }); - - this.mergeOptions({ ignore: lines }, loc); - }; - - /** - * Description - */ - - OptionManager.prototype.findConfigs = function findConfigs(loc) { - if (!loc) return; - - if (!_pathIsAbsolute2["default"](loc)) { - loc = _path2["default"].join(process.cwd(), loc); - } - - while (loc !== (loc = _path2["default"].dirname(loc))) { - if (this.options.breakConfig) return; - - var configLoc = _path2["default"].join(loc, BABELRC_FILENAME); - if (exists(configLoc)) this.addConfig(configLoc); - - var pkgLoc = _path2["default"].join(loc, PACKAGE_FILENAME); - if (exists(pkgLoc)) this.addConfig(pkgLoc, "babel", JSON); - - var ignoreLoc = _path2["default"].join(loc, BABELIGNORE_FILENAME); - if (exists(ignoreLoc)) this.addIgnoreConfig(ignoreLoc); - } - }; - - /** - * [Please add a description.] - */ - - OptionManager.prototype.normaliseOptions = function normaliseOptions() { - var opts = this.options; - - for (var key in _config2["default"]) { - var option = _config2["default"][key]; - var val = opts[key]; - - // optional - if (!val && option.optional) continue; - - // deprecated - if (this.log && val && option.deprecated) { - this.log.deprecate("Deprecated option " + key + ": " + option.deprecated); - } - - // validate - if (this.pipeline && val) { - val = _index.validateOption(key, val, this.pipeline); - } - - // aaliases - if (option.alias) { - opts[option.alias] = opts[option.alias] || val; - } else { - opts[key] = val; - } - } - }; - - /** - * [Please add a description.] - */ - - OptionManager.prototype.init = function init(opts) { - this.mergeOptions(opts, "direct"); - - // babelrc option - if (opts.babelrc) { - var _arr = opts.babelrc; - - for (var _i = 0; _i < _arr.length; _i++) { - var loc = _arr[_i];this.addConfig(loc); - } - } - - // resolve all .babelrc files - if (opts.babelrc !== false) { - this.findConfigs(opts.filename); - } - - // merge in env - var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; - if (this.options.env) { - this.mergeOptions(this.options.env[envKey], "direct.env." + envKey); - } - - // normalise - this.normaliseOptions(opts); - - return this.options; - }; - - return OptionManager; -})(); - -exports["default"] = OptionManager; -module.exports = exports["default"]; -}).call(this,_dereq_(10)) -},{"1":1,"10":10,"39":39,"410":410,"48":48,"49":49,"502":502,"534":534,"535":535,"9":9}],51:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.transformerList = transformerList; -exports.number = number; -exports.boolean = boolean; -exports.booleanString = booleanString; -exports.list = list; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _slash = _dereq_(596); - -var _slash2 = _interopRequireDefault(_slash); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -/** - * Get a transformer list from a value. - */ - -function transformerList(val) { - return util.arrayify(val); -} - -/** - * Validate transformer list. Maps "all" to all transformer names. - */ - -transformerList.validate = function (key, val, pipeline) { - if (val.indexOf("all") >= 0 || val.indexOf(true) >= 0) { - val = Object.keys(pipeline.transformers); - } - - return pipeline._ensureTransformerNames(key, val); -}; - -/** - * Cast a value to a number. - */ - -function number(val) { - return +val; -} - -/** - * Cast a value to a boolean. - */ - -var filename = _slash2["default"]; - -exports.filename = filename; -/** - * [Please add a description.] - */ - -function boolean(val) { - return !!val; -} - -/** - * Cast a boolean-like string to a boolean. - */ - -function booleanString(val) { - return util.booleanify(val); -} - -/** - * Cast a value to an array, splitting strings by ",". - */ - -function list(val) { - return util.list(val); -} -},{"182":182,"596":596}],52:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _transformer = _dereq_(83); - -var _transformer2 = _interopRequireDefault(_transformer); - -var _plugin = _dereq_(82); - -var _plugin2 = _interopRequireDefault(_plugin); - -var _types = _dereq_(179); - -var types = _interopRequireWildcard(_types); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _tryResolve = _dereq_(610); - -var _tryResolve2 = _interopRequireDefault(_tryResolve); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _helpersParse = _dereq_(42); - -var _helpersParse2 = _interopRequireDefault(_helpersParse); - -/** - * [Please add a description.] - */ - -var context = { - messages: messages, - Transformer: _transformer2["default"], - Plugin: _plugin2["default"], - types: types, - parse: _helpersParse2["default"], - traverse: _traversal2["default"] -}; - -/** - * [Please add a description.] - */ - -var PluginManager = (function () { - - /** - * [Please add a description.] - */ - - PluginManager.memoisePluginContainer = function memoisePluginContainer(fn) { - for (var i = 0; i < PluginManager.memoisedPlugins.length; i++) { - var plugin = PluginManager.memoisedPlugins[i]; - if (plugin.container === fn) return plugin.transformer; - } - - var transformer = fn(context); - PluginManager.memoisedPlugins.push({ - container: fn, - transformer: transformer - }); - return transformer; - }; - - /** - * [Please add a description.] - */ - - _createClass(PluginManager, null, [{ - key: "memoisedPlugins", - - /** - * [Please add a description.] - */ - - value: [], - enumerable: true - }, { - key: "positions", - value: ["before", "after"], - - /** - * [Please add a description.] - */ - - enumerable: true - }]); - - function PluginManager() { - var _ref = arguments.length <= 0 || arguments[0] === undefined ? { transformers: {}, before: [], after: [] } : arguments[0]; - - var file = _ref.file; - var transformers = _ref.transformers; - var before = _ref.before; - var after = _ref.after; - - _classCallCheck(this, PluginManager); - - this.transformers = transformers; - this.file = file; - this.before = before; - this.after = after; - } - - /** - * [Please add a description.] - */ - - PluginManager.prototype.subnormaliseString = function subnormaliseString(name, position) { - // this is a plugin in the form of "foobar" or "foobar:after" - // where the optional colon is the delimiter for plugin position in the transformer stack - - var match = name.match(/^(.*?):(after|before)$/); - if (match) { - ; - - name = match[1]; - position = match[2]; - }var loc = _tryResolve2["default"].relative("babel-plugin-" + name) || _tryResolve2["default"].relative(name); - if (loc) { - var plugin = _dereq_(loc); - return { - position: position, - plugin: plugin["default"] || plugin - }; - } else { - throw new ReferenceError(messages.get("pluginUnknown", name)); - } - }; - - /** - * [Please add a description.] - */ - - PluginManager.prototype.validate = function validate(name, plugin) { - // validate transformer key - var key = plugin.key; - if (this.transformers[key]) { - throw new ReferenceError(messages.get("pluginKeyCollision", key)); - } - - // validate Transformer instance - if (!plugin.buildPass || plugin.constructor.name !== "Plugin") { - throw new TypeError(messages.get("pluginNotTransformer", name)); - } - - // register as a plugin - plugin.metadata.plugin = true; - }; - - /** - * [Please add a description.] - */ - - PluginManager.prototype.add = function add(name) { - var position; - var plugin; - - if (name) { - if (typeof name === "object" && name.transformer) { - plugin = name.transformer; - position = name.position; - } else if (typeof name !== "string") { - // not a string so we'll just assume that it's a direct Transformer instance, if not then - // the checks later on will complain - plugin = name; - } - - if (typeof name === "string") { - var _subnormaliseString = this.subnormaliseString(name, position); - - plugin = _subnormaliseString.plugin; - position = _subnormaliseString.position; - } - } else { - throw new TypeError(messages.get("pluginIllegalKind", typeof name, name)); - } - - // default position - position = position || "before"; - - // validate position - if (PluginManager.positions.indexOf(position) < 0) { - throw new TypeError(messages.get("pluginIllegalPosition", position, name)); - } - - // allow plugin containers to be specified so they don't have to manually require - if (typeof plugin === "function") { - plugin = PluginManager.memoisePluginContainer(plugin); - } - - // - this.validate(name, plugin); - - // build! - var pass = this.transformers[plugin.key] = plugin.buildPass(this.file); - if (pass.canTransform()) { - var stack = position === "before" ? this.before : this.after; - stack.push(pass); - } - }; - - return PluginManager; -})(); - -exports["default"] = PluginManager; -module.exports = exports["default"]; -},{"148":148,"179":179,"42":42,"43":43,"610":610,"82":82,"83":83}],53:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _explodeAssignableExpression = _dereq_(58); - -var _explodeAssignableExpression2 = _interopRequireDefault(_explodeAssignableExpression); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -exports["default"] = function (opts) { - var exports = {}; - - /** - * [Please add a description.] - */ - - var isAssignment = function isAssignment(node) { - return node.operator === opts.operator + "="; - }; - - /** - * [Please add a description.] - */ - - var buildAssignment = function buildAssignment(left, right) { - return t.assignmentExpression("=", left, right); - }; - - /** - * [Please add a description.] - */ - - exports.ExpressionStatement = function (node, parent, scope, file) { - // hit the `AssignmentExpression` one below - if (this.isCompletionRecord()) return; - - var expr = node.expression; - if (!isAssignment(expr)) return; - - var nodes = []; - var exploded = _explodeAssignableExpression2["default"](expr.left, nodes, file, scope, true); - - nodes.push(t.expressionStatement(buildAssignment(exploded.ref, opts.build(exploded.uid, expr.right)))); - - return nodes; - }; - - /** - * [Please add a description.] - */ - - exports.AssignmentExpression = function (node, parent, scope, file) { - if (!isAssignment(node)) return; - - var nodes = []; - var exploded = _explodeAssignableExpression2["default"](node.left, nodes, file, scope); - nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right))); - return nodes; - }; - - /** - * [Please add a description.] - */ - - exports.BinaryExpression = function (node) { - if (node.operator !== opts.operator) return; - return opts.build(node.left, node.right); - }; - - return exports; -}; - -module.exports = exports["default"]; -},{"179":179,"58":58}],54:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports["default"] = build; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function build(node, buildBody) { - var self = node.blocks.shift(); - if (!self) return; - - var child = build(node, buildBody); - if (!child) { - // last item - child = buildBody(); - - // add a filter as this is our final stop - if (node.filter) { - child = t.ifStatement(node.filter, t.blockStatement([child])); - } - } - - return t.forOfStatement(t.variableDeclaration("let", [t.variableDeclarator(self.left)]), self.right, t.blockStatement([child])); -} - -module.exports = exports["default"]; -},{"179":179}],55:[function(_dereq_,module,exports){ -// Based upon the excellent jsx-transpiler by Ingvar Stepanyan (RReverser) -// https://github.com/RReverser/jsx-transpiler - -// jsx - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashLangIsString = _dereq_(514); - -var _lodashLangIsString2 = _interopRequireDefault(_lodashLangIsString); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _esutils = _dereq_(403); - -var _esutils2 = _interopRequireDefault(_esutils); - -var _react = _dereq_(62); - -var react = _interopRequireWildcard(_react); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -exports["default"] = function (opts) { - var visitor = {}; - - /** - * [Please add a description.] - */ - - visitor.JSXIdentifier = function (node) { - if (node.name === "this" && this.isReferenced()) { - return t.thisExpression(); - } else if (_esutils2["default"].keyword.isIdentifierNameES6(node.name)) { - node.type = "Identifier"; - } else { - return t.literal(node.name); - } - }; - - /** - * [Please add a description.] - */ - - visitor.JSXNamespacedName = function () { - throw this.errorWithNode(messages.get("JSXNamespacedTags")); - }; - - /** - * [Please add a description.] - */ - - visitor.JSXMemberExpression = { - exit: function exit(node) { - node.computed = t.isLiteral(node.property); - node.type = "MemberExpression"; - } - }; - - /** - * [Please add a description.] - */ - - visitor.JSXExpressionContainer = function (node) { - return node.expression; - }; - - /** - * [Please add a description.] - */ - - visitor.JSXAttribute = { - enter: function enter(node) { - var value = node.value; - if (t.isLiteral(value) && _lodashLangIsString2["default"](value.value)) { - value.value = value.value.replace(/\n\s+/g, " "); - } - }, - - exit: function exit(node) { - var value = node.value || t.literal(true); - return t.inherits(t.property("init", node.name, value), node); - } - }; - - /** - * [Please add a description.] - */ - - visitor.JSXOpeningElement = { - exit: function exit(node, parent, scope, file) { - parent.children = react.buildChildren(parent); - - var tagExpr = node.name; - var args = []; - - var tagName; - if (t.isIdentifier(tagExpr)) { - tagName = tagExpr.name; - } else if (t.isLiteral(tagExpr)) { - tagName = tagExpr.value; - } - - var state = { - tagExpr: tagExpr, - tagName: tagName, - args: args - }; - - if (opts.pre) { - opts.pre(state, file); - } - - var attribs = node.attributes; - if (attribs.length) { - attribs = buildJSXOpeningElementAttributes(attribs, file); - } else { - attribs = t.literal(null); - } - - args.push(attribs); - - if (opts.post) { - opts.post(state, file); - } - - return state.call || t.callExpression(state.callee, args); - } - }; - - /** - * The logic for this is quite terse. It's because we need to - * support spread elements. We loop over all attributes, - * breaking on spreads, we then push a new object containg - * all prior attributes to an array for later processing. - */ - - var buildJSXOpeningElementAttributes = function buildJSXOpeningElementAttributes(attribs, file) { - var _props = []; - var objs = []; - - var pushProps = function pushProps() { - if (!_props.length) return; - - objs.push(t.objectExpression(_props)); - _props = []; - }; - - while (attribs.length) { - var prop = attribs.shift(); - if (t.isJSXSpreadAttribute(prop)) { - pushProps(); - objs.push(prop.argument); - } else { - _props.push(prop); - } - } - - pushProps(); - - if (objs.length === 1) { - // only one object - attribs = objs[0]; - } else { - // looks like we have multiple objects - if (!t.isObjectExpression(objs[0])) { - objs.unshift(t.objectExpression([])); - } - - // spread it - attribs = t.callExpression(file.addHelper("extends"), objs); - } - - return attribs; - }; - - /** - * [Please add a description.] - */ - - visitor.JSXElement = { - exit: function exit(node) { - var callExpr = node.openingElement; - - callExpr.arguments = callExpr.arguments.concat(node.children); - - if (callExpr.arguments.length >= 3) { - callExpr._prettyCall = true; - } - - return t.inherits(callExpr, node); - } - }; - - return visitor; -}; - -module.exports = exports["default"]; -},{"179":179,"403":403,"43":43,"514":514,"62":62}],56:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent, scope, state) { - if (this.isThisExpression() || this.isReferencedIdentifier({ name: "arguments" })) { - state.found = true; - this.stop(); - } - }, - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - } -}; - -/** - * [Please add a description.] - */ - -exports["default"] = function (node, scope) { - var container = t.functionExpression(null, [], node.body, node.generator, node.async); - - var callee = container; - var args = []; - - var state = { found: false }; - scope.traverse(node, visitor, state); - if (state.found) { - callee = t.memberExpression(container, t.identifier("apply")); - args = [t.thisExpression(), t.identifier("arguments")]; - } - - var call = t.callExpression(callee, args); - if (node.generator) call = t.yieldExpression(call, true); - - return t.returnStatement(call); -}; - -module.exports = exports["default"]; -},{"179":179}],57:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.push = push; -exports.hasComputed = hasComputed; -exports.toComputedObjectFromClass = toComputedObjectFromClass; -exports.toClassObject = toClassObject; -exports.toDefineObject = toDefineObject; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _lodashObjectHas = _dereq_(520); - -var _lodashObjectHas2 = _interopRequireDefault(_lodashObjectHas); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function push(mutatorMap, node, kind, file) { - var alias = t.toKeyAlias(node); - - // - - var map = {}; - if (_lodashObjectHas2["default"](mutatorMap, alias)) map = mutatorMap[alias]; - mutatorMap[alias] = map; - - // - - map._inherits = map._inherits || []; - map._inherits.push(node); - - map._key = node.key; - - if (node.computed) { - map._computed = true; - } - - if (node.decorators) { - var decorators = map.decorators = map.decorators || t.arrayExpression([]); - decorators.elements = decorators.elements.concat(node.decorators.map(function (dec) { - return dec.expression; - }).reverse()); - } - - if (map.value || map.initializer) { - throw file.errorWithNode(node, "Key conflict with sibling node"); - } - - if (node.value) { - if (node.kind === "init") kind = "value"; - if (node.kind === "get") kind = "get"; - if (node.kind === "set") kind = "set"; - - t.inheritsComments(node.value, node); - map[kind] = node.value; - } - - return map; -} - -/** - * [Please add a description.] - */ - -function hasComputed(mutatorMap) { - for (var key in mutatorMap) { - if (mutatorMap[key]._computed) { - return true; - } - } - return false; -} - -/** - * [Please add a description.] - */ - -function toComputedObjectFromClass(obj) { - var objExpr = t.arrayExpression([]); - - for (var i = 0; i < obj.properties.length; i++) { - var prop = obj.properties[i]; - var val = prop.value; - val.properties.unshift(t.property("init", t.identifier("key"), t.toComputedKey(prop))); - objExpr.elements.push(val); - } - - return objExpr; -} - -/** - * [Please add a description.] - */ - -function toClassObject(mutatorMap) { - var objExpr = t.objectExpression([]); - - _lodashCollectionEach2["default"](mutatorMap, function (map) { - var mapNode = t.objectExpression([]); - - var propNode = t.property("init", map._key, mapNode, map._computed); - - _lodashCollectionEach2["default"](map, function (node, key) { - if (key[0] === "_") return; - - var inheritNode = node; - if (t.isMethodDefinition(node) || t.isClassProperty(node)) node = node.value; - - var prop = t.property("init", t.identifier(key), node); - t.inheritsComments(prop, inheritNode); - t.removeComments(inheritNode); - - mapNode.properties.push(prop); - }); - - objExpr.properties.push(propNode); - }); - - return objExpr; -} - -/** - * [Please add a description.] - */ - -function toDefineObject(mutatorMap) { - _lodashCollectionEach2["default"](mutatorMap, function (map) { - if (map.value) map.writable = t.literal(true); - map.configurable = t.literal(true); - map.enumerable = t.literal(true); - }); - - return toClassObject(mutatorMap); -} -},{"179":179,"419":419,"520":520}],58:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var getObjRef = function getObjRef(node, nodes, file, scope) { - var ref; - if (t.isIdentifier(node)) { - if (scope.hasBinding(node.name)) { - // this variable is declared in scope so we can be 100% sure - // that evaluating it multiple times wont trigger a getter - // or something else - return node; - } else { - // could possibly trigger a getter so we need to only evaluate - // it once - ref = node; - } - } else if (t.isMemberExpression(node)) { - ref = node.object; - - if (t.isIdentifier(ref) && scope.hasGlobal(ref.name)) { - // the object reference that we need to save is locally declared - // so as per the previous comment we can be 100% sure evaluating - // it multiple times will be safe - return ref; - } - } else { - throw new Error("We can't explode this node type " + node.type); - } - - var temp = scope.generateUidIdentifierBasedOnNode(ref); - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, ref)])); - return temp; -}; - -/** - * [Please add a description.] - */ - -var getPropRef = function getPropRef(node, nodes, file, scope) { - var prop = node.property; - var key = t.toComputedKey(node, prop); - if (t.isLiteral(key)) return key; - - var temp = scope.generateUidIdentifierBasedOnNode(prop); - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, prop)])); - return temp; -}; - -/** - * [Please add a description.] - */ - -exports["default"] = function (node, nodes, file, scope, allowedSingleIdent) { - var obj; - if (t.isIdentifier(node) && allowedSingleIdent) { - obj = node; - } else { - obj = getObjRef(node, nodes, file, scope); - } - - var ref, uid; - - if (t.isIdentifier(node)) { - ref = node; - uid = obj; - } else { - var prop = getPropRef(node, nodes, file, scope); - var computed = node.computed || t.isLiteral(prop); - uid = ref = t.memberExpression(obj, prop, computed); - } - - return { - uid: uid, - ref: ref - }; -}; - -module.exports = exports["default"]; -},{"179":179}],59:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -exports["default"] = function (node) { - var lastNonDefault = 0; - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - if (!t.isAssignmentPattern(param) && !t.isRestElement(param)) { - lastNonDefault = i + 1; - } - } - return lastNonDefault; -}; - -module.exports = exports["default"]; -},{"179":179}],60:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -exports["default"] = function (decorators, scope) { - for (var i = 0; i < decorators.length; i++) { - var decorator = decorators[i]; - var expression = decorator.expression; - if (!t.isMemberExpression(expression)) continue; - - var temp = scope.maybeGenerateMemoised(expression.object); - var ref; - - var nodes = []; - - if (temp) { - ref = temp; - nodes.push(t.assignmentExpression("=", temp, expression.object)); - } else { - ref = expression.object; - } - - nodes.push(t.callExpression(t.memberExpression(t.memberExpression(ref, expression.property, expression.computed), t.identifier("bind")), [ref])); - - if (nodes.length === 1) { - decorator.expression = nodes[0]; - } else { - decorator.expression = t.sequenceExpression(nodes); - } - } - - return decorators; -}; - -module.exports = exports["default"]; -},{"179":179}],61:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.custom = custom; -exports.property = property; -exports.bare = bare; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _getFunctionArity = _dereq_(59); - -var _getFunctionArity2 = _interopRequireDefault(_getFunctionArity); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function visitIdentifier(context, node, scope, state) { - // check if this node matches our function id - if (node.name !== state.name) return; - - // check that we don't have a local variable declared as that removes the need - // for the wrapper - var localDeclar = scope.getBindingIdentifier(state.name); - if (localDeclar !== state.outerDeclar) return; - - state.selfReference = true; - context.stop(); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - visitIdentifier(this, node, scope, state); - }, - - /** - * [Please add a description.] - */ - - BindingIdentifier: function BindingIdentifier(node, parent, scope, state) { - visitIdentifier(this, node, scope, state); - } -}; - -/** - * [Please add a description.] - */ - -var wrap = function wrap(state, method, id, scope) { - if (state.selfReference) { - if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { - // we can just munge the local binding - scope.rename(id.name); - } else { - // need to add a wrapper since we can't change the references - var templateName = "property-method-assignment-wrapper"; - if (method.generator) templateName += "-generator"; - var template = util.template(templateName, { - FUNCTION: method, - FUNCTION_ID: id, - FUNCTION_KEY: scope.generateUidIdentifier(id.name) - }); - template.callee._skipModulesRemap = true; - - // shim in dummy params to retain function arity, if you try to read the - // source then you'll get the original since it's proxied so it's all good - var params = template.callee.body.body[0].params; - for (var i = 0, len = _getFunctionArity2["default"](method); i < len; i++) { - params.push(scope.generateUidIdentifier("x")); - } - - return template; - } - } - - method.id = id; - scope.getProgramParent().references[id.name] = true; -}; - -/** - * [Please add a description.] - */ - -var visit = function visit(node, name, scope) { - var state = { - selfAssignment: false, - selfReference: false, - outerDeclar: scope.getBindingIdentifier(name), - references: [], - name: name - }; - - // check to see if we have a local binding of the id we're setting inside of - // the function, this is important as there are caveats associated - - var binding = scope.getOwnBinding(name); - - if (binding) { - if (binding.kind === "param") { - // safari will blow up in strict mode with code like: - // - // var t = function t(t) {}; - // - // with the error: - // - // Cannot declare a parameter named 't' as it shadows the name of a - // strict mode function. - // - // this isn't to the spec and they've invented this behaviour which is - // **extremely** annoying so we avoid setting the name if it has a param - // with the same id - state.selfReference = true; - } else { - // otherwise it's defined somewhere in scope like: - // - // var t = function () { - // var t = 2; - // }; - // - // so we can safely just set the id and move along as it shadows the - // bound function id - } - } else if (state.outerDeclar || scope.hasGlobal(name)) { - scope.traverse(node, visitor, state); - } - - return state; -}; - -/** - * [Please add a description.] - */ - -function custom(node, id, scope) { - var state = visit(node, id.name, scope); - return wrap(state, node, id, scope); -} - -/** - * [Please add a description.] - */ - -function property(node, file, scope) { - var key = t.toComputedKey(node, node.key); - if (!t.isLiteral(key)) return; // we can't set a function id with this - - var name = t.toBindingIdentifierName(key.value); - var id = t.identifier(name); - - var method = node.value; - var state = visit(method, name, scope); - node.value = wrap(state, method, id, scope) || method; -} - -/** - * [Please add a description.] - */ - -function bare(node, parent, scope) { - // has an `id` so we don't need to infer one - if (node.id) return; - - var id; - if (t.isProperty(parent) && parent.kind === "init" && (!parent.computed || t.isLiteral(parent.key))) { - // { foo() {} }; - id = parent.key; - } else if (t.isVariableDeclarator(parent)) { - // var foo = function () {}; - id = parent.id; - - if (t.isIdentifier(id)) { - var binding = scope.parent.getBinding(id.name); - if (binding && binding.constant && scope.getBinding(id.name) === binding) { - // always going to reference this method - node.id = id; - return; - } - } - } else { - return; - } - - var name; - if (t.isLiteral(id)) { - name = id.value; - } else if (t.isIdentifier(id)) { - name = id.name; - } else { - return; - } - - name = t.toBindingIdentifierName(name); - id = t.identifier(name); - - var state = visit(node, name, scope); - return wrap(state, node, id, scope); -} -},{"179":179,"182":182,"59":59}],62:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.isCompatTag = isCompatTag; -exports.buildChildren = buildChildren; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var isReactComponent = t.buildMatchMemberExpression("React.Component"); - -exports.isReactComponent = isReactComponent; -/** - * [Please add a description.] - */ - -function isCompatTag(tagName) { - return tagName && /^[a-z]|\-/.test(tagName); -} - -/** - * [Please add a description.] - */ - -function cleanJSXElementLiteralChild(child, args) { - var lines = child.value.split(/\r\n|\n|\r/); - - var lastNonEmptyLine = 0; - - for (var i = 0; i < lines.length; i++) { - if (lines[i].match(/[^ \t]/)) { - lastNonEmptyLine = i; - } - } - - var str = ""; - - for (var i = 0; i < lines.length; i++) { - var line = lines[i]; - - var isFirstLine = i === 0; - var isLastLine = i === lines.length - 1; - var isLastNonEmptyLine = i === lastNonEmptyLine; - - // replace rendered whitespace tabs with spaces - var trimmedLine = line.replace(/\t/g, " "); - - // trim whitespace touching a newline - if (!isFirstLine) { - trimmedLine = trimmedLine.replace(/^[ ]+/, ""); - } - - // trim whitespace touching an endline - if (!isLastLine) { - trimmedLine = trimmedLine.replace(/[ ]+$/, ""); - } - - if (trimmedLine) { - if (!isLastNonEmptyLine) { - trimmedLine += " "; - } - - str += trimmedLine; - } - } - - if (str) args.push(t.literal(str)); -} - -/** - * [Please add a description.] - */ - -function buildChildren(node) { - var elems = []; - - for (var i = 0; i < node.children.length; i++) { - var child = node.children[i]; - - if (t.isLiteral(child) && typeof child.value === "string") { - cleanJSXElementLiteralChild(child, elems); - continue; - } - - if (t.isJSXExpressionContainer(child)) child = child.expression; - if (t.isJSXEmptyExpression(child)) continue; - - elems.push(child); - } - - return elems; -} -},{"179":179}],63:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.is = is; -exports.pullFlag = pullFlag; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashArrayPull = _dereq_(416); - -var _lodashArrayPull2 = _interopRequireDefault(_lodashArrayPull); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function is(node, flag) { - return t.isLiteral(node) && node.regex && node.regex.flags.indexOf(flag) >= 0; -} - -/** - * [Please add a description.] - */ - -function pullFlag(node, flag) { - var flags = node.regex.flags.split(""); - if (node.regex.flags.indexOf(flag) < 0) return; - _lodashArrayPull2["default"](flags, flag); - node.regex.flags = flags.join(""); -} -},{"179":179,"416":416}],64:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var awaitVisitor = { - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - AwaitExpression: function AwaitExpression(node) { - node.type = "YieldExpression"; - - if (node.all) { - // await* foo; -> yield Promise.all(foo); - node.all = false; - node.argument = t.callExpression(t.memberExpression(t.identifier("Promise"), t.identifier("all")), [node.argument]); - } - } -}; - -/** - * [Please add a description.] - */ - -var referenceVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - var name = state.id.name; - if (node.name === name && scope.bindingIdentifierEquals(name, state.id)) { - return state.ref = state.ref || scope.generateUidIdentifier(name); - } - } -}; - -/** - * [Please add a description.] - */ - -exports["default"] = function (path, callId) { - var node = path.node; - - node.async = false; - node.generator = true; - - path.traverse(awaitVisitor, state); - - var call = t.callExpression(callId, [node]); - - var id = node.id; - node.id = null; - - if (t.isFunctionDeclaration(node)) { - var declar = t.variableDeclaration("let", [t.variableDeclarator(id, call)]); - declar._blockHoist = true; - return declar; - } else { - if (id) { - var state = { id: id }; - path.traverse(referenceVisitor, state); - - if (state.ref) { - path.scope.parent.push({ id: state.ref }); - return t.assignmentExpression("=", state.ref, call); - } - } - - return call; - } -}; - -module.exports = exports["default"]; -},{"179":179}],65:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function isIllegalBareSuper(node, parent) { - if (!t.isSuper(node)) return false; - if (t.isMemberExpression(parent, { computed: false })) return false; - if (t.isCallExpression(parent, { callee: node })) return false; - return true; -} - -/** - * [Please add a description.] - */ - -function isMemberExpressionSuper(node) { - return t.isMemberExpression(node) && t.isSuper(node.object); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent, scope, state) { - var topLevel = state.topLevel; - var self = state.self; - - if (t.isFunction(node) && !t.isArrowFunctionExpression(node)) { - // we need to call traverseLevel again so we're context aware - self.traverseLevel(this, false); - return this.skip(); - } - - if (t.isProperty(node, { method: true }) || t.isMethodDefinition(node)) { - // break on object methods - return this.skip(); - } - - var getThisReference = topLevel ? - // top level so `this` is the instance - t.thisExpression : - // not in the top level so we need to create a reference - self.getThisReference.bind(self); - - var callback = self.specHandle; - if (self.isLoose) callback = self.looseHandle; - var result = callback.call(self, this, getThisReference); - if (result) this.hasSuper = true; - if (result === true) return; - return result; - } -}; - -/** - * [Please add a description.] - */ - -var ReplaceSupers = (function () { - function ReplaceSupers(opts) { - var inClass = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - _classCallCheck(this, ReplaceSupers); - - this.topLevelThisReference = opts.topLevelThisReference; - this.methodPath = opts.methodPath; - this.methodNode = opts.methodNode; - this.superRef = opts.superRef; - this.isStatic = opts.isStatic; - this.hasSuper = false; - this.inClass = inClass; - this.isLoose = opts.isLoose; - this.scope = opts.scope; - this.file = opts.file; - this.opts = opts; - } - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.getObjectRef = function getObjectRef() { - return this.opts.objectRef || this.opts.getObjectRef(); - }; - - /** - * Sets a super class value of the named property. - * - * @example - * - * _set(Object.getPrototypeOf(CLASS.prototype), "METHOD", "VALUE", this) - * - */ - - ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed, thisExpression) { - return t.callExpression(this.file.addHelper("set"), [t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))]), isComputed ? property : t.literal(property.name), value, thisExpression]); - }; - - /** - * Gets a node representing the super class value of the named property. - * - * @example - * - * _get(Object.getPrototypeOf(CLASS.prototype), "METHOD", this) - * - */ - - ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed, thisExpression) { - return t.callExpression(this.file.addHelper("get"), [t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))]), isComputed ? property : t.literal(property.name), thisExpression]); - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.replace = function replace() { - this.traverseLevel(this.methodPath.get("value"), true); - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.traverseLevel = function traverseLevel(path, topLevel) { - var state = { self: this, topLevel: topLevel }; - path.traverse(visitor, state); - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.getThisReference = function getThisReference() { - if (this.topLevelThisReference) { - return this.topLevelThisReference; - } else { - var ref = this.topLevelThisReference = this.scope.generateUidIdentifier("this"); - this.methodNode.value.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(this.topLevelThisReference, t.thisExpression())])); - return ref; - } - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) { - var methodNode = this.methodNode; - var methodName = methodNode.key; - var superRef = this.superRef || t.identifier("Function"); - - if (parent.property === id) { - return; - } else if (t.isCallExpression(parent, { callee: id })) { - // super(); -> objectRef.prototype.MethodName.call(this); - parent.arguments.unshift(t.thisExpression()); - - if (methodName.name === "constructor") { - // constructor() { super(); } - if (parent.arguments.length === 2 && t.isSpreadElement(parent.arguments[1]) && t.isIdentifier(parent.arguments[1].argument, { name: "arguments" })) { - // special case single arguments spread - parent.arguments[1] = parent.arguments[1].argument; - return t.memberExpression(superRef, t.identifier("apply")); - } else { - return t.memberExpression(superRef, t.identifier("call")); - } - } else { - id = superRef; - - // foo() { super(); } - if (!methodNode["static"]) { - id = t.memberExpression(id, t.identifier("prototype")); - } - - id = t.memberExpression(id, methodName, methodNode.computed); - return t.memberExpression(id, t.identifier("call")); - } - } else if (t.isMemberExpression(parent) && !methodNode["static"]) { - // super.test -> objectRef.prototype.test - return t.memberExpression(superRef, t.identifier("prototype")); - } else { - return superRef; - } - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.looseHandle = function looseHandle(path, getThisReference) { - var node = path.node; - if (path.isSuper()) { - return this.getLooseSuperProperty(node, path.parent); - } else if (path.isCallExpression()) { - var callee = node.callee; - if (!t.isMemberExpression(callee)) return; - if (!t.isSuper(callee.object)) return; - - // super.test(); -> objectRef.prototype.MethodName.call(this); - t.appendToMemberExpression(callee, t.identifier("call")); - node.arguments.unshift(getThisReference()); - return true; - } - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.specHandleAssignmentExpression = function specHandleAssignmentExpression(ref, path, node, getThisReference) { - if (node.operator === "=") { - // super.name = "val"; -> _set(Object.getPrototypeOf(objectRef.prototype), "name", this); - return this.setSuperProperty(node.left.property, node.right, node.left.computed, getThisReference()); - } else { - // super.age += 2; -> var _ref = super.age; super.age = _ref + 2; - ref = ref || path.scope.generateUidIdentifier("ref"); - return [t.variableDeclaration("var", [t.variableDeclarator(ref, node.left)]), t.expressionStatement(t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)))]; - } - }; - - /** - * [Please add a description.] - */ - - ReplaceSupers.prototype.specHandle = function specHandle(path, getThisReference) { - var methodNode = this.methodNode; - var property; - var computed; - var args; - var thisReference; - - var parent = path.parent; - var node = path.node; - - if (isIllegalBareSuper(node, parent)) { - throw path.errorWithNode(messages.get("classesIllegalBareSuper")); - } - - if (t.isCallExpression(node)) { - var callee = node.callee; - if (t.isSuper(callee)) { - // super(); -> _get(Object.getPrototypeOf(objectRef), "MethodName", this).call(this); - property = methodNode.key; - computed = methodNode.computed; - args = node.arguments; - - // bare `super` call is illegal inside non-constructors - // - https://esdiscuss.org/topic/super-call-in-methods - // - https://twitter.com/wycats/status/544553184396836864 - if (methodNode.key.name !== "constructor" || !this.inClass) { - var methodName = methodNode.key.name || "METHOD_NAME"; - throw this.file.errorWithNode(node, messages.get("classesIllegalSuperCall", methodName)); - } - } else if (isMemberExpressionSuper(callee)) { - // super.test(); -> _get(Object.getPrototypeOf(objectRef.prototype), "test", this).call(this); - property = callee.property; - computed = callee.computed; - args = node.arguments; - } - } else if (t.isMemberExpression(node) && t.isSuper(node.object)) { - // super.name; -> _get(Object.getPrototypeOf(objectRef.prototype), "name", this); - property = node.property; - computed = node.computed; - } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) { - var binary = t.binaryExpression(node.operator[0], node.argument, t.literal(1)); - if (node.prefix) { - // ++super.foo; -> super.foo += 1; - return this.specHandleAssignmentExpression(null, path, binary, getThisReference); - } else { - // super.foo++; -> var _ref = super.foo; super.foo = _ref + 1; - var ref = path.scope.generateUidIdentifier("ref"); - return this.specHandleAssignmentExpression(ref, path, binary, getThisReference).concat(t.expressionStatement(ref)); - } - } else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) { - return this.specHandleAssignmentExpression(null, path, node, getThisReference); - } - - if (!property) return; - - thisReference = getThisReference(); - var superProperty = this.getSuperProperty(property, computed, thisReference); - if (args) { - if (args.length === 1 && t.isSpreadElement(args[0])) { - // super(...arguments); - return t.callExpression(t.memberExpression(superProperty, t.identifier("apply")), [thisReference, args[0].argument]); - } else { - return t.callExpression(t.memberExpression(superProperty, t.identifier("call")), [thisReference].concat(args)); - } - } else { - return superProperty; - } - }; - - return ReplaceSupers; -})(); - -exports["default"] = ReplaceSupers; -module.exports = exports["default"]; -},{"179":179,"43":43}],66:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _pipeline = _dereq_(80); - -var _pipeline2 = _interopRequireDefault(_pipeline); - -/** - * [Please add a description.] - */ - -/** - * [Please add a description.] - */ - -var _transformers = _dereq_(126); - -var _transformers2 = _interopRequireDefault(_transformers); - -/** - * [Please add a description.] - */ - -var _transformersDeprecated = _dereq_(85); - -var _transformersDeprecated2 = _interopRequireDefault(_transformersDeprecated); - -/** - * [Please add a description.] - */ - -var _transformersAliases = _dereq_(84); - -var _transformersAliases2 = _interopRequireDefault(_transformersAliases); - -/** - * [Please add a description.] - */ - -var _transformersFilters = _dereq_(125); - -var filters = _interopRequireWildcard(_transformersFilters); - -var pipeline = new _pipeline2["default"](); - -for (var key in _transformers2["default"]) { - var transformer = _transformers2["default"][key]; - - if (typeof transformer === "object") { - var metadata = transformer.metadata = transformer.metadata || {}; - metadata.group = metadata.group || "builtin-basic"; - } -} - -pipeline.addTransformers(_transformers2["default"]); -pipeline.addDeprecated(_transformersDeprecated2["default"]); -pipeline.addAliases(_transformersAliases2["default"]); -pipeline.addFilter(filters.internal); -pipeline.addFilter(filters.blacklist); -pipeline.addFilter(filters.whitelist); -pipeline.addFilter(filters.stage); -pipeline.addFilter(filters.optional); - -/** - * [Please add a description.] - */ - -var transform = pipeline.transform.bind(pipeline); -transform.fromAst = pipeline.transformFromAst.bind(pipeline); -transform.pipeline = pipeline; -exports["default"] = transform; -module.exports = exports["default"]; -},{"125":125,"126":126,"80":80,"84":84,"85":85}],67:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _libMetadata = _dereq_(75); - -var metadataVisitor = _interopRequireWildcard(_libMetadata); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _libRemaps = _dereq_(76); - -var _libRemaps2 = _interopRequireDefault(_libRemaps); - -var _helpersObject = _dereq_(41); - -var _helpersObject2 = _interopRequireDefault(_helpersObject); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var DefaultFormatter = (function () { - function DefaultFormatter(file) { - _classCallCheck(this, DefaultFormatter); - - // object containg all module sources with the scope that they're contained in - this.sourceScopes = _helpersObject2["default"](); - - // ids for use in module ids - this.defaultIds = _helpersObject2["default"](); - this.ids = _helpersObject2["default"](); - - // contains reference aliases for live bindings - this.remaps = new _libRemaps2["default"](file, this); - - this.scope = file.scope; - this.file = file; - - this.hasNonDefaultExports = false; - - this.hasLocalExports = false; - this.hasLocalImports = false; - - this.localExports = _helpersObject2["default"](); - this.localImports = _helpersObject2["default"](); - - this.metadata = file.metadata.modules; - this.getMetadata(); - } - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.addScope = function addScope(path) { - var source = path.node.source && path.node.source.value; - if (!source) return; - - var existingScope = this.sourceScopes[source]; - if (existingScope && existingScope !== path.scope) { - throw path.errorWithNode(messages.get("modulesDuplicateDeclarations")); - } - - this.sourceScopes[source] = path.scope; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.isModuleType = function isModuleType(node, type) { - var modules = this.file.dynamicImportTypes[type]; - return modules && modules.indexOf(node) >= 0; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.transform = function transform() { - this.remapAssignments(); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.doDefaultExportInterop = function doDefaultExportInterop(node) { - return (t.isExportDefaultDeclaration(node) || t.isSpecifierDefault(node)) && !this.noInteropRequireExport && !this.hasNonDefaultExports; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.getMetadata = function getMetadata() { - var has = false; - var _arr = this.file.ast.program.body; - for (var _i = 0; _i < _arr.length; _i++) { - var node = _arr[_i]; - if (t.isModuleDeclaration(node)) { - has = true; - break; - } - } - if (has || this.isLoose()) { - this.file.path.traverse(metadataVisitor, this); - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.remapAssignments = function remapAssignments() { - if (this.hasLocalExports || this.hasLocalImports) { - this.remaps.run(); - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.remapExportAssignment = function remapExportAssignment(node, exported) { - var assign = node; - - for (var i = 0; i < exported.length; i++) { - assign = t.assignmentExpression("=", t.memberExpression(t.identifier("exports"), exported[i]), assign); - } - - return assign; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype._addExport = function _addExport(name, exported) { - var info = this.localExports[name] = this.localExports[name] || { - binding: this.scope.getBindingIdentifier(name), - exported: [] - }; - info.exported.push(exported); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.getExport = function getExport(node, scope) { - if (!t.isIdentifier(node)) return; - - var local = this.localExports[node.name]; - if (local && local.binding === scope.getBindingIdentifier(node.name)) { - return local.exported; - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.getModuleName = function getModuleName() { - var opts = this.file.opts; - // moduleId is n/a if a `getModuleId()` is provided - if (opts.moduleId != null && !opts.getModuleId) { - return opts.moduleId; - } - - var filenameRelative = opts.filenameRelative; - var moduleName = ""; - - if (opts.moduleRoot != null) { - moduleName = opts.moduleRoot + "/"; - } - - if (!opts.filenameRelative) { - return moduleName + opts.filename.replace(/^\//, ""); - } - - if (opts.sourceRoot != null) { - // remove sourceRoot from filename - var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); - filenameRelative = filenameRelative.replace(sourceRootRegEx, ""); - } - - if (!opts.keepModuleIdExtensions) { - // remove extension - filenameRelative = filenameRelative.replace(/\.(\w*?)$/, ""); - } - - moduleName += filenameRelative; - - // normalize path separators - moduleName = moduleName.replace(/\\/g, "/"); - - if (opts.getModuleId) { - // If return is falsy, assume they want us to use our generated default name - return opts.getModuleId(moduleName) || moduleName; - } else { - return moduleName; - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype._pushStatement = function _pushStatement(ref, nodes) { - if (t.isClass(ref) || t.isFunction(ref)) { - if (ref.id) { - nodes.push(t.toStatement(ref)); - ref = ref.id; - } - } - - return ref; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype._hoistExport = function _hoistExport(declar, assign, priority) { - if (t.isFunctionDeclaration(declar)) { - assign._blockHoist = priority || 2; - } - - return assign; - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.getExternalReference = function getExternalReference(node, nodes) { - var ids = this.ids; - var id = node.source.value; - - if (ids[id]) { - return ids[id]; - } else { - return this.ids[id] = this._getExternalReference(node, nodes); - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.checkExportIdentifier = function checkExportIdentifier(node) { - if (t.isIdentifier(node, { name: "__esModule" })) { - throw this.file.errorWithNode(node, messages.get("modulesIllegalExportName", node.name)); - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.exportAllDeclaration = function exportAllDeclaration(node, nodes) { - var ref = this.getExternalReference(node, nodes); - nodes.push(this.buildExportsWildcard(ref, node)); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.isLoose = function isLoose() { - return this.file.isLoose("es6.modules"); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.exportSpecifier = function exportSpecifier(specifier, node, nodes) { - if (node.source) { - var ref = this.getExternalReference(node, nodes); - - if (specifier.local.name === "default" && !this.noInteropRequireExport) { - // importing a default so we need to normalize it - ref = t.callExpression(this.file.addHelper("interop-require"), [ref]); - } else { - ref = t.memberExpression(ref, specifier.local); - - if (!this.isLoose()) { - nodes.push(this.buildExportsFromAssignment(specifier.exported, ref, node)); - return; - } - } - - // export { foo } from "test"; - nodes.push(this.buildExportsAssignment(specifier.exported, ref, node)); - } else { - // export { foo }; - nodes.push(this.buildExportsAssignment(specifier.exported, specifier.local, node)); - } - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.buildExportsWildcard = function buildExportsWildcard(objectIdentifier) { - return t.expressionStatement(t.callExpression(this.file.addHelper("defaults"), [t.identifier("exports"), t.callExpression(this.file.addHelper("interop-export-wildcard"), [objectIdentifier, this.file.addHelper("defaults")])])); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.buildExportsFromAssignment = function buildExportsFromAssignment(id, init) { - this.checkExportIdentifier(id); - return util.template("exports-from-assign", { - INIT: init, - ID: t.literal(id.name) - }, true); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.buildExportsAssignment = function buildExportsAssignment(id, init) { - this.checkExportIdentifier(id); - return util.template("exports-assign", { - VALUE: init, - KEY: id - }, true); - }; - - /** - * [Please add a description.] - */ - - DefaultFormatter.prototype.exportDeclaration = function exportDeclaration(node, nodes) { - var declar = node.declaration; - - var id = declar.id; - - if (t.isExportDefaultDeclaration(node)) { - id = t.identifier("default"); - } - - var assign; - - if (t.isVariableDeclaration(declar)) { - for (var i = 0; i < declar.declarations.length; i++) { - var decl = declar.declarations[i]; - - decl.init = this.buildExportsAssignment(decl.id, decl.init, node).expression; - - var newDeclar = t.variableDeclaration(declar.kind, [decl]); - if (i === 0) t.inherits(newDeclar, declar); - nodes.push(newDeclar); - } - } else { - var ref = declar; - - if (t.isFunctionDeclaration(declar) || t.isClassDeclaration(declar)) { - ref = declar.id; - nodes.push(declar); - } - - assign = this.buildExportsAssignment(id, ref, node); - - nodes.push(assign); - - this._hoistExport(declar, assign); - } - }; - - return DefaultFormatter; -})(); - -exports["default"] = DefaultFormatter; -module.exports = exports["default"]; -},{"179":179,"182":182,"41":41,"43":43,"75":75,"76":76}],68:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -/** - * [Please add a description.] - */ - -exports["default"] = function (Parent) { - var Constructor = function Constructor() { - this.noInteropRequireImport = true; - this.noInteropRequireExport = true; - Parent.apply(this, arguments); - }; - - util.inherits(Constructor, Parent); - - return Constructor; -}; - -module.exports = exports["default"]; -},{"182":182}],69:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _amd = _dereq_(70); - -var _amd2 = _interopRequireDefault(_amd); - -var _strict = _dereq_(68); - -var _strict2 = _interopRequireDefault(_strict); - -/** - * [Please add a description.] - */ - -exports["default"] = _strict2["default"](_amd2["default"]); -module.exports = exports["default"]; -},{"68":68,"70":70}],70:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _default = _dereq_(67); - -var _default2 = _interopRequireDefault(_default); - -var _common = _dereq_(72); - -var _common2 = _interopRequireDefault(_common); - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _lodashObjectValues = _dereq_(525); - -var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var AMDFormatter = (function (_DefaultFormatter) { - _inherits(AMDFormatter, _DefaultFormatter); - - function AMDFormatter() { - _classCallCheck(this, AMDFormatter); - - _DefaultFormatter.apply(this, arguments); - } - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.setup = function setup() { - _common2["default"].prototype._setup.call(this, this.hasNonDefaultExports); - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.buildDependencyLiterals = function buildDependencyLiterals() { - var names = []; - for (var name in this.ids) { - names.push(t.literal(name)); - } - return names; - }; - - /** - * Wrap the entire body in a `define` wrapper. - */ - - AMDFormatter.prototype.transform = function transform(program) { - _common2["default"].prototype.transform.apply(this, arguments); - - var body = program.body; - - // build an array of module names - - var names = [t.literal("exports")]; - if (this.passModuleArg) names.push(t.literal("module")); - names = names.concat(this.buildDependencyLiterals()); - names = t.arrayExpression(names); - - // build up define container - - var params = _lodashObjectValues2["default"](this.ids); - if (this.passModuleArg) params.unshift(t.identifier("module")); - params.unshift(t.identifier("exports")); - - var container = t.functionExpression(null, params, t.blockStatement(body)); - - var defineArgs = [names, container]; - var moduleName = this.getModuleName(); - if (moduleName) defineArgs.unshift(t.literal(moduleName)); - - var call = t.callExpression(t.identifier("define"), defineArgs); - - program.body = [t.expressionStatement(call)]; - }; - - /** - * Get the AMD module name that we'll prepend to the wrapper - * to define this module - */ - - AMDFormatter.prototype.getModuleName = function getModuleName() { - if (this.file.opts.moduleIds) { - return _default2["default"].prototype.getModuleName.apply(this, arguments); - } else { - return null; - } - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype._getExternalReference = function _getExternalReference(node) { - return this.scope.generateUidIdentifier(node.source.value); - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.importDeclaration = function importDeclaration(node) { - this.getExternalReference(node); - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.importSpecifier = function importSpecifier(specifier, node, nodes, scope) { - var key = node.source.value; - var ref = this.getExternalReference(node); - - if (t.isImportNamespaceSpecifier(specifier) || t.isImportDefaultSpecifier(specifier)) { - this.defaultIds[key] = specifier.local; - } - - if (this.isModuleType(node, "absolute")) { - // absolute module reference - } else if (this.isModuleType(node, "absoluteDefault")) { - // prevent unnecessary renaming of dynamic imports - this.ids[node.source.value] = ref; - ref = t.memberExpression(ref, t.identifier("default")); - } else if (t.isImportNamespaceSpecifier(specifier)) { - // import * as bar from "foo"; - } else if (!_lodashCollectionIncludes2["default"](this.file.dynamicImported, node) && t.isSpecifierDefault(specifier) && !this.noInteropRequireImport) { - // import foo from "foo"; - var uid = scope.generateUidIdentifier(specifier.local.name); - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-default"), [ref]))])); - ref = t.memberExpression(uid, t.identifier("default")); - } else { - // import { foo } from "foo"; - var imported = specifier.imported; - if (t.isSpecifierDefault(specifier)) imported = t.identifier("default"); - ref = t.memberExpression(ref, imported); - } - - this.remaps.add(scope, specifier.local.name, ref); - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.exportSpecifier = function exportSpecifier(specifier, node, nodes) { - if (this.doDefaultExportInterop(specifier)) { - this.passModuleArg = true; - - if (specifier.exported !== specifier.local && !node.source) { - nodes.push(util.template("exports-default-assign", { - VALUE: specifier.local - }, true)); - return; - } - } - - _common2["default"].prototype.exportSpecifier.apply(this, arguments); - }; - - /** - * [Please add a description.] - */ - - AMDFormatter.prototype.exportDeclaration = function exportDeclaration(node, nodes) { - if (this.doDefaultExportInterop(node)) { - this.passModuleArg = true; - - var declar = node.declaration; - var assign = util.template("exports-default-assign", { - VALUE: this._pushStatement(declar, nodes) - }, true); - - if (t.isFunctionDeclaration(declar)) { - // we can hoist this assignment to the top of the file - assign._blockHoist = 3; - } - - nodes.push(assign); - return; - } - - _default2["default"].prototype.exportDeclaration.apply(this, arguments); - }; - - return AMDFormatter; -})(_default2["default"]); - -exports["default"] = AMDFormatter; -module.exports = exports["default"]; -},{"179":179,"182":182,"421":421,"525":525,"67":67,"72":72}],71:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _common = _dereq_(72); - -var _common2 = _interopRequireDefault(_common); - -var _strict = _dereq_(68); - -var _strict2 = _interopRequireDefault(_strict); - -/** - * [Please add a description.] - */ - -exports["default"] = _strict2["default"](_common2["default"]); -module.exports = exports["default"]; -},{"68":68,"72":72}],72:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _default = _dereq_(67); - -var _default2 = _interopRequireDefault(_default); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var CommonJSFormatter = (function (_DefaultFormatter) { - _inherits(CommonJSFormatter, _DefaultFormatter); - - function CommonJSFormatter() { - _classCallCheck(this, CommonJSFormatter); - - _DefaultFormatter.apply(this, arguments); - } - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.setup = function setup() { - this._setup(this.hasLocalExports); - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype._setup = function _setup(conditional) { - var file = this.file; - var scope = file.scope; - - scope.rename("module"); - scope.rename("exports"); - - if (!this.noInteropRequireImport && conditional) { - var templateName = "exports-module-declaration"; - if (this.file.isLoose("es6.modules")) templateName += "-loose"; - var declar = util.template(templateName, true); - declar._blockHoist = 3; - file.path.unshiftContainer("body", [declar]); - } - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.transform = function transform(program) { - _default2["default"].prototype.transform.apply(this, arguments); - - if (this.hasDefaultOnlyExport) { - program.body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.identifier("module"), t.identifier("exports")), t.memberExpression(t.identifier("exports"), t.identifier("default"))))); - } - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.importSpecifier = function importSpecifier(specifier, node, nodes, scope) { - var variableName = specifier.local; - - var ref = this.getExternalReference(node, nodes); - - // import foo from "foo"; - if (t.isSpecifierDefault(specifier)) { - if (this.isModuleType(node, "absolute")) { - // absolute module reference - } else if (this.isModuleType(node, "absoluteDefault")) { - this.remaps.add(scope, variableName.name, ref); - } else if (this.noInteropRequireImport) { - this.remaps.add(scope, variableName.name, t.memberExpression(ref, t.identifier("default"))); - } else { - var uid = this.scope.generateUidIdentifierBasedOnNode(node, "import"); - - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-default"), [ref]))])); - - this.remaps.add(scope, variableName.name, t.memberExpression(uid, t.identifier("default"))); - } - } else { - if (t.isImportNamespaceSpecifier(specifier)) { - if (!this.noInteropRequireImport) { - ref = t.callExpression(this.file.addHelper("interop-require-wildcard"), [ref]); - } - - // import * as bar from "foo"; - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(variableName, ref)])); - } else { - // import { foo } from "foo"; - this.remaps.add(scope, variableName.name, t.memberExpression(ref, t.identifier(specifier.imported.name))); - } - } - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.importDeclaration = function importDeclaration(node, nodes) { - // import "foo"; - nodes.push(util.template("require", { - MODULE_NAME: node.source - }, true)); - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.exportSpecifier = function exportSpecifier(specifier) { - if (this.doDefaultExportInterop(specifier)) { - this.hasDefaultOnlyExport = true; - } - - _default2["default"].prototype.exportSpecifier.apply(this, arguments); - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype.exportDeclaration = function exportDeclaration(node) { - if (this.doDefaultExportInterop(node)) { - this.hasDefaultOnlyExport = true; - } - - _default2["default"].prototype.exportDeclaration.apply(this, arguments); - }; - - /** - * [Please add a description.] - */ - - CommonJSFormatter.prototype._getExternalReference = function _getExternalReference(node, nodes) { - var call = t.callExpression(t.identifier("require"), [node.source]); - var uid; - - if (this.isModuleType(node, "absolute")) { - // absolute module reference - } else if (this.isModuleType(node, "absoluteDefault")) { - call = t.memberExpression(call, t.identifier("default")); - } else { - uid = this.scope.generateUidIdentifierBasedOnNode(node, "import"); - } - - uid = uid || node.specifiers[0].local; - - var declar = t.variableDeclaration("var", [t.variableDeclarator(uid, call)]); - nodes.push(declar); - return uid; - }; - - return CommonJSFormatter; -})(_default2["default"]); - -exports["default"] = CommonJSFormatter; -module.exports = exports["default"]; -},{"179":179,"182":182,"67":67}],73:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _default = _dereq_(67); - -var _default2 = _interopRequireDefault(_default); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var IgnoreFormatter = (function (_DefaultFormatter) { - _inherits(IgnoreFormatter, _DefaultFormatter); - - function IgnoreFormatter() { - _classCallCheck(this, IgnoreFormatter); - - _DefaultFormatter.apply(this, arguments); - } - - /** - * [Please add a description.] - */ - - IgnoreFormatter.prototype.exportDeclaration = function exportDeclaration(node, nodes) { - var declar = t.toStatement(node.declaration, true); - if (declar) nodes.push(t.inherits(declar, node)); - }; - - /** - * [Please add a description.] - */ - - IgnoreFormatter.prototype.exportAllDeclaration = function exportAllDeclaration() {}; - - IgnoreFormatter.prototype.importDeclaration = function importDeclaration() {}; - - IgnoreFormatter.prototype.importSpecifier = function importSpecifier() {}; - - IgnoreFormatter.prototype.exportSpecifier = function exportSpecifier() {}; - - IgnoreFormatter.prototype.transform = function transform() {}; - - return IgnoreFormatter; -})(_default2["default"]); - -exports["default"] = IgnoreFormatter; -module.exports = exports["default"]; -},{"179":179,"67":67}],74:[function(_dereq_,module,exports){ -/** - * [Please add a description.] - */ - -"use strict"; - -exports.__esModule = true; -exports["default"] = { - commonStrict: _dereq_(71), - amdStrict: _dereq_(69), - umdStrict: _dereq_(78), - common: _dereq_(72), - system: _dereq_(77), - ignore: _dereq_(73), - amd: _dereq_(70), - umd: _dereq_(79) -}; -module.exports = exports["default"]; -},{"69":69,"70":70,"71":71,"72":72,"73":73,"77":77,"78":78,"79":79}],75:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.ExportDeclaration = ExportDeclaration; -exports.Scope = Scope; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashObjectExtend = _dereq_(519); - -var _lodashObjectExtend2 = _interopRequireDefault(_lodashObjectExtend); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var ModuleDeclaration = { - enter: function enter(node, parent, scope, formatter) { - if (node.source) { - node.source.value = formatter.file.resolveModuleSource(node.source.value); - formatter.addScope(this); - } - } -}; - -exports.ModuleDeclaration = ModuleDeclaration; -/** - * [Please add a description.] - */ - -var ImportDeclaration = { - exit: function exit(node, parent, scope, formatter) { - formatter.hasLocalImports = true; - - var specifiers = []; - var imported = []; - formatter.metadata.imports.push({ - source: node.source.value, - imported: imported, - specifiers: specifiers - }); - - var _arr = this.get("specifiers"); - - for (var _i = 0; _i < _arr.length; _i++) { - var specifier = _arr[_i]; - var ids = specifier.getBindingIdentifiers(); - _lodashObjectExtend2["default"](formatter.localImports, ids); - - var local = specifier.node.local.name; - - if (specifier.isImportDefaultSpecifier()) { - imported.push("default"); - specifiers.push({ - kind: "named", - imported: "default", - local: local - }); - } - - if (specifier.isImportSpecifier()) { - var importedName = specifier.node.imported.name; - imported.push(importedName); - specifiers.push({ - kind: "named", - imported: importedName, - local: local - }); - } - - if (specifier.isImportNamespaceSpecifier()) { - imported.push("*"); - specifiers.push({ - kind: "namespace", - local: local - }); - } - } - } -}; - -exports.ImportDeclaration = ImportDeclaration; -/** - * [Please add a description.] - */ - -function ExportDeclaration(node, parent, scope, formatter) { - formatter.hasLocalExports = true; - - var source = node.source ? node.source.value : null; - var exports = formatter.metadata.exports; - - // export function foo() {} - // export var foo = "bar"; - var declar = this.get("declaration"); - if (declar.isStatement()) { - var bindings = declar.getBindingIdentifiers(); - - for (var name in bindings) { - var binding = bindings[name]; - formatter._addExport(name, binding); - - exports.exported.push(name); - exports.specifiers.push({ - kind: "local", - local: name, - exported: this.isExportDefaultDeclaration() ? "default" : name - }); - } - } - - if (this.isExportNamedDeclaration() && node.specifiers) { - var _arr2 = node.specifiers; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var specifier = _arr2[_i2]; - var exported = specifier.exported.name; - exports.exported.push(exported); - - // export foo from "bar"; - if (t.isExportDefaultSpecifier(specifier)) { - exports.specifiers.push({ - kind: "external", - local: exported, - exported: exported, - source: source - }); - } - - // export * as foo from "bar"; - if (t.isExportNamespaceSpecifier(specifier)) { - exports.specifiers.push({ - kind: "external-namespace", - exported: exported, - source: source - }); - } - - var local = specifier.local; - if (!local) continue; - - formatter._addExport(local.name, specifier.exported); - - // export { foo } from "bar"; - // export { foo as bar } from "bar"; - if (source) { - exports.specifiers.push({ - kind: "external", - local: local.name, - exported: exported, - source: source - }); - } - - // export { foo }; - // export { foo as bar }; - if (!source) { - exports.specifiers.push({ - kind: "local", - local: local.name, - exported: exported - }); - } - } - } - - // export * from "bar"; - if (this.isExportAllDeclaration()) { - exports.specifiers.push({ - kind: "external-all", - source: source - }); - } - - if (!t.isExportDefaultDeclaration(node) && !declar.isTypeAlias()) { - var onlyDefault = node.specifiers && node.specifiers.length === 1 && t.isSpecifierDefault(node.specifiers[0]); - if (!onlyDefault) { - formatter.hasNonDefaultExports = true; - } - } -} - -/** - * [Please add a description.] - */ - -function Scope(node, parent, scope, formatter) { - if (!formatter.isLoose()) { - this.skip(); - } -} -},{"179":179,"519":519}],76:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var remapVisitor = { - - /** - * [Please add a description.] - */ - - enter: function enter(node) { - if (node._skipModulesRemap) { - return this.skip(); - } - }, - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, remaps) { - var formatter = remaps.formatter; - - var remap = remaps.get(scope, node.name); - if (!remap || node === remap) return; - - if (!scope.hasBinding(node.name) || scope.bindingIdentifierEquals(node.name, formatter.localImports[node.name])) { - if (!formatter.isLoose() && this.key === "callee" && this.parentPath.isCallExpression()) { - return t.sequenceExpression([t.literal(0), remap]); - } else { - return remap; - } - } - }, - - /** - * [Please add a description.] - */ - - AssignmentExpression: { - exit: function exit(node, parent, scope, _ref) { - var formatter = _ref.formatter; - - if (!node._ignoreModulesRemap) { - var exported = formatter.getExport(node.left, scope); - if (exported) { - return formatter.remapExportAssignment(node, exported); - } - } - } - }, - - /** - * [Please add a description.] - */ - - UpdateExpression: function UpdateExpression(node, parent, scope, _ref2) { - var formatter = _ref2.formatter; - - var exported = formatter.getExport(node.argument, scope); - if (!exported) return; - - this.skip(); - - // expand to long file assignment expression - var assign = t.assignmentExpression(node.operator[0] + "=", node.argument, t.literal(1)); - - // remap this assignment expression - var remapped = formatter.remapExportAssignment(assign, exported); - - // we don't need to change the result - if (t.isExpressionStatement(parent) || node.prefix) { - return remapped; - } - - var nodes = []; - nodes.push(remapped); - - var operator; - if (node.operator === "--") { - operator = "+"; - } else { - // "++" - operator = "-"; - } - nodes.push(t.binaryExpression(operator, node.argument, t.literal(1))); - - return t.sequenceExpression(nodes); - } -}; - -/** - * [Please add a description.] - */ - -var Remaps = (function () { - function Remaps(file, formatter) { - _classCallCheck(this, Remaps); - - this.formatter = formatter; - this.file = file; - } - - /** - * [Please add a description.] - */ - - Remaps.prototype.run = function run() { - this.file.path.traverse(remapVisitor, this); - }; - - /** - * [Please add a description.] - */ - - Remaps.prototype._getKey = function _getKey(name) { - return name + ":moduleRemap"; - }; - - /** - * [Please add a description.] - */ - - Remaps.prototype.get = function get(scope, name) { - return scope.getData(this._getKey(name)); - }; - - /** - * [Please add a description.] - */ - - Remaps.prototype.add = function add(scope, name, val) { - if (this.all) { - this.all.push({ - name: name, - scope: scope, - node: val - }); - } - - return scope.setData(this._getKey(name), val); - }; - - /** - * [Please add a description.] - */ - - Remaps.prototype.remove = function remove(scope, name) { - return scope.removeData(this._getKey(name)); - }; - - /** - * These methods are used by the system module formatter who needs access to all the remaps - * so it can process them into it's specific setter method. We don't do this by default since - * no other module formatters need access to this. - */ - - Remaps.prototype.getAll = function getAll() { - return this.all; - }; - - /** - * [Please add a description.] - */ - - Remaps.prototype.clearAll = function clearAll() { - if (this.all) { - var _arr = this.all; - - for (var _i = 0; _i < _arr.length; _i++) { - var remap = _arr[_i]; - remap.scope.removeData(this._getKey(remap.name)); - } - } - - this.all = []; - }; - - return Remaps; -})(); - -exports["default"] = Remaps; -module.exports = exports["default"]; -},{"179":179}],77:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _default = _dereq_(67); - -var _default2 = _interopRequireDefault(_default); - -var _amd = _dereq_(70); - -var _amd2 = _interopRequireDefault(_amd); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _lodashArrayLast = _dereq_(415); - -var _lodashArrayLast2 = _interopRequireDefault(_lodashArrayLast); - -var _lodashCollectionMap = _dereq_(422); - -var _lodashCollectionMap2 = _interopRequireDefault(_lodashCollectionMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var hoistVariablesVisitor = { - - /** - * [Please add a description.] - */ - - Function: function Function() { - // nothing inside is accessible - this.skip(); - }, - - /** - * [Please add a description.] - */ - - VariableDeclaration: function VariableDeclaration(node, parent, scope, state) { - if (node.kind !== "var" && !t.isProgram(parent)) { - // let, const - // can't be accessed - return; - } - - // ignore block hoisted nodes as these can be left in - if (state.formatter._canHoist(node)) return; - - var nodes = []; - - for (var i = 0; i < node.declarations.length; i++) { - var declar = node.declarations[i]; - state.hoistDeclarators.push(t.variableDeclarator(declar.id)); - if (declar.init) { - // no initializer so we can just hoist it as-is - var assign = t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)); - nodes.push(assign); - } - } - - // for (var i in test) - if (t.isFor(parent) && parent.left === node) { - return node.declarations[0].id; - } - - return nodes; - } -}; - -/** - * [Please add a description.] - */ - -var hoistFunctionsVisitor = { - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent, scope, state) { - if (t.isFunctionDeclaration(node) || state.formatter._canHoist(node)) { - state.handlerBody.push(node); - this.dangerouslyRemove(); - } - } -}; - -/** - * [Please add a description.] - */ - -var runnerSettersVisitor = { - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent, scope, state) { - if (node._importSource === state.source) { - if (t.isVariableDeclaration(node)) { - var _arr = node.declarations; - - for (var _i = 0; _i < _arr.length; _i++) { - var declar = _arr[_i]; - state.hoistDeclarators.push(t.variableDeclarator(declar.id)); - state.nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init))); - } - } else { - state.nodes.push(node); - } - - this.dangerouslyRemove(); - } - } -}; - -/** - * [Please add a description.] - */ - -var SystemFormatter = (function (_AMDFormatter) { - _inherits(SystemFormatter, _AMDFormatter); - - function SystemFormatter(file) { - _classCallCheck(this, SystemFormatter); - - _AMDFormatter.call(this, file); - - this._setters = null; - this.exportIdentifier = file.scope.generateUidIdentifier("export"); - this.noInteropRequireExport = true; - this.noInteropRequireImport = true; - - this.remaps.clearAll(); - } - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype._addImportSource = function _addImportSource(node, exportNode) { - if (node) node._importSource = exportNode.source && exportNode.source.value; - return node; - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.buildExportsWildcard = function buildExportsWildcard(objectIdentifier, node) { - var leftIdentifier = this.scope.generateUidIdentifier("key"); - var valIdentifier = t.memberExpression(objectIdentifier, leftIdentifier, true); - - var left = t.variableDeclaration("var", [t.variableDeclarator(leftIdentifier)]); - - var right = objectIdentifier; - - var block = t.blockStatement([t.ifStatement(t.binaryExpression("!==", leftIdentifier, t.literal("default")), t.expressionStatement(this._buildExportCall(leftIdentifier, valIdentifier)))]); - - return this._addImportSource(t.forInStatement(left, right, block), node); - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.buildExportsAssignment = function buildExportsAssignment(id, init, node) { - var call = this._buildExportCall(t.literal(id.name), init, true); - return this._addImportSource(call, node); - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.buildExportsFromAssignment = function buildExportsFromAssignment() { - return this.buildExportsAssignment.apply(this, arguments); - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.remapExportAssignment = function remapExportAssignment(node, exported) { - var assign = node; - - for (var i = 0; i < exported.length; i++) { - assign = this._buildExportCall(t.literal(exported[i].name), assign); - } - - return assign; - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype._buildExportCall = function _buildExportCall(id, init, isStatement) { - var call = t.callExpression(this.exportIdentifier, [id, init]); - if (isStatement) { - return t.expressionStatement(call); - } else { - return call; - } - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.importSpecifier = function importSpecifier(specifier, node, nodes) { - _amd2["default"].prototype.importSpecifier.apply(this, arguments); - - var _arr2 = this.remaps.getAll(); - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var remap = _arr2[_i2]; - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(t.identifier(remap.name), remap.node)])); - } - - this.remaps.clearAll(); - - this._addImportSource(_lodashArrayLast2["default"](nodes), node); - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype._buildRunnerSetters = function _buildRunnerSetters(block, hoistDeclarators) { - var scope = this.file.scope; - - return t.arrayExpression(_lodashCollectionMap2["default"](this.ids, function (uid, source) { - var state = { - hoistDeclarators: hoistDeclarators, - source: source, - nodes: [] - }; - - scope.traverse(block, runnerSettersVisitor, state); - - return t.functionExpression(null, [uid], t.blockStatement(state.nodes)); - })); - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype._canHoist = function _canHoist(node) { - return node._blockHoist && !this.file.dynamicImports.length; - }; - - /** - * [Please add a description.] - */ - - SystemFormatter.prototype.transform = function transform(program) { - _default2["default"].prototype.transform.apply(this, arguments); - - var hoistDeclarators = []; - var moduleName = this.getModuleName(); - var moduleNameLiteral = t.literal(moduleName); - - var block = t.blockStatement(program.body); - - var setterListNode = this._buildRunnerSetters(block, hoistDeclarators); - this._setters = setterListNode; - - var runner = util.template("system", { - MODULE_DEPENDENCIES: t.arrayExpression(this.buildDependencyLiterals()), - EXPORT_IDENTIFIER: this.exportIdentifier, - MODULE_NAME: moduleNameLiteral, - SETTERS: setterListNode, - EXECUTE: t.functionExpression(null, [], block) - }, true); - - var handlerBody = runner.expression.arguments[2].body.body; - if (!moduleName) runner.expression.arguments.shift(); - - var returnStatement = handlerBody.pop(); - - // hoist up all variable declarations - this.file.scope.traverse(block, hoistVariablesVisitor, { - formatter: this, - hoistDeclarators: hoistDeclarators - }); - - if (hoistDeclarators.length) { - var hoistDeclar = t.variableDeclaration("var", hoistDeclarators); - hoistDeclar._blockHoist = true; - handlerBody.unshift(hoistDeclar); - } - - // hoist up function declarations for circular references - this.file.scope.traverse(block, hoistFunctionsVisitor, { - formatter: this, - handlerBody: handlerBody - }); - - handlerBody.push(returnStatement); - - program.body = [runner]; - }; - - return SystemFormatter; -})(_amd2["default"]); - -exports["default"] = SystemFormatter; -module.exports = exports["default"]; -},{"179":179,"182":182,"415":415,"422":422,"67":67,"70":70}],78:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _umd = _dereq_(79); - -var _umd2 = _interopRequireDefault(_umd); - -var _strict = _dereq_(68); - -var _strict2 = _interopRequireDefault(_strict); - -/** - * [Please add a description.] - */ - -exports["default"] = _strict2["default"](_umd2["default"]); -module.exports = exports["default"]; -},{"68":68,"79":79}],79:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _default = _dereq_(67); - -var _default2 = _interopRequireDefault(_default); - -var _amd = _dereq_(70); - -var _amd2 = _interopRequireDefault(_amd); - -var _lodashObjectValues = _dereq_(525); - -var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues); - -var _path = _dereq_(9); - -var _path2 = _interopRequireDefault(_path); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var UMDFormatter = (function (_AMDFormatter) { - _inherits(UMDFormatter, _AMDFormatter); - - function UMDFormatter() { - _classCallCheck(this, UMDFormatter); - - _AMDFormatter.apply(this, arguments); - } - - /** - * [Please add a description.] - */ - - UMDFormatter.prototype.transform = function transform(program) { - _default2["default"].prototype.transform.apply(this, arguments); - - var body = program.body; - - // build an array of module names - - var names = []; - for (var _name in this.ids) { - names.push(t.literal(_name)); - } - - // factory - - var ids = _lodashObjectValues2["default"](this.ids); - var args = [t.identifier("exports")]; - if (this.passModuleArg) args.push(t.identifier("module")); - args = args.concat(ids); - - var factory = t.functionExpression(null, args, t.blockStatement(body)); - - // amd - - var defineArgs = [t.literal("exports")]; - if (this.passModuleArg) defineArgs.push(t.literal("module")); - defineArgs = defineArgs.concat(names); - defineArgs = [t.arrayExpression(defineArgs)]; - - // common - - var testExports = util.template("test-exports"); - var testModule = util.template("test-module"); - var commonTests = this.passModuleArg ? t.logicalExpression("&&", testExports, testModule) : testExports; - - var commonArgs = [t.identifier("exports")]; - if (this.passModuleArg) commonArgs.push(t.identifier("module")); - commonArgs = commonArgs.concat(names.map(function (name) { - return t.callExpression(t.identifier("require"), [name]); - })); - - // globals - - var browserArgs = []; - if (this.passModuleArg) browserArgs.push(t.identifier("mod")); - - for (var _name2 in this.ids) { - var id = this.defaultIds[_name2] || t.identifier(t.toIdentifier(_path2["default"].basename(_name2, _path2["default"].extname(_name2)))); - browserArgs.push(t.memberExpression(t.identifier("global"), id)); - } - - // - - var moduleName = this.getModuleName(); - if (moduleName) defineArgs.unshift(t.literal(moduleName)); - - // - var globalArg = this.file.opts.basename; - if (moduleName) globalArg = moduleName; - globalArg = t.identifier(t.toIdentifier(globalArg)); - - var runner = util.template("umd-runner-body", { - AMD_ARGUMENTS: defineArgs, - COMMON_TEST: commonTests, - COMMON_ARGUMENTS: commonArgs, - BROWSER_ARGUMENTS: browserArgs, - GLOBAL_ARG: globalArg - }); - - // - - program.body = [t.expressionStatement(t.callExpression(runner, [t.thisExpression(), factory]))]; - }; - - return UMDFormatter; -})(_amd2["default"]); - -exports["default"] = UMDFormatter; -module.exports = exports["default"]; -},{"179":179,"182":182,"525":525,"67":67,"70":70,"9":9}],80:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _filePluginManager = _dereq_(52); - -var _filePluginManager2 = _interopRequireDefault(_filePluginManager); - -var _helpersNormalizeAst = _dereq_(40); - -var _helpersNormalizeAst2 = _interopRequireDefault(_helpersNormalizeAst); - -var _plugin = _dereq_(82); - -var _plugin2 = _interopRequireDefault(_plugin); - -var _lodashObjectAssign = _dereq_(517); - -var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); - -var _helpersObject = _dereq_(41); - -var _helpersObject2 = _interopRequireDefault(_helpersObject); - -var _file = _dereq_(46); - -var _file2 = _interopRequireDefault(_file); - -/** - * [Please add a description.] - */ - -var Pipeline = (function () { - function Pipeline() { - _classCallCheck(this, Pipeline); - - this.transformers = _helpersObject2["default"](); - this.namespaces = _helpersObject2["default"](); - this.deprecated = _helpersObject2["default"](); - this.aliases = _helpersObject2["default"](); - this.filters = []; - } - - /** - * [Please add a description.] - */ - - Pipeline.prototype.addTransformers = function addTransformers(transformers) { - for (var key in transformers) { - this.addTransformer(key, transformers[key]); - } - return this; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.addTransformer = function addTransformer(key, plugin) { - if (this.transformers[key]) throw new Error(); // todo: error - - var namespace = key.split(".")[0]; - this.namespaces[namespace] = this.namespaces[namespace] || []; - this.namespaces[namespace].push(key); - this.namespaces[key] = namespace; - - if (typeof plugin === "function") { - plugin = _filePluginManager2["default"].memoisePluginContainer(plugin); - plugin.key = key; - plugin.metadata.optional = true; - - if (key === "react.displayName") { - plugin.metadata.optional = false; - } - } else { - plugin = new _plugin2["default"](key, plugin); - } - - this.transformers[key] = plugin; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.addAliases = function addAliases(names) { - _lodashObjectAssign2["default"](this.aliases, names); - return this; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.addDeprecated = function addDeprecated(names) { - _lodashObjectAssign2["default"](this.deprecated, names); - return this; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.addFilter = function addFilter(filter) { - this.filters.push(filter); - return this; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.canTransform = function canTransform(plugin, fileOpts) { - if (plugin.metadata.plugin) { - return true; - } - - var _arr = this.filters; - for (var _i = 0; _i < _arr.length; _i++) { - var filter = _arr[_i]; - var result = filter(plugin, fileOpts); - if (result != null) return result; - } - - return true; - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.analyze = function analyze(code) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.code = false; - return this.transform(code, opts); - }; - - /** - * Build dependency graph by recursing `metadata.modules`. WIP. - */ - - Pipeline.prototype.pretransform = function pretransform(code, opts) { - var file = new _file2["default"](opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.parseCode(code); - return file; - }); - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.transform = function transform(code, opts) { - var file = new _file2["default"](opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.parseCode(code); - return file.transform(); - }); - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) { - ast = _helpersNormalizeAst2["default"](ast); - - var file = new _file2["default"](opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.addAst(ast); - return file.transform(); - }); - }; - - /** - * [Please add a description.] - */ - - Pipeline.prototype._ensureTransformerNames = function _ensureTransformerNames(type, rawKeys) { - var keys = []; - - for (var i = 0; i < rawKeys.length; i++) { - var key = rawKeys[i]; - var deprecatedKey = this.deprecated[key]; - var aliasKey = this.aliases[key]; - if (aliasKey) { - keys.push(aliasKey); - } else if (deprecatedKey) { - // deprecated key, remap it to the new one - console.error("[BABEL] The transformer " + key + " has been renamed to " + deprecatedKey); - rawKeys.push(deprecatedKey); - } else if (this.transformers[key]) { - // valid key - keys.push(key); - } else if (this.namespaces[key]) { - // namespace, append all transformers within this namespace - keys = keys.concat(this.namespaces[key]); - } else { - // invalid key - throw new ReferenceError("Unknown transformer " + key + " specified in " + type); - } - } - - return keys; - }; - - return Pipeline; -})(); - -exports["default"] = Pipeline; -module.exports = exports["default"]; -},{"40":40,"41":41,"46":46,"517":517,"52":52,"82":82}],81:[function(_dereq_,module,exports){ - - -/** - * This class is responsible for traversing over the provided `File`s - * AST and running it's parent transformers handlers over it. - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var PluginPass = (function () { - function PluginPass(file, plugin) { - _classCallCheck(this, PluginPass); - - this.plugin = plugin; - this.file = file; - this.key = plugin.key; - - if (this.canTransform() && plugin.metadata.experimental && !file.opts.experimental) { - file.log.warn("THE TRANSFORMER " + this.key + " HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. " + "THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE " + "`experimental` OPTION TO IGNORE THIS WARNING."); - } - } - - /** - * [Please add a description.] - */ - - PluginPass.prototype.canTransform = function canTransform() { - return this.file.transformerDependencies[this.key] || this.file.pipeline.canTransform(this.plugin, this.file.opts); - }; - - /** - * [Please add a description.] - */ - - PluginPass.prototype.transform = function transform() { - var file = this.file; - file.log.debug("Start transformer " + this.key); - _traversal2["default"](file.ast, this.plugin.visitor, file.scope, file); - file.log.debug("Finish transformer " + this.key); - }; - - return PluginPass; -})(); - -exports["default"] = PluginPass; -module.exports = exports["default"]; -},{"148":148}],82:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _pluginPass = _dereq_(81); - -var _pluginPass2 = _interopRequireDefault(_pluginPass); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _lodashObjectAssign = _dereq_(517); - -var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); - -var _lodashLangClone = _dereq_(502); - -var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone); - -var _file = _dereq_(46); - -var _file2 = _interopRequireDefault(_file); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var VALID_PLUGIN_PROPERTIES = ["visitor", "metadata", "manipulateOptions", "post", "pre"]; - -var VALID_METADATA_PROPERTIES = ["dependencies", "optional", "stage", "group", "experimental", "secondPass"]; - -/** - * [Please add a description.] - */ - -var Plugin = (function () { - function Plugin(key, plugin) { - _classCallCheck(this, Plugin); - - Plugin.validate(key, plugin); - - plugin = _lodashObjectAssign2["default"]({}, plugin); - - var take = function take(key) { - var val = plugin[key]; - delete plugin[key]; - return val; - }; - - this.manipulateOptions = take("manipulateOptions"); - this.metadata = take("metadata") || {}; - this.dependencies = this.metadata.dependencies || []; - this.post = take("post"); - this.pre = take("pre"); - - // - - if (this.metadata.stage != null) { - this.metadata.optional = true; - } - - // - - this.visitor = this.normalize(_lodashLangClone2["default"](take("visitor")) || {}); - this.key = key; - } - - /** - * [Please add a description.] - */ - - Plugin.validate = function validate(name, plugin) { - for (var key in plugin) { - if (key[0] === "_") continue; - if (VALID_PLUGIN_PROPERTIES.indexOf(key) >= 0) continue; - - var msgType = "pluginInvalidProperty"; - if (t.TYPES.indexOf(key) >= 0) msgType = "pluginInvalidPropertyVisitor"; - throw new Error(messages.get(msgType, name, key)); - } - - for (var key in plugin.metadata) { - if (VALID_METADATA_PROPERTIES.indexOf(key) >= 0) continue; - - throw new Error(messages.get("pluginInvalidProperty", name, "metadata." + key)); - } - }; - - /** - * [Please add a description.] - */ - - Plugin.prototype.normalize = function normalize(visitor) { - _traversal2["default"].explode(visitor); - return visitor; - }; - - /** - * [Please add a description.] - */ - - Plugin.prototype.buildPass = function buildPass(file) { - // validate Transformer instance - if (!(file instanceof _file2["default"])) { - throw new TypeError(messages.get("pluginNotFile", this.key)); - } - - return new _pluginPass2["default"](file, this); - }; - - return Plugin; -})(); - -exports["default"] = Plugin; -module.exports = exports["default"]; -},{"148":148,"179":179,"43":43,"46":46,"502":502,"517":517,"81":81}],83:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _plugin = _dereq_(82); - -var _plugin2 = _interopRequireDefault(_plugin); - -/** - * [Please add a description.] - */ - -var Transformer = function Transformer(key, obj) { - _classCallCheck(this, Transformer); - - var plugin = {}; - - plugin.metadata = obj.metadata; - delete obj.metadata; - - plugin.visitor = obj; - - return new _plugin2["default"](key, plugin); -}; - -exports["default"] = Transformer; -module.exports = exports["default"]; -},{"82":82}],84:[function(_dereq_,module,exports){ -module.exports={ - "useStrict": "strict", - "es5.runtime": "runtime", - "es6.runtime": "runtime", - "minification.inlineExpressions": "minification.constantFolding" -} - -},{}],85:[function(_dereq_,module,exports){ -module.exports={ - "selfContained": "runtime", - "unicode-regex": "regex.unicode", - "spec.typeofSymbol": "es6.spec.symbols", - "es6.symbols": "es6.spec.symbols", - "es6.blockScopingTDZ": "es6.spec.blockScoping", - - "utility.inlineExpressions": "minification.constantFolding", - "utility.deadCodeElimination": "minification.deadCodeElimination", - "utility.removeConsoleCalls": "minification.removeConsole", - "utility.removeDebugger": "minification.removeDebugger", - - "es6.parameters.rest": "es6.parameters", - "es6.parameters.default": "es6.parameters" -} - -},{}],86:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -/** - * Turn member expression reserved word properties into literals. - * - * @example - * - * **In** - * - * ```javascript - * foo.catch; - * ``` - * - * **Out** - * - * ```javascript - * foo["catch"]; - * ``` - */ - -var visitor = { - - /** - * Look for non-computed properties with names that are not valid identifiers. - * Turn them into computed properties with literal names. - */ - - MemberExpression: { - exit: function exit(node) { - var prop = node.property; - if (!node.computed && t.isIdentifier(prop) && !t.isValidIdentifier(prop.name)) { - // foo.default -> foo["default"] - node.property = t.literal(prop.name); - node.computed = true; - } - } - } -}; -exports.visitor = visitor; -},{"179":179}],87:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -/** - * Turn reserved word properties into literals. - * - * **In** - * - * ```javascript - * var foo = { - * catch: function () {} - * }; - * ``` - * - * **Out** - * - * ```javascript - * var foo = { - * "catch": function () {} - * }; - * ``` - */ - -var visitor = { - - /** - * Look for non-computed keys with names that are not valid identifiers. - * Turn them into literals. - */ - - Property: { - exit: function exit(node) { - var key = node.key; - if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) { - // default: "bar" -> "default": "bar" - node.key = t.literal(key.name); - } - } - } -}; -exports.visitor = visitor; -},{"179":179}],88:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _helpersDefineMap = _dereq_(57); - -var defineMap = _interopRequireWildcard(_helpersDefineMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Turn [object initializer mutators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Method_definitions) - * into `Object.defineProperties`. - * - * **In** - * - * ```javascript - * var foo = { - * get bar() { - * return "bar"; - * } - * }; - * ``` - * - * **Out** - * - * ```javascript - * var foo = Object.defineProperties({}, { - * bar: { - * get: function () { - * return "bar"; - * }, - * enumerable: true, - * configurable: true - * } - * }); - * ``` - */ - -var visitor = { - - /** - * Look for getters and setters on an object. - * Filter them out and wrap the object with an `Object.defineProperties` that - * defines the getters and setters. - */ - - ObjectExpression: function ObjectExpression(node, parent, scope, file) { - var hasAny = false; - var _arr = node.properties; - for (var _i = 0; _i < _arr.length; _i++) { - var prop = _arr[_i]; - if (prop.kind === "get" || prop.kind === "set") { - hasAny = true; - break; - } - } - if (!hasAny) return; - - var mutatorMap = {}; - - node.properties = node.properties.filter(function (prop) { - if (prop.kind === "get" || prop.kind === "set") { - defineMap.push(mutatorMap, prop, prop.kind, file); - return false; - } else { - return true; - } - }); - - return t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("defineProperties")), [node, defineMap.toDefineObject(mutatorMap)]); - } -}; -exports.visitor = visitor; -},{"179":179,"57":57}],89:[function(_dereq_,module,exports){ -/** - * Turn arrow functions into normal functions. - * - * @example - * - * **In** - * - * ```javascript - * arr.map(x => x * x); - * ``` - * - * **Out** - * - * ```javascript - * arr.map(function (x) { - * return x * x; - * }); - */ - -"use strict"; - -exports.__esModule = true; -var visitor = { - - /** - * Look for arrow functions and mark them as "shadow functions". - * @see /transformation/transformers/internal/shadow-functions.js - */ - - ArrowFunctionExpression: function ArrowFunctionExpression(node) { - this.ensureBlock(); - node.expression = false; - node.type = "FunctionExpression"; - node.shadow = node.shadow || true; - } -}; -exports.visitor = visitor; -},{}],90:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _helpersObject = _dereq_(41); - -var _helpersObject2 = _interopRequireDefault(_helpersObject); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _lodashObjectValues = _dereq_(525); - -var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues); - -var _lodashObjectExtend = _dereq_(519); - -var _lodashObjectExtend2 = _interopRequireDefault(_lodashObjectExtend); - -/** - * [Please add a description.] - */ - -function isLet(node, parent) { - if (!t.isVariableDeclaration(node)) return false; - if (node._let) return true; - if (node.kind !== "let") return false; - - // https://github.com/babel/babel/issues/255 - if (isLetInitable(node, parent)) { - for (var i = 0; i < node.declarations.length; i++) { - var declar = node.declarations[i]; - declar.init = declar.init || t.identifier("undefined"); - } - } - - node._let = true; - node.kind = "var"; - return true; -} - -/** - * [Please add a description.] - */ - -function isLetInitable(node, parent) { - return !t.isFor(parent) || !t.isFor(parent, { left: node }); -} - -/** - * [Please add a description.] - */ - -function isVar(node, parent) { - return t.isVariableDeclaration(node, { kind: "var" }) && !isLet(node, parent); -} - -/** - * [Please add a description.] - */ - -function standardizeLets(declars) { - var _arr = declars; - - for (var _i = 0; _i < _arr.length; _i++) { - var declar = _arr[_i]; - delete declar._let; - } -} - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - VariableDeclaration: function VariableDeclaration(node, parent, scope, file) { - if (!isLet(node, parent)) return; - - if (isLetInitable(node) && file.transformers["es6.spec.blockScoping"].canTransform()) { - var nodes = [node]; - - for (var i = 0; i < node.declarations.length; i++) { - var decl = node.declarations[i]; - if (decl.init) { - var assign = t.assignmentExpression("=", decl.id, decl.init); - assign._ignoreBlockScopingTDZ = true; - nodes.push(t.expressionStatement(assign)); - } - decl.init = file.addHelper("temporal-undefined"); - } - - node._blockHoist = 2; - - return nodes; - } - }, - - /** - * [Please add a description.] - */ - - Loop: function Loop(node, parent, scope, file) { - var init = node.left || node.init; - if (isLet(init, node)) { - t.ensureBlock(node); - node.body._letDeclarators = [init]; - } - - var blockScoping = new BlockScoping(this, this.get("body"), parent, scope, file); - return blockScoping.run(); - }, - - /** - * [Please add a description.] - */ - - "BlockStatement|Program": function BlockStatementProgram(block, parent, scope, file) { - if (!t.isLoop(parent)) { - var blockScoping = new BlockScoping(null, this, parent, scope, file); - blockScoping.run(); - } - } -}; - -exports.visitor = visitor; -/** - * [Please add a description.] - */ - -function replace(node, parent, scope, remaps) { - var remap = remaps[node.name]; - if (!remap) return; - - var ownBinding = scope.getBindingIdentifier(node.name); - if (ownBinding === remap.binding) { - node.name = remap.uid; - } else { - // scope already has it's own binding that doesn't - // match the one we have a stored replacement for - if (this) this.skip(); - } -} - -/** - * [Please add a description.] - */ - -var replaceVisitor = { - ReferencedIdentifier: replace, - - /** - * [Please add a description.] - */ - - AssignmentExpression: function AssignmentExpression(node, parent, scope, remaps) { - var ids = this.getBindingIdentifiers(); - for (var name in ids) { - replace(ids[name], node, scope, remaps); - } - } -}; - -/** - * [Please add a description.] - */ - -function traverseReplace(node, parent, scope, remaps) { - if (t.isIdentifier(node)) { - replace(node, parent, scope, remaps); - } - - if (t.isAssignmentExpression(node)) { - var ids = t.getBindingIdentifiers(node); - for (var name in ids) { - replace(ids[name], parent, scope, remaps); - } - } - - scope.traverse(node, replaceVisitor, remaps); -} - -/** - * [Please add a description.] - */ - -var letReferenceBlockVisitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, state) { - this.traverse(letReferenceFunctionVisitor, state); - return this.skip(); - } -}; - -/** - * [Please add a description.] - */ - -var letReferenceFunctionVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - var ref = state.letReferences[node.name]; - - // not a part of our scope - if (!ref) return; - - // this scope has a variable with the same name so it couldn't belong - // to our let scope - var localBinding = scope.getBindingIdentifier(node.name); - if (localBinding && localBinding !== ref) return; - - state.closurify = true; - } -}; - -/** - * [Please add a description.] - */ - -var hoistVarDeclarationsVisitor = { - enter: function enter(node, parent, scope, self) { - if (this.isForStatement()) { - if (isVar(node.init, node)) { - var nodes = self.pushDeclar(node.init); - if (nodes.length === 1) { - node.init = nodes[0]; - } else { - node.init = t.sequenceExpression(nodes); - } - } - } else if (this.isFor()) { - if (isVar(node.left, node)) { - self.pushDeclar(node.left); - node.left = node.left.declarations[0].id; - } - } else if (isVar(node, parent)) { - return self.pushDeclar(node).map(t.expressionStatement); - } else if (this.isFunction()) { - return this.skip(); - } - } -}; - -/** - * [Please add a description.] - */ - -var loopLabelVisitor = { - LabeledStatement: function LabeledStatement(node, parent, scope, state) { - state.innerLabels.push(node.label.name); - } -}; - -/** - * [Please add a description.] - */ - -var continuationVisitor = { - enter: function enter(node, parent, scope, state) { - if (this.isAssignmentExpression() || this.isUpdateExpression()) { - var bindings = this.getBindingIdentifiers(); - for (var name in bindings) { - if (state.outsideReferences[name] !== scope.getBindingIdentifier(name)) continue; - state.reassignments[name] = true; - } - } - } -}; - -/** - * [Please add a description.] - */ - -var loopNodeTo = function loopNodeTo(node) { - if (t.isBreakStatement(node)) { - return "break"; - } else if (t.isContinueStatement(node)) { - return "continue"; - } -}; - -/** - * [Please add a description.] - */ - -var loopVisitor = { - - /** - * [Please add a description.] - */ - - Loop: function Loop(node, parent, scope, state) { - var oldIgnoreLabeless = state.ignoreLabeless; - state.ignoreLabeless = true; - this.traverse(loopVisitor, state); - state.ignoreLabeless = oldIgnoreLabeless; - this.skip(); - }, - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - SwitchCase: function SwitchCase(node, parent, scope, state) { - var oldInSwitchCase = state.inSwitchCase; - state.inSwitchCase = true; - this.traverse(loopVisitor, state); - state.inSwitchCase = oldInSwitchCase; - this.skip(); - }, - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent, scope, state) { - var replace; - var loopText = loopNodeTo(node); - - if (loopText) { - if (node.label) { - // we shouldn't be transforming this because it exists somewhere inside - if (state.innerLabels.indexOf(node.label.name) >= 0) { - return; - } - - loopText = loopText + "|" + node.label.name; - } else { - // we shouldn't be transforming these statements because - // they don't refer to the actual loop we're scopifying - if (state.ignoreLabeless) return; - - // - if (state.inSwitchCase) return; - - // break statements mean something different in this context - if (t.isBreakStatement(node) && t.isSwitchCase(parent)) return; - } - - state.hasBreakContinue = true; - state.map[loopText] = node; - replace = t.literal(loopText); - } - - if (this.isReturnStatement()) { - state.hasReturn = true; - replace = t.objectExpression([t.property("init", t.identifier("v"), node.argument || t.identifier("undefined"))]); - } - - if (replace) { - replace = t.returnStatement(replace); - this.skip(); - return t.inherits(replace, node); - } - } -}; - -/** - * [Please add a description.] - */ - -var BlockScoping = (function () { - function BlockScoping(loopPath, blockPath, parent, scope, file) { - _classCallCheck(this, BlockScoping); - - this.parent = parent; - this.scope = scope; - this.file = file; - - this.blockPath = blockPath; - this.block = blockPath.node; - - this.outsideLetReferences = _helpersObject2["default"](); - this.hasLetReferences = false; - this.letReferences = this.block._letReferences = _helpersObject2["default"](); - this.body = []; - - if (loopPath) { - this.loopParent = loopPath.parent; - this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label; - this.loopPath = loopPath; - this.loop = loopPath.node; - } - } - - /** - * Start the ball rolling. - */ - - BlockScoping.prototype.run = function run() { - var block = this.block; - if (block._letDone) return; - block._letDone = true; - - var needsClosure = this.getLetReferences(); - - // this is a block within a `Function/Program` so we can safely leave it be - if (t.isFunction(this.parent) || t.isProgram(this.block)) return; - - // we can skip everything - if (!this.hasLetReferences) return; - - if (needsClosure) { - this.wrapClosure(); - } else { - this.remap(); - } - - if (this.loopLabel && !t.isLabeledStatement(this.loopParent)) { - return t.labeledStatement(this.loopLabel, this.loop); - } - }; - - /** - * [Please add a description.] - */ - - BlockScoping.prototype.remap = function remap() { - var hasRemaps = false; - var letRefs = this.letReferences; - var scope = this.scope; - - // alright, so since we aren't wrapping this block in a closure - // we have to check if any of our let variables collide with - // those in upper scopes and then if they do, generate a uid - // for them and replace all references with it - var remaps = _helpersObject2["default"](); - - for (var key in letRefs) { - // just an Identifier node we collected in `getLetReferences` - // this is the defining identifier of a declaration - var ref = letRefs[key]; - - // todo: could skip this if the colliding binding is in another function - if (scope.parentHasBinding(key) || scope.hasGlobal(key)) { - var uid = scope.generateUidIdentifier(ref.name).name; - ref.name = uid; - - hasRemaps = true; - remaps[key] = remaps[uid] = { - binding: ref, - uid: uid - }; - } - } - - if (!hasRemaps) return; - - // - - var loop = this.loop; - if (loop) { - traverseReplace(loop.right, loop, scope, remaps); - traverseReplace(loop.test, loop, scope, remaps); - traverseReplace(loop.update, loop, scope, remaps); - } - - this.blockPath.traverse(replaceVisitor, remaps); - }; - - /** - * [Please add a description.] - */ - - BlockScoping.prototype.wrapClosure = function wrapClosure() { - var block = this.block; - - var outsideRefs = this.outsideLetReferences; - - // remap loop heads with colliding variables - if (this.loop) { - for (var name in outsideRefs) { - var id = outsideRefs[name]; - - if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) { - delete outsideRefs[id.name]; - delete this.letReferences[id.name]; - - this.scope.rename(id.name); - - this.letReferences[id.name] = id; - outsideRefs[id.name] = id; - } - } - } - - // if we're inside of a for loop then we search to see if there are any - // `break`s, `continue`s, `return`s etc - this.has = this.checkLoop(); - - // hoist var references to retain scope - this.hoistVarDeclarations(); - - // turn outsideLetReferences into an array - var params = _lodashObjectValues2["default"](outsideRefs); - var args = _lodashObjectValues2["default"](outsideRefs); - - // build the closure that we're going to wrap the block with - var fn = t.functionExpression(null, params, t.blockStatement(block.body)); - fn.shadow = true; - - // continuation - this.addContinuations(fn); - - // replace the current block body with the one we're going to build - block.body = this.body; - - var ref = fn; - - if (this.loop) { - ref = this.scope.generateUidIdentifier("loop"); - this.loopPath.insertBefore(t.variableDeclaration("var", [t.variableDeclarator(ref, fn)])); - } - - // build a call and a unique id that we can assign the return value to - var call = t.callExpression(ref, args); - var ret = this.scope.generateUidIdentifier("ret"); - - // handle generators - var hasYield = _traversal2["default"].hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES); - if (hasYield) { - fn.generator = true; - call = t.yieldExpression(call, true); - } - - // handlers async functions - var hasAsync = _traversal2["default"].hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES); - if (hasAsync) { - fn.async = true; - call = t.awaitExpression(call); - } - - this.buildClosure(ret, call); - }; - - /** - * Push the closure to the body. - */ - - BlockScoping.prototype.buildClosure = function buildClosure(ret, call) { - var has = this.has; - if (has.hasReturn || has.hasBreakContinue) { - this.buildHas(ret, call); - } else { - this.body.push(t.expressionStatement(call)); - } - }; - - /** - * If any of the outer let variables are reassigned then we need to rename them in - * the closure so we can get direct access to the outer variable to continue the - * iteration with bindings based on each iteration. - * - * Reference: https://github.com/babel/babel/issues/1078 - */ - - BlockScoping.prototype.addContinuations = function addContinuations(fn) { - var state = { - reassignments: {}, - outsideReferences: this.outsideLetReferences - }; - - this.scope.traverse(fn, continuationVisitor, state); - - for (var i = 0; i < fn.params.length; i++) { - var param = fn.params[i]; - if (!state.reassignments[param.name]) continue; - - var newParam = this.scope.generateUidIdentifier(param.name); - fn.params[i] = newParam; - - this.scope.rename(param.name, newParam.name, fn); - - // assign outer reference as it's been modified internally and needs to be retained - fn.body.body.push(t.expressionStatement(t.assignmentExpression("=", param, newParam))); - } - }; - - /** - * [Please add a description.] - */ - - BlockScoping.prototype.getLetReferences = function getLetReferences() { - var block = this.block; - - var declarators = block._letDeclarators || []; - - // - for (var i = 0; i < declarators.length; i++) { - var declar = declarators[i]; - _lodashObjectExtend2["default"](this.outsideLetReferences, t.getBindingIdentifiers(declar)); - } - - // - if (block.body) { - for (var i = 0; i < block.body.length; i++) { - var declar = block.body[i]; - if (isLet(declar, block)) { - declarators = declarators.concat(declar.declarations); - } - } - } - - // - for (var i = 0; i < declarators.length; i++) { - var declar = declarators[i]; - var keys = t.getBindingIdentifiers(declar); - _lodashObjectExtend2["default"](this.letReferences, keys); - this.hasLetReferences = true; - } - - // no let references so we can just quit - if (!this.hasLetReferences) return; - - // set let references to plain var references - standardizeLets(declarators); - - var state = { - letReferences: this.letReferences, - closurify: false - }; - - // traverse through this block, stopping on functions and checking if they - // contain any local let references - this.blockPath.traverse(letReferenceBlockVisitor, state); - - return state.closurify; - }; - - /** - * If we're inside of a loop then traverse it and check if it has one of - * the following node types `ReturnStatement`, `BreakStatement`, - * `ContinueStatement` and replace it with a return value that we can track - * later on. - * - * @returns {Object} - */ - - BlockScoping.prototype.checkLoop = function checkLoop() { - var state = { - hasBreakContinue: false, - ignoreLabeless: false, - inSwitchCase: false, - innerLabels: [], - hasReturn: false, - isLoop: !!this.loop, - map: {} - }; - - this.blockPath.traverse(loopLabelVisitor, state); - this.blockPath.traverse(loopVisitor, state); - - return state; - }; - - /** - * Hoist all var declarations in this block to before it so they retain scope - * once we wrap everything in a closure. - */ - - BlockScoping.prototype.hoistVarDeclarations = function hoistVarDeclarations() { - this.blockPath.traverse(hoistVarDeclarationsVisitor, this); - }; - - /** - * Turn a `VariableDeclaration` into an array of `AssignmentExpressions` with - * their declarations hoisted to before the closure wrapper. - */ - - BlockScoping.prototype.pushDeclar = function pushDeclar(node) { - var declars = []; - var names = t.getBindingIdentifiers(node); - for (var name in names) { - declars.push(t.variableDeclarator(names[name])); - } - - this.body.push(t.variableDeclaration(node.kind, declars)); - - var replace = []; - - for (var i = 0; i < node.declarations.length; i++) { - var declar = node.declarations[i]; - if (!declar.init) continue; - - var expr = t.assignmentExpression("=", declar.id, declar.init); - replace.push(t.inherits(expr, declar)); - } - - return replace; - }; - - /** - * [Please add a description.] - */ - - BlockScoping.prototype.buildHas = function buildHas(ret, call) { - var body = this.body; - - body.push(t.variableDeclaration("var", [t.variableDeclarator(ret, call)])); - - var retCheck; - var has = this.has; - var cases = []; - - if (has.hasReturn) { - // typeof ret === "object" - retCheck = util.template("let-scoping-return", { - RETURN: ret - }); - } - - if (has.hasBreakContinue) { - for (var key in has.map) { - cases.push(t.switchCase(t.literal(key), [has.map[key]])); - } - - if (has.hasReturn) { - cases.push(t.switchCase(null, [retCheck])); - } - - if (cases.length === 1) { - var single = cases[0]; - body.push(this.file.attachAuxiliaryComment(t.ifStatement(t.binaryExpression("===", ret, single.test), single.consequent[0]))); - } else { - // https://github.com/babel/babel/issues/998 - for (var i = 0; i < cases.length; i++) { - var caseConsequent = cases[i].consequent[0]; - if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) { - caseConsequent.label = this.loopLabel = this.loopLabel || this.file.scope.generateUidIdentifier("loop"); - } - } - - body.push(this.file.attachAuxiliaryComment(t.switchStatement(ret, cases))); - } - } else { - if (has.hasReturn) { - body.push(this.file.attachAuxiliaryComment(retCheck)); - } - } - }; - - return BlockScoping; -})(); -},{"148":148,"179":179,"182":182,"41":41,"519":519,"525":525}],91:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _loose = _dereq_(92); - -var _loose2 = _interopRequireDefault(_loose); - -var _vanilla = _dereq_(93); - -var _vanilla2 = _interopRequireDefault(_vanilla); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _helpersNameMethod = _dereq_(61); - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ClassDeclaration: function ClassDeclaration(node) { - return t.variableDeclaration("let", [t.variableDeclarator(node.id, t.toExpression(node))]); - }, - - /** - * [Please add a description.] - */ - - ClassExpression: function ClassExpression(node, parent, scope, file) { - var inferred = _helpersNameMethod.bare(node, parent, scope); - if (inferred) return inferred; - - if (file.isLoose("es6.classes")) { - return new _loose2["default"](this, file).run(); - } else { - return new _vanilla2["default"](this, file).run(); - } - } -}; -exports.visitor = visitor; -},{"179":179,"61":61,"92":92,"93":93}],92:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _vanilla = _dereq_(93); - -var _vanilla2 = _interopRequireDefault(_vanilla); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var LooseClassTransformer = (function (_VanillaTransformer) { - _inherits(LooseClassTransformer, _VanillaTransformer); - - function LooseClassTransformer() { - _classCallCheck(this, LooseClassTransformer); - - _VanillaTransformer.apply(this, arguments); - this.isLoose = true; - } - - /** - * [Please add a description.] - */ - - LooseClassTransformer.prototype._processMethod = function _processMethod(node) { - if (!node.decorators) { - // use assignments instead of define properties for loose classes - - var classRef = this.classRef; - if (!node["static"]) classRef = t.memberExpression(classRef, t.identifier("prototype")); - var methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key)); - - var expr = t.expressionStatement(t.assignmentExpression("=", methodName, node.value)); - t.inheritsComments(expr, node); - this.body.push(expr); - return true; - } - }; - - return LooseClassTransformer; -})(_vanilla2["default"]); - -exports["default"] = LooseClassTransformer; -module.exports = exports["default"]; -},{"179":179,"93":93}],93:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _helpersMemoiseDecorators = _dereq_(60); - -var _helpersMemoiseDecorators2 = _interopRequireDefault(_helpersMemoiseDecorators); - -var _helpersReplaceSupers = _dereq_(65); - -var _helpersReplaceSupers2 = _interopRequireDefault(_helpersReplaceSupers); - -var _helpersNameMethod = _dereq_(61); - -var nameMethod = _interopRequireWildcard(_helpersNameMethod); - -var _helpersDefineMap = _dereq_(57); - -var defineMap = _interopRequireWildcard(_helpersDefineMap); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var PROPERTY_COLLISION_METHOD_NAME = "__initializeProperties"; - -/** - * [Please add a description.] - */ - -var collectPropertyReferencesVisitor = { - - /** - * [Please add a description.] - */ - - Identifier: { - enter: function enter(node, parent, scope, state) { - if (this.parentPath.isClassProperty({ key: node })) { - return; - } - - if (this.isReferenced() && scope.getBinding(node.name) === state.scope.getBinding(node.name)) { - state.references[node.name] = true; - } - } - } -}; - -/** - * [Please add a description.] - */ - -var verifyConstructorVisitor = { - - /** - * [Please add a description.] - */ - - MethodDefinition: function MethodDefinition() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - Property: function Property(node) { - if (node.method) this.skip(); - }, - - /** - * [Please add a description.] - */ - - CallExpression: { - exit: function exit(node, parent, scope, state) { - if (this.get("callee").isSuper()) { - state.hasBareSuper = true; - state.bareSuper = this; - - if (!state.isDerived) { - throw this.errorWithNode("super call is only allowed in derived constructor"); - } - } - } - }, - - /** - * [Please add a description.] - */ - - "FunctionDeclaration|FunctionExpression": function FunctionDeclarationFunctionExpression() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - ThisExpression: function ThisExpression(node, parent, scope, state) { - if (state.isDerived && !state.hasBareSuper) { - if (this.inShadow()) { - // https://github.com/babel/babel/issues/1920 - var thisAlias = state.constructorPath.getData("this"); - - if (!thisAlias) { - thisAlias = state.constructorPath.setData("this", state.constructorPath.scope.generateUidIdentifier("this")); - } - - return thisAlias; - } else { - throw this.errorWithNode("'this' is not allowed before super()"); - } - } - }, - - /** - * [Please add a description.] - */ - - Super: function Super(node, parent, scope, state) { - if (state.isDerived && !state.hasBareSuper && !this.parentPath.isCallExpression({ callee: node })) { - throw this.errorWithNode("'super.*' is not allowed before super()"); - } - } -}; - -/** - * [Please add a description.] - */ - -var ClassTransformer = (function () { - function ClassTransformer(path, file) { - _classCallCheck(this, ClassTransformer); - - this.parent = path.parent; - this.scope = path.scope; - this.node = path.node; - this.path = path; - this.file = file; - - this.clearDescriptors(); - - this.instancePropBody = []; - this.instancePropRefs = {}; - this.staticPropBody = []; - this.body = []; - - this.pushedConstructor = false; - this.pushedInherits = false; - this.hasDecorators = false; - this.isLoose = false; - - // class id - this.classId = this.node.id; - - // this is the name of the binding that will **always** reference the class we've constructed - this.classRef = this.node.id || this.scope.generateUidIdentifier("class"); - - // this is a direct reference to the class we're building, class decorators can shadow the classRef - this.directRef = null; - - this.superName = this.node.superClass || t.identifier("Function"); - this.isDerived = !!this.node.superClass; - } - - /** - * [Please add a description.] - * @returns {Array} - */ - - ClassTransformer.prototype.run = function run() { - var superName = this.superName; - var file = this.file; - - // - - var body = this.body; - - // - - var constructorBody = this.constructorBody = t.blockStatement([]); - this.constructor = this.buildConstructor(); - - // - - var closureParams = []; - var closureArgs = []; - - // - if (this.isDerived) { - closureArgs.push(superName); - - superName = this.scope.generateUidIdentifierBasedOnNode(superName); - closureParams.push(superName); - - this.superName = superName; - } - - // - var decorators = this.node.decorators; - if (decorators) { - // this is so super calls and the decorators have access to the raw function - this.directRef = this.scope.generateUidIdentifier(this.classRef); - } else { - this.directRef = this.classRef; - } - - // - this.buildBody(); - - // make sure this class isn't directly called - constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [t.thisExpression(), this.directRef]))); - - // - this.pushDecorators(); - - body = body.concat(this.staticPropBody); - - if (this.classId) { - // named class with only a constructor - if (body.length === 1) return t.toExpression(body[0]); - } - - // - body.push(t.returnStatement(this.classRef)); - - var container = t.functionExpression(null, closureParams, t.blockStatement(body)); - container.shadow = true; - return t.callExpression(container, closureArgs); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.buildConstructor = function buildConstructor() { - var func = t.functionDeclaration(this.classRef, [], this.constructorBody); - t.inherits(func, this.node); - return func; - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable) { - var kind = arguments.length <= 2 || arguments[2] === undefined ? "value" : arguments[2]; - - var mutatorMap; - if (node["static"]) { - this.hasStaticDescriptors = true; - mutatorMap = this.staticMutatorMap; - } else { - this.hasInstanceDescriptors = true; - mutatorMap = this.instanceMutatorMap; - } - - var map = defineMap.push(mutatorMap, node, kind, this.file); - - if (enumerable) { - map.enumerable = t.literal(true); - } - - if (map.decorators) { - this.hasDecorators = true; - } - }; - - /** - * [Please add a description.] - * https://www.youtube.com/watch?v=fWNaR-rxAic - */ - - ClassTransformer.prototype.constructorMeMaybe = function constructorMeMaybe() { - var hasConstructor = false; - var paths = this.path.get("body.body"); - var _arr = paths; - for (var _i = 0; _i < _arr.length; _i++) { - var path = _arr[_i]; - hasConstructor = path.equals("kind", "constructor"); - if (hasConstructor) break; - } - if (hasConstructor) return; - - var constructor; - if (this.isDerived) { - constructor = util.template("class-derived-default-constructor"); - } else { - constructor = t.functionExpression(null, [], t.blockStatement([])); - } - - this.path.get("body").unshiftContainer("body", t.methodDefinition(t.identifier("constructor"), constructor, "constructor")); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.buildBody = function buildBody() { - this.constructorMeMaybe(); - this.pushBody(); - this.placePropertyInitializers(); - - if (this.userConstructor) { - var constructorBody = this.constructorBody; - constructorBody.body = constructorBody.body.concat(this.userConstructor.body.body); - t.inherits(this.constructor, this.userConstructor); - t.inherits(constructorBody, this.userConstructor.body); - } - - this.pushDescriptors(); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.pushBody = function pushBody() { - var classBodyPaths = this.path.get("body.body"); - - var _arr2 = classBodyPaths; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var path = _arr2[_i2]; - var node = path.node; - - if (node.decorators) { - _helpersMemoiseDecorators2["default"](node.decorators, this.scope); - } - - if (t.isMethodDefinition(node)) { - var isConstructor = node.kind === "constructor"; - if (isConstructor) this.verifyConstructor(path); - - var replaceSupers = new _helpersReplaceSupers2["default"]({ - methodPath: path, - methodNode: node, - objectRef: this.directRef, - superRef: this.superName, - isStatic: node["static"], - isLoose: this.isLoose, - scope: this.scope, - file: this.file - }, true); - - replaceSupers.replace(); - - if (isConstructor) { - this.pushConstructor(node, path); - } else { - this.pushMethod(node, path); - } - } else if (t.isClassProperty(node)) { - this.pushProperty(node, path); - } - } - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.clearDescriptors = function clearDescriptors() { - this.hasInstanceDescriptors = false; - this.hasStaticDescriptors = false; - - this.instanceMutatorMap = {}; - this.staticMutatorMap = {}; - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.pushDescriptors = function pushDescriptors() { - this.pushInherits(); - - var body = this.body; - - var instanceProps; - var staticProps; - var classHelper = "create-class"; - if (this.hasDecorators) classHelper = "create-decorated-class"; - - if (this.hasInstanceDescriptors) { - instanceProps = defineMap.toClassObject(this.instanceMutatorMap); - } - - if (this.hasStaticDescriptors) { - staticProps = defineMap.toClassObject(this.staticMutatorMap); - } - - if (instanceProps || staticProps) { - if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps); - if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps); - - var nullNode = t.literal(null); - - // (Constructor, instanceDescriptors, staticDescriptors, instanceInitializers, staticInitializers) - var args = [this.classRef, nullNode, nullNode, nullNode, nullNode]; - - if (instanceProps) args[1] = instanceProps; - if (staticProps) args[2] = staticProps; - - if (this.instanceInitializersId) { - args[3] = this.instanceInitializersId; - body.unshift(this.buildObjectAssignment(this.instanceInitializersId)); - } - - if (this.staticInitializersId) { - args[4] = this.staticInitializersId; - body.unshift(this.buildObjectAssignment(this.staticInitializersId)); - } - - var lastNonNullIndex = 0; - for (var i = 0; i < args.length; i++) { - if (args[i] !== nullNode) lastNonNullIndex = i; - } - args = args.slice(0, lastNonNullIndex + 1); - - body.push(t.expressionStatement(t.callExpression(this.file.addHelper(classHelper), args))); - } - - this.clearDescriptors(); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.buildObjectAssignment = function buildObjectAssignment(id) { - return t.variableDeclaration("var", [t.variableDeclarator(id, t.objectExpression([]))]); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.placePropertyInitializers = function placePropertyInitializers() { - var body = this.instancePropBody; - if (!body.length) return; - - if (this.hasPropertyCollision()) { - var call = t.expressionStatement(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier(PROPERTY_COLLISION_METHOD_NAME)), [])); - - this.pushMethod(t.methodDefinition(t.identifier(PROPERTY_COLLISION_METHOD_NAME), t.functionExpression(null, [], t.blockStatement(body))), null, true); - - if (this.isDerived) { - this.bareSuper.insertAfter(call); - } else { - this.constructorBody.body.unshift(call); - } - } else { - if (this.isDerived) { - this.bareSuper.insertAfter(body); - } else { - this.constructorBody.body = body.concat(this.constructorBody.body); - } - } - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.hasPropertyCollision = function hasPropertyCollision() { - if (this.userConstructorPath) { - for (var name in this.instancePropRefs) { - if (this.userConstructorPath.scope.hasOwnBinding(name)) { - return true; - } - } - } - - return false; - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.verifyConstructor = function verifyConstructor(path) { - var state = { - constructorPath: path.get("value"), - hasBareSuper: false, - bareSuper: null, - isDerived: this.isDerived, - file: this.file - }; - - state.constructorPath.traverse(verifyConstructorVisitor, state); - - var thisAlias = state.constructorPath.getData("this"); - if (thisAlias && state.bareSuper) { - state.bareSuper.insertAfter(t.variableDeclaration("var", [t.variableDeclarator(thisAlias, t.thisExpression())])); - } - - this.bareSuper = state.bareSuper; - - if (!state.hasBareSuper && this.isDerived) { - throw path.errorWithNode("Derived constructor must call super()"); - } - }; - - /** - * Push a method to its respective mutatorMap. - */ - - ClassTransformer.prototype.pushMethod = function pushMethod(node, path, allowedIllegal) { - if (!allowedIllegal && t.isLiteral(t.toComputedKey(node), { value: PROPERTY_COLLISION_METHOD_NAME })) { - throw this.file.errorWithNode(node, messages.get("illegalMethodName", PROPERTY_COLLISION_METHOD_NAME)); - } - - if (node.kind === "method") { - nameMethod.property(node, this.file, path ? path.get("value").scope : this.scope); - if (this._processMethod(node)) return; - } - - this.pushToMap(node); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype._processMethod = function _processMethod() { - return false; - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype.pushProperty = function pushProperty(node, path) { - path.traverse(collectPropertyReferencesVisitor, { - references: this.instancePropRefs, - scope: this.scope - }); - - if (node.decorators) { - var body = []; - if (node.value) { - body.push(t.returnStatement(node.value)); - node.value = t.functionExpression(null, [], t.blockStatement(body)); - } else { - node.value = t.literal(null); - } - this.pushToMap(node, true, "initializer"); - - var initializers; - var target; - if (node["static"]) { - initializers = this.staticInitializersId = this.staticInitializersId || this.scope.generateUidIdentifier("staticInitializers"); - body = this.staticPropBody; - target = this.classRef; - } else { - initializers = this.instanceInitializersId = this.instanceInitializersId || this.scope.generateUidIdentifier("instanceInitializers"); - body = this.instancePropBody; - target = t.thisExpression(); - } - - body.push(t.expressionStatement(t.callExpression(this.file.addHelper("define-decorated-property-descriptor"), [target, t.literal(node.key.name), initializers]))); - } else { - if (!node.value && !node.decorators) return; - - if (node["static"]) { - // can just be added to the static map - this.pushToMap(node, true); - } else if (node.value) { - // add this to the instancePropBody which will be added after the super call in a derived constructor - // or at the start of a constructor for a non-derived constructor - this.instancePropBody.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.thisExpression(), node.key), node.value))); - } - } - }; - - /** - * Replace the constructor body of our class. - */ - - ClassTransformer.prototype.pushConstructor = function pushConstructor(method, path) { - // https://github.com/babel/babel/issues/1077 - var fnPath = path.get("value"); - if (fnPath.scope.hasOwnBinding(this.classRef.name)) { - fnPath.scope.rename(this.classRef.name); - } - - var construct = this.constructor; - var fn = method.value; - - this.userConstructorPath = fnPath; - this.userConstructor = fn; - this.hasConstructor = true; - - t.inheritsComments(construct, method); - - construct._ignoreUserWhitespace = true; - construct.params = fn.params; - - t.inherits(construct.body, fn.body); - - // push constructor to body - this._pushConstructor(); - }; - - /** - * [Please add a description.] - */ - - ClassTransformer.prototype._pushConstructor = function _pushConstructor() { - if (this.pushedConstructor) return; - this.pushedConstructor = true; - - // we haven't pushed any descriptors yet - if (this.hasInstanceDescriptors || this.hasStaticDescriptors) { - this.pushDescriptors(); - } - - this.body.push(this.constructor); - - this.pushInherits(); - }; - - /** - * Push inherits helper to body. - */ - - ClassTransformer.prototype.pushInherits = function pushInherits() { - if (!this.isDerived || this.pushedInherits) return; - - // Unshift to ensure that the constructor inheritance is set up before - // any properties can be assigned to the prototype. - this.pushedInherits = true; - this.body.unshift(t.expressionStatement(t.callExpression(this.file.addHelper("inherits"), [this.classRef, this.superName]))); - }; - - /** - * Push decorators to body. - */ - - ClassTransformer.prototype.pushDecorators = function pushDecorators() { - var decorators = this.node.decorators; - if (!decorators) return; - - this.body.push(t.variableDeclaration("var", [t.variableDeclarator(this.directRef, this.classRef)])); - - // reverse the decorators so we execute them in the right order - decorators = decorators.reverse(); - - var _arr3 = decorators; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var decorator = _arr3[_i3]; - var decoratorNode = util.template("class-decorator", { - DECORATOR: decorator.expression, - CLASS_REF: this.classRef - }, true); - decoratorNode.expression._ignoreModulesRemap = true; - this.body.push(decoratorNode); - } - }; - - return ClassTransformer; -})(); - -exports["default"] = ClassTransformer; -module.exports = exports["default"]; -},{"179":179,"182":182,"43":43,"57":57,"60":60,"61":61,"65":65}],94:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -/** - * Turn constants into variables. - * Ensure there are no constant violations in any scope. - * - * @example - * - * **In** - * - * ```javascript - * const MULTIPLIER = 5; - * ``` - * - * **Out** - * - * ```javascript - * var MULTIPLIER = 5; - * ``` - */ - -var visitor = { - - /** - * Look for any constants (or modules) in scope. - * If they have any `constantViolations` throw an error. - */ - - Scope: function Scope(node, parent, scope) { - for (var name in scope.bindings) { - var binding = scope.bindings[name]; - - // not a constant - if (binding.kind !== "const" && binding.kind !== "module") continue; - - var _arr = binding.constantViolations; - for (var _i = 0; _i < _arr.length; _i++) { - var violation = _arr[_i]; - throw violation.errorWithNode(messages.get("readOnly", name)); - } - } - }, - - /** - * Look for constants. - * Turn them into `let` variables. - */ - - VariableDeclaration: function VariableDeclaration(node) { - if (node.kind === "const") node.kind = "let"; - } -}; -exports.visitor = visitor; -},{"43":43}],95:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ForXStatement: function ForXStatement(node, parent, scope, file) { - var left = node.left; - - if (t.isPattern(left)) { - // for ({ length: k } in { abc: 3 }); - - var temp = scope.generateUidIdentifier("ref"); - - node.left = t.variableDeclaration("var", [t.variableDeclarator(temp)]); - - this.ensureBlock(); - - node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(left, temp)])); - - return; - } - - if (!t.isVariableDeclaration(left)) return; - - var pattern = left.declarations[0].id; - if (!t.isPattern(pattern)) return; - - var key = scope.generateUidIdentifier("ref"); - node.left = t.variableDeclaration(left.kind, [t.variableDeclarator(key, null)]); - - var nodes = []; - - var destructuring = new DestructuringTransformer({ - kind: left.kind, - file: file, - scope: scope, - nodes: nodes - }); - - destructuring.init(pattern, key); - - this.ensureBlock(); - - var block = node.body; - block.body = nodes.concat(block.body); - }, - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, file) { - var hasDestructuring = false; - var _arr = node.params; - for (var _i = 0; _i < _arr.length; _i++) { - var pattern = _arr[_i]; - if (t.isPattern(pattern)) { - hasDestructuring = true; - break; - } - } - if (!hasDestructuring) return; - - var nodes = []; - - for (var i = 0; i < node.params.length; i++) { - var pattern = node.params[i]; - if (!t.isPattern(pattern)) continue; - - var ref = scope.generateUidIdentifier("ref"); - if (t.isAssignmentPattern(pattern)) { - var _pattern = pattern; - pattern = pattern.left; - _pattern.left = ref; - } else { - node.params[i] = ref; - } - - t.inherits(ref, pattern); - - var destructuring = new DestructuringTransformer({ - blockHoist: node.params.length - i, - nodes: nodes, - scope: scope, - file: file, - kind: "let" - }); - - destructuring.init(pattern, ref); - } - - this.ensureBlock(); - - var block = node.body; - block.body = nodes.concat(block.body); - }, - - /** - * [Please add a description.] - */ - - CatchClause: function CatchClause(node, parent, scope, file) { - var pattern = node.param; - if (!t.isPattern(pattern)) return; - - var ref = scope.generateUidIdentifier("ref"); - node.param = ref; - - var nodes = []; - - var destructuring = new DestructuringTransformer({ - kind: "let", - file: file, - scope: scope, - nodes: nodes - }); - destructuring.init(pattern, ref); - - node.body.body = nodes.concat(node.body.body); - }, - - /** - * [Please add a description.] - */ - - AssignmentExpression: function AssignmentExpression(node, parent, scope, file) { - if (!t.isPattern(node.left)) return; - - var nodes = []; - - var destructuring = new DestructuringTransformer({ - operator: node.operator, - file: file, - scope: scope, - nodes: nodes - }); - - var ref; - if (this.isCompletionRecord() || !this.parentPath.isExpressionStatement()) { - ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref"); - - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(ref, node.right)])); - - if (t.isArrayExpression(node.right)) { - destructuring.arrays[ref.name] = true; - } - } - - destructuring.init(node.left, ref || node.right); - - if (ref) { - nodes.push(t.expressionStatement(ref)); - } - - return nodes; - }, - - /** - * [Please add a description.] - */ - - VariableDeclaration: function VariableDeclaration(node, parent, scope, file) { - if (t.isForXStatement(parent)) return; - if (!variableDeclarationHasPattern(node)) return; - - var nodes = []; - var declar; - - for (var i = 0; i < node.declarations.length; i++) { - declar = node.declarations[i]; - - var patternId = declar.init; - var pattern = declar.id; - - var destructuring = new DestructuringTransformer({ - nodes: nodes, - scope: scope, - kind: node.kind, - file: file - }); - - if (t.isPattern(pattern)) { - destructuring.init(pattern, patternId); - - if (+i !== node.declarations.length - 1) { - // we aren't the last declarator so let's just make the - // last transformed node inherit from us - t.inherits(nodes[nodes.length - 1], declar); - } - } else { - nodes.push(t.inherits(destructuring.buildVariableAssignment(declar.id, declar.init), declar)); - } - } - - if (!t.isProgram(parent) && !t.isBlockStatement(parent)) { - // https://github.com/babel/babel/issues/113 - // for (let [x] = [0]; false;) {} - - declar = null; - - for (i = 0; i < nodes.length; i++) { - node = nodes[i]; - declar = declar || t.variableDeclaration(node.kind, []); - - if (!t.isVariableDeclaration(node) && declar.kind !== node.kind) { - throw file.errorWithNode(node, messages.get("invalidParentForThisNode")); - } - - declar.declarations = declar.declarations.concat(node.declarations); - } - - return declar; - } - - return nodes; - } -}; - -exports.visitor = visitor; -/** - * Test if a VariableDeclaration's declarations contains any Patterns. - */ - -function variableDeclarationHasPattern(node) { - for (var i = 0; i < node.declarations.length; i++) { - if (t.isPattern(node.declarations[i].id)) { - return true; - } - } - return false; -} - -/** - * Test if an ArrayPattern's elements contain any RestElements. - */ - -function hasRest(pattern) { - for (var i = 0; i < pattern.elements.length; i++) { - if (t.isRestElement(pattern.elements[i])) { - return true; - } - } - return false; -} - -/** - * [Please add a description.] - */ - -var arrayUnpackVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (state.bindings[node.name]) { - state.deopt = true; - this.stop(); - } - } -}; - -/** - * [Please add a description.] - */ - -var DestructuringTransformer = (function () { - function DestructuringTransformer(opts) { - _classCallCheck(this, DestructuringTransformer); - - this.blockHoist = opts.blockHoist; - this.operator = opts.operator; - this.arrays = {}; - this.nodes = opts.nodes || []; - this.scope = opts.scope; - this.file = opts.file; - this.kind = opts.kind; - } - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.buildVariableAssignment = function buildVariableAssignment(id, init) { - var op = this.operator; - if (t.isMemberExpression(id)) op = "="; - - var node; - - if (op) { - node = t.expressionStatement(t.assignmentExpression(op, id, init)); - } else { - node = t.variableDeclaration(this.kind, [t.variableDeclarator(id, init)]); - } - - node._blockHoist = this.blockHoist; - - return node; - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.buildVariableDeclaration = function buildVariableDeclaration(id, init) { - var declar = t.variableDeclaration("var", [t.variableDeclarator(id, init)]); - declar._blockHoist = this.blockHoist; - return declar; - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.push = function push(id, init) { - if (t.isObjectPattern(id)) { - this.pushObjectPattern(id, init); - } else if (t.isArrayPattern(id)) { - this.pushArrayPattern(id, init); - } else if (t.isAssignmentPattern(id)) { - this.pushAssignmentPattern(id, init); - } else { - this.nodes.push(this.buildVariableAssignment(id, init)); - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.toArray = function toArray(node, count) { - if (this.file.isLoose("es6.destructuring") || t.isIdentifier(node) && this.arrays[node.name]) { - return node; - } else { - return this.scope.toArray(node, count); - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushAssignmentPattern = function pushAssignmentPattern(pattern, valueRef) { - // we need to assign the current value of the assignment to avoid evaluating - // it more than once - - var tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef); - - var declar = t.variableDeclaration("var", [t.variableDeclarator(tempValueRef, valueRef)]); - declar._blockHoist = this.blockHoist; - this.nodes.push(declar); - - // - - var tempConditional = t.conditionalExpression(t.binaryExpression("===", tempValueRef, t.identifier("undefined")), pattern.right, tempValueRef); - - var left = pattern.left; - if (t.isPattern(left)) { - var tempValueDefault = t.expressionStatement(t.assignmentExpression("=", tempValueRef, tempConditional)); - tempValueDefault._blockHoist = this.blockHoist; - - this.nodes.push(tempValueDefault); - this.push(left, tempValueRef); - } else { - this.nodes.push(this.buildVariableAssignment(left, tempConditional)); - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushObjectSpread = function pushObjectSpread(pattern, objRef, spreadProp, spreadPropIndex) { - // get all the keys that appear in this object before the current spread - - var keys = []; - - for (var i = 0; i < pattern.properties.length; i++) { - var prop = pattern.properties[i]; - - // we've exceeded the index of the spread property to all properties to the - // right need to be ignored - if (i >= spreadPropIndex) break; - - // ignore other spread properties - if (t.isSpreadProperty(prop)) continue; - - var key = prop.key; - if (t.isIdentifier(key) && !prop.computed) key = t.literal(prop.key.name); - keys.push(key); - } - - keys = t.arrayExpression(keys); - - // - - var value = t.callExpression(this.file.addHelper("object-without-properties"), [objRef, keys]); - this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value)); - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushObjectProperty = function pushObjectProperty(prop, propRef) { - if (t.isLiteral(prop.key)) prop.computed = true; - - var pattern = prop.value; - var objRef = t.memberExpression(propRef, prop.key, prop.computed); - - if (t.isPattern(pattern)) { - this.push(pattern, objRef); - } else { - this.nodes.push(this.buildVariableAssignment(pattern, objRef)); - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushObjectPattern = function pushObjectPattern(pattern, objRef) { - // https://github.com/babel/babel/issues/681 - - if (!pattern.properties.length) { - this.nodes.push(t.expressionStatement(t.callExpression(this.file.addHelper("object-destructuring-empty"), [objRef]))); - } - - // if we have more than one properties in this pattern and the objectRef is a - // member expression then we need to assign it to a temporary variable so it's - // only evaluated once - - if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) { - var temp = this.scope.generateUidIdentifierBasedOnNode(objRef); - this.nodes.push(this.buildVariableDeclaration(temp, objRef)); - objRef = temp; - } - - // - - for (var i = 0; i < pattern.properties.length; i++) { - var prop = pattern.properties[i]; - if (t.isSpreadProperty(prop)) { - this.pushObjectSpread(pattern, objRef, prop, i); - } else { - this.pushObjectProperty(prop, objRef); - } - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.canUnpackArrayPattern = function canUnpackArrayPattern(pattern, arr) { - // not an array so there's no way we can deal with this - if (!t.isArrayExpression(arr)) return false; - - // pattern has less elements than the array and doesn't have a rest so some - // elements wont be evaluated - if (pattern.elements.length > arr.elements.length) return; - if (pattern.elements.length < arr.elements.length && !hasRest(pattern)) return false; - - var _arr2 = pattern.elements; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var elem = _arr2[_i2]; - // deopt on holes - if (!elem) return false; - - // deopt on member expressions as they may be included in the RHS - if (t.isMemberExpression(elem)) return false; - } - - var _arr3 = arr.elements; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var elem = _arr3[_i3]; - // deopt on spread elements - if (t.isSpreadElement(elem)) return false; - } - - // deopt on reference to left side identifiers - var bindings = t.getBindingIdentifiers(pattern); - var state = { deopt: false, bindings: bindings }; - this.scope.traverse(arr, arrayUnpackVisitor, state); - return !state.deopt; - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushUnpackedArrayPattern = function pushUnpackedArrayPattern(pattern, arr) { - for (var i = 0; i < pattern.elements.length; i++) { - var elem = pattern.elements[i]; - if (t.isRestElement(elem)) { - this.push(elem.argument, t.arrayExpression(arr.elements.slice(i))); - } else { - this.push(elem, arr.elements[i]); - } - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.pushArrayPattern = function pushArrayPattern(pattern, arrayRef) { - if (!pattern.elements) return; - - // optimise basic array destructuring of an array expression - // - // we can't do this to a pattern of unequal size to it's right hand - // array expression as then there will be values that wont be evaluated - // - // eg: var [a, b] = [1, 2]; - - if (this.canUnpackArrayPattern(pattern, arrayRef)) { - return this.pushUnpackedArrayPattern(pattern, arrayRef); - } - - // if we have a rest then we need all the elements so don't tell - // `scope.toArray` to only get a certain amount - - var count = !hasRest(pattern) && pattern.elements.length; - - // so we need to ensure that the `arrayRef` is an array, `scope.toArray` will - // return a locally bound identifier if it's been inferred to be an array, - // otherwise it'll be a call to a helper that will ensure it's one - - var toArray = this.toArray(arrayRef, count); - - if (t.isIdentifier(toArray)) { - // we've been given an identifier so it must have been inferred to be an - // array - arrayRef = toArray; - } else { - arrayRef = this.scope.generateUidIdentifierBasedOnNode(arrayRef); - this.arrays[arrayRef.name] = true; - this.nodes.push(this.buildVariableDeclaration(arrayRef, toArray)); - } - - // - - for (var i = 0; i < pattern.elements.length; i++) { - var elem = pattern.elements[i]; - - // hole - if (!elem) continue; - - var elemRef; - - if (t.isRestElement(elem)) { - elemRef = this.toArray(arrayRef); - - if (i > 0) { - elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.literal(i)]); - } - - // set the element to the rest element argument since we've dealt with it - // being a rest already - elem = elem.argument; - } else { - elemRef = t.memberExpression(arrayRef, t.literal(i), true); - } - - this.push(elem, elemRef); - } - }; - - /** - * [Please add a description.] - */ - - DestructuringTransformer.prototype.init = function init(pattern, ref) { - // trying to destructure a value that we can't evaluate more than once so we - // need to save it to a variable - - if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) { - var memo = this.scope.maybeGenerateMemoised(ref, true); - if (memo) { - this.nodes.push(this.buildVariableDeclaration(memo, ref)); - ref = memo; - } - } - - // - - this.push(pattern, ref); - - return this.nodes; - }; - - return DestructuringTransformer; -})(); -},{"179":179,"43":43}],96:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports._ForOfStatementArray = _ForOfStatementArray; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ForOfStatement: function ForOfStatement(node, parent, scope, file) { - if (this.get("right").isArrayExpression()) { - return _ForOfStatementArray.call(this, node, scope, file); - } - - var callback = spec; - if (file.isLoose("es6.forOf")) callback = loose; - - var build = callback(node, parent, scope, file); - var declar = build.declar; - var loop = build.loop; - var block = loop.body; - - // ensure that it's a block so we can take all its statements - this.ensureBlock(); - - // add the value declaration to the new loop body - if (declar) { - block.body.push(declar); - } - - // push the rest of the original loop body onto our new body - block.body = block.body.concat(node.body.body); - - t.inherits(loop, node); - t.inherits(loop.body, node.body); - - if (build.replaceParent) { - this.parentPath.replaceWithMultiple(build.node); - this.dangerouslyRemove(); - } else { - return build.node; - } - } -}; - -exports.visitor = visitor; -/** - * [Please add a description.] - */ - -function _ForOfStatementArray(node, scope) { - var nodes = []; - var right = node.right; - - if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) { - var uid = scope.generateUidIdentifier("arr"); - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, right)])); - right = uid; - } - - var iterationKey = scope.generateUidIdentifier("i"); - - var loop = util.template("for-of-array", { - BODY: node.body, - KEY: iterationKey, - ARR: right - }); - - t.inherits(loop, node); - t.ensureBlock(loop); - - var iterationValue = t.memberExpression(right, iterationKey, true); - - var left = node.left; - if (t.isVariableDeclaration(left)) { - left.declarations[0].init = iterationValue; - loop.body.body.unshift(left); - } else { - loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue))); - } - - if (this.parentPath.isLabeledStatement()) { - loop = t.labeledStatement(this.parentPath.node.label, loop); - } - - nodes.push(loop); - - return nodes; -} - -/** - * [Please add a description.] - */ - -var loose = function loose(node, parent, scope, file) { - var left = node.left; - var declar, id; - - if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { - // for (i of test), for ({ i } of test) - id = left; - } else if (t.isVariableDeclaration(left)) { - // for (var i of test) - id = scope.generateUidIdentifier("ref"); - declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, id)]); - } else { - throw file.errorWithNode(left, messages.get("unknownForHead", left.type)); - } - - var iteratorKey = scope.generateUidIdentifier("iterator"); - var isArrayKey = scope.generateUidIdentifier("isArray"); - - var loop = util.template("for-of-loose", { - LOOP_OBJECT: iteratorKey, - IS_ARRAY: isArrayKey, - OBJECT: node.right, - INDEX: scope.generateUidIdentifier("i"), - ID: id - }); - - if (!declar) { - // no declaration so we need to remove the variable declaration at the top of - // the for-of-loose template - loop.body.body.shift(); - } - - // - - return { - declar: declar, - node: loop, - loop: loop - }; -}; - -/** - * [Please add a description.] - */ - -var spec = function spec(node, parent, scope, file) { - var left = node.left; - var declar; - - var stepKey = scope.generateUidIdentifier("step"); - var stepValue = t.memberExpression(stepKey, t.identifier("value")); - - if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { - // for (i of test), for ({ i } of test) - declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue)); - } else if (t.isVariableDeclaration(left)) { - // for (var i of test) - declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]); - } else { - throw file.errorWithNode(left, messages.get("unknownForHead", left.type)); - } - - // - - var iteratorKey = scope.generateUidIdentifier("iterator"); - - var template = util.template("for-of", { - ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), - ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), - ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), - ITERATOR_KEY: iteratorKey, - STEP_KEY: stepKey, - OBJECT: node.right, - BODY: null - }); - - var isLabeledParent = t.isLabeledStatement(parent); - - var tryBody = template[3].block.body; - var loop = tryBody[0]; - - if (isLabeledParent) { - tryBody[0] = t.labeledStatement(parent.label, loop); - } - - // - - return { - replaceParent: isLabeledParent, - declar: declar, - loop: loop, - node: template - }; -}; -},{"179":179,"182":182,"43":43}],97:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -var visitor = { - Literal: function Literal(node) { - // number octal like 0b10 or 0o70 - if (typeof node.value === "number" && /^0[ob]/i.test(node.raw)) { - node.raw = undefined; - } - - // unicode escape - if (typeof node.value === "string" && /\\[u]/gi.test(node.raw)) { - node.raw = undefined; - } - } -}; -exports.visitor = visitor; -},{}],98:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -function keepBlockHoist(node, nodes) { - if (node._blockHoist) { - for (var i = 0; i < nodes.length; i++) { - nodes[i]._blockHoist = node._blockHoist; - } - } -} - -var metadata = { - group: "builtin-modules" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ImportDeclaration: function ImportDeclaration(node, parent, scope, file) { - // flow type - if (node.importKind === "type" || node.importKind === "typeof") return; - - var nodes = []; - - if (node.specifiers.length) { - var _arr = node.specifiers; - - for (var _i = 0; _i < _arr.length; _i++) { - var specifier = _arr[_i]; - file.moduleFormatter.importSpecifier(specifier, node, nodes, scope); - } - } else { - file.moduleFormatter.importDeclaration(node, nodes, scope); - } - - if (nodes.length === 1) { - // inherit `_blockHoist` - this is for `_blockHoist` in File.prototype.addImport - nodes[0]._blockHoist = node._blockHoist; - } - - return nodes; - }, - - /** - * [Please add a description.] - */ - - ExportAllDeclaration: function ExportAllDeclaration(node, parent, scope, file) { - var nodes = []; - file.moduleFormatter.exportAllDeclaration(node, nodes, scope); - keepBlockHoist(node, nodes); - return nodes; - }, - - /** - * [Please add a description.] - */ - - ExportDefaultDeclaration: function ExportDefaultDeclaration(node, parent, scope, file) { - var nodes = []; - file.moduleFormatter.exportDeclaration(node, nodes, scope); - keepBlockHoist(node, nodes); - return nodes; - }, - - /** - * [Please add a description.] - */ - - ExportNamedDeclaration: function ExportNamedDeclaration(node, parent, scope, file) { - // flow type - if (this.get("declaration").isTypeAlias()) return; - - var nodes = []; - - if (node.declaration) { - // make sure variable exports have an initializer - // this is done here to avoid duplicating it in the module formatters - if (t.isVariableDeclaration(node.declaration)) { - var declar = node.declaration.declarations[0]; - declar.init = declar.init || t.identifier("undefined"); - } - - file.moduleFormatter.exportDeclaration(node, nodes, scope); - } else if (node.specifiers) { - for (var i = 0; i < node.specifiers.length; i++) { - file.moduleFormatter.exportSpecifier(node.specifiers[i], node, nodes, scope); - } - } - - keepBlockHoist(node, nodes); - - return nodes; - } -}; -exports.visitor = visitor; -},{"179":179}],99:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersReplaceSupers = _dereq_(65); - -var _helpersReplaceSupers2 = _interopRequireDefault(_helpersReplaceSupers); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function Property(path, node, scope, getObjectRef, file) { - if (!node.method && node.kind === "init") return; - if (!t.isFunction(node.value)) return; - - var replaceSupers = new _helpersReplaceSupers2["default"]({ - getObjectRef: getObjectRef, - methodNode: node, - methodPath: path, - isStatic: true, - scope: scope, - file: file - }); - - replaceSupers.replace(); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ObjectExpression: function ObjectExpression(node, parent, scope, file) { - var objectRef; - var getObjectRef = function getObjectRef() { - return objectRef = objectRef || scope.generateUidIdentifier("obj"); - }; - - var propPaths = this.get("properties"); - for (var i = 0; i < node.properties.length; i++) { - Property(propPaths[i], node.properties[i], scope, getObjectRef, file); - } - - if (objectRef) { - scope.push({ id: objectRef }); - return t.assignmentExpression("=", objectRef, node); - } - } -}; -exports.visitor = visitor; -},{"179":179,"65":65}],100:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersCallDelegate = _dereq_(56); - -var _helpersCallDelegate2 = _interopRequireDefault(_helpersCallDelegate); - -var _helpersGetFunctionArity = _dereq_(59); - -var _helpersGetFunctionArity2 = _interopRequireDefault(_helpersGetFunctionArity); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var hasDefaults = function hasDefaults(node) { - for (var i = 0; i < node.params.length; i++) { - if (!t.isIdentifier(node.params[i])) return true; - } - return false; -}; - -/** - * [Please add a description.] - */ - -var iifeVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (node.name !== "eval") { - if (!state.scope.hasOwnBinding(node.name)) return; - if (state.scope.bindingIdentifierEquals(node.name, node)) return; - } - - state.iife = true; - this.stop(); - } -}; - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, file) { - if (!hasDefaults(node)) return; - - // ensure it's a block, useful for arrow functions - this.ensureBlock(); - - var state = { - iife: false, - scope: scope - }; - - var body = []; - - // - var argsIdentifier = t.identifier("arguments"); - argsIdentifier._shadowedFunctionLiteral = this; - - // push a default parameter definition - function pushDefNode(left, right, i) { - var defNode; - if (exceedsLastNonDefault(i) || t.isPattern(left) || file.transformers["es6.spec.blockScoping"].canTransform()) { - defNode = util.template("default-parameter", { - VARIABLE_NAME: left, - DEFAULT_VALUE: right, - ARGUMENT_KEY: t.literal(i), - ARGUMENTS: argsIdentifier - }, true); - } else { - defNode = util.template("default-parameter-assign", { - VARIABLE_NAME: left, - DEFAULT_VALUE: right - }, true); - } - defNode._blockHoist = node.params.length - i; - body.push(defNode); - } - - // check if an index exceeds the functions arity - function exceedsLastNonDefault(i) { - return i + 1 > lastNonDefaultParam; - } - - // - var lastNonDefaultParam = _helpersGetFunctionArity2["default"](node); - - // - var params = this.get("params"); - for (var i = 0; i < params.length; i++) { - var param = params[i]; - - if (!param.isAssignmentPattern()) { - if (!param.isIdentifier()) { - param.traverse(iifeVisitor, state); - } - - if (file.transformers["es6.spec.blockScoping"].canTransform() && param.isIdentifier()) { - pushDefNode(param.node, t.identifier("undefined"), i); - } - - continue; - } - - var left = param.get("left"); - var right = param.get("right"); - - if (exceedsLastNonDefault(i) || left.isPattern()) { - var placeholder = scope.generateUidIdentifier("x"); - placeholder._isDefaultPlaceholder = true; - node.params[i] = placeholder; - } else { - node.params[i] = left.node; - } - - if (!state.iife) { - if (right.isIdentifier() && scope.hasOwnBinding(right.node.name)) { - state.iife = true; - } else { - right.traverse(iifeVisitor, state); - } - } - - pushDefNode(left.node, right.node, i); - } - - // we need to cut off all trailing default parameters - node.params = node.params.slice(0, lastNonDefaultParam); - - if (state.iife) { - body.push(_helpersCallDelegate2["default"](node, scope)); - node.body = t.blockStatement(body); - } else { - node.body.body = body.concat(node.body.body); - } - } -}; -exports.visitor = visitor; -},{"179":179,"182":182,"56":56,"59":59}],101:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _traversalVisitors = _dereq_(168); - -var visitors = _interopRequireWildcard(_traversalVisitors); - -var _default = _dereq_(100); - -var def = _interopRequireWildcard(_default); - -var _rest = _dereq_(102); - -var rest = _interopRequireWildcard(_rest); - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = visitors.merge([rest.visitor, def.visitor]); -exports.visitor = visitor; -},{"100":100,"102":102,"168":168}],102:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var memberExpressionOptimisationVisitor = { - - /** - * [Please add a description.] - */ - - Scope: function Scope(node, parent, scope, state) { - // check if this scope has a local binding that will shadow the rest parameter - if (!scope.bindingIdentifierEquals(state.name, state.outerBinding)) { - this.skip(); - } - }, - - /** - * [Please add a description.] - */ - - Flow: function Flow() { - // don't touch reference in type annotations - this.skip(); - }, - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, state) { - // skip over functions as whatever `arguments` we reference inside will refer - // to the wrong function - var oldNoOptimise = state.noOptimise; - state.noOptimise = true; - this.traverse(memberExpressionOptimisationVisitor, state); - state.noOptimise = oldNoOptimise; - this.skip(); - }, - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - // we can't guarantee the purity of arguments - if (node.name === "arguments") { - state.deopted = true; - } - - // is this a referenced identifier and is it referencing the rest parameter? - if (node.name !== state.name) return; - - if (state.noOptimise) { - state.deopted = true; - } else { - if (this.parentPath.isMemberExpression({ computed: true, object: node })) { - // if we know that this member expression is referencing a number then we can safely - // optimise it - var prop = this.parentPath.get("property"); - if (prop.isBaseType("number")) { - state.candidates.push(this); - return; - } - } - - // optimise single spread args in calls - if (this.parentPath.isSpreadElement() && state.offset === 0) { - var call = this.parentPath.parentPath; - if (call.isCallExpression() && call.node.arguments.length === 1) { - state.candidates.push(this); - return; - } - } - - state.references.push(this); - } - }, - - /** - * Deopt on use of a binding identifier with the same name as our rest param. - * - * See https://github.com/babel/babel/issues/2091 - */ - - BindingIdentifier: function BindingIdentifier(node, parent, scope, state) { - if (node.name === state.name) { - state.deopted = true; - } - } -}; - -/** - * [Please add a description.] - */ - -function optimiseMemberExpression(parent, offset) { - if (offset === 0) return; - - var newExpr; - var prop = parent.property; - - if (t.isLiteral(prop)) { - prop.value += offset; - prop.raw = String(prop.value); - } else { - // // UnaryExpression, BinaryExpression - newExpr = t.binaryExpression("+", prop, t.literal(offset)); - parent.property = newExpr; - } -} - -/** - * [Please add a description.] - */ - -function hasRest(node) { - return t.isRestElement(node.params[node.params.length - 1]); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope) { - if (!hasRest(node)) return; - - var restParam = node.params.pop(); - var rest = restParam.argument; - - var argsId = t.identifier("arguments"); - - // otherwise `arguments` will be remapped in arrow functions - argsId._shadowedFunctionLiteral = this; - - // support patterns - if (t.isPattern(rest)) { - var pattern = rest; - rest = scope.generateUidIdentifier("ref"); - - var declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) { - var accessExpr = t.memberExpression(rest, t.literal(index), true); - return t.variableDeclarator(elem, accessExpr); - })); - node.body.body.unshift(declar); - } - - // check and optimise for extremely common cases - var state = { - references: [], - offset: node.params.length, - - argumentsNode: argsId, - outerBinding: scope.getBindingIdentifier(rest.name), - - // candidate member expressions we could optimise if there are no other references - candidates: [], - - // local rest binding name - name: rest.name, - - // whether any references to the rest parameter were made in a function - deopted: false - }; - - this.traverse(memberExpressionOptimisationVisitor, state); - - if (!state.deopted && !state.references.length) { - // we only have shorthands and there are no other references - if (state.candidates.length) { - var _arr = state.candidates; - - for (var _i = 0; _i < _arr.length; _i++) { - var candidate = _arr[_i]; - candidate.replaceWith(argsId); - if (candidate.parentPath.isMemberExpression()) { - optimiseMemberExpression(candidate.parent, state.offset); - } - } - } - return; - } else { - state.references = state.references.concat(state.candidates); - } - - // deopt shadowed functions as transforms like regenerator may try touch the allocation loop - state.deopted = state.deopted || !!node.shadow; - - // - - var start = t.literal(node.params.length); - var key = scope.generateUidIdentifier("key"); - var len = scope.generateUidIdentifier("len"); - - var arrKey = key; - var arrLen = len; - if (node.params.length) { - // this method has additional params, so we need to subtract - // the index of the current argument position from the - // position in the array that we want to populate - arrKey = t.binaryExpression("-", key, start); - - // we need to work out the size of the array that we're - // going to store all the rest parameters - // - // we need to add a check to avoid constructing the array - // with <0 if there are less arguments than params as it'll - // cause an error - arrLen = t.conditionalExpression(t.binaryExpression(">", len, start), t.binaryExpression("-", len, start), t.literal(0)); - } - - var loop = util.template("rest", { - ARRAY_TYPE: restParam.typeAnnotation, - ARGUMENTS: argsId, - ARRAY_KEY: arrKey, - ARRAY_LEN: arrLen, - START: start, - ARRAY: rest, - KEY: key, - LEN: len - }); - - if (state.deopted) { - loop._blockHoist = node.params.length + 1; - node.body.body.unshift(loop); - } else { - // perform allocation at the lowest common denominator of all references - loop._blockHoist = 1; - - var target = this.getEarliestCommonAncestorFrom(state.references).getStatementParent(); - - // don't perform the allocation inside a loop - var highestLoop; - target.findParent(function (path) { - if (path.isLoop()) { - highestLoop = path; - } else if (path.isFunction()) { - // stop crawling up for functions - return true; - } - }); - if (highestLoop) target = highestLoop; - - target.insertBefore(loop); - } - } -}; -exports.visitor = visitor; -},{"179":179,"182":182}],103:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function loose(node, body, objId) { - var _arr = node.properties; - - for (var _i = 0; _i < _arr.length; _i++) { - var prop = _arr[_i]; - body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(objId, prop.key, prop.computed || t.isLiteral(prop.key)), prop.value))); - } -} - -/** - * [Please add a description.] - */ - -function spec(node, body, objId, initProps, file) { - // add a simple assignment for all Symbol member expressions due to symbol polyfill limitations - // otherwise use Object.defineProperty - - var _arr2 = node.properties; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var prop = _arr2[_i2]; - // this wont work with Object.defineProperty - if (t.isLiteral(t.toComputedKey(prop), { value: "__proto__" })) { - initProps.push(prop); - continue; - } - - var key = prop.key; - if (t.isIdentifier(key) && !prop.computed) { - key = t.literal(key.name); - } - - var bodyNode = t.callExpression(file.addHelper("define-property"), [objId, key, prop.value]); - - body.push(t.expressionStatement(bodyNode)); - } - - // only one node and it's a Object.defineProperty that returns the object - - if (body.length === 1) { - var first = body[0].expression; - - if (t.isCallExpression(first)) { - first.arguments[0] = t.objectExpression(initProps); - return first; - } - } -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ObjectExpression: { - exit: function exit(node, parent, scope, file) { - var hasComputed = false; - - var _arr3 = node.properties; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var prop = _arr3[_i3]; - hasComputed = t.isProperty(prop, { computed: true, kind: "init" }); - if (hasComputed) break; - } - - if (!hasComputed) return; - - // put all getters/setters into the first object expression as well as all initialisers up - // to the first computed property - - var initProps = []; - var stopInits = false; - - node.properties = node.properties.filter(function (prop) { - if (prop.computed) { - stopInits = true; - } - - if (prop.kind !== "init" || !stopInits) { - initProps.push(prop); - return false; - } else { - return true; - } - }); - - // - - var objId = scope.generateUidIdentifierBasedOnNode(parent); - - // - - var body = []; - - // - - var callback = spec; - if (file.isLoose("es6.properties.computed")) callback = loose; - - var result = callback(node, body, objId, initProps, file); - if (result) return result; - - // - - body.unshift(t.variableDeclaration("var", [t.variableDeclarator(objId, t.objectExpression(initProps))])); - - body.push(t.expressionStatement(objId)); - - return body; - } - } -}; -exports.visitor = visitor; -},{"179":179}],104:[function(_dereq_,module,exports){ -/** - * [Please add a description.] - */ - -"use strict"; - -exports.__esModule = true; -var visitor = { - - /** - * [Please add a description.] - */ - - Property: function Property(node) { - if (node.method) { - node.method = false; - } - - if (node.shorthand) { - node.shorthand = false; - } - } -}; -exports.visitor = visitor; -},{}],105:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _helpersRegex = _dereq_(63); - -var regex = _interopRequireWildcard(_helpersRegex); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Literal: function Literal(node) { - if (!regex.is(node, "y")) return; - return t.newExpression(t.identifier("RegExp"), [t.literal(node.regex.pattern), t.literal(node.regex.flags)]); - } -}; -exports.visitor = visitor; -},{"179":179,"63":63}],106:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _regexpuRewritePattern = _dereq_(591); - -var _regexpuRewritePattern2 = _interopRequireDefault(_regexpuRewritePattern); - -var _helpersRegex = _dereq_(63); - -var regex = _interopRequireWildcard(_helpersRegex); - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Literal: function Literal(node) { - if (!regex.is(node, "u")) return; - node.regex.pattern = _regexpuRewritePattern2["default"](node.regex.pattern, node.regex.flags); - regex.pullFlag(node, "u"); - } -}; -exports.visitor = visitor; -},{"591":591,"63":63}],107:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre", - optional: true -}; - -exports.metadata = metadata; -var visitor = { - ArrowFunctionExpression: function ArrowFunctionExpression(node, parent, scope, file) { - if (node.shadow) return; - node.shadow = { "this": false }; - - var boundThis = t.thisExpression(); - boundThis._forceShadow = this; - - // make sure that arrow function won't be instantiated - t.ensureBlock(node); - this.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(file.addHelper("new-arrow-check"), [t.thisExpression(), boundThis]))); - - return t.callExpression(t.memberExpression(node, t.identifier("bind")), [t.thisExpression()]); - } -}; -exports.visitor = visitor; -},{"179":179}],108:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function buildAssert(node, file) { - return t.callExpression(file.addHelper("temporal-assert-defined"), [node, t.literal(node.name), file.addHelper("temporal-undefined")]); -} - -/** - * [Please add a description.] - */ - -function references(node, scope, state) { - var declared = state.letRefs[node.name]; - if (!declared) return false; - - // declared node is different in this scope - return scope.getBindingIdentifier(node.name) === declared; -} - -/** - * [Please add a description.] - */ - -var refVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (t.isFor(parent) && parent.left === node) return; - - if (!references(node, scope, state)) return; - - var assert = buildAssert(node, state.file); - - this.skip(); - - if (t.isUpdateExpression(parent)) { - if (parent._ignoreBlockScopingTDZ) return; - this.parentPath.replaceWith(t.sequenceExpression([assert, parent])); - } else { - return t.logicalExpression("&&", assert, node); - } - }, - - /** - * [Please add a description.] - */ - - AssignmentExpression: { - exit: function exit(node, parent, scope, state) { - if (node._ignoreBlockScopingTDZ) return; - - var nodes = []; - var ids = this.getBindingIdentifiers(); - - for (var name in ids) { - var id = ids[name]; - - if (references(id, scope, state)) { - nodes.push(buildAssert(id, state.file)); - } - } - - if (nodes.length) { - node._ignoreBlockScopingTDZ = true; - nodes.push(node); - return nodes.map(t.expressionStatement); - } - } - } -}; - -var metadata = { - optional: true, - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - "Program|Loop|BlockStatement": { - exit: function exit(node, parent, scope, file) { - var letRefs = node._letReferences; - if (!letRefs) return; - - this.traverse(refVisitor, { - letRefs: letRefs, - file: file - }); - } - } -}; -exports.visitor = visitor; -},{"179":179}],109:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre", - optional: true -}; - -exports.metadata = metadata; -var visitor = { - Program: function Program() { - var id = this.scope.generateUidIdentifier("null"); - this.unshiftContainer("body", [t.variableDeclaration("var", [t.variableDeclarator(id, t.literal(null))]), t.exportNamedDeclaration(null, [t.exportSpecifier(id, t.identifier("__proto__"))])]); - } -}; -exports.visitor = visitor; -},{"179":179}],110:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - UnaryExpression: function UnaryExpression(node, parent, scope, file) { - if (node._ignoreSpecSymbols) return; - - if (this.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) { - // optimise `typeof foo === "string"` since we can determine that they'll never need to handle symbols - var opposite = this.getOpposite(); - if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") return; - } - - if (node.operator === "typeof") { - var call = t.callExpression(file.addHelper("typeof"), [node.argument]); - if (this.get("argument").isIdentifier()) { - var undefLiteral = t.literal("undefined"); - var unary = t.unaryExpression("typeof", node.argument); - unary._ignoreSpecSymbols = true; - return t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call); - } else { - return call; - } - } - }, - - /** - * [Please add a description.] - */ - - BinaryExpression: function BinaryExpression(node, parent, scope, file) { - if (node.operator === "instanceof") { - return t.callExpression(file.addHelper("instanceof"), [node.left, node.right]); - } - }, - - /** - * [Please add a description.] - */ - - "VariableDeclaration|FunctionDeclaration": function VariableDeclarationFunctionDeclaration(node) { - if (node._generated) this.skip(); - } -}; -exports.visitor = visitor; -},{"179":179}],111:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true, - group: "builtin-pre" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - TemplateLiteral: function TemplateLiteral(node, parent) { - if (t.isTaggedTemplateExpression(parent)) return; - - for (var i = 0; i < node.expressions.length; i++) { - node.expressions[i] = t.callExpression(t.identifier("String"), [node.expressions[i]]); - } - } -}; -exports.visitor = visitor; -},{"179":179}],112:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function getSpreadLiteral(spread, scope) { - if (scope.hub.file.isLoose("es6.spread") && !t.isIdentifier(spread.argument, { name: "arguments" })) { - return spread.argument; - } else { - return scope.toArray(spread.argument, true); - } -} - -/** - * [Please add a description.] - */ - -function hasSpread(nodes) { - for (var i = 0; i < nodes.length; i++) { - if (t.isSpreadElement(nodes[i])) { - return true; - } - } - return false; -} - -/** - * [Please add a description.] - */ - -function build(props, scope) { - var nodes = []; - - var _props = []; - - var push = function push() { - if (!_props.length) return; - nodes.push(t.arrayExpression(_props)); - _props = []; - }; - - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (t.isSpreadElement(prop)) { - push(); - nodes.push(getSpreadLiteral(prop, scope)); - } else { - _props.push(prop); - } - } - - push(); - - return nodes; -} - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ArrayExpression: function ArrayExpression(node, parent, scope) { - var elements = node.elements; - if (!hasSpread(elements)) return; - - var nodes = build(elements, scope); - var first = nodes.shift(); - - if (!t.isArrayExpression(first)) { - nodes.unshift(first); - first = t.arrayExpression([]); - } - - return t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes); - }, - - /** - * [Please add a description.] - */ - - CallExpression: function CallExpression(node, parent, scope) { - var args = node.arguments; - if (!hasSpread(args)) return; - - var contextLiteral = t.identifier("undefined"); - - node.arguments = []; - - var nodes; - if (args.length === 1 && args[0].argument.name === "arguments") { - nodes = [args[0].argument]; - } else { - nodes = build(args, scope); - } - - var first = nodes.shift(); - if (nodes.length) { - node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes)); - } else { - node.arguments.push(first); - } - - var callee = node.callee; - - if (this.get("callee").isMemberExpression()) { - var temp = scope.maybeGenerateMemoised(callee.object); - if (temp) { - callee.object = t.assignmentExpression("=", temp, callee.object); - contextLiteral = temp; - } else { - contextLiteral = callee.object; - } - t.appendToMemberExpression(callee, t.identifier("apply")); - } else { - node.callee = t.memberExpression(node.callee, t.identifier("apply")); - } - - node.arguments.unshift(contextLiteral); - }, - - /** - * [Please add a description.] - */ - - NewExpression: function NewExpression(node, parent, scope, file) { - var args = node.arguments; - if (!hasSpread(args)) return; - - var nodes = build(args, scope); - - var context = t.arrayExpression([t.literal(null)]); - - args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes); - - return t.newExpression(t.callExpression(t.memberExpression(file.addHelper("bind"), t.identifier("apply")), [node.callee, args]), []); - } -}; -exports.visitor = visitor; -},{"179":179}],113:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _lodashCollectionReduceRight = _dereq_(423); - -var _lodashCollectionReduceRight2 = _interopRequireDefault(_lodashCollectionReduceRight); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _lodashArrayFlatten = _dereq_(414); - -var _lodashArrayFlatten2 = _interopRequireDefault(_lodashArrayFlatten); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _lodashCollectionMap = _dereq_(422); - -var _lodashCollectionMap2 = _interopRequireDefault(_lodashCollectionMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, file) { - if (node.generator || node.async) return; - var tailCall = new TailCallTransformer(this, scope, file); - tailCall.run(); - } -}; - -exports.visitor = visitor; -/** - * [Please add a description.] - */ - -function returnBlock(expr) { - return t.blockStatement([t.returnStatement(expr)]); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - enter: function enter(node, parent) { - if (t.isTryStatement(parent)) { - if (node === parent.block) { - this.skip(); - } else if (parent.finalizer && node !== parent.finalizer) { - this.skip(); - } - } - }, - - /** - * [Please add a description.] - */ - - ReturnStatement: function ReturnStatement(node, parent, scope, state) { - return state.subTransform(node.argument); - }, - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - VariableDeclaration: function VariableDeclaration(node, parent, scope, state) { - state.vars.push(node); - }, - - /** - * [Please add a description.] - */ - - ThisExpression: function ThisExpression(node, parent, scope, state) { - if (!state.isShadowed) { - state.needsThis = true; - state.thisPaths.push(this); - } - }, - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (node.name === "arguments" && (!state.isShadowed || node._shadowedFunctionLiteral)) { - state.needsArguments = true; - state.argumentsPaths.push(this); - } - } -}; - -/** - * [Please add a description.] - */ - -var TailCallTransformer = (function () { - function TailCallTransformer(path, scope, file) { - _classCallCheck(this, TailCallTransformer); - - this.hasTailRecursion = false; - - this.needsArguments = false; - this.argumentsPaths = []; - this.setsArguments = false; - - this.needsThis = false; - this.thisPaths = []; - - this.isShadowed = path.isArrowFunctionExpression() || path.is("shadow"); - this.ownerId = path.node.id; - this.vars = []; - - this.scope = scope; - this.path = path; - this.file = file; - this.node = path.node; - } - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getArgumentsId = function getArgumentsId() { - return this.argumentsId = this.argumentsId || this.scope.generateUidIdentifier("arguments"); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getThisId = function getThisId() { - return this.thisId = this.thisId || this.scope.generateUidIdentifier("this"); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getLeftId = function getLeftId() { - return this.leftId = this.leftId || this.scope.generateUidIdentifier("left"); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getFunctionId = function getFunctionId() { - return this.functionId = this.functionId || this.scope.generateUidIdentifier("function"); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getAgainId = function getAgainId() { - return this.againId = this.againId || this.scope.generateUidIdentifier("again"); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.getParams = function getParams() { - var params = this.params; - - if (!params) { - params = this.node.params; - this.paramDecls = []; - - for (var i = 0; i < params.length; i++) { - var param = params[i]; - if (!param._isDefaultPlaceholder) { - this.paramDecls.push(t.variableDeclarator(param, params[i] = this.scope.generateUidIdentifier("x"))); - } - } - } - - return this.params = params; - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.hasDeopt = function hasDeopt() { - // check if the ownerId has been reassigned, if it has then it's not safe to - // perform optimisations - var ownerIdInfo = this.scope.getBinding(this.ownerId.name); - return ownerIdInfo && !ownerIdInfo.constant; - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.run = function run() { - var node = this.node; - - // only tail recursion can be optimized as for now, so we can skip anonymous - // functions entirely - var ownerId = this.ownerId; - if (!ownerId) return; - - // traverse the function and look for tail recursion - this.path.traverse(visitor, this); - - // has no tail call recursion - if (!this.hasTailRecursion) return; - - // the function binding isn't constant so we can't be sure that it's the same function :( - if (this.hasDeopt()) { - this.file.log.deopt(node, messages.get("tailCallReassignmentDeopt")); - return; - } - - // - - var body = this.path.ensureBlock().body; - - for (var i = 0; i < body.length; i++) { - var bodyNode = body[i]; - if (!t.isFunctionDeclaration(bodyNode)) continue; - - bodyNode = body[i] = t.variableDeclaration("var", [t.variableDeclarator(bodyNode.id, t.toExpression(bodyNode))]); - bodyNode._blockHoist = 2; - } - - var paramDecls = this.paramDecls; - if (paramDecls.length > 0) { - var paramDecl = t.variableDeclaration("var", paramDecls); - paramDecl._blockHoist = Infinity; - body.unshift(paramDecl); - } - - body.unshift(t.expressionStatement(t.assignmentExpression("=", this.getAgainId(), t.literal(false)))); - - node.body = util.template("tail-call-body", { - FUNCTION_ID: this.getFunctionId(), - AGAIN_ID: this.getAgainId(), - BLOCK: node.body - }); - - var topVars = []; - - if (this.needsThis) { - var _arr = this.thisPaths; - - for (var _i = 0; _i < _arr.length; _i++) { - var path = _arr[_i]; - path.replaceWith(this.getThisId()); - } - - topVars.push(t.variableDeclarator(this.getThisId(), t.thisExpression())); - } - - if (this.needsArguments || this.setsArguments) { - var _arr2 = this.argumentsPaths; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var _path = _arr2[_i2]; - _path.replaceWith(this.argumentsId); - } - - var decl = t.variableDeclarator(this.argumentsId); - if (this.argumentsId) { - decl.init = t.identifier("arguments"); - decl.init._shadowedFunctionLiteral = this.path; - } - topVars.push(decl); - } - - var leftId = this.leftId; - if (leftId) { - topVars.push(t.variableDeclarator(leftId)); - } - - if (topVars.length > 0) { - node.body.body.unshift(t.variableDeclaration("var", topVars)); - } - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.subTransform = function subTransform(node) { - if (!node) return; - - var handler = this["subTransform" + node.type]; - if (handler) return handler.call(this, node); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.subTransformConditionalExpression = function subTransformConditionalExpression(node) { - var callConsequent = this.subTransform(node.consequent); - var callAlternate = this.subTransform(node.alternate); - if (!callConsequent && !callAlternate) { - return; - } - - // if ternary operator had tail recursion in value, convert to optimized if-statement - node.type = "IfStatement"; - node.consequent = callConsequent ? t.toBlock(callConsequent) : returnBlock(node.consequent); - - if (callAlternate) { - node.alternate = t.isIfStatement(callAlternate) ? callAlternate : t.toBlock(callAlternate); - } else { - node.alternate = returnBlock(node.alternate); - } - - return [node]; - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.subTransformLogicalExpression = function subTransformLogicalExpression(node) { - // only call in right-value of can be optimized - var callRight = this.subTransform(node.right); - if (!callRight) return; - - // cache left value as it might have side-effects - var leftId = this.getLeftId(); - var testExpr = t.assignmentExpression("=", leftId, node.left); - - if (node.operator === "&&") { - testExpr = t.unaryExpression("!", testExpr); - } - - return [t.ifStatement(testExpr, returnBlock(leftId))].concat(callRight); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.subTransformSequenceExpression = function subTransformSequenceExpression(node) { - var seq = node.expressions; - - // only last element can be optimized - var lastCall = this.subTransform(seq[seq.length - 1]); - if (!lastCall) { - return; - } - - // remove converted expression from sequence - // and convert to regular expression if needed - if (--seq.length === 1) { - node = seq[0]; - } - - return [t.expressionStatement(node)].concat(lastCall); - }; - - /** - * [Please add a description.] - */ - - TailCallTransformer.prototype.subTransformCallExpression = function subTransformCallExpression(node) { - var callee = node.callee; - var thisBinding, args; - - if (t.isMemberExpression(callee, { computed: false }) && t.isIdentifier(callee.property)) { - switch (callee.property.name) { - case "call": - args = t.arrayExpression(node.arguments.slice(1)); - break; - - case "apply": - args = node.arguments[1] || t.identifier("undefined"); - this.needsArguments = true; - break; - - default: - return; - } - - thisBinding = node.arguments[0]; - callee = callee.object; - } - - // only tail recursion can be optimized as for now - if (!t.isIdentifier(callee) || !this.scope.bindingIdentifierEquals(callee.name, this.ownerId)) { - return; - } - - this.hasTailRecursion = true; - - if (this.hasDeopt()) return; - - var body = []; - - if (this.needsThis && !t.isThisExpression(thisBinding)) { - body.push(t.expressionStatement(t.assignmentExpression("=", this.getThisId(), thisBinding || t.identifier("undefined")))); - } - - if (!args) { - args = t.arrayExpression(node.arguments); - } - - var argumentsId = this.getArgumentsId(); - var params = this.getParams(); - - if (this.needsArguments) { - body.push(t.expressionStatement(t.assignmentExpression("=", argumentsId, args))); - } - - if (t.isArrayExpression(args)) { - var elems = args.elements; - - // pad out the args so all the function args are reset - https://github.com/babel/babel/issues/1938 - while (elems.length < params.length) { - elems.push(t.identifier("undefined")); - } - - for (var i = 0; i < elems.length; i++) { - var param = params[i]; - var elem = elems[i]; - - if (param && !param._isDefaultPlaceholder) { - elems[i] = t.assignmentExpression("=", param, elem); - } else { - // exceeds parameters but push it anyway to ensure correct execution - } - } - - if (!this.needsArguments) { - var _arr3 = elems; - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var elem = _arr3[_i3]; - // only push expressions that we really need, this will skip pure arguments that exceed the - // parameter length of the current function - if (!this.scope.isPure(elem)) { - body.push(t.expressionStatement(elem)); - } - } - } - } else { - this.setsArguments = true; - for (var i = 0; i < params.length; i++) { - var param = params[i]; - if (!param._isDefaultPlaceholder) { - body.push(t.expressionStatement(t.assignmentExpression("=", param, t.memberExpression(argumentsId, t.literal(i), true)))); - } - } - } - - body.push(t.expressionStatement(t.assignmentExpression("=", this.getAgainId(), t.literal(true)))); - - if (this.vars.length > 0) { - var declarations = _lodashArrayFlatten2["default"](_lodashCollectionMap2["default"](this.vars, function (decl) { - return decl.declarations; - })); - - var assignment = _lodashCollectionReduceRight2["default"](declarations, function (expr, decl) { - return t.assignmentExpression("=", decl.id, expr); - }, t.identifier("undefined")); - - var statement = t.expressionStatement(assignment); - body.push(statement); - } - - body.push(t.continueStatement(this.getFunctionId())); - - return body; - }; - - return TailCallTransformer; -})(); -},{"179":179,"182":182,"414":414,"422":422,"423":423,"43":43}],114:[function(_dereq_,module,exports){ -/* eslint no-unused-vars: 0 */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -function isString(node) { - return t.isLiteral(node) && typeof node.value === "string"; -} - -/** - * [Please add a description.] - */ - -function buildBinaryExpression(left, right) { - var node = t.binaryExpression("+", left, right); - node._templateLiteralProduced = true; - return node; -} - -/** - * [Please add a description.] - */ - -function crawl(path) { - if (path.is("_templateLiteralProduced")) { - crawl(path.get("left")); - crawl(path.get("right")); - } else if (!path.isBaseType("string") && !path.isBaseType("number")) { - path.replaceWith(t.callExpression(t.identifier("String"), [path.node])); - } -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - TaggedTemplateExpression: function TaggedTemplateExpression(node, parent, scope, file) { - var quasi = node.quasi; - var args = []; - - var strings = []; - var raw = []; - - var _arr = quasi.quasis; - for (var _i = 0; _i < _arr.length; _i++) { - var elem = _arr[_i]; - strings.push(t.literal(elem.value.cooked)); - raw.push(t.literal(elem.value.raw)); - } - - strings = t.arrayExpression(strings); - raw = t.arrayExpression(raw); - - var templateName = "tagged-template-literal"; - if (file.isLoose("es6.templateLiterals")) templateName += "-loose"; - - var templateObject = file.addTemplateObject(templateName, strings, raw); - args.push(templateObject); - - args = args.concat(quasi.expressions); - - return t.callExpression(node.tag, args); - }, - - /** - * [Please add a description.] - */ - - TemplateLiteral: function TemplateLiteral(node, parent, scope, file) { - var nodes = []; - - var _arr2 = node.quasis; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var elem = _arr2[_i2]; - nodes.push(t.literal(elem.value.cooked)); - - var expr = node.expressions.shift(); - if (expr) nodes.push(expr); - } - - // filter out empty string literals - nodes = nodes.filter(function (n) { - return !t.isLiteral(n, { value: "" }); - }); - - // since `+` is left-to-right associative - // ensure the first node is a string if first/second isn't - if (!isString(nodes[0]) && !isString(nodes[1])) { - nodes.unshift(t.literal("")); - } - - if (nodes.length > 1) { - var root = buildBinaryExpression(nodes.shift(), nodes.shift()); - - var _arr3 = nodes; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var _node = _arr3[_i3]; - root = buildBinaryExpression(root, _node); - } - - this.replaceWith(root); - //crawl(this); - } else { - return nodes[0]; - } - } -}; -exports.visitor = visitor; -},{"179":179}],115:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -var metadata = { - stage: 3 -}; -exports.metadata = metadata; -},{}],116:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -var metadata = { - stage: 1, - dependencies: ["es6.classes"] -}; -exports.metadata = metadata; -},{}],117:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersBuildComprehension = _dereq_(54); - -var _helpersBuildComprehension2 = _interopRequireDefault(_helpersBuildComprehension); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _util = _dereq_(182); - -var util = _interopRequireWildcard(_util); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - stage: 0 -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ComprehensionExpression: function ComprehensionExpression(node, parent, scope) { - var callback = array; - if (node.generator) callback = generator; - return callback(node, parent, scope); - } -}; - -exports.visitor = visitor; -/** - * [Please add a description.] - */ - -function generator(node) { - var body = []; - var container = t.functionExpression(null, [], t.blockStatement(body), true); - container.shadow = true; - - body.push(_helpersBuildComprehension2["default"](node, function () { - return t.expressionStatement(t.yieldExpression(node.body)); - })); - - return t.callExpression(container, []); -} - -/** - * [Please add a description.] - */ - -function array(node, parent, scope) { - var uid = scope.generateUidIdentifierBasedOnNode(parent); - - var container = util.template("array-comprehension-container", { - KEY: uid - }); - container.callee.shadow = true; - - var block = container.callee.body; - var body = block.body; - - if (_traversal2["default"].hasType(node, scope, "YieldExpression", t.FUNCTION_TYPES)) { - container.callee.generator = true; - container = t.yieldExpression(container, true); - } - - var returnStatement = body.pop(); - - body.push(_helpersBuildComprehension2["default"](node, function () { - return util.template("array-push", { - STATEMENT: node.body, - KEY: uid - }, true); - })); - body.push(returnStatement); - - return container; -} -},{"148":148,"179":179,"182":182,"54":54}],118:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersMemoiseDecorators = _dereq_(60); - -var _helpersMemoiseDecorators2 = _interopRequireDefault(_helpersMemoiseDecorators); - -var _helpersDefineMap = _dereq_(57); - -var defineMap = _interopRequireWildcard(_helpersDefineMap); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - dependencies: ["es6.classes"], - optional: true, - stage: 1 -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ObjectExpression: function ObjectExpression(node, parent, scope, file) { - var hasDecorators = false; - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - if (prop.decorators) { - hasDecorators = true; - break; - } - } - if (!hasDecorators) return; - - var mutatorMap = {}; - - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - if (prop.decorators) _helpersMemoiseDecorators2["default"](prop.decorators, scope); - - if (prop.kind === "init" && !prop.method) { - prop.kind = ""; - prop.value = t.functionExpression(null, [], t.blockStatement([t.returnStatement(prop.value)])); - } - - defineMap.push(mutatorMap, prop, "initializer", file); - } - - var obj = defineMap.toClassObject(mutatorMap); - obj = defineMap.toComputedObjectFromClass(obj); - return t.callExpression(file.addHelper("create-decorated-object"), [obj]); - } -}; -exports.visitor = visitor; -},{"179":179,"57":57,"60":60}],119:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true, - stage: 0 -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - DoExpression: function DoExpression(node) { - var body = node.body.body; - if (body.length) { - return body; - } else { - return t.identifier("undefined"); - } - } -}; -exports.visitor = visitor; -},{"179":179}],120:[function(_dereq_,module,exports){ -// https://github.com/rwaldron/exponentiation-operator - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersBuildBinaryAssignmentOperatorTransformer = _dereq_(53); - -var _helpersBuildBinaryAssignmentOperatorTransformer2 = _interopRequireDefault(_helpersBuildBinaryAssignmentOperatorTransformer); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - stage: 3 -}; - -exports.metadata = metadata; -var MATH_POW = t.memberExpression(t.identifier("Math"), t.identifier("pow")); - -/** - * [Please add a description.] - */ - -var visitor = _helpersBuildBinaryAssignmentOperatorTransformer2["default"]({ - operator: "**", - - /** - * [Please add a description.] - */ - - build: function build(left, right) { - return t.callExpression(MATH_POW, [left, right]); - } -}); -exports.visitor = visitor; -},{"179":179,"53":53}],121:[function(_dereq_,module,exports){ -// https://github.com/leebyron/ecmascript-more-export-from - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - stage: 1 -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -function build(node, nodes, scope) { - var first = node.specifiers[0]; - if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return; - - var specifier = node.specifiers.shift(); - var uid = scope.generateUidIdentifier(specifier.exported.name); - - var newSpecifier; - if (t.isExportNamespaceSpecifier(specifier)) { - newSpecifier = t.importNamespaceSpecifier(uid); - } else { - newSpecifier = t.importDefaultSpecifier(uid); - } - - nodes.push(t.importDeclaration([newSpecifier], node.source)); - nodes.push(t.exportNamedDeclaration(null, [t.exportSpecifier(uid, specifier.exported)])); - - build(node, nodes, scope); -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ExportNamedDeclaration: function ExportNamedDeclaration(node, parent, scope) { - var nodes = []; - build(node, nodes, scope); - if (!nodes.length) return; - - if (node.specifiers.length >= 1) { - nodes.push(node); - } - - return nodes; - } -}; -exports.visitor = visitor; -},{"179":179}],122:[function(_dereq_,module,exports){ -// https://github.com/zenparsing/es-function-bind - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true, - stage: 0 -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -function getTempId(scope) { - var id = scope.path.getData("functionBind"); - if (id) return id; - - id = scope.generateDeclaredUidIdentifier("context"); - return scope.path.setData("functionBind", id); -} - -/** - * [Please add a description.] - */ - -function getStaticContext(bind, scope) { - var object = bind.object || bind.callee.object; - return scope.isStatic(object) && object; -} - -/** - * [Please add a description.] - */ - -function inferBindContext(bind, scope) { - var staticContext = getStaticContext(bind, scope); - if (staticContext) return staticContext; - - var tempId = getTempId(scope); - if (bind.object) { - bind.callee = t.sequenceExpression([t.assignmentExpression("=", tempId, bind.object), bind.callee]); - } else { - bind.callee.object = t.assignmentExpression("=", tempId, bind.callee.object); - } - return tempId; -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - CallExpression: function CallExpression(node, parent, scope) { - var bind = node.callee; - if (!t.isBindExpression(bind)) return; - - var context = inferBindContext(bind, scope); - node.callee = t.memberExpression(bind.callee, t.identifier("call")); - node.arguments.unshift(context); - }, - - /** - * [Please add a description.] - */ - - BindExpression: function BindExpression(node, parent, scope) { - var context = inferBindContext(node, scope); - return t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context]); - } -}; -exports.visitor = visitor; -},{"179":179}],123:[function(_dereq_,module,exports){ -// https://github.com/sebmarkbage/ecmascript-rest-spread - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - stage: 2, - dependencies: ["es6.destructuring"] -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var hasSpread = function hasSpread(node) { - for (var i = 0; i < node.properties.length; i++) { - if (t.isSpreadProperty(node.properties[i])) { - return true; - } - } - return false; -}; - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ObjectExpression: function ObjectExpression(node, parent, scope, file) { - if (!hasSpread(node)) return; - - var args = []; - var props = []; - - var push = function push() { - if (!props.length) return; - args.push(t.objectExpression(props)); - props = []; - }; - - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - if (t.isSpreadProperty(prop)) { - push(); - args.push(prop.argument); - } else { - props.push(prop); - } - } - - push(); - - if (!t.isObjectExpression(args[0])) { - args.unshift(t.objectExpression([])); - } - - return t.callExpression(file.addHelper("extends"), args); - } -}; -exports.visitor = visitor; -},{"179":179}],124:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -var metadata = { - stage: 2 -}; -exports.metadata = metadata; -},{}],125:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.internal = internal; -exports.blacklist = blacklist; -exports.whitelist = whitelist; -exports.stage = stage; -exports.optional = optional; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -/** - * [Please add a description.] - */ - -function internal(transformer) { - if (transformer.key[0] === "_") return true; -} - -/** - * [Please add a description.] - */ - -function blacklist(transformer, opts) { - var blacklist = opts.blacklist; - if (blacklist.length && _lodashCollectionIncludes2["default"](blacklist, transformer.key)) return false; -} - -/** - * [Please add a description.] - */ - -function whitelist(transformer, opts) { - var whitelist = opts.whitelist; - if (whitelist) return _lodashCollectionIncludes2["default"](whitelist, transformer.key); -} - -/** - * [Please add a description.] - */ - -function stage(transformer, opts) { - var stage = transformer.metadata.stage; - if (stage != null && stage >= opts.stage) return true; -} - -/** - * [Please add a description.] - */ - -function optional(transformer, opts) { - if (transformer.metadata.optional && !_lodashCollectionIncludes2["default"](opts.optional, transformer.key)) return false; -} -},{"421":421}],126:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports["default"] = { - //- builtin-prepass - "minification.constantFolding": _dereq_(183), - - //- builtin-pre - strict: _dereq_(142), - eval: _dereq_(185), - _validation: _dereq_(132), - _hoistDirectives: _dereq_(128), - "minification.removeDebugger": _dereq_(194), - "minification.removeConsole": _dereq_(193), - "utility.inlineEnvironmentVariables": _dereq_(186), - "minification.deadCodeElimination": _dereq_(184), - _modules: _dereq_(130), - "react.displayName": _dereq_(192), - "es6.spec.modules": _dereq_(109), - "es6.spec.arrowFunctions": _dereq_(107), - "es6.spec.templateLiterals": _dereq_(111), - "es6.templateLiterals": _dereq_(114), - "es6.literals": _dereq_(97), - "validation.undeclaredVariableCheck": _dereq_(197), - - //- builtin-basic - // this is where the bulk of the ES6 transformations take place, none of them require traversal state - // so they can all be concatenated together for performance - "spec.functionName": _dereq_(144), - "es7.classProperties": _dereq_(116), - "es7.trailingFunctionCommas": _dereq_(124), - "es7.asyncFunctions": _dereq_(115), - "es7.decorators": _dereq_(118), - "validation.react": _dereq_(145), - "es6.arrowFunctions": _dereq_(89), - "spec.blockScopedFunctions": _dereq_(143), - "optimisation.react.constantElements": _dereq_(191), - "optimisation.react.inlineElements": _dereq_(135), - "es7.comprehensions": _dereq_(117), - "es6.classes": _dereq_(91), - asyncToGenerator: _dereq_(136), - bluebirdCoroutines: _dereq_(137), - "es6.objectSuper": _dereq_(99), - "es7.objectRestSpread": _dereq_(123), - "es7.exponentiationOperator": _dereq_(120), - "es5.properties.mutators": _dereq_(88), - "es6.properties.shorthand": _dereq_(104), - "es6.properties.computed": _dereq_(103), - "optimisation.flow.forOf": _dereq_(133), - "es6.forOf": _dereq_(96), - "es6.regex.sticky": _dereq_(105), - "es6.regex.unicode": _dereq_(106), - "es6.constants": _dereq_(94), - "es7.exportExtensions": _dereq_(121), - "spec.protoToAssign": _dereq_(190), - "es7.doExpressions": _dereq_(119), - "es6.spec.symbols": _dereq_(110), - "es7.functionBind": _dereq_(122), - "spec.undefinedToVoid": _dereq_(199), - - //- builtin-advanced - "es6.spread": _dereq_(112), - "es6.parameters": _dereq_(101), - "es6.destructuring": _dereq_(95), - "es6.blockScoping": _dereq_(90), - "es6.spec.blockScoping": _dereq_(108), - reactCompat: _dereq_(139), - react: _dereq_(140), - regenerator: _dereq_(141), - - // es6 syntax transformation is **forbidden** past this point since regenerator will chuck a massive - // hissy fit - - //- builtin-modules - runtime: _dereq_(196), - "es6.modules": _dereq_(98), - _moduleFormatter: _dereq_(129), - - //- builtin-trailing - // these clean up the output and do finishing up transformations, it's important to note that by this - // stage you can't import any new modules or insert new ES6 as all those transformers have already - // been ran - "es6.tailCall": _dereq_(113), - _shadowFunctions: _dereq_(131), - "es3.propertyLiterals": _dereq_(87), - "es3.memberExpressionLiterals": _dereq_(86), - "minification.memberExpressionLiterals": _dereq_(188), - "minification.propertyLiterals": _dereq_(189), - _blockHoist: _dereq_(127), - jscript: _dereq_(187), - flow: _dereq_(138), - "optimisation.modules.system": _dereq_(134) -}; -module.exports = exports["default"]; -},{"101":101,"103":103,"104":104,"105":105,"106":106,"107":107,"108":108,"109":109,"110":110,"111":111,"112":112,"113":113,"114":114,"115":115,"116":116,"117":117,"118":118,"119":119,"120":120,"121":121,"122":122,"123":123,"124":124,"127":127,"128":128,"129":129,"130":130,"131":131,"132":132,"133":133,"134":134,"135":135,"136":136,"137":137,"138":138,"139":139,"140":140,"141":141,"142":142,"143":143,"144":144,"145":145,"183":183,"184":184,"185":185,"186":186,"187":187,"188":188,"189":189,"190":190,"191":191,"192":192,"193":193,"194":194,"196":196,"197":197,"199":199,"86":86,"87":87,"88":88,"89":89,"90":90,"91":91,"94":94,"95":95,"96":96,"97":97,"98":98,"99":99}],127:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashCollectionSortBy = _dereq_(425); - -var _lodashCollectionSortBy2 = _interopRequireDefault(_lodashCollectionSortBy); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - * - * Priority: - * - * - 0 We want this to be at the **very** bottom - * - 1 Default node position - * - 2 Priority over normal nodes - * - 3 We want this to be at the **very** top - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Block: { - exit: function exit(node) { - var hasChange = false; - for (var i = 0; i < node.body.length; i++) { - var bodyNode = node.body[i]; - if (bodyNode && bodyNode._blockHoist != null) { - hasChange = true; - break; - } - } - if (!hasChange) return; - - node.body = _lodashCollectionSortBy2["default"](node.body, function (bodyNode) { - var priority = bodyNode && bodyNode._blockHoist; - if (priority == null) priority = 1; - if (priority === true) priority = 2; - - // Higher priorities should move toward the top. - return -1 * priority; - }); - } - } -}; -exports.visitor = visitor; -},{"425":425}],128:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Block: { - exit: function exit(node) { - for (var i = 0; i < node.body.length; i++) { - var bodyNode = node.body[i]; - if (t.isExpressionStatement(bodyNode) && t.isLiteral(bodyNode.expression)) { - bodyNode._blockHoist = Infinity; - } else { - return; - } - } - } - } -}; -exports.visitor = visitor; -},{"179":179}],129:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -var metadata = { - group: "builtin-modules" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Program: { - exit: function exit(program, parent, scope, file) { - // ensure that these are at the top, just like normal imports - var _arr = file.dynamicImports; - for (var _i = 0; _i < _arr.length; _i++) { - var node = _arr[_i]; - node._blockHoist = 3; - } - - program.body = file.dynamicImports.concat(program.body); - - if (!file.transformers["es6.modules"].canTransform()) return; - - if (file.moduleFormatter.transform) { - file.moduleFormatter.transform(program); - } - } - } -}; -exports.visitor = visitor; -},{}],130:[function(_dereq_,module,exports){ -// in this transformer we have to split up classes and function declarations -// from their exports. why? because sometimes we need to replace classes with -// nodes that aren't allowed in the same contexts. also, if you're exporting -// a generator function as a default then regenerator will destroy the export -// declaration and leave a variable declaration in it's place... yeah, handy. - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function getDeclar(node) { - var declar = node.declaration; - t.inheritsComments(declar, node); - t.removeComments(node); - declar._ignoreUserWhitespace = true; - return declar; -} - -/** - * [Please add a description.] - */ - -function buildExportSpecifier(id) { - return t.exportSpecifier(cloneIdentifier(id), cloneIdentifier(id)); -} - -function cloneIdentifier(_ref) { - var name = _ref.name; - var loc = _ref.loc; - - var id = t.identifier(name); - id._loc = loc; - return id; -} - -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ExportDefaultDeclaration: function ExportDefaultDeclaration(node, parent, scope) { - var declar = node.declaration; - - if (t.isClassDeclaration(declar)) { - // export default class Foo {}; - var nodes = [getDeclar(node), node]; - node.declaration = declar.id; - return nodes; - } else if (t.isClassExpression(declar)) { - // export default class {}; - var temp = scope.generateUidIdentifier("default"); - node.declaration = t.variableDeclaration("var", [t.variableDeclarator(temp, declar)]); - - var nodes = [getDeclar(node), node]; - node.declaration = temp; - return nodes; - } else if (t.isFunctionDeclaration(declar)) { - // export default function Foo() {} - node._blockHoist = 2; - - var nodes = [getDeclar(node), node]; - node.declaration = declar.id; - return nodes; - } - }, - - /** - * [Please add a description.] - */ - - ExportNamedDeclaration: function ExportNamedDeclaration(node) { - var declar = node.declaration; - - if (t.isClassDeclaration(declar)) { - // export class Foo {} - node.specifiers = [buildExportSpecifier(declar.id)]; - - var nodes = [getDeclar(node), node]; - node.declaration = null; - return nodes; - } else if (t.isFunctionDeclaration(declar)) { - // export function Foo() {} - var newExport = t.exportNamedDeclaration(null, [buildExportSpecifier(declar.id)]); - newExport._blockHoist = 2; - return [getDeclar(node), newExport]; - } else if (t.isVariableDeclaration(declar)) { - // export var foo = "bar"; - var specifiers = []; - var bindings = this.get("declaration").getBindingIdentifiers(); - for (var key in bindings) { - specifiers.push(buildExportSpecifier(bindings[key])); - } - return [declar, t.exportNamedDeclaration(null, specifiers)]; - } - }, - - /** - * [Please add a description.] - */ - - Program: { - enter: function enter(node) { - var imports = []; - var rest = []; - - for (var i = 0; i < node.body.length; i++) { - var bodyNode = node.body[i]; - if (t.isImportDeclaration(bodyNode)) { - imports.push(bodyNode); - } else { - rest.push(bodyNode); - } - } - - node.body = imports.concat(rest); - }, - - exit: function exit(node, parent, scope, file) { - if (!file.transformers["es6.modules"].canTransform()) return; - - if (file.moduleFormatter.setup) { - file.moduleFormatter.setup(); - } - } - } -}; -exports.visitor = visitor; -},{"179":179}],131:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -function shouldShadow(path, shadowPath) { - if (path.is("_forceShadow")) { - return true; - } else { - return shadowPath && !shadowPath.isArrowFunctionExpression(); - } -} - -/** - * [Please add a description.] - */ - -function remap(path, key, create) { - // ensure that we're shadowed - var shadowPath = path.inShadow(key); - if (!shouldShadow(path, shadowPath)) return; - - var shadowFunction = path.node._shadowedFunctionLiteral; - var currentFunction; - - var fnPath = path.findParent(function (path) { - if (path.isProgram() || path.isFunction()) { - // catch current function in case this is the shadowed one and we can ignore it - currentFunction = currentFunction || path; - } - - if (path.isProgram()) { - return true; - } else if (path.isFunction()) { - if (shadowFunction) { - return path === shadowFunction || path.node === shadowFunction.node; - } else { - return !path.is("shadow"); - } - } - - return false; - }); - - // no point in realiasing if we're in this function - if (fnPath === currentFunction) return; - - var cached = fnPath.getData(key); - if (cached) return cached; - - var init = create(); - var id = path.scope.generateUidIdentifier(key); - - fnPath.setData(key, id); - fnPath.scope.push({ id: id, init: init }); - - return id; -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ThisExpression: function ThisExpression() { - return remap(this, "this", function () { - return t.thisExpression(); - }); - }, - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node) { - if (node.name === "arguments") { - return remap(this, "arguments", function () { - return t.identifier("arguments"); - }); - } - } -}; -exports.visitor = visitor; -},{"179":179}],132:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ForXStatement: function ForXStatement(node, parent, scope, file) { - var left = node.left; - if (t.isVariableDeclaration(left)) { - var declar = left.declarations[0]; - if (declar.init) throw file.errorWithNode(declar, messages.get("noAssignmentsInForHead")); - } - }, - - /** - * [Please add a description.] - */ - - Property: function Property(node, parent, scope, file) { - if (node.kind === "set") { - var first = node.value.params[0]; - if (t.isRestElement(first)) { - throw file.errorWithNode(first, messages.get("settersNoRest")); - } - } - } -}; -exports.visitor = visitor; -},{"179":179,"43":43}],133:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _es6ForOf = _dereq_(96); - -var metadata = { - optional: true -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - ForOfStatement: function ForOfStatement(node, parent, scope, file) { - if (this.get("right").isGenericType("Array")) { - return _es6ForOf._ForOfStatementArray.call(this, node, scope, file); - } - } -}; -exports.visitor = visitor; -},{"96":96}],134:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true, - group: "builtin-trailing" -}; - -exports.metadata = metadata; -var visitor = { - Program: function Program(node, parent, scope, file) { - if (file.moduleFormatter._setters) { - scope.traverse(file.moduleFormatter._setters, optimizeSettersVisitor, { - exportFunctionIdentifier: file.moduleFormatter.exportIdentifier - }); - } - } -}; - -exports.visitor = visitor; -/** - * Setters are optimized to avoid slow export behavior in modules that rely on deep hierarchies - * of export-from declarations. - * More info in https://github.com/babel/babel/pull/1722 and - * https://github.com/ModuleLoader/es6-module-loader/issues/386. - * - * TODO: Ideally this would be optimized during construction of the setters, but the current - * architecture of the module formatters make that difficult. - */ -var optimizeSettersVisitor = { - FunctionExpression: { - enter: function enter(node, parent, scope, state) { - state.hasExports = false; - state.exportObjectIdentifier = scope.generateUidIdentifier("exportObj"); - }, - exit: function exit(node, parent, scope, state) { - if (!state.hasExports) return; - - node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(t.cloneDeep(state.exportObjectIdentifier), t.objectExpression([]))])); - node.body.body.push(t.expressionStatement(t.callExpression(t.cloneDeep(state.exportFunctionIdentifier), [t.cloneDeep(state.exportObjectIdentifier)]))); - } - }, - CallExpression: function CallExpression(node, parent, scope, state) { - if (!t.isIdentifier(node.callee, { name: state.exportFunctionIdentifier.name })) return; - - state.hasExports = true; - var memberNode = t.memberExpression(t.cloneDeep(state.exportObjectIdentifier), node.arguments[0], true); - return t.assignmentExpression("=", memberNode, node.arguments[1]); - } -}; -},{"179":179}],135:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _helpersReact = _dereq_(62); - -var react = _interopRequireWildcard(_helpersReact); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - optional: true -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -function hasRefOrSpread(attrs) { - for (var i = 0; i < attrs.length; i++) { - var attr = attrs[i]; - if (t.isJSXSpreadAttribute(attr)) return true; - if (isJSXAttributeOfName(attr, "ref")) return true; - } - return false; -} - -/** - * [Please add a description.] - */ - -function isJSXAttributeOfName(attr, name) { - return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name, { name: name }); -} - -/** - * [Please add a description.] - */ -var visitor = { - - /** - * [Please add a description.] - */ - - JSXElement: function JSXElement(node, parent, scope, file) { - // filter - var open = node.openingElement; - if (hasRefOrSpread(open.attributes)) return; - - // init - var isComponent = true; - var props = t.objectExpression([]); - var obj = t.objectExpression([]); - var key = t.literal(null); - var type = open.name; - - if (t.isJSXIdentifier(type) && react.isCompatTag(type.name)) { - type = t.literal(type.name); - isComponent = false; - } - - function pushElemProp(key, value) { - pushProp(obj.properties, t.identifier(key), value); - } - - function pushProp(objProps, key, value) { - objProps.push(t.property("init", key, value)); - } - - if (node.children.length) { - var children = react.buildChildren(node); - children = children.length === 1 ? children[0] : t.arrayExpression(children); - pushProp(props.properties, t.identifier("children"), children); - } - - // props - for (var i = 0; i < open.attributes.length; i++) { - var attr = open.attributes[i]; - if (isJSXAttributeOfName(attr, "key")) { - key = attr.value; - } else { - pushProp(props.properties, attr.name, attr.value || t.identifier("true")); - } - } - - if (isComponent) { - props = t.callExpression(file.addHelper("default-props"), [t.memberExpression(type, t.identifier("defaultProps")), props]); - } - - // metadata - pushElemProp("$$typeof", file.addHelper("typeof-react-element")); - pushElemProp("type", type); - pushElemProp("key", key); - pushElemProp("ref", t.literal(null)); - - pushElemProp("props", props); - pushElemProp("_owner", t.literal(null)); - - return obj; - } -}; -exports.visitor = visitor; -},{"179":179,"62":62}],136:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersRemapAsyncToGenerator = _dereq_(64); - -var _helpersRemapAsyncToGenerator2 = _interopRequireDefault(_helpersRemapAsyncToGenerator); - -var _bluebirdCoroutines = _dereq_(137); - -exports.manipulateOptions = _bluebirdCoroutines.manipulateOptions; -var metadata = { - optional: true, - dependencies: ["es7.asyncFunctions", "es6.classes"] -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, file) { - if (!node.async || node.generator) return; - - return _helpersRemapAsyncToGenerator2["default"](this, file.addHelper("async-to-generator")); - } -}; -exports.visitor = visitor; -},{"137":137,"64":64}],137:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.manipulateOptions = manipulateOptions; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersRemapAsyncToGenerator = _dereq_(64); - -var _helpersRemapAsyncToGenerator2 = _interopRequireDefault(_helpersRemapAsyncToGenerator); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function manipulateOptions(opts) { - opts.blacklist.push("regenerator"); -} - -var metadata = { - optional: true, - dependencies: ["es7.asyncFunctions", "es6.classes"] -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: function Function(node, parent, scope, file) { - if (!node.async || node.generator) return; - - return _helpersRemapAsyncToGenerator2["default"](this, t.memberExpression(file.addImport("bluebird", null, "absolute"), t.identifier("coroutine"))); - } -}; -exports.visitor = visitor; -},{"179":179,"64":64}],138:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-trailing" -}; - -exports.metadata = metadata; -var FLOW_DIRECTIVE = "@flow"; - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Program: function Program(node, parent, scope, file) { - var _arr = file.ast.comments; - - for (var _i = 0; _i < _arr.length; _i++) { - var comment = _arr[_i]; - if (comment.value.indexOf(FLOW_DIRECTIVE) >= 0) { - // remove flow directive - comment.value = comment.value.replace(FLOW_DIRECTIVE, ""); - - // remove the comment completely if it only consists of whitespace and/or stars - if (!comment.value.replace(/\*/g, "").trim()) comment._displayed = true; - } - } - }, - - /** - * [Please add a description.] - */ - - Flow: function Flow() { - this.dangerouslyRemove(); - }, - - /** - * [Please add a description.] - */ - - ClassProperty: function ClassProperty(node) { - node.typeAnnotation = null; - if (!node.value) this.dangerouslyRemove(); - }, - - /** - * [Please add a description.] - */ - - Class: function Class(node) { - node["implements"] = null; - }, - - /** - * [Please add a description.] - */ - - Function: function Function(node) { - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - param.optional = false; - } - }, - - /** - * [Please add a description.] - */ - - TypeCastExpression: function TypeCastExpression(node) { - do { - node = node.expression; - } while (t.isTypeCastExpression(node)); - return node; - } -}; -exports.visitor = visitor; -},{"179":179}],139:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.manipulateOptions = manipulateOptions; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _helpersReact = _dereq_(62); - -var react = _interopRequireWildcard(_helpersReact); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function manipulateOptions(opts) { - opts.blacklist.push("react"); -} - -var metadata = { - optional: true, - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = _dereq_(55)({ - - /** - * [Please add a description.] - */ - - pre: function pre(state) { - state.callee = state.tagExpr; - }, - - /** - * [Please add a description.] - */ - - post: function post(state) { - if (react.isCompatTag(state.tagName)) { - state.call = t.callExpression(t.memberExpression(t.memberExpression(t.identifier("React"), t.identifier("DOM")), state.tagExpr, t.isLiteral(state.tagExpr)), state.args); - } - } -}); -exports.visitor = visitor; -},{"179":179,"55":55,"62":62}],140:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _helpersReact = _dereq_(62); - -var react = _interopRequireWildcard(_helpersReact); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/; - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = _dereq_(55)({ - - /** - * [Please add a description.] - */ - - pre: function pre(state) { - var tagName = state.tagName; - var args = state.args; - if (react.isCompatTag(tagName)) { - args.push(t.literal(tagName)); - } else { - args.push(state.tagExpr); - } - }, - - /** - * [Please add a description.] - */ - - post: function post(state, file) { - state.callee = file.get("jsxIdentifier"); - } -}); - -exports.visitor = visitor; -/** - * [Please add a description.] - */ - -visitor.Program = function (node, parent, scope, file) { - var id = file.opts.jsxPragma; - - for (var i = 0; i < file.ast.comments.length; i++) { - var comment = file.ast.comments[i]; - var matches = JSX_ANNOTATION_REGEX.exec(comment.value); - if (matches) { - id = matches[1]; - if (id === "React.DOM") { - throw file.errorWithNode(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12"); - } else { - break; - } - } - } - - file.set("jsxIdentifier", id.split(".").map(t.identifier).reduce(function (object, property) { - return t.memberExpression(object, property); - })); -}; -},{"179":179,"55":55,"62":62}],141:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _regenerator = _dereq_(543); - -var _regenerator2 = _interopRequireDefault(_regenerator); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -// It's important to use the exact same NodePath constructor that -// Regenerator uses, rather than require("ast-types").NodePath, because -// the version of ast-types that Babel knows about might be different from -// the version that Regenerator depends on. See for example #1958. -var NodePath = _regenerator2["default"].types.NodePath; - -var metadata = { - group: "builtin-advanced" -}; - -exports.metadata = metadata; -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Function: { - exit: function exit(node) { - if (node.async || node.generator) { - // Although this code transforms only the subtree rooted at the given - // Function node, that node might contain other generator functions - // that will also be transformed. It might help performance to ignore - // nested functions, and rely on the traversal to visit them later, - // but that's a small optimization. Starting here instead of at the - // root of the AST is the key optimization, since huge async/generator - // functions are relatively rare. - _regenerator2["default"].transform(convertNodePath(this)); - } - } - } -}; - -exports.visitor = visitor; -// Given a Babel NodePath, return an ast-types NodePath that includes full -// ancestry information (up to and including the Program node). This is -// complicated by having to include intermediate objects like blockStatement.body -// arrays, in addition to Node objects. -function convertNodePath(path) { - var programNode; - var keysAlongPath = []; - - while (path) { - var pp = path.parentPath; - var parentNode = pp && pp.node; - if (parentNode) { - keysAlongPath.push(path.key); - - if (parentNode !== path.container) { - var found = Object.keys(parentNode).some(function (listKey) { - if (parentNode[listKey] === path.container) { - keysAlongPath.push(listKey); - return true; - } - }); - - if (!found) { - throw new Error("Failed to find container object in parent node"); - } - } - - if (t.isProgram(parentNode)) { - programNode = parentNode; - break; - } - } - - path = pp; - } - - if (!programNode) { - throw new Error("Failed to find root Program node"); - } - - var nodePath = new NodePath(programNode); - - while (keysAlongPath.length > 0) { - nodePath = nodePath.get(keysAlongPath.pop()); - } - - return nodePath; -} -},{"179":179,"543":543}],142:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var metadata = { - group: "builtin-pre" -}; - -exports.metadata = metadata; -var THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty"]; - -function isUseStrict(node) { - if (!t.isLiteral(node)) return false; - - if (node.raw && node.rawValue === node.value) { - return node.rawValue === "use strict"; - } else { - return node.value === "use strict"; - } -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - Program: { - enter: function enter(program) { - var first = program.body[0]; - - var directive; - if (t.isExpressionStatement(first) && isUseStrict(first.expression)) { - directive = first; - } else { - directive = t.expressionStatement(t.literal("use strict")); - this.unshiftContainer("body", directive); - if (first) { - directive.leadingComments = first.leadingComments; - first.leadingComments = []; - } - } - directive._blockHoist = Infinity; - } - }, - - /** - * [Please add a description.] - */ - - ThisExpression: function ThisExpression() { - if (!this.findParent(function (path) { - return !path.is("shadow") && THIS_BREAK_KEYS.indexOf(path.type) >= 0; - })) { - return t.identifier("undefined"); - } - } -}; -exports.visitor = visitor; -},{"179":179}],143:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function statementList(key, path) { - var paths = path.get(key); - - for (var i = 0; i < paths.length; i++) { - var _path = paths[i]; - - var func = _path.node; - if (!t.isFunctionDeclaration(func)) continue; - - var declar = t.variableDeclaration("let", [t.variableDeclarator(func.id, t.toExpression(func))]); - - // hoist it up above everything else - declar._blockHoist = 2; - - // todo: name this - func.id = null; - - _path.replaceWith(declar); - } -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - BlockStatement: function BlockStatement(node, parent) { - if (t.isFunction(parent) && parent.body === node || t.isExportDeclaration(parent)) { - return; - } - - statementList("body", this); - }, - - /** - * [Please add a description.] - */ - - SwitchCase: function SwitchCase() { - statementList("consequent", this); - } -}; -exports.visitor = visitor; -},{"179":179}],144:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _helpersNameMethod = _dereq_(61); - -var metadata = { - group: "builtin-basic" -}; - -exports.metadata = metadata; -// visit Property functions first - https://github.com/babel/babel/issues/1860 - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - "ArrowFunctionExpression|FunctionExpression": { - exit: function exit() { - if (!this.parentPath.isProperty()) { - return _helpersNameMethod.bare.apply(this, arguments); - } - } - }, - - /** - * [Please add a description.] - */ - - ObjectExpression: function ObjectExpression() { - var props = this.get("properties"); - var _arr = props; - for (var _i = 0; _i < _arr.length; _i++) { - var prop = _arr[_i]; - var value = prop.get("value"); - if (value.isFunction()) { - var newNode = _helpersNameMethod.bare(value.node, prop.node, value.scope); - if (newNode) value.replaceWith(newNode); - } - } - } -}; -exports.visitor = visitor; -},{"61":61}],145:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -// check if the input Literal `source` is an alternate casing of "react" -function check(source, file) { - if (t.isLiteral(source)) { - var name = source.value; - var lower = name.toLowerCase(); - - if (lower === "react" && name !== lower) { - throw file.errorWithNode(source, messages.get("didYouMean", "react")); - } - } -} - -/** - * [Please add a description.] - */ - -var visitor = { - - /** - * [Please add a description.] - */ - - CallExpression: function CallExpression(node, parent, scope, file) { - if (this.get("callee").isIdentifier({ name: "require" }) && node.arguments.length === 1) { - check(node.arguments[0], file); - } - }, - - /** - * [Please add a description.] - */ - - ModuleDeclaration: function ModuleDeclaration(node, parent, scope, file) { - check(node.source, file); - } -}; -exports.visitor = visitor; -},{"179":179,"43":43}],146:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _path = _dereq_(155); - -var _path2 = _interopRequireDefault(_path); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var TraversalContext = (function () { - function TraversalContext(scope, opts, state, parentPath) { - _classCallCheck(this, TraversalContext); - - this.queue = null; - - this.parentPath = parentPath; - this.scope = scope; - this.state = state; - this.opts = opts; - } - - /** - * [Please add a description.] - */ - - TraversalContext.prototype.shouldVisit = function shouldVisit(node) { - var opts = this.opts; - if (opts.enter || opts.exit) return true; - - if (opts[node.type]) return true; - - var keys = t.VISITOR_KEYS[node.type]; - if (!keys || !keys.length) return false; - - var _arr = keys; - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i]; - if (node[key]) return true; - } - - return false; - }; - - /** - * [Please add a description.] - */ - - TraversalContext.prototype.create = function create(node, obj, key, listKey) { - var path = _path2["default"].get({ - parentPath: this.parentPath, - parent: node, - container: obj, - key: key, - listKey: listKey - }); - path.unshiftContext(this); - return path; - }; - - /** - * [Please add a description.] - */ - - TraversalContext.prototype.visitMultiple = function visitMultiple(container, parent, listKey) { - // nothing to traverse! - if (container.length === 0) return false; - - var visited = []; - - var queue = this.queue = []; - var stop = false; - - // build up initial queue - for (var key = 0; key < container.length; key++) { - var self = container[key]; - if (self && this.shouldVisit(self)) { - queue.push(this.create(parent, container, key, listKey)); - } - } - - // visit the queue - var _arr2 = queue; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var path = _arr2[_i2]; - path.resync(); - - if (visited.indexOf(path.node) >= 0) continue; - visited.push(path.node); - - if (path.visit()) { - stop = true; - break; - } - } - - var _arr3 = queue; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var path = _arr3[_i3]; - path.shiftContext(); - } - - this.queue = null; - - return stop; - }; - - /** - * [Please add a description.] - */ - - TraversalContext.prototype.visitSingle = function visitSingle(node, key) { - if (this.shouldVisit(node[key])) { - var path = this.create(node, node, key); - path.visit(); - path.shiftContext(); - } - }; - - /** - * [Please add a description.] - */ - - TraversalContext.prototype.visit = function visit(node, key) { - var nodes = node[key]; - if (!nodes) return; - - if (Array.isArray(nodes)) { - return this.visitMultiple(nodes, node, key); - } else { - return this.visitSingle(node, key); - } - }; - - return TraversalContext; -})(); - -exports["default"] = TraversalContext; -module.exports = exports["default"]; -},{"155":155,"179":179}],147:[function(_dereq_,module,exports){ -/** - * [Please add a description.] - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Hub = function Hub(file) { - _classCallCheck(this, Hub); - - this.file = file; -}; - -exports["default"] = Hub; -module.exports = exports["default"]; -},{}],148:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports["default"] = traverse; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _context = _dereq_(146); - -var _context2 = _interopRequireDefault(_context); - -var _visitors = _dereq_(168); - -var visitors = _interopRequireWildcard(_visitors); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function traverse(parent, opts, scope, state, parentPath) { - if (!parent) return; - if (!opts) opts = {}; - - if (!opts.noScope && !scope) { - if (parent.type !== "Program" && parent.type !== "File") { - throw new Error(messages.get("traverseNeedsParent", parent.type)); - } - } - - visitors.explode(opts); - - // array of nodes - if (Array.isArray(parent)) { - for (var i = 0; i < parent.length; i++) { - traverse.node(parent[i], opts, scope, state, parentPath); - } - } else { - traverse.node(parent, opts, scope, state, parentPath); - } -} - -traverse.visitors = visitors; -traverse.verify = visitors.verify; -traverse.explode = visitors.explode; - -/** - * [Please add a description.] - */ - -traverse.node = function (node, opts, scope, state, parentPath, skipKeys) { - var keys = t.VISITOR_KEYS[node.type]; - if (!keys) return; - - var context = new _context2["default"](scope, opts, state, parentPath); - var _arr = keys; - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i]; - if (skipKeys && skipKeys[key]) continue; - if (context.visit(node, key)) return; - } -}; - -/** - * [Please add a description.] - */ - -var CLEAR_KEYS = t.COMMENT_KEYS.concat(["_scopeInfo", "_paths", "tokens", "comments", "start", "end", "loc", "raw", "rawValue"]); - -/** - * [Please add a description.] - */ - -traverse.clearNode = function (node) { - for (var i = 0; i < CLEAR_KEYS.length; i++) { - var key = CLEAR_KEYS[i]; - if (node[key] != null) node[key] = undefined; - } -}; - -/** - * [Please add a description.] - */ - -var clearVisitor = { - noScope: true, - exit: traverse.clearNode -}; - -/** - * [Please add a description.] - */ - -traverse.removeProperties = function (tree) { - traverse(tree, clearVisitor); - traverse.clearNode(tree); - - return tree; -}; - -/** - * [Please add a description.] - */ - -function hasBlacklistedType(node, parent, scope, state) { - if (node.type === state.type) { - state.has = true; - this.skip(); - } -} - -/** - * [Please add a description.] - */ - -traverse.hasType = function (tree, scope, type, blacklistTypes) { - // the node we're searching in is blacklisted - if (_lodashCollectionIncludes2["default"](blacklistTypes, tree.type)) return false; - - // the type we're looking for is the same as the passed node - if (tree.type === type) return true; - - var state = { - has: false, - type: type - }; - - traverse(tree, { - blacklist: blacklistTypes, - enter: hasBlacklistedType - }, scope, state); - - return state.has; -}; -module.exports = exports["default"]; -},{"146":146,"168":168,"179":179,"421":421,"43":43}],149:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.findParent = findParent; -exports.getFunctionParent = getFunctionParent; -exports.getStatementParent = getStatementParent; -exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom; -exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom; -exports.getAncestry = getAncestry; -exports.inType = inType; -exports.inShadow = inShadow; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _index = _dereq_(155); - -var _index2 = _interopRequireDefault(_index); - -/** - * Call the provided `callback` with the `NodePath`s of all the parents. - * When the `callback` returns a truthy value, we return that node path. - */ - -function findParent(callback) { - var path = this; - while (path = path.parentPath) { - if (callback(path)) return path; - } - return null; -} - -/** - * Get the parent function of the current path. - */ - -function getFunctionParent() { - return this.findParent(function (path) { - return path.isFunction() || path.isProgram(); - }); -} - -/** - * Walk up the tree until we hit a parent node path in a list. - */ - -function getStatementParent() { - var path = this; - do { - if (Array.isArray(path.container)) { - return path; - } - } while (path = path.parentPath); -} - -/** - * Get the deepest common ancestor and then from it, get the earliest relationship path - * to that ancestor. - * - * Earliest is defined as being "before" all the other nodes in terms of list container - * position and visiting key. - */ - -function getEarliestCommonAncestorFrom(paths) { - return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) { - var earliest; - var keys = t.VISITOR_KEYS[deepest.type]; - - var _arr = ancestries; - for (var _i = 0; _i < _arr.length; _i++) { - var ancestry = _arr[_i]; - var path = ancestry[i + 1]; - - // first path - if (!earliest) { - earliest = path; - continue; - } - - // handle containers - if (path.listKey && earliest.listKey === path.listKey) { - // we're in the same container so check if we're earlier - if (path.key < earliest.key) { - earliest = path; - continue; - } - } - - // handle keys - var earliestKeyIndex = keys.indexOf(earliest.parentKey); - var currentKeyIndex = keys.indexOf(path.parentKey); - if (earliestKeyIndex > currentKeyIndex) { - // key appears before so it's earlier - earliest = path; - } - } - - return earliest; - }); -} - -/** - * Get the earliest path in the tree where the provided `paths` intersect. - * - * TODO: Possible optimisation target. - */ - -function getDeepestCommonAncestorFrom(paths, filter) { - // istanbul ignore next - - var _this = this; - - if (!paths.length) { - return this; - } - - if (paths.length === 1) { - return paths[0]; - } - - // minimum depth of the tree so we know the highest node - var minDepth = Infinity; - - // last common ancestor - var lastCommonIndex, lastCommon; - - // get the ancestors of the path, breaking when the parent exceeds ourselves - var ancestries = paths.map(function (path) { - var ancestry = []; - - do { - ancestry.unshift(path); - } while ((path = path.parentPath) && path !== _this); - - // save min depth to avoid going too far in - if (ancestry.length < minDepth) { - minDepth = ancestry.length; - } - - return ancestry; - }); - - // get the first ancestry so we have a seed to assess all other ancestries with - var first = ancestries[0]; - - // check ancestor equality - depthLoop: for (var i = 0; i < minDepth; i++) { - var shouldMatch = first[i]; - - var _arr2 = ancestries; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var ancestry = _arr2[_i2]; - if (ancestry[i] !== shouldMatch) { - // we've hit a snag - break depthLoop; - } - } - - // next iteration may break so store these so they can be returned - lastCommonIndex = i; - lastCommon = shouldMatch; - } - - if (lastCommon) { - if (filter) { - return filter(lastCommon, lastCommonIndex, ancestries); - } else { - return lastCommon; - } - } else { - throw new Error("Couldn't find intersection"); - } -} - -/** - * Build an array of node paths containing the entire ancestry of the current node path. - * - * NOTE: The current node path is included in this. - */ - -function getAncestry() { - var path = this; - var paths = []; - do { - paths.push(path); - } while (path = path.parentPath); - return paths; -} - -/** - * [Please add a description.] - */ - -function inType() { - var path = this; - while (path) { - var _arr3 = arguments; - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var type = _arr3[_i3]; - if (path.node.type === type) return true; - } - path = path.parentPath; - } - - return false; -} - -/** - * Check if we're inside a shadowed function. - */ - -function inShadow(key) { - var path = this; - do { - if (path.isFunction()) { - var shadow = path.node.shadow; - if (shadow) { - // this is because sometimes we may have a `shadow` value of: - // - // { this: false } - // - // we need to catch this case if `inShadow` has been passed a `key` - if (!key || shadow[key] !== false) { - return path; - } - } else if (path.isArrowFunctionExpression()) { - return path; - } - - // normal function, we've found our function context - return null; - } - } while (path = path.parentPath); - return null; -} -},{"155":155,"179":179}],150:[function(_dereq_,module,exports){ -/** - * Share comments amongst siblings. - */ - -"use strict"; - -exports.__esModule = true; -exports.shareCommentsWithSiblings = shareCommentsWithSiblings; -exports.addComment = addComment; -exports.addComments = addComments; - -function shareCommentsWithSiblings() { - var node = this.node; - if (!node) return; - - var trailing = node.trailingComments; - var leading = node.leadingComments; - if (!trailing && !leading) return; - - var prev = this.getSibling(this.key - 1); - var next = this.getSibling(this.key + 1); - - if (!prev.node) prev = next; - if (!next.node) next = prev; - - prev.addComments("trailing", leading); - next.addComments("leading", trailing); -} - -/** - * [Please add a description.] - */ - -function addComment(type, content, line) { - this.addComments(type, [{ - type: line ? "CommentLine" : "CommentBlock", - value: content - }]); -} - -/** - * Give node `comments` of the specified `type`. - */ - -function addComments(type, comments) { - if (!comments) return; - - var node = this.node; - if (!node) return; - - var key = type + "Comments"; - - if (node[key]) { - node[key] = node[key].concat(comments); - } else { - node[key] = comments; - } -} -},{}],151:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.call = call; -exports.isBlacklisted = isBlacklisted; -exports.visit = visit; -exports.skip = skip; -exports.skipKey = skipKey; -exports.stop = stop; -exports.setScope = setScope; -exports.setContext = setContext; -exports.resync = resync; -exports._resyncParent = _resyncParent; -exports._resyncKey = _resyncKey; -exports._resyncList = _resyncList; -exports._resyncRemoved = _resyncRemoved; -exports.shiftContext = shiftContext; -exports.unshiftContext = unshiftContext; -exports.setup = setup; -exports.setKey = setKey; -exports.queueNode = queueNode; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(148); - -var _index2 = _interopRequireDefault(_index); - -/** - * [Please add a description.] - */ - -function call(key) { - var node = this.node; - if (!node) return; - - var opts = this.opts; - - var _arr = [opts[key], opts[node.type] && opts[node.type][key]]; - for (var _i = 0; _i < _arr.length; _i++) { - var fns = _arr[_i]; - if (!fns) continue; - - var _arr2 = fns; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var fn = _arr2[_i2]; - if (!fn) continue; - - var _node = this.node; - if (!_node) return; - - var previousType = this.type; - - // call the function with the params (node, parent, scope, state) - var replacement = fn.call(this, _node, this.parent, this.scope, this.state); - - if (replacement) { - this.replaceWith(replacement, true); - } - - if (this.shouldStop || this.shouldSkip || this.removed) return; - - if (previousType !== this.type) { - this.queueNode(this); - return; - } - } - } -} - -/** - * [Please add a description.] - */ - -function isBlacklisted() { - var blacklist = this.opts.blacklist; - return blacklist && blacklist.indexOf(this.node.type) > -1; -} - -/** - * Visits a node and calls appropriate enter and exit callbacks - * as required. - */ - -function visit() { - if (this.isBlacklisted()) return false; - if (this.opts.shouldSkip && this.opts.shouldSkip(this)) return false; - - this.call("enter"); - - if (this.shouldSkip) { - return this.shouldStop; - } - - var node = this.node; - var opts = this.opts; - - if (node) { - if (Array.isArray(node)) { - // traverse over these replacement nodes we purposely don't call exitNode - // as the original node has been destroyed - for (var i = 0; i < node.length; i++) { - _index2["default"].node(node[i], opts, this.scope, this.state, this, this.skipKeys); - } - } else { - _index2["default"].node(node, opts, this.scope, this.state, this, this.skipKeys); - this.call("exit"); - } - } - - return this.shouldStop; -} - -/** - * Sets shouldSkip flag true so that this node will be skipped while visiting. - */ - -function skip() { - this.shouldSkip = true; -} - -/** - * Adds given key to the list of keys to be skipped. - */ - -function skipKey(key) { - this.skipKeys[key] = true; -} - -/** - * [Please add a description.] - */ - -function stop() { - this.shouldStop = true; - this.shouldSkip = true; -} - -/** - * [Please add a description.] - */ - -function setScope() { - if (this.opts && this.opts.noScope) return; - - var target = this.context || this.parentPath; - this.scope = this.getScope(target && target.scope); - if (this.scope) this.scope.init(); -} - -/** - * [Please add a description.] - */ - -function setContext(context) { - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; - this.skipKeys = {}; - - if (context) { - this.context = context; - this.state = context.state; - this.opts = context.opts; - } - - this.setScope(); - - return this; -} - -/** - * Here we resync the node paths `key` and `container`. If they've changed according - * to what we have stored internally then we attempt to resync by crawling and looking - * for the new values. - */ - -function resync() { - if (this.removed) return; - - this._resyncParent(); - this._resyncList(); - this._resyncKey(); - //this._resyncRemoved(); -} - -/** - * [Please add a description.] - */ - -function _resyncParent() { - if (this.parentPath) { - this.parent = this.parentPath.node; - } -} - -/** - * [Please add a description.] - */ - -function _resyncKey() { - if (!this.container) return; - - if (this.node === this.container[this.key]) return; - - // grrr, path key is out of sync. this is likely due to a modification to the AST - // not done through our path APIs - - if (Array.isArray(this.container)) { - for (var i = 0; i < this.container.length; i++) { - if (this.container[i] === this.node) { - return this.setKey(i); - } - } - } else { - for (var key in this.container) { - if (this.container[key] === this.node) { - return this.setKey(key); - } - } - } - - this.key = null; -} - -/** - * [Please add a description.] - */ - -function _resyncList() { - var listKey = this.listKey; - var parentPath = this.parentPath; - if (!listKey || !parentPath) return; - - var newContainer = parentPath.node[listKey]; - if (this.container === newContainer) return; - - // container is out of sync. this is likely the result of it being reassigned - - if (newContainer) { - this.container = newContainer; - } else { - this.container = null; - } -} - -/** - * [Please add a description.] - */ - -function _resyncRemoved() { - if (this.key == null || !this.container || this.container[this.key] !== this.node) { - this._markRemoved(); - } -} - -/** - * [Please add a description.] - */ - -function shiftContext() { - this.contexts.shift(); - this.setContext(this.contexts[0]); -} - -/** - * [Please add a description.] - */ - -function unshiftContext(context) { - this.contexts.unshift(context); - this.setContext(context); -} - -/** - * [Please add a description.] - */ - -function setup(parentPath, container, listKey, key) { - this.inList = !!listKey; - this.listKey = listKey; - this.parentKey = listKey || key; - this.container = container; - - this.parentPath = parentPath || this.parentPath; - this.setKey(key); -} - -/** - * [Please add a description.] - */ - -function setKey(key) { - this.key = key; - this.node = this.container[this.key]; - this.type = this.node && this.node.type; -} - -/** - * [Please add a description.] - */ - -function queueNode(path) { - var _arr3 = this.contexts; - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var context = _arr3[_i3]; - if (context.queue) { - context.queue.push(path); - } - } -} -},{"148":148}],152:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.toComputedKey = toComputedKey; -exports.ensureBlock = ensureBlock; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function toComputedKey() { - var node = this.node; - - var key; - if (this.isMemberExpression()) { - key = node.property; - } else if (this.isProperty()) { - key = node.key; - } else { - throw new ReferenceError("todo"); - } - - if (!node.computed) { - if (t.isIdentifier(key)) key = t.literal(key.name); - } - - return key; -} - -/** - * [Please add a description.] - */ - -function ensureBlock() { - return t.ensureBlock(this.node); -} -},{"179":179}],153:[function(_dereq_,module,exports){ -(function (global){ -/* eslint eqeqeq: 0 */ - -"use strict"; - -exports.__esModule = true; -exports.evaluateTruthy = evaluateTruthy; -exports.evaluate = evaluate; -var VALID_CALLEES = ["String", "Number", "Math"]; - -/** - * Walk the input `node` and statically evaluate if it's truthy. - * - * Returning `true` when we're sure that the expression will evaluate to a - * truthy value, `false` if we're sure that it will evaluate to a falsy - * value and `undefined` if we aren't sure. Because of this please do not - * rely on coercion when using this method and check with === if it's false. - * - * For example do: - * - * if (t.evaluateTruthy(node) === false) falsyLogic(); - * - * **AND NOT** - * - * if (!t.evaluateTruthy(node)) falsyLogic(); - * - */ - -function evaluateTruthy() { - var res = this.evaluate(); - if (res.confident) return !!res.value; -} - -/** - * Walk the input `node` and statically evaluate it. - * - * Returns an object in the form `{ confident, value }`. `confident` indicates - * whether or not we had to drop out of evaluating the expression because of - * hitting an unknown node that we couldn't confidently find the value of. - * - * Example: - * - * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } - * t.evaluate(parse("!true")) // { confident: true, value: false } - * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined } - * - */ - -function evaluate() { - var confident = true; - - var value = evaluate(this); - if (!confident) value = undefined; - return { - confident: confident, - value: value - }; - - function evaluate(path) { - if (!confident) return; - - var node = path.node; - - if (path.isSequenceExpression()) { - var exprs = path.get("expressions"); - return evaluate(exprs[exprs.length - 1]); - } - - if (path.isLiteral()) { - if (node.regex) { - // we have a regex and we can't represent it natively - } else { - return node.value; - } - } - - if (path.isConditionalExpression()) { - if (evaluate(path.get("test"))) { - return evaluate(path.get("consequent")); - } else { - return evaluate(path.get("alternate")); - } - } - - if (path.isTypeCastExpression()) { - return evaluate(path.get("expression")); - } - - if (path.isIdentifier() && !path.scope.hasBinding(node.name, true)) { - if (node.name === "undefined") { - return undefined; - } else if (node.name === "Infinity") { - return Infinity; - } else if (node.name === "NaN") { - return NaN; - } - } - - // "foo".length - if (path.isMemberExpression() && !path.parentPath.isCallExpression({ callee: node })) { - var _property = path.get("property"); - var object = path.get("object"); - - if (object.isLiteral() && _property.isIdentifier()) { - var _value = object.node.value; - var type = typeof _value; - if (type === "number" || type === "string") { - return _value[_property.node.name]; - } - } - } - - if (path.isReferencedIdentifier()) { - var binding = path.scope.getBinding(node.name); - if (binding && binding.hasValue) { - return binding.value; - } else { - var resolved = path.resolve(); - if (resolved === path) { - return confident = false; - } else { - return evaluate(resolved); - } - } - } - - if (path.isUnaryExpression({ prefix: true })) { - var argument = path.get("argument"); - var arg = evaluate(argument); - switch (node.operator) { - case "void": - return undefined; - case "!": - return !arg; - case "+": - return +arg; - case "-": - return -arg; - case "~": - return ~arg; - case "typeof": - if (argument.isFunction()) { - return "function"; - } else { - return typeof arg; - } - } - } - - if (path.isArrayExpression() || path.isObjectExpression()) { - // we could evaluate these but it's probably impractical and not very useful - } - - if (path.isLogicalExpression()) { - // If we are confident that one side of an && is false, or one side of - // an || is true, we can be confident about the entire expression - var wasConfident = confident; - var left = evaluate(path.get("left")); - var leftConfident = confident; - confident = wasConfident; - var right = evaluate(path.get("right")); - var rightConfident = confident; - var uncertain = leftConfident !== rightConfident; - confident = leftConfident && rightConfident; - - switch (node.operator) { - case "||": - if ((left || right) && uncertain) { - confident = true; - } - return left || right; - case "&&": - if (!left && leftConfident || !right && rightConfident) { - confident = true; - } - return left && right; - } - } - - if (path.isBinaryExpression()) { - var left = evaluate(path.get("left")); - var right = evaluate(path.get("right")); - - switch (node.operator) { - case "-": - return left - right; - case "+": - return left + right; - case "/": - return left / right; - case "*": - return left * right; - case "%": - return left % right; - case "**": - return Math.pow(left, right); - case "<": - return left < right; - case ">": - return left > right; - case "<=": - return left <= right; - case ">=": - return left >= right; - case "==": - return left == right; - case "!=": - return left != right; - case "===": - return left === right; - case "!==": - return left !== right; - case "|": - return left | right; - case "&": - return left & right; - case "^": - return left ^ right; - case "<<": - return left << right; - case ">>": - return left >> right; - case ">>>": - return left >>> right; - } - } - - if (path.isCallExpression()) { - var callee = path.get("callee"); - var context; - var func; - - // Number(1); - if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && VALID_CALLEES.indexOf(callee.node.name) >= 0) { - func = global[node.callee.name]; - } - - if (callee.isMemberExpression()) { - var object = callee.get("object"); - var property = callee.get("property"); - - // Math.min(1, 2) - if (object.isIdentifier() && property.isIdentifier() && VALID_CALLEES.indexOf(object.node.name) >= 0) { - context = global[object.node.name]; - func = context[property.node.name]; - } - - // "abc".charCodeAt(4) - if (object.isLiteral() && property.isIdentifier()) { - var type = typeof object.node.value; - if (type === "string" || type === "number") { - context = object.node.value; - func = context[property.node.name]; - } - } - } - - if (func) { - var args = path.get("arguments").map(evaluate); - if (!confident) return; - - return func.apply(context, args); - } - } - - confident = false; - } -} -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],154:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getStatementParent = getStatementParent; -exports.getOpposite = getOpposite; -exports.getCompletionRecords = getCompletionRecords; -exports.getSibling = getSibling; -exports.get = get; -exports._getKey = _getKey; -exports._getPattern = _getPattern; -exports.getBindingIdentifiers = getBindingIdentifiers; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(155); - -var _index2 = _interopRequireDefault(_index); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -function getStatementParent() { - var path = this; - - do { - if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) { - break; - } else { - path = path.parentPath; - } - } while (path); - - if (path && (path.isProgram() || path.isFile())) { - throw new Error("File/Program node, we can't possibly find a statement parent to this"); - } - - return path; -} - -/** - * [Please add a description.] - */ - -function getOpposite() { - if (this.key === "left") { - return this.getSibling("right"); - } else if (this.key === "right") { - return this.getSibling("left"); - } -} - -/** - * [Please add a description.] - */ - -function getCompletionRecords() { - var paths = []; - - var add = function add(path) { - if (path) paths = paths.concat(path.getCompletionRecords()); - }; - - if (this.isIfStatement()) { - add(this.get("consequent")); - add(this.get("alternate")); - } else if (this.isDoExpression() || this.isFor() || this.isWhile()) { - add(this.get("body")); - } else if (this.isProgram() || this.isBlockStatement()) { - add(this.get("body").pop()); - } else if (this.isFunction()) { - return this.get("body").getCompletionRecords(); - } else if (this.isTryStatement()) { - add(this.get("block")); - add(this.get("handler")); - add(this.get("finalizer")); - } else { - paths.push(this); - } - - return paths; -} - -/** - * [Please add a description.] - */ - -function getSibling(key) { - return _index2["default"].get({ - parentPath: this.parentPath, - parent: this.parent, - container: this.container, - listKey: this.listKey, - key: key - }); -} - -/** - * [Please add a description.] - */ - -function get(key, context) { - if (context === true) context = this.context; - var parts = key.split("."); - if (parts.length === 1) { - // "foo" - return this._getKey(key, context); - } else { - // "foo.bar" - return this._getPattern(parts, context); - } -} - -/** - * [Please add a description.] - */ - -function _getKey(key, context) { - // istanbul ignore next - - var _this = this; - - var node = this.node; - var container = node[key]; - - if (Array.isArray(container)) { - // requested a container so give them all the paths - return container.map(function (_, i) { - return _index2["default"].get({ - listKey: key, - parentPath: _this, - parent: node, - container: container, - key: i - }).setContext(context); - }); - } else { - return _index2["default"].get({ - parentPath: this, - parent: node, - container: node, - key: key - }).setContext(context); - } -} - -/** - * [Please add a description.] - */ - -function _getPattern(parts, context) { - var path = this; - var _arr = parts; - for (var _i = 0; _i < _arr.length; _i++) { - var part = _arr[_i]; - if (part === ".") { - path = path.parentPath; - } else { - if (Array.isArray(path)) { - path = path[part]; - } else { - path = path.get(part, context); - } - } - } - return path; -} - -/** - * [Please add a description.] - */ - -function getBindingIdentifiers(duplicates) { - return t.getBindingIdentifiers(this.node, duplicates); -} -},{"155":155,"179":179}],155:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _libVirtualTypes = _dereq_(162); - -var virtualTypes = _interopRequireWildcard(_libVirtualTypes); - -var _index = _dereq_(148); - -var _index2 = _interopRequireDefault(_index); - -var _lodashObjectAssign = _dereq_(517); - -var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); - -var _scope = _dereq_(167); - -var _scope2 = _interopRequireDefault(_scope); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var NodePath = (function () { - - /** - * [Please add a description.] - */ - - function NodePath(hub, parent) { - _classCallCheck(this, NodePath); - - this.contexts = []; - this.parent = parent; - this.data = {}; - this.hub = hub; - - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; - this.state = null; - this.opts = null; - this.skipKeys = null; - this.parentPath = null; - this.context = null; - this.container = null; - this.listKey = null; - this.inList = false; - this.parentKey = null; - this.key = null; - this.node = null; - this.scope = null; - this.type = null; - this.typeAnnotation = null; - } - - /** - * [Please add a description.] - */ - - /** - * [Please add a description.] - */ - - NodePath.get = function get(_ref) { - var hub = _ref.hub; - var parentPath = _ref.parentPath; - var parent = _ref.parent; - var container = _ref.container; - var listKey = _ref.listKey; - var key = _ref.key; - - if (!hub && parentPath) { - hub = parentPath.hub; - } - - var targetNode = container[key]; - var paths = parent._paths = parent._paths || []; - var path; - - for (var i = 0; i < paths.length; i++) { - var pathCheck = paths[i]; - if (pathCheck.node === targetNode) { - path = pathCheck; - break; - } - } - - if (!path) { - path = new NodePath(hub, parent); - paths.push(path); - } - - path.setup(parentPath, container, listKey, key); - - return path; - }; - - /** - * [Please add a description.] - */ - - NodePath.prototype.getScope = function getScope(scope) { - var ourScope = scope; - - // we're entering a new scope so let's construct it! - if (this.isScope()) { - ourScope = new _scope2["default"](this, scope); - } - - return ourScope; - }; - - /** - * [Please add a description.] - */ - - NodePath.prototype.setData = function setData(key, val) { - return this.data[key] = val; - }; - - /** - * [Please add a description.] - */ - - NodePath.prototype.getData = function getData(key, def) { - var val = this.data[key]; - if (!val && def) val = this.data[key] = def; - return val; - }; - - /** - * [Please add a description.] - */ - - NodePath.prototype.errorWithNode = function errorWithNode(msg) { - var Error = arguments.length <= 1 || arguments[1] === undefined ? SyntaxError : arguments[1]; - - return this.hub.file.errorWithNode(this.node, msg, Error); - }; - - /** - * [Please add a description.] - */ - - NodePath.prototype.traverse = function traverse(visitor, state) { - _index2["default"](this.node, visitor, this.scope, state, this); - }; - - return NodePath; -})(); - -exports["default"] = NodePath; -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(149)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(156)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(165)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(153)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(152)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(159)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(151)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(164)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(163)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(154)); -_lodashObjectAssign2["default"](NodePath.prototype, _dereq_(150)); - -var _arr = t.TYPES; - -var _loop = function () { - var type = _arr[_i]; - var typeKey = "is" + type; - NodePath.prototype[typeKey] = function (opts) { - return t[typeKey](this.node, opts); - }; -}; - -for (var _i = 0; _i < _arr.length; _i++) { - _loop(); -} - -var _loop2 = function (type) { - if (type[0] === "_") return "continue"; - if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type); - - NodePath.prototype["is" + type] = function (opts) { - return virtualTypes[type].checkPath(this, opts); - }; -}; - -for (var type in virtualTypes) { - var _ret2 = _loop2(type); - - // istanbul ignore next - if (_ret2 === "continue") continue; -} -module.exports = exports["default"]; -},{"148":148,"149":149,"150":150,"151":151,"152":152,"153":153,"154":154,"156":156,"159":159,"162":162,"163":163,"164":164,"165":165,"167":167,"179":179,"517":517}],156:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getTypeAnnotation = getTypeAnnotation; -exports._getTypeAnnotation = _getTypeAnnotation; -exports.isBaseType = isBaseType; -exports.couldBeBaseType = couldBeBaseType; -exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches; -exports.isGenericType = isGenericType; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _inferers = _dereq_(158); - -var inferers = _interopRequireWildcard(_inferers); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Infer the type of the current `NodePath`. - */ - -function getTypeAnnotation() { - if (this.typeAnnotation) return this.typeAnnotation; - - var type = this._getTypeAnnotation() || t.anyTypeAnnotation(); - if (t.isTypeAnnotation(type)) type = type.typeAnnotation; - return this.typeAnnotation = type; -} - -/** - * todo: split up this method - */ - -function _getTypeAnnotation() { - var node = this.node; - - if (!node) { - // handle initializerless variables, add in checks for loop initializers too - if (this.key === "init" && this.parentPath.isVariableDeclarator()) { - var declar = this.parentPath.parentPath; - var declarParent = declar.parentPath; - - // for (var NODE in bar) {} - if (declar.key === "left" && declarParent.isForInStatement()) { - return t.stringTypeAnnotation(); - } - - // for (var NODE of bar) {} - if (declar.key === "left" && declarParent.isForOfStatement()) { - return t.anyTypeAnnotation(); - } - - return t.voidTypeAnnotation(); - } else { - return; - } - } - - if (node.typeAnnotation) { - return node.typeAnnotation; - } - - var inferer = inferers[node.type]; - if (inferer) { - return inferer.call(this, node); - } - - inferer = inferers[this.parentPath.type]; - if (inferer && inferer.validParent) { - return this.parentPath.getTypeAnnotation(); - } -} - -/** - * [Please add a description.] - */ - -function isBaseType(baseName, soft) { - return _isBaseType(baseName, this.getTypeAnnotation(), soft); -} - -/** - * [Please add a description.] - */ - -function _isBaseType(baseName, type, soft) { - if (baseName === "string") { - return t.isStringTypeAnnotation(type); - } else if (baseName === "number") { - return t.isNumberTypeAnnotation(type); - } else if (baseName === "boolean") { - return t.isBooleanTypeAnnotation(type); - } else if (baseName === "any") { - return t.isAnyTypeAnnotation(type); - } else if (baseName === "mixed") { - return t.isMixedTypeAnnotation(type); - } else if (baseName === "void") { - return t.isVoidTypeAnnotation(type); - } else { - if (soft) { - return false; - } else { - throw new Error("Unknown base type " + baseName); - } - } -} - -/** - * [Please add a description.] - */ - -function couldBeBaseType(name) { - var type = this.getTypeAnnotation(); - if (t.isAnyTypeAnnotation(type)) return true; - - if (t.isUnionTypeAnnotation(type)) { - var _arr = type.types; - - for (var _i = 0; _i < _arr.length; _i++) { - var type2 = _arr[_i]; - if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) { - return true; - } - } - return false; - } else { - return _isBaseType(name, type, true); - } -} - -/** - * [Please add a description.] - */ - -function baseTypeStrictlyMatches(right) { - var left = this.getTypeAnnotation(); - right = right.getTypeAnnotation(); - - if (!t.isAnyTypeAnnotation() && t.isFlowBaseAnnotation(left)) { - return right.type === left.type; - } -} - -/** - * [Please add a description.] - */ - -function isGenericType(genericName) { - var type = this.getTypeAnnotation(); - return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName }); -} -},{"158":158,"179":179}],157:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -exports["default"] = function (node) { - if (!this.isReferenced()) return; - - // check if a binding exists of this value and if so then return a union type of all - // possible types that the binding could be - var binding = this.scope.getBinding(node.name); - if (binding) { - if (binding.identifier.typeAnnotation) { - return binding.identifier.typeAnnotation; - } else { - return getTypeAnnotationBindingConstantViolations(this, node.name); - } - } - - // built-in values - if (node.name === "undefined") { - return t.voidTypeAnnotation(); - } else if (node.name === "NaN" || node.name === "Infinity") { - return t.numberTypeAnnotation(); - } else if (node.name === "arguments") { - // todo - } -}; - -/** - * [Please add a description.] - */ - -function getTypeAnnotationBindingConstantViolations(path, name) { - var binding = path.scope.getBinding(name); - - var types = []; - path.typeAnnotation = t.unionTypeAnnotation(types); - - var functionConstantViolations = []; - var constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations); - - var testType = getConditionalAnnotation(path, name); - if (testType) { - var testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement); - - // remove constant violations observed before the IfStatement - constantViolations = constantViolations.filter(function (path) { - return testConstantViolations.indexOf(path) < 0; - }); - - // clear current types and add in observed test type - types.push(testType.typeAnnotation); - } - - if (constantViolations.length) { - // pick one constant from each scope which will represent the last possible - // control flow path that it could've taken/been - var rawConstantViolations = constantViolations.reverse(); - var visitedScopes = []; - constantViolations = []; - var _arr = rawConstantViolations; - for (var _i = 0; _i < _arr.length; _i++) { - var violation = _arr[_i]; - var violationScope = violation.scope; - if (visitedScopes.indexOf(violationScope) >= 0) continue; - - visitedScopes.push(violationScope); - constantViolations.push(violation); - - if (violationScope === path.scope) { - constantViolations = [violation]; - break; - } - } - - // add back on function constant violations since we can't track calls - constantViolations = constantViolations.concat(functionConstantViolations); - - // push on inferred types of violated paths - var _arr2 = constantViolations; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var violation = _arr2[_i2]; - types.push(violation.getTypeAnnotation()); - } - } - - if (types.length) { - return t.createUnionTypeAnnotation(types); - } -} - -/** - * [Please add a description.] - */ - -function getConstantViolationsBefore(binding, path, functions) { - var violations = binding.constantViolations.slice(); - violations.unshift(binding.path); - return violations.filter(function (violation) { - violation = violation.resolve(); - var status = violation._guessExecutionStatusRelativeTo(path); - if (functions && status === "function") functions.push(violation); - return status === "before"; - }); -} - -/** - * [Please add a description.] - */ - -function inferAnnotationFromBinaryExpression(name, path) { - var operator = path.node.operator; - - var right = path.get("right").resolve(); - var left = path.get("left").resolve(); - - var target; - if (left.isIdentifier({ name: name })) { - target = right; - } else if (right.isIdentifier({ name: name })) { - target = left; - } - if (target) { - if (operator === "===") { - return target.getTypeAnnotation(); - } else if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { - return t.numberTypeAnnotation(); - } else { - return; - } - } else { - if (operator !== "===") return; - } - - // - var typeofPath; - var typePath; - if (left.isUnaryExpression({ operator: "typeof" })) { - typeofPath = left; - typePath = right; - } else if (right.isUnaryExpression({ operator: "typeof" })) { - typeofPath = right; - typePath = left; - } - if (!typePath && !typeofPath) return; - - // ensure that the type path is a Literal - typePath = typePath.resolve(); - if (!typePath.isLiteral()) return; - - // and that it's a string so we can infer it - var typeValue = typePath.node.value; - if (typeof typeValue !== "string") return; - - // and that the argument of the typeof path references us! - if (!typeofPath.get("argument").isIdentifier({ name: name })) return; - - // turn type value into a type annotation - return t.createTypeAnnotationBasedOnTypeof(typePath.node.value); -} - -/** - * [Please add a description.] - */ - -function getParentConditionalPath(path) { - var parentPath; - while (parentPath = path.parentPath) { - if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) { - if (path.key === "test") { - return; - } else { - return parentPath; - } - } else { - path = parentPath; - } - } -} - -/** - * [Please add a description.] - */ - -function getConditionalAnnotation(path, name) { - var ifStatement = getParentConditionalPath(path); - if (!ifStatement) return; - - var test = ifStatement.get("test"); - var paths = [test]; - var types = []; - - do { - var _path = paths.shift().resolve(); - - if (_path.isLogicalExpression()) { - paths.push(_path.get("left")); - paths.push(_path.get("right")); - } - - if (_path.isBinaryExpression()) { - var type = inferAnnotationFromBinaryExpression(name, _path); - if (type) types.push(type); - } - } while (paths.length); - - if (types.length) { - return { - typeAnnotation: t.createUnionTypeAnnotation(types), - ifStatement: ifStatement - }; - } else { - return getConditionalAnnotation(ifStatement, name); - } -} -module.exports = exports["default"]; -},{"179":179}],158:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.VariableDeclarator = VariableDeclarator; -exports.TypeCastExpression = TypeCastExpression; -exports.NewExpression = NewExpression; -exports.TemplateLiteral = TemplateLiteral; -exports.UnaryExpression = UnaryExpression; -exports.BinaryExpression = BinaryExpression; -exports.LogicalExpression = LogicalExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.SequenceExpression = SequenceExpression; -exports.AssignmentExpression = AssignmentExpression; -exports.UpdateExpression = UpdateExpression; -exports.Literal = Literal; -exports.ObjectExpression = ObjectExpression; -exports.ArrayExpression = ArrayExpression; -exports.RestElement = RestElement; -exports.CallExpression = CallExpression; -exports.TaggedTemplateExpression = TaggedTemplateExpression; -// istanbul ignore next - -function _interopRequire(obj) { return obj && obj.__esModule ? obj["default"] : obj; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _infererReference = _dereq_(157); - -exports.Identifier = _interopRequire(_infererReference); - -/** - * [Please add a description.] - */ - -function VariableDeclarator() { - var id = this.get("id"); - - if (id.isIdentifier()) { - return this.get("init").getTypeAnnotation(); - } else { - return; - } -} - -/** - * [Please add a description.] - */ - -function TypeCastExpression(node) { - return node.typeAnnotation; -} - -TypeCastExpression.validParent = true; - -/** - * [Please add a description.] - */ - -function NewExpression(node) { - if (this.get("callee").isIdentifier()) { - // only resolve identifier callee - return t.genericTypeAnnotation(node.callee); - } -} - -/** - * [Please add a description.] - */ - -function TemplateLiteral() { - return t.stringTypeAnnotation(); -} - -/** - * [Please add a description.] - */ - -function UnaryExpression(node) { - var operator = node.operator; - - if (operator === "void") { - return t.voidTypeAnnotation(); - } else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) { - return t.numberTypeAnnotation(); - } else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) { - return t.stringTypeAnnotation(); - } else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) { - return t.booleanTypeAnnotation(); - } -} - -/** - * [Please add a description.] - */ - -function BinaryExpression(node) { - var operator = node.operator; - - if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { - return t.numberTypeAnnotation(); - } else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) { - return t.booleanTypeAnnotation(); - } else if (operator === "+") { - var right = this.get("right"); - var left = this.get("left"); - - if (left.isBaseType("number") && right.isBaseType("number")) { - // both numbers so this will be a number - return t.numberTypeAnnotation(); - } else if (left.isBaseType("string") || right.isBaseType("string")) { - // one is a string so the result will be a string - return t.stringTypeAnnotation(); - } - - // unsure if left and right are strings or numbers so stay on the safe side - return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]); - } -} - -/** - * [Please add a description.] - */ - -function LogicalExpression() { - return t.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]); -} - -/** - * [Please add a description.] - */ - -function ConditionalExpression() { - return t.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]); -} - -/** - * [Please add a description.] - */ - -function SequenceExpression() { - return this.get("expressions").pop().getTypeAnnotation(); -} - -/** - * [Please add a description.] - */ - -function AssignmentExpression() { - return this.get("right").getTypeAnnotation(); -} - -/** - * [Please add a description.] - */ - -function UpdateExpression(node) { - var operator = node.operator; - if (operator === "++" || operator === "--") { - return t.numberTypeAnnotation(); - } -} - -/** - * [Please add a description.] - */ - -function Literal(node) { - var value = node.value; - if (typeof value === "string") return t.stringTypeAnnotation(); - if (typeof value === "number") return t.numberTypeAnnotation(); - if (typeof value === "boolean") return t.booleanTypeAnnotation(); - if (value === null) return t.voidTypeAnnotation(); - if (node.regex) return t.genericTypeAnnotation(t.identifier("RegExp")); -} - -/** - * [Please add a description.] - */ - -function ObjectExpression() { - return t.genericTypeAnnotation(t.identifier("Object")); -} - -/** - * [Please add a description.] - */ - -function ArrayExpression() { - return t.genericTypeAnnotation(t.identifier("Array")); -} - -/** - * [Please add a description.] - */ - -function RestElement() { - return ArrayExpression(); -} - -RestElement.validParent = true; - -/** - * [Please add a description.] - */ - -function Func() { - return t.genericTypeAnnotation(t.identifier("Function")); -} - -exports.Function = Func; -exports.Class = Func; - -/** - * [Please add a description.] - */ - -function CallExpression() { - return resolveCall(this.get("callee")); -} - -/** - * [Please add a description.] - */ - -function TaggedTemplateExpression() { - return resolveCall(this.get("tag")); -} - -/** - * [Please add a description.] - */ - -function resolveCall(callee) { - callee = callee.resolve(); - - if (callee.isFunction()) { - if (callee.is("async")) { - if (callee.is("generator")) { - return t.genericTypeAnnotation(t.identifier("AsyncIterator")); - } else { - return t.genericTypeAnnotation(t.identifier("Promise")); - } - } else { - if (callee.node.returnType) { - return callee.node.returnType; - } else { - // todo: get union type of all return arguments - } - } - } -} -},{"157":157,"179":179}],159:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.matchesPattern = matchesPattern; -exports.has = has; -exports.isnt = isnt; -exports.equals = equals; -exports.isNodeType = isNodeType; -exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression; -exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement; -exports.isCompletionRecord = isCompletionRecord; -exports.isStatementOrBlock = isStatementOrBlock; -exports.referencesImport = referencesImport; -exports.getSource = getSource; -exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore; -exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo; -exports.resolve = resolve; -exports._resolve = _resolve; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Match the current node if it matches the provided `pattern`. - * - * For example, given the match `React.createClass` it would match the - * parsed nodes of `React.createClass` and `React["createClass"]`. - */ - -function matchesPattern(pattern, allowPartial) { - // not a member expression - if (!this.isMemberExpression()) return false; - - var parts = pattern.split("."); - var search = [this.node]; - var i = 0; - - function matches(name) { - var part = parts[i]; - return part === "*" || name === part; - } - - while (search.length) { - var node = search.shift(); - - if (allowPartial && i === parts.length) { - return true; - } - - if (t.isIdentifier(node)) { - // this part doesn't match - if (!matches(node.name)) return false; - } else if (t.isLiteral(node)) { - // this part doesn't match - if (!matches(node.value)) return false; - } else if (t.isMemberExpression(node)) { - if (node.computed && !t.isLiteral(node.property)) { - // we can't deal with this - return false; - } else { - search.unshift(node.property); - search.unshift(node.object); - continue; - } - } else if (t.isThisExpression(node)) { - if (!matches("this")) return false; - } else { - // we can't deal with this - return false; - } - - // too many parts - if (++i > parts.length) { - return false; - } - } - - return i === parts.length; -} - -/** - * Check whether we have the input `key`. If the `key` references an array then we check - * if the array has any items, otherwise we just check if it's falsy. - */ - -function has(key) { - var val = this.node[key]; - if (val && Array.isArray(val)) { - return !!val.length; - } else { - return !!val; - } -} - -/** - * Alias of `has`. - */ - -var is = has; - -exports.is = is; -/** - * Opposite of `has`. - */ - -function isnt(key) { - return !this.has(key); -} - -/** - * Check whether the path node `key` strict equals `value`. - */ - -function equals(key, value) { - return this.node[key] === value; -} - -/** - * Check the type against our stored internal type of the node. This is handy when a node has - * been removed yet we still internally know the type and need it to calculate node replacement. - */ - -function isNodeType(type) { - return t.isType(this.type, type); -} - -/** - * This checks whether or not we're in one of the following positions: - * - * for (KEY in right); - * for (KEY;;); - * - * This is because these spots allow VariableDeclarations AND normal expressions so we need - * to tell the path replacement that it's ok to replace this with an expression. - */ - -function canHaveVariableDeclarationOrExpression() { - return (this.key === "init" || this.key === "left") && this.parentPath.isFor(); -} - -/** - * This checks whether we are swapping an arrow function's body between an - * expression and a block statement (or vice versa). - * - * This is because arrow functions may implicitly return an expression, which - * is the same as containing a block statement. - */ - -function canSwapBetweenExpressionAndStatement(replacement) { - if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) { - return false; - } - - if (this.isExpression()) { - return t.isBlockStatement(replacement); - } else if (this.isBlockStatement()) { - return t.isExpression(replacement); - } - - return false; -} - -/** - * Check whether the current path references a completion record - */ - -function isCompletionRecord(allowInsideFunction) { - var path = this; - var first = true; - - do { - var container = path.container; - - // we're in a function so can't be a completion record - if (path.isFunction() && !first) { - return !!allowInsideFunction; - } - - first = false; - - // check to see if we're the last item in the container and if we are - // we're a completion record! - if (Array.isArray(container) && path.key !== container.length - 1) { - return false; - } - } while ((path = path.parentPath) && !path.isProgram()); - - return true; -} - -/** - * Check whether or not the current `key` allows either a single statement or block statement - * so we can explode it if necessary. - */ - -function isStatementOrBlock() { - if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) { - return false; - } else { - return _lodashCollectionIncludes2["default"](t.STATEMENT_OR_BLOCK_KEYS, this.key); - } -} - -/** - * Check if the currently assigned path references the `importName` of `moduleSource`. - */ - -function referencesImport(moduleSource, importName) { - if (!this.isReferencedIdentifier()) return false; - - var binding = this.scope.getBinding(this.node.name); - if (!binding || binding.kind !== "module") return false; - - var path = binding.path; - var parent = path.parentPath; - if (!parent.isImportDeclaration()) return false; - - // check moduleSource - if (parent.node.source.value === moduleSource) { - if (!importName) return true; - } else { - return false; - } - - if (path.isImportDefaultSpecifier() && importName === "default") { - return true; - } - - if (path.isImportNamespaceSpecifier() && importName === "*") { - return true; - } - - if (path.isImportSpecifier() && path.node.imported.name === importName) { - return true; - } - - return false; -} - -/** - * Get the source code associated with this node. - */ - -function getSource() { - var node = this.node; - if (node.end) { - return this.hub.file.code.slice(node.start, node.end); - } else { - return ""; - } -} - -/** - * [Please add a description.] - */ - -function willIMaybeExecuteBefore(target) { - return this._guessExecutionStatusRelativeTo(target) !== "after"; -} - -/** - * Given a `target` check the execution status of it relative to the current path. - * - * "Execution status" simply refers to where or not we **think** this will execuete - * before or after the input `target` element. - */ - -function _guessExecutionStatusRelativeTo(target) { - // check if the two paths are in different functions, we can't track execution of these - var targetFuncParent = target.scope.getFunctionParent(); - var selfFuncParent = this.scope.getFunctionParent(); - if (targetFuncParent !== selfFuncParent) { - return "function"; - } - - var targetPaths = target.getAncestry(); - //if (targetPaths.indexOf(this) >= 0) return "after"; - - var selfPaths = this.getAncestry(); - - // get ancestor where the branches intersect - var commonPath; - var targetIndex; - var selfIndex; - for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) { - var selfPath = selfPaths[selfIndex]; - targetIndex = targetPaths.indexOf(selfPath); - if (targetIndex >= 0) { - commonPath = selfPath; - break; - } - } - if (!commonPath) { - return "before"; - } - - // get the relationship paths that associate these nodes to their common ancestor - var targetRelationship = targetPaths[targetIndex - 1]; - var selfRelationship = selfPaths[selfIndex - 1]; - if (!targetRelationship || !selfRelationship) { - return "before"; - } - - // container list so let's see which one is after the other - if (targetRelationship.listKey && targetRelationship.container === selfRelationship.container) { - return targetRelationship.key > selfRelationship.key ? "before" : "after"; - } - - // otherwise we're associated by a parent node, check which key comes before the other - var targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key); - var selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); - return targetKeyPosition > selfKeyPosition ? "before" : "after"; -} - -/** - * Resolve a "pointer" `NodePath` to it's absolute path. - */ - -function resolve(dangerous, resolved) { - return this._resolve(dangerous, resolved) || this; -} - -/** - * [Please add a description.] - */ - -function _resolve(dangerous, resolved) { - // detect infinite recursion - // todo: possibly have a max length on this just to be safe - if (resolved && resolved.indexOf(this) >= 0) return; - - // we store all the paths we've "resolved" in this array to prevent infinite recursion - resolved = resolved || []; - resolved.push(this); - - if (this.isVariableDeclarator()) { - if (this.get("id").isIdentifier()) { - return this.get("init").resolve(dangerous, resolved); - } else { - // otherwise it's a request for a pattern and that's a bit more tricky - } - } else if (this.isReferencedIdentifier()) { - var binding = this.scope.getBinding(this.node.name); - if (!binding) return; - - // reassigned so we can't really resolve it - if (!binding.constant) return; - - // todo - lookup module in dependency graph - if (binding.kind === "module") return; - - if (binding.path !== this) { - return binding.path.resolve(dangerous, resolved); - } - } else if (this.isTypeCastExpression()) { - return this.get("expression").resolve(dangerous, resolved); - } else if (dangerous && this.isMemberExpression()) { - // this is dangerous, as non-direct target assignments will mutate it's state - // making this resolution inaccurate - - var targetKey = this.toComputedKey(); - if (!t.isLiteral(targetKey)) return; - - var targetName = targetKey.value; - - var target = this.get("object").resolve(dangerous, resolved); - - if (target.isObjectExpression()) { - var props = target.get("properties"); - var _arr = props; - for (var _i = 0; _i < _arr.length; _i++) { - var prop = _arr[_i]; - if (!prop.isProperty()) continue; - - var key = prop.get("key"); - - // { foo: obj } - var match = prop.isnt("computed") && key.isIdentifier({ name: targetName }); - - // { "foo": "obj" } or { ["foo"]: "obj" } - match = match || key.isLiteral({ value: targetName }); - - if (match) return prop.get("value").resolve(dangerous, resolved); - } - } else if (target.isArrayExpression() && !isNaN(+targetName)) { - var elems = target.get("elements"); - var elem = elems[targetName]; - if (elem) return elem.resolve(dangerous, resolved); - } - } -} -},{"179":179,"421":421}],160:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _transformationHelpersReact = _dereq_(62); - -var react = _interopRequireWildcard(_transformationHelpersReact); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var referenceVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (this.isJSXIdentifier() && react.isCompatTag(node.name)) { - return; - } - - // direct references that we need to track to hoist this to the highest scope we can - var binding = scope.getBinding(node.name); - if (!binding) return; - - // this binding isn't accessible from the parent scope so we can safely ignore it - // eg. it's in a closure etc - if (binding !== state.scope.getBinding(node.name)) return; - - if (binding.constant) { - state.bindings[node.name] = binding; - } else { - var _arr = binding.constantViolations; - - for (var _i = 0; _i < _arr.length; _i++) { - var violationPath = _arr[_i]; - state.breakOnScopePaths = state.breakOnScopePaths.concat(violationPath.getAncestry()); - } - } - } -}; - -/** - * [Please add a description.] - */ - -var PathHoister = (function () { - function PathHoister(path, scope) { - _classCallCheck(this, PathHoister); - - this.breakOnScopePaths = []; - this.bindings = {}; - this.scopes = []; - this.scope = scope; - this.path = path; - } - - /** - * [Please add a description.] - */ - - PathHoister.prototype.isCompatibleScope = function isCompatibleScope(scope) { - for (var key in this.bindings) { - var binding = this.bindings[key]; - if (!scope.bindingIdentifierEquals(key, binding.identifier)) { - return false; - } - } - - return true; - }; - - /** - * [Please add a description.] - */ - - PathHoister.prototype.getCompatibleScopes = function getCompatibleScopes() { - var scope = this.path.scope; - do { - if (this.isCompatibleScope(scope)) { - this.scopes.push(scope); - } else { - break; - } - - if (this.breakOnScopePaths.indexOf(scope.path) >= 0) { - break; - } - } while (scope = scope.parent); - }; - - /** - * [Please add a description.] - */ - - PathHoister.prototype.getAttachmentPath = function getAttachmentPath() { - var scopes = this.scopes; - - var scope = scopes.pop(); - if (!scope) return; - - if (scope.path.isFunction()) { - if (this.hasOwnParamBindings(scope)) { - // should ignore this scope since it's ourselves - if (this.scope === scope) return; - - // needs to be attached to the body - return scope.path.get("body").get("body")[0]; - } else { - // doesn't need to be be attached to this scope - return this.getNextScopeStatementParent(); - } - } else if (scope.path.isProgram()) { - return this.getNextScopeStatementParent(); - } - }; - - /** - * [Please add a description.] - */ - - PathHoister.prototype.getNextScopeStatementParent = function getNextScopeStatementParent() { - var scope = this.scopes.pop(); - if (scope) return scope.path.getStatementParent(); - }; - - /** - * [Please add a description.] - */ - - PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) { - for (var name in this.bindings) { - if (!scope.hasOwnBinding(name)) continue; - - var binding = this.bindings[name]; - if (binding.kind === "param") return true; - } - return false; - }; - - /** - * [Please add a description.] - */ - - PathHoister.prototype.run = function run() { - var node = this.path.node; - if (node._hoisted) return; - node._hoisted = true; - - this.path.traverse(referenceVisitor, this); - - this.getCompatibleScopes(); - - var attachTo = this.getAttachmentPath(); - if (!attachTo) return; - - // don't bother hoisting to the same function as this will cause multiple branches to be evaluated more than once leading to a bad optimisation - if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return; - - var uid = attachTo.scope.generateUidIdentifier("ref"); - - attachTo.insertBefore([t.variableDeclaration("var", [t.variableDeclarator(uid, this.path.node)])]); - - var parent = this.path.parentPath; - - if (parent.isJSXElement() && this.path.container === parent.node.children) { - // turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with - // an expression container - uid = t.JSXExpressionContainer(uid); - } - - this.path.replaceWith(uid); - }; - - return PathHoister; -})(); - -exports["default"] = PathHoister; -module.exports = exports["default"]; -},{"179":179,"62":62}],161:[function(_dereq_,module,exports){ -// this file contains hooks that handle ancestry cleanup of parent nodes when removing children - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Pre hooks should be used for either rejecting removal or delegating removal - */ - -var pre = [ - -/** - * [Please add a description.] - */ - -function (self) { - if (self.key === "body" && (self.isBlockStatement() || self.isClassBody())) { - // function () NODE - // class NODE - // attempting to remove a block statement that's someones body so let's just clear all the inner - // statements instead - self.node.body = []; - return true; - } -}, - -/** - * [Please add a description.] - */ - -function (self, parent) { - var replace = false; - - // () => NODE; - // removing the body of an arrow function - replace = replace || self.key === "body" && parent.isArrowFunctionExpression(); - - // throw NODE; - // removing a throw statement argument - replace = replace || self.key === "argument" && parent.isThrowStatement(); - - if (replace) { - self.replaceWith(t.identifier("undefined")); - return true; - } -}]; - -exports.pre = pre; -/** - * Post hooks should be used for cleaning up parents - */ - -var post = [ - -/** - * [Please add a description.] - */ - -function (self, parent) { - var removeParent = false; - - // while (NODE); - // removing the test of a while/switch, we can either just remove it entirely *or* turn the `test` into `true` - // unlikely that the latter will ever be what's wanted so we just remove the loop to avoid infinite recursion - removeParent = removeParent || self.key === "test" && (parent.isWhile() || parent.isSwitchCase()); - - // export NODE; - // just remove a declaration for an export as this is no longer valid - removeParent = removeParent || self.key === "declaration" && parent.isExportDeclaration(); - - // label: NODE - // stray labeled statement with no body - removeParent = removeParent || self.key === "body" && parent.isLabeledStatement(); - - // var NODE; - // remove an entire declaration if there are no declarators left - removeParent = removeParent || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 0; - - // NODE; - // remove the entire expression statement if there's no expression - removeParent = removeParent || self.key === "expression" && parent.isExpressionStatement(); - - // if (NODE); - // remove the entire if since the consequent is never going to be hit, if there's an alternate then it's already been - // handled with the `pre` hook - removeParent = removeParent || self.key === "test" && parent.isIfStatement(); - - if (removeParent) { - parent.dangerouslyRemove(); - return true; - } -}, - -/** - * [Please add a description.] - */ - -function (self, parent) { - if (parent.isSequenceExpression() && parent.node.expressions.length === 1) { - // (node, NODE); - // we've just removed the second element of a sequence expression so let's turn that sequence - // expression into a regular expression - parent.replaceWith(parent.node.expressions[0]); - return true; - } -}, - -/** - * [Please add a description.] - */ - -function (self, parent) { - if (parent.isBinary()) { - // left + NODE; - // NODE + right; - // we're in a binary expression, better remove it and replace it with the last expression - if (self.key === "left") { - parent.replaceWith(parent.node.right); - } else { - // key === "right" - parent.replaceWith(parent.node.left); - } - return true; - } -}]; -exports.post = post; -},{"179":179}],162:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _transformationHelpersReact = _dereq_(62); - -var react = _interopRequireWildcard(_transformationHelpersReact); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var ReferencedIdentifier = { - types: ["Identifier", "JSXIdentifier"], - checkPath: function checkPath(_ref, opts) { - var node = _ref.node; - var parent = _ref.parent; - - if (!t.isIdentifier(node, opts)) { - if (t.isJSXIdentifier(node, opts)) { - if (react.isCompatTag(node.name)) return false; - } else { - // not a JSXIdentifier or an Identifier - return false; - } - } - - // check if node is referenced - return t.isReferenced(node, parent); - } -}; - -exports.ReferencedIdentifier = ReferencedIdentifier; -/** - * [Please add a description.] - */ - -var BindingIdentifier = { - types: ["Identifier"], - checkPath: function checkPath(_ref2) { - var node = _ref2.node; - var parent = _ref2.parent; - - return t.isBinding(node, parent); - } -}; - -exports.BindingIdentifier = BindingIdentifier; -/** - * [Please add a description.] - */ - -var Statement = { - types: ["Statement"], - checkPath: function checkPath(_ref3) { - var node = _ref3.node; - var parent = _ref3.parent; - - if (t.isStatement(node)) { - if (t.isVariableDeclaration(node)) { - if (t.isForXStatement(parent, { left: node })) return false; - if (t.isForStatement(parent, { init: node })) return false; - } - - return true; - } else { - return false; - } - } -}; - -exports.Statement = Statement; -/** - * [Please add a description.] - */ - -var Expression = { - types: ["Expression"], - checkPath: function checkPath(path) { - if (path.isIdentifier()) { - return path.isReferencedIdentifier(); - } else { - return t.isExpression(path.node); - } - } -}; - -exports.Expression = Expression; -/** - * [Please add a description.] - */ - -var Scope = { - types: ["Scopable"], - checkPath: function checkPath(path) { - return t.isScope(path.node, path.parent); - } -}; - -exports.Scope = Scope; -/** - * [Please add a description.] - */ - -var Referenced = { - checkPath: function checkPath(path) { - return t.isReferenced(path.node, path.parent); - } -}; - -exports.Referenced = Referenced; -/** - * [Please add a description.] - */ - -var BlockScoped = { - checkPath: function checkPath(path) { - return t.isBlockScoped(path.node); - } -}; - -exports.BlockScoped = BlockScoped; -/** - * [Please add a description.] - */ - -var Var = { - types: ["VariableDeclaration"], - checkPath: function checkPath(path) { - return t.isVar(path.node); - } -}; - -exports.Var = Var; -/** - * [Please add a description.] - */ - -var DirectiveLiteral = { - types: ["Literal"], - checkPath: function checkPath(path) { - return path.isLiteral() && path.parentPath.isExpressionStatement(); - } -}; - -exports.DirectiveLiteral = DirectiveLiteral; -/** - * [Please add a description.] - */ - -var Directive = { - types: ["ExpressionStatement"], - checkPath: function checkPath(path) { - return path.get("expression").isLiteral(); - } -}; - -exports.Directive = Directive; -/** - * [Please add a description.] - */ - -var User = { - checkPath: function checkPath(path) { - return path.node && !!path.node.loc; - } -}; - -exports.User = User; -/** - * [Please add a description.] - */ - -var Generated = { - checkPath: function checkPath(path) { - return !path.isUser(); - } -}; - -exports.Generated = Generated; -/** - * [Please add a description.] - */ - -var Flow = { - types: ["Flow", "ImportDeclaration", "ExportDeclaration"], - checkPath: function checkPath(_ref4) { - var node = _ref4.node; - - if (t.isFlow(node)) { - return true; - } else if (t.isImportDeclaration(node)) { - return node.importKind === "type" || node.importKind === "typeof"; - } else if (t.isExportDeclaration(node)) { - return node.exportKind === "type"; - } else { - return false; - } - } -}; -exports.Flow = Flow; -},{"179":179,"62":62}],163:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.insertBefore = insertBefore; -exports._containerInsert = _containerInsert; -exports._containerInsertBefore = _containerInsertBefore; -exports._containerInsertAfter = _containerInsertAfter; -exports._maybePopFromStatements = _maybePopFromStatements; -exports.insertAfter = insertAfter; -exports.updateSiblingKeys = updateSiblingKeys; -exports._verifyNodeList = _verifyNodeList; -exports.unshiftContainer = unshiftContainer; -exports.pushContainer = pushContainer; -exports.hoist = hoist; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _libHoister = _dereq_(160); - -var _libHoister2 = _interopRequireDefault(_libHoister); - -var _index = _dereq_(155); - -var _index2 = _interopRequireDefault(_index); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * Insert the provided nodes before the current one. - */ - -function insertBefore(nodes) { - this._assertUnremoved(); - - nodes = this._verifyNodeList(nodes); - - if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { - return this.parentPath.insertBefore(nodes); - } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") { - if (this.node) nodes.push(this.node); - this.replaceExpressionWithStatements(nodes); - } else { - this._maybePopFromStatements(nodes); - if (Array.isArray(this.container)) { - return this._containerInsertBefore(nodes); - } else if (this.isStatementOrBlock()) { - if (this.node) nodes.push(this.node); - this.node = this.container[this.key] = t.blockStatement(nodes); - } else { - throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?"); - } - } - - return [this]; -} - -/** - * [Please add a description.] - */ - -function _containerInsert(from, nodes) { - this.updateSiblingKeys(from, nodes.length); - - var paths = []; - - for (var i = 0; i < nodes.length; i++) { - var to = from + i; - var node = nodes[i]; - this.container.splice(to, 0, node); - - if (this.context) { - var path = this.context.create(this.parent, this.container, to, this.listKey); - paths.push(path); - this.queueNode(path); - } else { - paths.push(_index2["default"].get({ - parentPath: this, - parent: node, - container: this.container, - listKey: this.listKey, - key: to - })); - } - } - - return paths; -} - -/** - * [Please add a description.] - */ - -function _containerInsertBefore(nodes) { - return this._containerInsert(this.key, nodes); -} - -/** - * [Please add a description.] - */ - -function _containerInsertAfter(nodes) { - return this._containerInsert(this.key + 1, nodes); -} - -/** - * [Please add a description.] - */ - -function _maybePopFromStatements(nodes) { - var last = nodes[nodes.length - 1]; - if (t.isExpressionStatement(last) && t.isIdentifier(last.expression) && !this.isCompletionRecord()) { - nodes.pop(); - } -} - -/** - * Insert the provided nodes after the current one. When inserting nodes after an - * expression, ensure that the completion record is correct by pushing the current node. - */ - -function insertAfter(nodes) { - this._assertUnremoved(); - - nodes = this._verifyNodeList(nodes); - - if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { - return this.parentPath.insertAfter(nodes); - } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") { - if (this.node) { - var temp = this.scope.generateDeclaredUidIdentifier(); - nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node))); - nodes.push(t.expressionStatement(temp)); - } - this.replaceExpressionWithStatements(nodes); - } else { - this._maybePopFromStatements(nodes); - if (Array.isArray(this.container)) { - return this._containerInsertAfter(nodes); - } else if (this.isStatementOrBlock()) { - if (this.node) nodes.unshift(this.node); - this.node = this.container[this.key] = t.blockStatement(nodes); - } else { - throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?"); - } - } - - return [this]; -} - -/** - * Update all sibling node paths after `fromIndex` by `incrementBy`. - */ - -function updateSiblingKeys(fromIndex, incrementBy) { - var paths = this.parent._paths; - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (path.key >= fromIndex) { - path.key += incrementBy; - } - } -} - -/** - * [Please add a description.] - */ - -function _verifyNodeList(nodes) { - if (nodes.constructor !== Array) { - nodes = [nodes]; - } - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (!node) { - throw new Error("Node list has falsy node with the index of " + i); - } else if (typeof node !== "object") { - throw new Error("Node list contains a non-object node with the index of " + i); - } else if (!node.type) { - throw new Error("Node list contains a node without a type with the index of " + i); - } else if (node instanceof _index2["default"]) { - nodes[i] = node.node; - } - } - - return nodes; -} - -/** - * [Please add a description.] - */ - -function unshiftContainer(listKey, nodes) { - this._assertUnremoved(); - - nodes = this._verifyNodeList(nodes); - - // get the first path and insert our nodes before it, if it doesn't exist then it - // doesn't matter, our nodes will be inserted anyway - - var container = this.node[listKey]; - var path = _index2["default"].get({ - parentPath: this, - parent: this.node, - container: container, - listKey: listKey, - key: 0 - }); - - return path.insertBefore(nodes); -} - -/** - * [Please add a description.] - */ - -function pushContainer(listKey, nodes) { - this._assertUnremoved(); - - nodes = this._verifyNodeList(nodes); - - // get an invisible path that represents the last node + 1 and replace it with our - // nodes, effectively inlining it - - var container = this.node[listKey]; - var i = container.length; - var path = _index2["default"].get({ - parentPath: this, - parent: this.node, - container: container, - listKey: listKey, - key: i - }); - - return path.replaceWith(nodes, true); -} - -/** - * Hoist the current node to the highest scope possible and return a UID - * referencing it. - */ - -function hoist() { - var scope = arguments.length <= 0 || arguments[0] === undefined ? this.scope : arguments[0]; - - var hoister = new _libHoister2["default"](this, scope); - return hoister.run(); -} -},{"155":155,"160":160,"179":179}],164:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.remove = remove; -exports.dangerouslyRemove = dangerouslyRemove; -exports._callRemovalHooks = _callRemovalHooks; -exports._remove = _remove; -exports._markRemoved = _markRemoved; -exports._assertUnremoved = _assertUnremoved; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _libRemovalHooks = _dereq_(161); - -var removalHooks = _interopRequireWildcard(_libRemovalHooks); - -/** - * Deprecated in favor of `dangerouslyRemove` as it's far more scary and more accurately portrays - * the risk. - */ - -function remove() { - console.trace("Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it."); - return this.dangerouslyRemove(); -} - -/** - * Dangerously remove the current node. This may sometimes result in a tainted - * invalid AST so use with caution. - */ - -function dangerouslyRemove() { - this._assertUnremoved(); - - this.resync(); - - if (this._callRemovalHooks("pre")) { - this._markRemoved(); - return; - } - - this.shareCommentsWithSiblings(); - this._remove(); - this._markRemoved(); - - this._callRemovalHooks("post"); -} - -/** - * [Please add a description.] - */ - -function _callRemovalHooks(position) { - var _arr = removalHooks[position]; - - for (var _i = 0; _i < _arr.length; _i++) { - var fn = _arr[_i]; - if (fn(this, this.parentPath)) return true; - } -} - -/** - * [Please add a description.] - */ - -function _remove() { - if (Array.isArray(this.container)) { - this.container.splice(this.key, 1); - this.updateSiblingKeys(this.key, -1); - } else { - this.container[this.key] = null; - } -} - -/** - * [Please add a description.] - */ - -function _markRemoved() { - this.shouldSkip = true; - this.removed = true; - this.node = null; -} - -/** - * [Please add a description.] - */ - -function _assertUnremoved() { - if (this.removed) { - throw this.errorWithNode("NodePath has been removed so is read-only."); - } -} -},{"161":161}],165:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.replaceWithMultiple = replaceWithMultiple; -exports.replaceWithSourceString = replaceWithSourceString; -exports.replaceWith = replaceWith; -exports.replaceExpressionWithStatements = replaceExpressionWithStatements; -exports.replaceInline = replaceInline; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _helpersCodeFrame = _dereq_(38); - -var _helpersCodeFrame2 = _interopRequireDefault(_helpersCodeFrame); - -var _index = _dereq_(148); - -var _index2 = _interopRequireDefault(_index); - -var _index3 = _dereq_(155); - -var _index4 = _interopRequireDefault(_index3); - -var _helpersParse = _dereq_(42); - -var _helpersParse2 = _interopRequireDefault(_helpersParse); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -/** - * [Please add a description.] - */ - -var hoistVariablesVisitor = { - - /** - * [Please add a description.] - */ - - Function: function Function() { - this.skip(); - }, - - /** - * [Please add a description.] - */ - - VariableDeclaration: function VariableDeclaration(node, parent, scope) { - if (node.kind !== "var") return; - - var bindings = this.getBindingIdentifiers(); - for (var key in bindings) { - scope.push({ id: bindings[key] }); - } - - var exprs = []; - - var _arr = node.declarations; - for (var _i = 0; _i < _arr.length; _i++) { - var declar = _arr[_i]; - if (declar.init) { - exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init))); - } - } - - return exprs; - } -}; - -/** - * Replace a node with an array of multiple. This method performs the following steps: - * - * - Inherit the comments of first provided node with that of the current node. - * - Insert the provided nodes after the current node. - * - Remove the current node. - */ - -function replaceWithMultiple(nodes) { - this.resync(); - - nodes = this._verifyNodeList(nodes); - t.inheritLeadingComments(nodes[0], this.node); - t.inheritTrailingComments(nodes[nodes.length - 1], this.node); - this.node = this.container[this.key] = null; - this.insertAfter(nodes); - if (!this.node) this.dangerouslyRemove(); -} - -/** - * Parse a string as an expression and replace the current node with the result. - * - * NOTE: This is typically not a good idea to use. Building source strings when - * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's - * easier to use, your transforms will be extremely brittle. - */ - -function replaceWithSourceString(replacement) { - this.resync(); - - try { - replacement = "(" + replacement + ")"; - replacement = _helpersParse2["default"](replacement); - } catch (err) { - var loc = err.loc; - if (loc) { - err.message += " - make sure this is an expression."; - err.message += "\n" + _helpersCodeFrame2["default"](replacement, loc.line, loc.column + 1); - } - throw err; - } - - replacement = replacement.program.body[0].expression; - _index2["default"].removeProperties(replacement); - return this.replaceWith(replacement); -} - -/** - * Replace the current node with another. - */ - -function replaceWith(replacement, whateverAllowed) { - this.resync(); - - if (this.removed) { - throw new Error("You can't replace this node, we've already removed it"); - } - - if (replacement instanceof _index4["default"]) { - replacement = replacement.node; - } - - if (!replacement) { - throw new Error("You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead"); - } - - if (this.node === replacement) { - return; - } - - if (this.isProgram() && !t.isProgram(replacement)) { - throw new Error("You can only replace a Program root node with another Program node"); - } - - // normalise inserting an entire AST - if (t.isProgram(replacement) && !this.isProgram()) { - replacement = replacement.body; - whateverAllowed = true; - } - - if (Array.isArray(replacement)) { - if (whateverAllowed) { - return this.replaceWithMultiple(replacement); - } else { - throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`"); - } - } - - if (typeof replacement === "string") { - // triggers an error - return this.replaceWithSourceString(); - } - - if (this.isNodeType("Statement") && t.isExpression(replacement)) { - if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { - // replacing a statement with an expression so wrap it in an expression statement - replacement = t.expressionStatement(replacement); - } - } - - if (this.isNodeType("Expression") && t.isStatement(replacement)) { - if (!this.canSwapBetweenExpressionAndStatement(replacement)) { - // replacing an expression with a statement so let's explode it - return this.replaceExpressionWithStatements([replacement]); - } - } - - var oldNode = this.node; - if (oldNode) t.inheritsComments(replacement, oldNode); - - // replace the node - this.node = this.container[this.key] = replacement; - this.type = replacement.type; - - // potentially create new scope - this.setScope(); -} - -/** - * This method takes an array of statements nodes and then explodes it - * into expressions. This method retains completion records which is - * extremely important to retain original semantics. - */ - -function replaceExpressionWithStatements(nodes) { - this.resync(); - - var toSequenceExpression = t.toSequenceExpression(nodes, this.scope); - - if (toSequenceExpression) { - return this.replaceWith(toSequenceExpression); - } else { - var container = t.functionExpression(null, [], t.blockStatement(nodes)); - container.shadow = true; - - this.replaceWith(t.callExpression(container, [])); - this.traverse(hoistVariablesVisitor); - - // add implicit returns to all ending expression statements - var last = this.get("callee").getCompletionRecords(); - var _arr2 = last; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var lastNode = _arr2[_i2]; - if (!lastNode.isExpressionStatement()) continue; - - var loop = lastNode.findParent(function (path) { - return path.isLoop(); - }); - if (loop) { - var uid = this.get("callee").scope.generateDeclaredUidIdentifier("ret"); - this.get("callee.body").pushContainer("body", t.returnStatement(uid)); - lastNode.get("expression").replaceWith(t.assignmentExpression("=", uid, lastNode.node.expression)); - } else { - lastNode.replaceWith(t.returnStatement(lastNode.node.expression)); - } - } - - return this.node; - } -} - -/** - * [Please add a description.] - */ - -function replaceInline(nodes) { - this.resync(); - - if (Array.isArray(nodes)) { - if (Array.isArray(this.container)) { - nodes = this._verifyNodeList(nodes); - this._containerInsertAfter(nodes); - return this.dangerouslyRemove(); - } else { - return this.replaceWithMultiple(nodes); - } - } else { - return this.replaceWith(nodes); - } -} -},{"148":148,"155":155,"179":179,"38":38,"42":42}],166:[function(_dereq_,module,exports){ -/** - * This class is responsible for a binding inside of a scope. - * - * It tracks the following: - * - * * Node path. - * * Amount of times referenced by other nodes. - * * Paths to nodes that reassign or modify this binding. - * * The kind of binding. (Is it a parameter, declaration etc) - */ - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Binding = (function () { - function Binding(_ref) { - var existing = _ref.existing; - var identifier = _ref.identifier; - var scope = _ref.scope; - var path = _ref.path; - var kind = _ref.kind; - - _classCallCheck(this, Binding); - - this.constantViolations = []; - this.constant = true; - - this.identifier = identifier; - this.references = 0; - this.referenced = false; - - this.scope = scope; - this.path = path; - this.kind = kind; - - this.hasValue = false; - this.hasDeoptedValue = false; - this.value = null; - - this.clearValue(); - - if (existing) { - this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations); - } - } - - /** - * [Please add a description.] - */ - - Binding.prototype.deoptValue = function deoptValue() { - this.clearValue(); - this.hasDeoptedValue = true; - }; - - /** - * [Please add a description.] - */ - - Binding.prototype.setValue = function setValue(value) { - if (this.hasDeoptedValue) return; - this.hasValue = true; - this.value = value; - }; - - /** - * [Please add a description.] - */ - - Binding.prototype.clearValue = function clearValue() { - this.hasDeoptedValue = false; - this.hasValue = false; - this.value = null; - }; - - /** - * Register a constant violation with the provided `path`. - */ - - Binding.prototype.reassign = function reassign(path) { - this.constant = false; - this.constantViolations.push(path); - }; - - /** - * Increment the amount of references to this binding. - */ - - Binding.prototype.reference = function reference() { - this.referenced = true; - this.references++; - }; - - /** - * Decrement the amount of references to this binding. - */ - - Binding.prototype.dereference = function dereference() { - this.references--; - this.referenced = !!this.references; - }; - - return Binding; -})(); - -exports["default"] = Binding; -module.exports = exports["default"]; -},{}],167:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _lodashCollectionIncludes = _dereq_(421); - -var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); - -var _repeating = _dereq_(592); - -var _repeating2 = _interopRequireDefault(_repeating); - -var _index = _dereq_(148); - -var _index2 = _interopRequireDefault(_index); - -var _lodashObjectDefaults = _dereq_(518); - -var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _binding = _dereq_(166); - -var _binding2 = _interopRequireDefault(_binding); - -var _globals = _dereq_(405); - -var _globals2 = _interopRequireDefault(_globals); - -var _lodashArrayFlatten = _dereq_(414); - -var _lodashArrayFlatten2 = _interopRequireDefault(_lodashArrayFlatten); - -var _lodashObjectExtend = _dereq_(519); - -var _lodashObjectExtend2 = _interopRequireDefault(_lodashObjectExtend); - -var _helpersObject = _dereq_(41); - -var _helpersObject2 = _interopRequireDefault(_helpersObject); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var collectorVisitor = { - For: function For() { - var _arr = t.FOR_INIT_KEYS; - - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i]; - var declar = this.get(key); - if (declar.isVar()) this.scope.getFunctionParent().registerBinding("var", declar); - } - }, - - Declaration: function Declaration() { - // delegate block scope handling to the `blockVariableVisitor` - if (this.isBlockScoped()) return; - - // this will be hit again once we traverse into it after this iteration - if (this.isExportDeclaration() && this.get("declaration").isDeclaration()) return; - - // we've ran into a declaration! - this.scope.getFunctionParent().registerDeclaration(this); - }, - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - state.references.push(this); - }, - - ForXStatement: function ForXStatement(node, parent, scope, state) { - var left = this.get("left"); - if (left.isPattern() || left.isIdentifier()) { - state.constantViolations.push(left); - } - }, - - ExportDeclaration: { - exit: function exit(node, parent, scope) { - var declar = node.declaration; - if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) { - var binding = scope.getBinding(declar.id.name); - if (binding) binding.reference(); - } else if (t.isVariableDeclaration(declar)) { - var _arr2 = declar.declarations; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var decl = _arr2[_i2]; - var ids = t.getBindingIdentifiers(decl); - for (var _name in ids) { - var binding = scope.getBinding(_name); - if (binding) binding.reference(); - } - } - } - } - }, - - LabeledStatement: function LabeledStatement() { - this.scope.getProgramParent().addGlobal(this.node); - this.scope.getBlockParent().registerDeclaration(this); - }, - - AssignmentExpression: function AssignmentExpression(node, parent, scope, state) { - state.assignments.push(this); - }, - - UpdateExpression: function UpdateExpression(node, parent, scope, state) { - state.constantViolations.push(this.get("argument")); - }, - - UnaryExpression: function UnaryExpression(node, parent, scope, state) { - if (this.node.operator === "delete") { - state.constantViolations.push(this.get("argument")); - } - }, - - BlockScoped: function BlockScoped() { - var scope = this.scope; - if (scope.path === this) scope = scope.parent; - scope.getBlockParent().registerDeclaration(this); - }, - - ClassDeclaration: function ClassDeclaration() { - var name = this.node.id.name; - this.scope.bindings[name] = this.scope.getBinding(name); - }, - - Block: function Block() { - var paths = this.get("body"); - var _arr3 = paths; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var bodyPath = _arr3[_i3]; - if (bodyPath.isFunctionDeclaration()) { - this.scope.getBlockParent().registerDeclaration(bodyPath); - } - } - } -}; - -/** - * [Please add a description.] - */ - -var renameVisitor = { - - /** - * [Please add a description.] - */ - - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, state) { - if (node.name === state.oldName) { - node.name = state.newName; - } - }, - - /** - * [Please add a description.] - */ - - Scope: function Scope(node, parent, scope, state) { - if (!scope.bindingIdentifierEquals(state.oldName, state.binding)) { - this.skip(); - } - }, - - "AssignmentExpression|Declaration": function AssignmentExpressionDeclaration(node, parent, scope, state) { - var ids = this.getBindingIdentifiers(); - - for (var name in ids) { - if (name === state.oldName) ids[name].name = state.newName; - } - } -}; - -/** - * [Please add a description.] - */ - -var Scope = (function () { - - /** - * This searches the current "scope" and collects all references/bindings - * within. - */ - - function Scope(path, parent) { - _classCallCheck(this, Scope); - - if (parent && parent.block === path.node) { - return parent; - } - - var cached = path.getData("scope"); - if (cached && cached.parent === parent && cached.block === path.node) { - return cached; - } else { - path.setData("scope", this); - } - - this.parent = parent; - this.hub = path.hub; - - this.parentBlock = path.parent; - this.block = path.node; - this.path = path; - } - - /** - * Globals. - */ - - /** - * Traverse node with current scope and path. - */ - - Scope.prototype.traverse = function traverse(node, opts, state) { - _index2["default"](node, opts, this, state, this.path); - }; - - /** - * Generate a unique identifier and add it to the current scope. - */ - - Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() { - var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0]; - - var id = this.generateUidIdentifier(name); - this.push({ id: id }); - return id; - }; - - /** - * Generate a unique identifier. - */ - - Scope.prototype.generateUidIdentifier = function generateUidIdentifier(name) { - return t.identifier(this.generateUid(name)); - }; - - /** - * Generate a unique `_id1` binding. - */ - - Scope.prototype.generateUid = function generateUid(name) { - name = t.toIdentifier(name).replace(/^_+/, ""); - - var uid; - var i = 0; - do { - uid = this._generateUid(name, i); - i++; - } while (this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); - - var program = this.getProgramParent(); - program.references[uid] = true; - program.uids[uid] = true; - - return uid; - }; - - /** - * Generate an `_id1`. - */ - - Scope.prototype._generateUid = function _generateUid(name, i) { - var id = name; - if (i > 1) id += i; - return "_" + id; - }; - - /** - * Generate a unique identifier based on a node. - */ - - Scope.prototype.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(parent, defaultName) { - var node = parent; - - if (t.isAssignmentExpression(parent)) { - node = parent.left; - } else if (t.isVariableDeclarator(parent)) { - node = parent.id; - } else if (t.isProperty(node)) { - node = node.key; - } - - var parts = []; - - var add = function add(node) { - if (t.isModuleDeclaration(node)) { - if (node.source) { - add(node.source); - } else if (node.specifiers && node.specifiers.length) { - var _arr4 = node.specifiers; - - for (var _i4 = 0; _i4 < _arr4.length; _i4++) { - var specifier = _arr4[_i4]; - add(specifier); - } - } else if (node.declaration) { - add(node.declaration); - } - } else if (t.isModuleSpecifier(node)) { - add(node.local); - } else if (t.isMemberExpression(node)) { - add(node.object); - add(node.property); - } else if (t.isIdentifier(node)) { - parts.push(node.name); - } else if (t.isLiteral(node)) { - parts.push(node.value); - } else if (t.isCallExpression(node)) { - add(node.callee); - } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) { - var _arr5 = node.properties; - - for (var _i5 = 0; _i5 < _arr5.length; _i5++) { - var prop = _arr5[_i5]; - add(prop.key || prop.argument); - } - } - }; - - add(node); - - var id = parts.join("$"); - id = id.replace(/^_/, "") || defaultName || "ref"; - - return this.generateUidIdentifier(id); - }; - - /** - * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. - * evaluating it wont result in potentially arbitrary code from being ran. The following are - * whitelisted and determined not to cause side effects: - * - * - `this` expressions - * - `super` expressions - * - Bound identifiers - */ - - Scope.prototype.isStatic = function isStatic(node) { - if (t.isThisExpression(node) || t.isSuper(node)) { - return true; - } - - if (t.isIdentifier(node)) { - var binding = this.getBinding(node.name); - if (binding) { - return binding.constant; - } else { - return this.hasBinding(node.name); - } - } - - return false; - }; - - /** - * Possibly generate a memoised identifier if it is not static and has consequences. - */ - - Scope.prototype.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) { - if (this.isStatic(node)) { - return null; - } else { - var id = this.generateUidIdentifierBasedOnNode(node); - if (!dontPush) this.push({ id: id }); - return id; - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) { - // ignore parameters - if (kind === "param") return; - - // ignore hoisted functions if there's also a local let - if (kind === "hoisted" && local.kind === "let") return; - - var duplicate = false; - - // don't allow duplicate bindings to exist alongside - if (!duplicate) duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module"; - - // don't allow a local of param with a kind of let - if (!duplicate) duplicate = local.kind === "param" && (kind === "let" || kind === "const"); - - if (duplicate) { - throw this.hub.file.errorWithNode(id, messages.get("scopeDuplicateDeclaration", name), TypeError); - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.rename = function rename(oldName, newName, block) { - newName = newName || this.generateUidIdentifier(oldName).name; - - var info = this.getBinding(oldName); - if (!info) return; - - var state = { - newName: newName, - oldName: oldName, - binding: info.identifier, - info: info - }; - - var scope = info.scope; - scope.traverse(block || scope.block, renameVisitor, state); - - if (!block) { - scope.removeOwnBinding(oldName); - scope.bindings[newName] = info; - state.binding.name = newName; - } - - var file = this.hub.file; - if (file) { - this._renameFromMap(file.moduleFormatter.localImports, oldName, newName, state.binding); - //this._renameFromMap(file.moduleFormatter.localExports, oldName, newName); - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { - if (map[oldName]) { - map[newName] = value; - map[oldName] = null; - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.dump = function dump() { - var sep = _repeating2["default"]("-", 60); - console.log(sep); - var scope = this; - do { - console.log("#", scope.block.type); - for (var name in scope.bindings) { - var binding = scope.bindings[name]; - console.log(" -", name, { - constant: binding.constant, - references: binding.references, - kind: binding.kind - }); - } - } while (scope = scope.parent); - console.log(sep); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.toArray = function toArray(node, i) { - var file = this.hub.file; - - if (t.isIdentifier(node)) { - var binding = this.getBinding(node.name); - if (binding && binding.constant && binding.path.isGenericType("Array")) return node; - } - - if (t.isArrayExpression(node)) { - return node; - } - - if (t.isIdentifier(node, { name: "arguments" })) { - return t.callExpression(t.memberExpression(file.addHelper("slice"), t.identifier("call")), [node]); - } - - var helperName = "to-array"; - var args = [node]; - if (i === true) { - helperName = "to-consumable-array"; - } else if (i) { - args.push(t.literal(i)); - helperName = "sliced-to-array"; - if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose"; - } - return t.callExpression(file.addHelper(helperName), args); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.registerDeclaration = function registerDeclaration(path) { - if (path.isLabeledStatement()) { - this.registerBinding("label", path); - } else if (path.isFunctionDeclaration()) { - this.registerBinding("hoisted", path.get("id"), path); - } else if (path.isVariableDeclaration()) { - var declarations = path.get("declarations"); - var _arr6 = declarations; - for (var _i6 = 0; _i6 < _arr6.length; _i6++) { - var declar = _arr6[_i6]; - this.registerBinding(path.node.kind, declar); - } - } else if (path.isClassDeclaration()) { - this.registerBinding("let", path); - } else if (path.isImportDeclaration()) { - var specifiers = path.get("specifiers"); - var _arr7 = specifiers; - for (var _i7 = 0; _i7 < _arr7.length; _i7++) { - var specifier = _arr7[_i7]; - this.registerBinding("module", specifier); - } - } else if (path.isExportDeclaration()) { - var declar = path.get("declaration"); - if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) { - this.registerDeclaration(declar); - } - } else { - this.registerBinding("unknown", path); - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.registerConstantViolation = function registerConstantViolation(path) { - var ids = path.getBindingIdentifiers(); - for (var _name2 in ids) { - var binding = this.getBinding(_name2); - if (binding) binding.reassign(path); - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.registerBinding = function registerBinding(kind, path) { - var bindingPath = arguments.length <= 2 || arguments[2] === undefined ? path : arguments[2]; - return (function () { - if (!kind) throw new ReferenceError("no `kind`"); - - if (path.isVariableDeclaration()) { - var declarators = path.get("declarations"); - var _arr8 = declarators; - for (var _i8 = 0; _i8 < _arr8.length; _i8++) { - var declar = _arr8[_i8]; - this.registerBinding(kind, declar); - } - return; - } - - var parent = this.getProgramParent(); - var ids = path.getBindingIdentifiers(true); - - for (var name in ids) { - var _arr9 = ids[name]; - - for (var _i9 = 0; _i9 < _arr9.length; _i9++) { - var id = _arr9[_i9]; - var local = this.getOwnBinding(name); - if (local) { - // same identifier so continue safely as we're likely trying to register it - // multiple times - if (local.identifier === id) continue; - - this.checkBlockScopedCollisions(local, kind, name, id); - } - - parent.references[name] = true; - - this.bindings[name] = new _binding2["default"]({ - identifier: id, - existing: local, - scope: this, - path: bindingPath, - kind: kind - }); - } - } - }).apply(this, arguments); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.addGlobal = function addGlobal(node) { - this.globals[node.name] = node; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.hasUid = function hasUid(name) { - var scope = this; - - do { - if (scope.uids[name]) return true; - } while (scope = scope.parent); - - return false; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.hasGlobal = function hasGlobal(name) { - var scope = this; - - do { - if (scope.globals[name]) return true; - } while (scope = scope.parent); - - return false; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.hasReference = function hasReference(name) { - var scope = this; - - do { - if (scope.references[name]) return true; - } while (scope = scope.parent); - - return false; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.isPure = function isPure(node, constantsOnly) { - if (t.isIdentifier(node)) { - var binding = this.getBinding(node.name); - if (!binding) return false; - if (constantsOnly) return binding.constant; - return true; - } else if (t.isClass(node)) { - return !node.superClass || this.isPure(node.superClass, constantsOnly); - } else if (t.isBinary(node)) { - return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); - } else if (t.isArrayExpression(node)) { - var _arr10 = node.elements; - - for (var _i10 = 0; _i10 < _arr10.length; _i10++) { - var elem = _arr10[_i10]; - if (!this.isPure(elem, constantsOnly)) return false; - } - return true; - } else if (t.isObjectExpression(node)) { - var _arr11 = node.properties; - - for (var _i11 = 0; _i11 < _arr11.length; _i11++) { - var prop = _arr11[_i11]; - if (!this.isPure(prop, constantsOnly)) return false; - } - return true; - } else if (t.isProperty(node)) { - if (node.computed && !this.isPure(node.key, constantsOnly)) return false; - return this.isPure(node.value, constantsOnly); - } else { - return t.isPure(node); - } - }; - - /** - * Set some arbitrary data on the current scope. - */ - - Scope.prototype.setData = function setData(key, val) { - return this.data[key] = val; - }; - - /** - * Recursively walk up scope tree looking for the data `key`. - */ - - Scope.prototype.getData = function getData(key) { - var scope = this; - do { - var data = scope.data[key]; - if (data != null) return data; - } while (scope = scope.parent); - }; - - /** - * Recursively walk up scope tree looking for the data `key` and if it exists, - * remove it. - */ - - Scope.prototype.removeData = function removeData(key) { - var scope = this; - do { - var data = scope.data[key]; - if (data != null) scope.data[key] = null; - } while (scope = scope.parent); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.init = function init() { - if (!this.references) this.crawl(); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.crawl = function crawl() { - var path = this.path; - - // - - var info = this.block._scopeInfo; - if (info) return _lodashObjectExtend2["default"](this, info); - - info = this.block._scopeInfo = { - references: _helpersObject2["default"](), - bindings: _helpersObject2["default"](), - globals: _helpersObject2["default"](), - uids: _helpersObject2["default"](), - data: _helpersObject2["default"]() - }; - - _lodashObjectExtend2["default"](this, info); - - // ForStatement - left, init - - if (path.isLoop()) { - var _arr12 = t.FOR_INIT_KEYS; - - for (var _i12 = 0; _i12 < _arr12.length; _i12++) { - var key = _arr12[_i12]; - var node = path.get(key); - if (node.isBlockScoped()) this.registerBinding(node.node.kind, node); - } - } - - // FunctionExpression - id - - if (path.isFunctionExpression() && path.has("id")) { - this.registerBinding("local", path.get("id"), path); - } - - // Class - - if (path.isClassExpression() && path.has("id")) { - this.registerBinding("local", path); - } - - // Function - params, rest - - if (path.isFunction()) { - var params = path.get("params"); - var _arr13 = params; - for (var _i13 = 0; _i13 < _arr13.length; _i13++) { - var param = _arr13[_i13]; - this.registerBinding("param", param); - } - } - - // CatchClause - param - - if (path.isCatchClause()) { - this.registerBinding("let", path); - } - - // ComprehensionExpression - blocks - - if (path.isComprehensionExpression()) { - this.registerBinding("let", path); - } - - // Program - - var parent = this.getProgramParent(); - if (parent.crawling) return; - - var state = { - references: [], - constantViolations: [], - assignments: [] - }; - - this.crawling = true; - path.traverse(collectorVisitor, state); - this.crawling = false; - - // register assignments - for (var _iterator = state.assignments, _isArray = Array.isArray(_iterator), _i14 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i14 >= _iterator.length) break; - _ref = _iterator[_i14++]; - } else { - _i14 = _iterator.next(); - if (_i14.done) break; - _ref = _i14.value; - } - - var _path = _ref; - - // register undeclared bindings as globals - var ids = _path.getBindingIdentifiers(); - var programParent = undefined; - for (var _name3 in ids) { - if (_path.scope.getBinding(_name3)) continue; - - programParent = programParent || _path.scope.getProgramParent(); - programParent.addGlobal(ids[_name3]); - } - - // register as constant violation - _path.scope.registerConstantViolation(_path); - } - - // register references - for (var _iterator2 = state.references, _isArray2 = Array.isArray(_iterator2), _i15 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i15 >= _iterator2.length) break; - _ref2 = _iterator2[_i15++]; - } else { - _i15 = _iterator2.next(); - if (_i15.done) break; - _ref2 = _i15.value; - } - - var ref = _ref2; - - var binding = ref.scope.getBinding(ref.node.name); - if (binding) { - binding.reference(ref); - } else { - ref.scope.getProgramParent().addGlobal(ref.node); - } - } - - // register constant violations - for (var _iterator3 = state.constantViolations, _isArray3 = Array.isArray(_iterator3), _i16 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { - var _ref3; - - if (_isArray3) { - if (_i16 >= _iterator3.length) break; - _ref3 = _iterator3[_i16++]; - } else { - _i16 = _iterator3.next(); - if (_i16.done) break; - _ref3 = _i16.value; - } - - var _path2 = _ref3; - - _path2.scope.registerConstantViolation(_path2); - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.push = function push(opts) { - var path = this.path; - - if (path.isSwitchStatement()) { - path = this.getFunctionParent().path; - } - - if (path.isLoop() || path.isCatchClause() || path.isFunction()) { - t.ensureBlock(path.node); - path = path.get("body"); - } - - if (!path.isBlockStatement() && !path.isProgram()) { - path = this.getBlockParent().path; - } - - var unique = opts.unique; - var kind = opts.kind || "var"; - var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; - - var dataKey = "declaration:" + kind + ":" + blockHoist; - var declarPath = !unique && path.getData(dataKey); - - if (!declarPath) { - var declar = t.variableDeclaration(kind, []); - declar._generated = true; - declar._blockHoist = blockHoist; - - this.hub.file.attachAuxiliaryComment(declar); - - var _path$unshiftContainer = path.unshiftContainer("body", [declar]); - - declarPath = _path$unshiftContainer[0]; - - if (!unique) path.setData(dataKey, declarPath); - } - - var declarator = t.variableDeclarator(opts.id, opts.init); - declarPath.node.declarations.push(declarator); - this.registerBinding(kind, declarPath.get("declarations").pop()); - }; - - /** - * Walk up to the top of the scope tree and get the `Program`. - */ - - Scope.prototype.getProgramParent = function getProgramParent() { - var scope = this; - do { - if (scope.path.isProgram()) { - return scope; - } - } while (scope = scope.parent); - throw new Error("We couldn't find a Function or Program..."); - }; - - /** - * Walk up the scope tree until we hit either a Function or reach the - * very top and hit Program. - */ - - Scope.prototype.getFunctionParent = function getFunctionParent() { - var scope = this; - do { - if (scope.path.isFunctionParent()) { - return scope; - } - } while (scope = scope.parent); - throw new Error("We couldn't find a Function or Program..."); - }; - - /** - * Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the - * very top and hit Program. - */ - - Scope.prototype.getBlockParent = function getBlockParent() { - var scope = this; - do { - if (scope.path.isBlockParent()) { - return scope; - } - } while (scope = scope.parent); - throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); - }; - - /** - * Walks the scope tree and gathers **all** bindings. - */ - - Scope.prototype.getAllBindings = function getAllBindings() { - var ids = _helpersObject2["default"](); - - var scope = this; - do { - _lodashObjectDefaults2["default"](ids, scope.bindings); - scope = scope.parent; - } while (scope); - - return ids; - }; - - /** - * Walks the scope tree and gathers all declarations of `kind`. - */ - - Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind() { - var ids = _helpersObject2["default"](); - - var _arr14 = arguments; - for (var _i17 = 0; _i17 < _arr14.length; _i17++) { - var kind = _arr14[_i17]; - var scope = this; - do { - for (var name in scope.bindings) { - var binding = scope.bindings[name]; - if (binding.kind === kind) ids[name] = binding; - } - scope = scope.parent; - } while (scope); - } - - return ids; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) { - return this.getBindingIdentifier(name) === node; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.getBinding = function getBinding(name) { - var scope = this; - - do { - var binding = scope.getOwnBinding(name); - if (binding) return binding; - } while (scope = scope.parent); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.getOwnBinding = function getOwnBinding(name) { - return this.bindings[name]; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) { - var info = this.getBinding(name); - return info && info.identifier; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) { - var binding = this.bindings[name]; - return binding && binding.identifier; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.hasOwnBinding = function hasOwnBinding(name) { - return !!this.getOwnBinding(name); - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.hasBinding = function hasBinding(name, noGlobals) { - if (!name) return false; - if (this.hasOwnBinding(name)) return true; - if (this.parentHasBinding(name, noGlobals)) return true; - if (this.hasUid(name)) return true; - if (!noGlobals && _lodashCollectionIncludes2["default"](Scope.globals, name)) return true; - if (!noGlobals && _lodashCollectionIncludes2["default"](Scope.contextVariables, name)) return true; - return false; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.parentHasBinding = function parentHasBinding(name, noGlobals) { - return this.parent && this.parent.hasBinding(name, noGlobals); - }; - - /** - * Move a binding of `name` to another `scope`. - */ - - Scope.prototype.moveBindingTo = function moveBindingTo(name, scope) { - var info = this.getBinding(name); - if (info) { - info.scope.removeOwnBinding(name); - info.scope = scope; - scope.bindings[name] = info; - } - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.removeOwnBinding = function removeOwnBinding(name) { - delete this.bindings[name]; - }; - - /** - * [Please add a description.] - */ - - Scope.prototype.removeBinding = function removeBinding(name) { - // clear literal binding - var info = this.getBinding(name); - if (info) { - info.scope.removeOwnBinding(name); - } - - // clear uids with this name - https://github.com/babel/babel/issues/2101 - var scope = this; - do { - if (scope.uids[name]) { - scope.uids[name] = false; - } - } while (scope = scope.parent); - }; - - _createClass(Scope, null, [{ - key: "globals", - value: _lodashArrayFlatten2["default"]([_globals2["default"].builtin, _globals2["default"].browser, _globals2["default"].node].map(Object.keys)), - - /** - * Variables available in current context. - */ - - enumerable: true - }, { - key: "contextVariables", - value: ["arguments", "undefined", "Infinity", "NaN"], - enumerable: true - }]); - - return Scope; -})(); - -exports["default"] = Scope; -module.exports = exports["default"]; -},{"148":148,"166":166,"179":179,"405":405,"41":41,"414":414,"421":421,"43":43,"518":518,"519":519,"592":592}],168:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.explode = explode; -exports.verify = verify; -exports.merge = merge; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _pathLibVirtualTypes = _dereq_(162); - -var virtualTypes = _interopRequireWildcard(_pathLibVirtualTypes); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _lodashLangClone = _dereq_(502); - -var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone); - -/** - * [Please add a description.] - */ - -function explode(visitor) { - if (visitor._exploded) return visitor; - visitor._exploded = true; - - // normalise pipes - for (var nodeType in visitor) { - if (shouldIgnoreKey(nodeType)) continue; - - var parts = nodeType.split("|"); - if (parts.length === 1) continue; - - var fns = visitor[nodeType]; - delete visitor[nodeType]; - - var _arr = parts; - for (var _i = 0; _i < _arr.length; _i++) { - var part = _arr[_i]; - visitor[part] = fns; - } - } - - // verify data structure - verify(visitor); - - // make sure there's no __esModule type since this is because we're using loose mode - // and it sets __esModule to be enumerable on all modules :( - delete visitor.__esModule; - - // ensure visitors are objects - ensureEntranceObjects(visitor); - - // ensure enter/exit callbacks are arrays - ensureCallbackArrays(visitor); - - // add type wrappers - - var _arr2 = Object.keys(visitor); - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var nodeType = _arr2[_i2]; - if (shouldIgnoreKey(nodeType)) continue; - - var wrapper = virtualTypes[nodeType]; - if (!wrapper) continue; - - // wrap all the functions - var fns = visitor[nodeType]; - for (var type in fns) { - fns[type] = wrapCheck(wrapper, fns[type]); - } - - // clear it from the visitor - delete visitor[nodeType]; - - if (wrapper.types) { - var _arr4 = wrapper.types; - - for (var _i4 = 0; _i4 < _arr4.length; _i4++) { - var type = _arr4[_i4]; - // merge the visitor if necessary or just put it back in - if (visitor[type]) { - mergePair(visitor[type], fns); - } else { - visitor[type] = fns; - } - } - } else { - mergePair(visitor, fns); - } - } - - // add aliases - for (var nodeType in visitor) { - if (shouldIgnoreKey(nodeType)) continue; - - var fns = visitor[nodeType]; - - var aliases = t.FLIPPED_ALIAS_KEYS[nodeType]; - if (!aliases) continue; - - // clear it from the visitor - delete visitor[nodeType]; - - var _arr3 = aliases; - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var alias = _arr3[_i3]; - var existing = visitor[alias]; - if (existing) { - mergePair(existing, fns); - } else { - visitor[alias] = _lodashLangClone2["default"](fns); - } - } - } - - for (var nodeType in visitor) { - if (shouldIgnoreKey(nodeType)) continue; - - ensureCallbackArrays(visitor[nodeType]); - } - - return visitor; -} - -/** - * [Please add a description.] - */ - -function verify(visitor) { - if (visitor._verified) return; - - if (typeof visitor === "function") { - throw new Error(messages.get("traverseVerifyRootFunction")); - } - - for (var nodeType in visitor) { - if (shouldIgnoreKey(nodeType)) continue; - - if (t.TYPES.indexOf(nodeType) < 0) { - throw new Error(messages.get("traverseVerifyNodeType", nodeType)); - } - - var visitors = visitor[nodeType]; - if (typeof visitors === "object") { - for (var visitorKey in visitors) { - if (visitorKey === "enter" || visitorKey === "exit") continue; - throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey)); - } - } - } - - visitor._verified = true; -} - -/** - * [Please add a description.] - */ - -function merge(visitors) { - var rootVisitor = {}; - - var _arr5 = visitors; - for (var _i5 = 0; _i5 < _arr5.length; _i5++) { - var visitor = _arr5[_i5]; - explode(visitor); - - for (var type in visitor) { - var nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; - mergePair(nodeVisitor, visitor[type]); - } - } - - return rootVisitor; -} - -/** - * [Please add a description.] - */ - -function ensureEntranceObjects(obj) { - for (var key in obj) { - if (shouldIgnoreKey(key)) continue; - - var fns = obj[key]; - if (typeof fns === "function") { - obj[key] = { enter: fns }; - } - } -} - -/** - * Makes sure that enter and exit callbacks are arrays. - */ - -function ensureCallbackArrays(obj) { - if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; - if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; -} - -/** - * [Please add a description.] - */ - -function wrapCheck(wrapper, fn) { - return function () { - if (wrapper.checkPath(this)) { - return fn.apply(this, arguments); - } - }; -} - -/** - * [Please add a description.] - */ - -function shouldIgnoreKey(key) { - // internal/hidden key - if (key[0] === "_") return true; - - // ignore function keys - if (key === "enter" || key === "exit" || key === "shouldSkip") return true; - - // ignore other options - if (key === "blacklist" || key === "noScope" || key === "skipKeys") return true; - - return false; -} - -/** - * [Please add a description.] - */ - -function mergePair(dest, src) { - for (var key in src) { - dest[key] = [].concat(dest[key] || [], src[key]); - } -} -},{"162":162,"179":179,"43":43,"502":502}],169:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.toComputedKey = toComputedKey; -exports.toSequenceExpression = toSequenceExpression; -exports.toKeyAlias = toKeyAlias; -exports.toIdentifier = toIdentifier; -exports.toBindingIdentifierName = toBindingIdentifierName; -exports.toStatement = toStatement; -exports.toExpression = toExpression; -exports.toBlock = toBlock; -exports.valueToNode = valueToNode; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashLangIsPlainObject = _dereq_(512); - -var _lodashLangIsPlainObject2 = _interopRequireDefault(_lodashLangIsPlainObject); - -var _lodashLangIsNumber = _dereq_(510); - -var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber); - -var _lodashLangIsRegExp = _dereq_(513); - -var _lodashLangIsRegExp2 = _interopRequireDefault(_lodashLangIsRegExp); - -var _lodashLangIsString = _dereq_(514); - -var _lodashLangIsString2 = _interopRequireDefault(_lodashLangIsString); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _index = _dereq_(179); - -var t = _interopRequireWildcard(_index); - -/** - * [Please add a description.] - */ - -function toComputedKey(node) { - var key = arguments.length <= 1 || arguments[1] === undefined ? node.key || node.property : arguments[1]; - return (function () { - if (!node.computed) { - if (t.isIdentifier(key)) key = t.literal(key.name); - } - return key; - })(); -} - -/** - * Turn an array of statement `nodes` into a `SequenceExpression`. - * - * Variable declarations are turned into simple assignments and their - * declarations hoisted to the top of the current scope. - * - * Expression statements are just resolved to their expression. - */ - -function toSequenceExpression(nodes, scope) { - var declars = []; - var bailed = false; - - var result = convert(nodes); - if (bailed) return; - - for (var i = 0; i < declars.length; i++) { - scope.push(declars[i]); - } - - return result; - - function convert(nodes) { - var ensureLastUndefined = false; - var exprs = []; - - var _arr = nodes; - for (var _i = 0; _i < _arr.length; _i++) { - var node = _arr[_i]; - if (t.isExpression(node)) { - exprs.push(node); - } else if (t.isExpressionStatement(node)) { - exprs.push(node.expression); - } else if (t.isVariableDeclaration(node)) { - if (node.kind !== "var") return bailed = true; // bailed - - var _arr2 = node.declarations; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var declar = _arr2[_i2]; - var bindings = t.getBindingIdentifiers(declar); - for (var key in bindings) { - declars.push({ - kind: node.kind, - id: bindings[key] - }); - } - - if (declar.init) { - exprs.push(t.assignmentExpression("=", declar.id, declar.init)); - } - } - - ensureLastUndefined = true; - continue; - } else if (t.isIfStatement(node)) { - var consequent = node.consequent ? convert([node.consequent]) : t.identifier("undefined"); - var alternate = node.alternate ? convert([node.alternate]) : t.identifier("undefined"); - if (!consequent || !alternate) return bailed = true; - - exprs.push(t.conditionalExpression(node.test, consequent, alternate)); - } else if (t.isBlockStatement(node)) { - exprs.push(convert(node.body)); - } else if (t.isEmptyStatement(node)) { - // empty statement so ensure the last item is undefined if we're last - ensureLastUndefined = true; - continue; - } else { - // bailed, we can't turn this statement into an expression - return bailed = true; - } - - ensureLastUndefined = false; - } - - if (ensureLastUndefined) { - exprs.push(t.identifier("undefined")); - } - - // - - if (exprs.length === 1) { - return exprs[0]; - } else { - return t.sequenceExpression(exprs); - } - } -} - -/** - * [Please add a description.] - */ - -function toKeyAlias(node) { - var key = arguments.length <= 1 || arguments[1] === undefined ? node.key : arguments[1]; - return (function () { - var alias; - - if (node.kind === "method") { - return toKeyAlias.uid++; - } else if (t.isIdentifier(key)) { - alias = key.name; - } else if (t.isLiteral(key)) { - alias = JSON.stringify(key.value); - } else { - alias = JSON.stringify(_traversal2["default"].removeProperties(t.cloneDeep(key))); - } - - if (node.computed) { - alias = "[" + alias + "]"; - } - - return alias; - })(); -} - -toKeyAlias.uid = 0; - -/** - * [Please add a description.] - */ - -function toIdentifier(name) { - if (t.isIdentifier(name)) return name.name; - - name = name + ""; - - // replace all non-valid identifiers with dashes - name = name.replace(/[^a-zA-Z0-9$_]/g, "-"); - - // remove all dashes and numbers from start of name - name = name.replace(/^[-0-9]+/, ""); - - // camel case - name = name.replace(/[-\s]+(.)?/g, function (match, c) { - return c ? c.toUpperCase() : ""; - }); - - if (!t.isValidIdentifier(name)) { - name = "_" + name; - } - - return name || "_"; -} - -/** - * [Please add a description.] - */ - -function toBindingIdentifierName(name) { - name = toIdentifier(name); - if (name === "eval" || name === "arguments") name = "_" + name; - return name; -} - -/** - * [Please add a description.] - * @returns {Object|Boolean} - */ - -function toStatement(node, ignore) { - if (t.isStatement(node)) { - return node; - } - - var mustHaveId = false; - var newType; - - if (t.isClass(node)) { - mustHaveId = true; - newType = "ClassDeclaration"; - } else if (t.isFunction(node)) { - mustHaveId = true; - newType = "FunctionDeclaration"; - } else if (t.isAssignmentExpression(node)) { - return t.expressionStatement(node); - } - - if (mustHaveId && !node.id) { - newType = false; - } - - if (!newType) { - if (ignore) { - return false; - } else { - throw new Error("cannot turn " + node.type + " to a statement"); - } - } - - node.type = newType; - - return node; -} - -/** - * [Please add a description.] - */ - -function toExpression(node) { - if (t.isExpressionStatement(node)) { - node = node.expression; - } - - if (t.isClass(node)) { - node.type = "ClassExpression"; - } else if (t.isFunction(node)) { - node.type = "FunctionExpression"; - } - - if (t.isExpression(node)) { - return node; - } else { - throw new Error("cannot turn " + node.type + " to an expression"); - } -} - -/** - * [Please add a description.] - */ - -function toBlock(node, parent) { - if (t.isBlockStatement(node)) { - return node; - } - - if (t.isEmptyStatement(node)) { - node = []; - } - - if (!Array.isArray(node)) { - if (!t.isStatement(node)) { - if (t.isFunction(parent)) { - node = t.returnStatement(node); - } else { - node = t.expressionStatement(node); - } - } - - node = [node]; - } - - return t.blockStatement(node); -} - -/** - * [Please add a description.] - */ - -function valueToNode(value) { - // undefined - if (value === undefined) { - return t.identifier("undefined"); - } - - // null, booleans, strings, numbers, regexs - if (value === true || value === false || value === null || _lodashLangIsString2["default"](value) || _lodashLangIsNumber2["default"](value) || _lodashLangIsRegExp2["default"](value)) { - return t.literal(value); - } - - // array - if (Array.isArray(value)) { - return t.arrayExpression(value.map(t.valueToNode)); - } - - // object - if (_lodashLangIsPlainObject2["default"](value)) { - var props = []; - for (var key in value) { - var nodeKey; - if (t.isValidIdentifier(key)) { - nodeKey = t.identifier(key); - } else { - nodeKey = t.literal(key); - } - props.push(t.property("init", nodeKey, t.valueToNode(value[key]))); - } - return t.objectExpression(props); - } - - throw new Error("don't know how to turn this value into a node"); -} -},{"148":148,"179":179,"510":510,"512":512,"513":513,"514":514}],170:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("ArrayExpression", { - visitor: ["elements"], - aliases: ["Expression"] -}); - -_index2["default"]("AssignmentExpression", { - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Expression"] -}); - -_index2["default"]("BinaryExpression", { - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Binary", "Expression"] -}); - -_index2["default"]("BlockStatement", { - visitor: ["body"], - aliases: ["Scopable", "BlockParent", "Block", "Statement"] -}); - -_index2["default"]("BreakStatement", { - visitor: ["label"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -_index2["default"]("CallExpression", { - visitor: ["callee", "arguments"], - aliases: ["Expression"] -}); - -_index2["default"]("CatchClause", { - visitor: ["param", "body"], - aliases: ["Scopable"] -}); - -_index2["default"]("ConditionalExpression", { - visitor: ["test", "consequent", "alternate"], - aliases: ["Expression"] -}); - -_index2["default"]("ContinueStatement", { - visitor: ["label"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -_index2["default"]("DebuggerStatement", { - aliases: ["Statement"] -}); - -_index2["default"]("DoWhileStatement", { - visitor: ["body", "test"], - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] -}); - -_index2["default"]("EmptyStatement", { - aliases: ["Statement"] -}); - -_index2["default"]("ExpressionStatement", { - visitor: ["expression"], - aliases: ["Statement"] -}); - -_index2["default"]("File", { - builder: ["program", "comments", "tokens"], - visitor: ["program"] -}); - -_index2["default"]("ForInStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"] -}); - -_index2["default"]("ForStatement", { - visitor: ["init", "test", "update", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"] -}); - -_index2["default"]("FunctionDeclaration", { - builder: { - id: null, - params: null, - body: null, - generator: false, - async: false - }, - visitor: ["id", "params", "body", "returnType", "typeParameters"], - aliases: ["Scopable", "Function", "Func", "BlockParent", "FunctionParent", "Statement", "Pure", "Declaration"] -}); - -_index2["default"]("FunctionExpression", { - builder: { - id: null, - params: null, - body: null, - generator: false, - async: false - }, - visitor: ["id", "params", "body", "returnType", "typeParameters"], - aliases: ["Scopable", "Function", "Func", "BlockParent", "FunctionParent", "Expression", "Pure"] -}); - -_index2["default"]("Identifier", { - builder: ["name"], - visitor: ["typeAnnotation"], - aliases: ["Expression"] -}); - -_index2["default"]("IfStatement", { - visitor: ["test", "consequent", "alternate"], - aliases: ["Statement"] -}); - -_index2["default"]("LabeledStatement", { - visitor: ["label", "body"], - aliases: ["Statement"] -}); - -_index2["default"]("Literal", { - builder: ["value"], - aliases: ["Expression", "Pure"] -}); - -_index2["default"]("LogicalExpression", { - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Binary", "Expression"] -}); - -_index2["default"]("MemberExpression", { - builder: { - object: null, - property: null, - computed: false - }, - visitor: ["object", "property"], - aliases: ["Expression"] -}); - -_index2["default"]("NewExpression", { - visitor: ["callee", "arguments"], - aliases: ["Expression"] -}); - -_index2["default"]("ObjectExpression", { - visitor: ["properties"], - aliases: ["Expression"] -}); - -_index2["default"]("Program", { - visitor: ["body"], - aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"] -}); - -_index2["default"]("Property", { - builder: { - kind: "init", - key: null, - value: null, - computed: false - }, - visitor: ["key", "value", "decorators"], - aliases: ["UserWhitespacable"] -}); - -_index2["default"]("RestElement", { - visitor: ["argument", "typeAnnotation"] -}); - -_index2["default"]("ReturnStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -_index2["default"]("SequenceExpression", { - visitor: ["expressions"], - aliases: ["Expression"] -}); - -_index2["default"]("SwitchCase", { - visitor: ["test", "consequent"] -}); - -_index2["default"]("SwitchStatement", { - visitor: ["discriminant", "cases"], - aliases: ["Statement", "BlockParent", "Scopable"] -}); - -_index2["default"]("ThisExpression", { - aliases: ["Expression"] -}); - -_index2["default"]("ThrowStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -_index2["default"]("TryStatement", { - builder: ["block", "handler", "finalizer"], - visitor: ["block", "handlers", "handler", "guardedHandlers", "finalizer"], - aliases: ["Statement"] -}); - -_index2["default"]("UnaryExpression", { - builder: { - operator: null, - argument: null, - prefix: false - }, - visitor: ["argument"], - aliases: ["UnaryLike", "Expression"] -}); - -_index2["default"]("UpdateExpression", { - builder: { - operator: null, - argument: null, - prefix: false - }, - visitor: ["argument"], - aliases: ["Expression"] -}); - -_index2["default"]("VariableDeclaration", { - builder: ["kind", "declarations"], - visitor: ["declarations"], - aliases: ["Statement", "Declaration"] -}); - -_index2["default"]("VariableDeclarator", { - visitor: ["id", "init"] -}); - -_index2["default"]("WhileStatement", { - visitor: ["test", "body"], - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] -}); - -_index2["default"]("WithStatement", { - visitor: ["object", "body"], - aliases: ["Statement"] -}); -},{"174":174}],171:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("AssignmentPattern", { - visitor: ["left", "right"], - aliases: ["Pattern"] -}); - -_index2["default"]("ArrayPattern", { - visitor: ["elements", "typeAnnotation"], - aliases: ["Pattern"] -}); - -_index2["default"]("ArrowFunctionExpression", { - builder: ["params", "body", "async"], - visitor: ["params", "body", "returnType"], - aliases: ["Scopable", "Function", "Func", "BlockParent", "FunctionParent", "Expression", "Pure"] -}); - -_index2["default"]("ClassBody", { - visitor: ["body"] -}); - -_index2["default"]("ClassDeclaration", { - visitor: ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"], - aliases: ["Scopable", "Class", "Statement", "Declaration"] -}); - -_index2["default"]("ClassExpression", { - visitor: ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"], - aliases: ["Scopable", "Class", "Expression"] -}); - -_index2["default"]("ExportAllDeclaration", { - visitor: ["source", "exported"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"] -}); - -_index2["default"]("ExportDefaultDeclaration", { - visitor: ["declaration"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"] -}); - -_index2["default"]("ExportNamedDeclaration", { - visitor: ["declaration", "specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"] -}); - -_index2["default"]("ExportDefaultSpecifier", { - visitor: ["exported"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("ExportNamespaceSpecifier", { - visitor: ["exported"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("ExportSpecifier", { - visitor: ["local", "exported"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("ForOfStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"] -}); - -_index2["default"]("ImportDeclaration", { - visitor: ["specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration"] -}); - -_index2["default"]("ImportDefaultSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("ImportNamespaceSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("ImportSpecifier", { - visitor: ["local", "imported"], - aliases: ["ModuleSpecifier"] -}); - -_index2["default"]("MetaProperty", { - visitor: ["meta", "property"], - aliases: ["Expression"] -}); - -_index2["default"]("MethodDefinition", { - builder: { - key: null, - value: null, - kind: "method", - computed: false, - "static": false - }, - visitor: ["key", "value", "decorators"] -}); - -_index2["default"]("ObjectPattern", { - visitor: ["properties", "typeAnnotation"], - aliases: ["Pattern"] -}); - -_index2["default"]("SpreadElement", { - visitor: ["argument"], - aliases: ["UnaryLike"] -}); - -_index2["default"]("Super", { - aliases: ["Expression"] -}); - -_index2["default"]("TaggedTemplateExpression", { - visitor: ["tag", "quasi"], - aliases: ["Expression"] -}); - -_index2["default"]("TemplateElement"); - -_index2["default"]("TemplateLiteral", { - visitor: ["quasis", "expressions"], - aliases: ["Expression"] -}); - -_index2["default"]("YieldExpression", { - builder: ["argument", "delegate"], - visitor: ["argument"], - aliases: ["Expression", "Terminatorless"] -}); -},{"174":174}],172:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("AwaitExpression", { - builder: ["argument", "all"], - visitor: ["argument"], - aliases: ["Expression", "Terminatorless"] -}); - -_index2["default"]("BindExpression", { - visitor: ["object", "callee"] -}); - -_index2["default"]("ComprehensionBlock", { - visitor: ["left", "right"] -}); - -_index2["default"]("ComprehensionExpression", { - visitor: ["filter", "blocks", "body"], - aliases: ["Expression", "Scopable"] -}); - -_index2["default"]("Decorator", { - visitor: ["expression"] -}); - -_index2["default"]("DoExpression", { - visitor: ["body"], - aliases: ["Expression"] -}); - -_index2["default"]("SpreadProperty", { - visitor: ["argument"], - aliases: ["UnaryLike"] -}); -},{"174":174}],173:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("AnyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -_index2["default"]("ArrayTypeAnnotation", { - visitor: ["elementType"], - aliases: ["Flow"] -}); - -_index2["default"]("BooleanTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -_index2["default"]("BooleanLiteralTypeAnnotation", { - aliases: ["Flow"] -}); - -_index2["default"]("ClassImplements", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"] -}); - -_index2["default"]("ClassProperty", { - visitor: ["key", "value", "typeAnnotation", "decorators"], - aliases: ["Flow"] -}); - -_index2["default"]("DeclareClass", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("DeclareFunction", { - visitor: ["id"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("DeclareModule", { - visitor: ["id", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("DeclareVariable", { - visitor: ["id"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("FunctionTypeAnnotation", { - visitor: ["typeParameters", "params", "rest", "returnType"], - aliases: ["Flow"] -}); - -_index2["default"]("FunctionTypeParam", { - visitor: ["name", "typeAnnotation"], - aliases: ["Flow"] -}); - -_index2["default"]("GenericTypeAnnotation", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"] -}); - -_index2["default"]("InterfaceExtends", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"] -}); - -_index2["default"]("InterfaceDeclaration", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("IntersectionTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"] -}); - -_index2["default"]("MixedTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -_index2["default"]("NullableTypeAnnotation", { - visitor: ["typeAnnotation"], - aliases: ["Flow"] -}); - -_index2["default"]("NumberLiteralTypeAnnotation", { - aliases: ["Flow"] -}); - -_index2["default"]("NumberTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -_index2["default"]("StringLiteralTypeAnnotation", { - aliases: ["Flow"] -}); - -_index2["default"]("StringTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -_index2["default"]("TupleTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"] -}); - -_index2["default"]("TypeofTypeAnnotation", { - visitor: ["argument"], - aliases: ["Flow"] -}); - -_index2["default"]("TypeAlias", { - visitor: ["id", "typeParameters", "right"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"] -}); - -_index2["default"]("TypeAnnotation", { - visitor: ["typeAnnotation"], - aliases: ["Flow"] -}); - -_index2["default"]("TypeCastExpression", { - visitor: ["expression", "typeAnnotation"], - aliases: ["Flow"] -}); - -_index2["default"]("TypeParameterDeclaration", { - visitor: ["params"], - aliases: ["Flow"] -}); - -_index2["default"]("TypeParameterInstantiation", { - visitor: ["params"], - aliases: ["Flow"] -}); - -_index2["default"]("ObjectTypeAnnotation", { - visitor: ["properties", "indexers", "callProperties"], - aliases: ["Flow"] -}); - -_index2["default"]("ObjectTypeCallProperty", { - visitor: ["value"], - aliases: ["Flow", "UserWhitespacable"] -}); - -_index2["default"]("ObjectTypeIndexer", { - visitor: ["id", "key", "value"], - aliases: ["Flow", "UserWhitespacable"] -}); - -_index2["default"]("ObjectTypeProperty", { - visitor: ["key", "value"], - aliases: ["Flow", "UserWhitespacable"] -}); - -_index2["default"]("QualifiedTypeIdentifier", { - visitor: ["id", "qualification"], - aliases: ["Flow"] -}); - -_index2["default"]("UnionTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"] -}); - -_index2["default"]("VoidTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); -},{"174":174}],174:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports["default"] = defineType; -var VISITOR_KEYS = {}; -exports.VISITOR_KEYS = VISITOR_KEYS; -var ALIAS_KEYS = {}; -exports.ALIAS_KEYS = ALIAS_KEYS; -var BUILDER_KEYS = {}; - -exports.BUILDER_KEYS = BUILDER_KEYS; -function builderFromArray(arr) { - var builder = {}; - var _arr = arr; - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i];builder[key] = null; - }return builder; -} - -function defineType(type) { - var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - opts.visitor = opts.visitor || []; - opts.aliases = opts.aliases || []; - - if (!opts.builder) opts.builder = builderFromArray(opts.visitor); - if (Array.isArray(opts.builder)) opts.builder = builderFromArray(opts.builder); - - VISITOR_KEYS[type] = opts.visitor; - ALIAS_KEYS[type] = opts.aliases; - BUILDER_KEYS[type] = opts.builder; -} -},{}],175:[function(_dereq_,module,exports){ -"use strict"; - -_dereq_(174); - -_dereq_(170); - -_dereq_(171); - -_dereq_(173); - -_dereq_(176); - -_dereq_(177); - -_dereq_(172); -},{"170":170,"171":171,"172":172,"173":173,"174":174,"176":176,"177":177}],176:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("JSXAttribute", { - visitor: ["name", "value"], - aliases: ["JSX", "Immutable"] -}); - -_index2["default"]("JSXClosingElement", { - visitor: ["name"], - aliases: ["JSX", "Immutable"] -}); - -_index2["default"]("JSXElement", { - visitor: ["openingElement", "closingElement", "children"], - aliases: ["JSX", "Immutable", "Expression"] -}); - -_index2["default"]("JSXEmptyExpression", { - aliases: ["JSX", "Expression"] -}); - -_index2["default"]("JSXExpressionContainer", { - visitor: ["expression"], - aliases: ["JSX", "Immutable"] -}); - -_index2["default"]("JSXIdentifier", { - aliases: ["JSX", "Expression"] -}); - -_index2["default"]("JSXMemberExpression", { - visitor: ["object", "property"], - aliases: ["JSX", "Expression"] -}); - -_index2["default"]("JSXNamespacedName", { - visitor: ["namespace", "name"], - aliases: ["JSX"] -}); - -_index2["default"]("JSXOpeningElement", { - visitor: ["name", "attributes"], - aliases: ["JSX", "Immutable"] -}); - -_index2["default"]("JSXSpreadAttribute", { - visitor: ["argument"], - aliases: ["JSX"] -}); -},{"174":174}],177:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(174); - -var _index2 = _interopRequireDefault(_index); - -_index2["default"]("Noop", { - visitor: [] -}); - -_index2["default"]("ParenthesizedExpression", { - visitor: ["expression"], - aliases: ["Expression"] -}); -},{"174":174}],178:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.createUnionTypeAnnotation = createUnionTypeAnnotation; -exports.removeTypeDuplicates = removeTypeDuplicates; -exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _index = _dereq_(179); - -var t = _interopRequireWildcard(_index); - -/** - * Takes an array of `types` and flattens them, removing duplicates and - * returns a `UnionTypeAnnotation` node containg them. - */ - -function createUnionTypeAnnotation(types) { - var flattened = removeTypeDuplicates(types); - - if (flattened.length === 1) { - return flattened[0]; - } else { - return t.unionTypeAnnotation(flattened); - } -} - -/** - * Dedupe type annotations. - */ - -function removeTypeDuplicates(nodes) { - var generics = {}; - var bases = {}; - - // store union type groups to circular references - var typeGroups = []; - - var types = []; - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (!node) continue; - - // detect duplicates - if (types.indexOf(node) >= 0) { - continue; - } - - // this type matches anything - if (t.isAnyTypeAnnotation(node)) { - return [node]; - } - - // - if (t.isFlowBaseAnnotation(node)) { - bases[node.type] = node; - continue; - } - - // - if (t.isUnionTypeAnnotation(node)) { - if (typeGroups.indexOf(node.types) < 0) { - nodes = nodes.concat(node.types); - typeGroups.push(node.types); - } - continue; - } - - // find a matching generic type and merge and deduplicate the type parameters - if (t.isGenericTypeAnnotation(node)) { - var _name = node.id.name; - - if (generics[_name]) { - var existing = generics[_name]; - if (existing.typeParameters) { - if (node.typeParameters) { - existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); - } - } else { - existing = node.typeParameters; - } - } else { - generics[_name] = node; - } - - continue; - } - - types.push(node); - } - - // add back in bases - for (var type in bases) { - types.push(bases[type]); - } - - // add back in generics - for (var _name2 in generics) { - types.push(generics[_name2]); - } - - return types; -} - -/** - * Create a type anotation based on typeof expression. - */ - -function createTypeAnnotationBasedOnTypeof(type) { - if (type === "string") { - return t.stringTypeAnnotation(); - } else if (type === "number") { - return t.numberTypeAnnotation(); - } else if (type === "undefined") { - return t.voidTypeAnnotation(); - } else if (type === "boolean") { - return t.booleanTypeAnnotation(); - } else if (type === "function") { - return t.genericTypeAnnotation(t.identifier("Function")); - } else if (type === "object") { - return t.genericTypeAnnotation(t.identifier("Object")); - } else if (type === "symbol") { - return t.genericTypeAnnotation(t.identifier("Symbol")); - } else { - throw new Error("Invalid typeof value"); - } -} -},{"179":179}],179:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.is = is; -exports.isType = isType; -exports.shallowEqual = shallowEqual; -exports.appendToMemberExpression = appendToMemberExpression; -exports.prependToMemberExpression = prependToMemberExpression; -exports.ensureBlock = ensureBlock; -exports.clone = clone; -exports.cloneDeep = cloneDeep; -exports.buildMatchMemberExpression = buildMatchMemberExpression; -exports.removeComments = removeComments; -exports.inheritsComments = inheritsComments; -exports.inheritTrailingComments = inheritTrailingComments; -exports.inheritLeadingComments = inheritLeadingComments; -exports.inheritInnerComments = inheritInnerComments; -exports.inherits = inherits; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _toFastProperties = _dereq_(608); - -var _toFastProperties2 = _interopRequireDefault(_toFastProperties); - -var _lodashArrayCompact = _dereq_(413); - -var _lodashArrayCompact2 = _interopRequireDefault(_lodashArrayCompact); - -var _lodashObjectAssign = _dereq_(517); - -var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); - -var _lodashCollectionEach = _dereq_(419); - -var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach); - -var _lodashArrayUniq = _dereq_(417); - -var _lodashArrayUniq2 = _interopRequireDefault(_lodashArrayUniq); - -_dereq_(175); - -var _definitions = _dereq_(174); - -var t = exports; - -/** - * Registers `is[Type]` and `assert[Type]` generated functions for a given `type`. - * Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`. - */ - -function registerType(type, skipAliasCheck) { - var is = t["is" + type] = function (node, opts) { - return t.is(type, node, opts, skipAliasCheck); - }; - - t["assert" + type] = function (node, opts) { - opts = opts || {}; - if (!is(node, opts)) { - throw new Error("Expected type " + JSON.stringify(type) + " with option " + JSON.stringify(opts)); - } - }; -} - -/** - * Constants. - */ - -var STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; -exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS; -var FLATTENABLE_KEYS = ["body", "expressions"]; -exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS; -var FOR_INIT_KEYS = ["left", "init"]; -exports.FOR_INIT_KEYS = FOR_INIT_KEYS; -var COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; - -exports.COMMENT_KEYS = COMMENT_KEYS; -var INHERIT_KEYS = { - optional: ["typeAnnotation", "typeParameters", "returnType"], - force: ["_scopeInfo", "_paths", "start", "loc", "end"] -}; - -exports.INHERIT_KEYS = INHERIT_KEYS; -var BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; -exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS; -var EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; -exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS; -var COMPARISON_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS.concat(["in", "instanceof"]); -exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS; -var BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS); -exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS; -var NUMBER_BINARY_OPERATORS = ["-", "/", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; - -exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS; -var BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; -exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS; -var NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; -exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS; -var STRING_UNARY_OPERATORS = ["typeof"]; - -exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS; -exports.VISITOR_KEYS = _definitions.VISITOR_KEYS; -exports.BUILDER_KEYS = _definitions.BUILDER_KEYS; -exports.ALIAS_KEYS = _definitions.ALIAS_KEYS; - -/** - * Registers `is[Type]` and `assert[Type]` for all types. - */ - -_lodashCollectionEach2["default"](t.VISITOR_KEYS, function (keys, type) { - registerType(type, true); -}); - -/** - * Flip `ALIAS_KEYS` for faster access in the reverse direction. - */ - -t.FLIPPED_ALIAS_KEYS = {}; - -_lodashCollectionEach2["default"](t.ALIAS_KEYS, function (aliases, type) { - _lodashCollectionEach2["default"](aliases, function (alias) { - var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; - types.push(type); - }); -}); - -/** - * Registers `is[Alias]` and `assert[Alias]` functions for all aliases. - */ - -_lodashCollectionEach2["default"](t.FLIPPED_ALIAS_KEYS, function (types, type) { - t[type.toUpperCase() + "_TYPES"] = types; - registerType(type, false); -}); - -var TYPES = Object.keys(t.VISITOR_KEYS).concat(Object.keys(t.FLIPPED_ALIAS_KEYS)); - -exports.TYPES = TYPES; -/** - * Returns whether `node` is of given `type`. - * - * For better performance, use this instead of `is[Type]` when `type` is unknown. - * Optionally, pass `skipAliasCheck` to directly compare `node.type` with `type`. - */ - -// @TODO should `skipAliasCheck` be removed? -/*eslint-disable no-unused-vars */ - -function is(type, node, opts, skipAliasCheck) { - if (!node) return false; - - var matches = isType(node.type, type); - if (!matches) return false; - - if (typeof opts === "undefined") { - return true; - } else { - return t.shallowEqual(node, opts); - } -} - -/*eslint-enable no-unused-vars */ - -/** - * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`. - */ - -function isType(nodeType, targetType) { - if (nodeType === targetType) return true; - - var aliases = t.FLIPPED_ALIAS_KEYS[targetType]; - if (aliases) { - if (aliases[0] === nodeType) return true; - - var _arr = aliases; - for (var _i = 0; _i < _arr.length; _i++) { - var alias = _arr[_i]; - if (nodeType === alias) return true; - } - } - - return false; -} - -/** - * [Please add a description.] - */ - -_lodashCollectionEach2["default"](t.VISITOR_KEYS, function (keys, type) { - if (t.BUILDER_KEYS[type]) return; - - var defs = {}; - _lodashCollectionEach2["default"](keys, function (key) { - defs[key] = null; - }); - t.BUILDER_KEYS[type] = defs; -}); - -/** - * [Please add a description.] - */ - -_lodashCollectionEach2["default"](t.BUILDER_KEYS, function (keys, type) { - var builder = function builder() { - var node = {}; - node.type = type; - - var i = 0; - - for (var key in keys) { - var arg = arguments[i++]; - if (arg === undefined) arg = keys[key]; - node[key] = arg; - } - - return node; - }; - - t[type] = builder; - t[type[0].toLowerCase() + type.slice(1)] = builder; -}); - -/** - * Test if an object is shallowly equal. - */ - -function shallowEqual(actual, expected) { - var keys = Object.keys(expected); - - var _arr2 = keys; - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var key = _arr2[_i2]; - if (actual[key] !== expected[key]) { - return false; - } - } - - return true; -} - -/** - * Append a node to a member expression. - */ - -function appendToMemberExpression(member, append, computed) { - member.object = t.memberExpression(member.object, member.property, member.computed); - member.property = append; - member.computed = !!computed; - return member; -} - -/** - * Prepend a node to a member expression. - */ - -function prependToMemberExpression(member, prepend) { - member.object = t.memberExpression(prepend, member.object); - return member; -} - -/** - * Ensure the `key` (defaults to "body") of a `node` is a block. - * Casting it to a block if it is not. - */ - -function ensureBlock(node) { - var key = arguments.length <= 1 || arguments[1] === undefined ? "body" : arguments[1]; - - return node[key] = t.toBlock(node[key], node); -} - -/** - * Create a shallow clone of a `node` excluding `_private` properties. - */ - -function clone(node) { - var newNode = {}; - for (var key in node) { - if (key[0] === "_") continue; - newNode[key] = node[key]; - } - return newNode; -} - -/** - * Create a deep clone of a `node` and all of it's child nodes - * exluding `_private` properties. - */ - -function cloneDeep(node) { - var newNode = {}; - - for (var key in node) { - if (key[0] === "_") continue; - - var val = node[key]; - - if (val) { - if (val.type) { - val = t.cloneDeep(val); - } else if (Array.isArray(val)) { - val = val.map(t.cloneDeep); - } - } - - newNode[key] = val; - } - - return newNode; -} - -/** - * Build a function that when called will return whether or not the - * input `node` `MemberExpression` matches the input `match`. - * - * For example, given the match `React.createClass` it would match the - * parsed nodes of `React.createClass` and `React["createClass"]`. - */ - -function buildMatchMemberExpression(match, allowPartial) { - var parts = match.split("."); - - return function (member) { - // not a member expression - if (!t.isMemberExpression(member)) return false; - - var search = [member]; - var i = 0; - - while (search.length) { - var node = search.shift(); - - if (allowPartial && i === parts.length) { - return true; - } - - if (t.isIdentifier(node)) { - // this part doesn't match - if (parts[i] !== node.name) return false; - } else if (t.isLiteral(node)) { - // this part doesn't match - if (parts[i] !== node.value) return false; - } else if (t.isMemberExpression(node)) { - if (node.computed && !t.isLiteral(node.property)) { - // we can't deal with this - return false; - } else { - search.push(node.object); - search.push(node.property); - continue; - } - } else { - // we can't deal with this - return false; - } - - // too many parts - if (++i > parts.length) { - return false; - } - } - - return true; - }; -} - -/** - * Remove comment properties from a node. - */ - -function removeComments(node) { - var _arr3 = COMMENT_KEYS; - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var key = _arr3[_i3]; - delete node[key]; - } - return node; -} - -/** - * Inherit all unique comments from `parent` node to `child` node. - */ - -function inheritsComments(child, parent) { - inheritTrailingComments(child, parent); - inheritLeadingComments(child, parent); - inheritInnerComments(child, parent); - return child; -} - -function inheritTrailingComments(child, parent) { - _inheritComments("trailingComments", child, parent); -} - -function inheritLeadingComments(child, parent) { - _inheritComments("leadingComments", child, parent); -} - -function inheritInnerComments(child, parent) { - _inheritComments("innerComments", child, parent); -} - -function _inheritComments(key, child, parent) { - if (child && parent) { - child[key] = _lodashArrayUniq2["default"](_lodashArrayCompact2["default"]([].concat(child[key], parent[key]))); - } -} - -/** - * Inherit all contextual properties from `parent` node to `child` node. - */ - -function inherits(child, parent) { - if (!child || !parent) return child; - - var _arr4 = t.INHERIT_KEYS.optional; - for (var _i4 = 0; _i4 < _arr4.length; _i4++) { - var key = _arr4[_i4]; - if (child[key] == null) { - child[key] = parent[key]; - } - } - - var _arr5 = t.INHERIT_KEYS.force; - for (var _i5 = 0; _i5 < _arr5.length; _i5++) { - var key = _arr5[_i5]; - child[key] = parent[key]; - } - - t.inheritsComments(child, parent); - - return child; -} - -// Optimize property access. -_toFastProperties2["default"](t); -_toFastProperties2["default"](t.VISITOR_KEYS); - -// Export all type checkers from other files. -_lodashObjectAssign2["default"](t, _dereq_(180)); -_lodashObjectAssign2["default"](t, _dereq_(181)); -_lodashObjectAssign2["default"](t, _dereq_(169)); -_lodashObjectAssign2["default"](t, _dereq_(178)); -},{"169":169,"174":174,"175":175,"178":178,"180":180,"181":181,"413":413,"417":417,"419":419,"517":517,"608":608}],180:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getBindingIdentifiers = getBindingIdentifiers; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -var _index = _dereq_(179); - -var t = _interopRequireWildcard(_index); - -/** - * Return a list of binding identifiers associated with the input `node`. - */ - -function getBindingIdentifiers(node, duplicates) { - var search = [].concat(node); - var ids = Object.create(null); - - while (search.length) { - var id = search.shift(); - if (!id) continue; - - var keys = t.getBindingIdentifiers.keys[id.type]; - - if (t.isIdentifier(id)) { - if (duplicates) { - var _ids = ids[id.name] = ids[id.name] || []; - _ids.push(id); - } else { - ids[id.name] = id; - } - } else if (t.isExportDeclaration(id)) { - if (t.isDeclaration(node.declaration)) { - search.push(node.declaration); - } - } else if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (id[key]) { - search = search.concat(id[key]); - } - } - } - } - - return ids; -} - -/** - * Mapping of types to their identifier keys. - */ - -getBindingIdentifiers.keys = { - DeclareClass: ["id"], - DeclareFunction: ["id"], - DeclareModule: ["id"], - DeclareVariable: ["id"], - InterfaceDeclaration: ["id"], - TypeAlias: ["id"], - - ComprehensionExpression: ["blocks"], - ComprehensionBlock: ["left"], - - CatchClause: ["param"], - LabeledStatement: ["label"], - UnaryExpression: ["argument"], - AssignmentExpression: ["left"], - - ImportSpecifier: ["local"], - ImportNamespaceSpecifier: ["local"], - ImportDefaultSpecifier: ["local"], - ImportDeclaration: ["specifiers"], - - FunctionDeclaration: ["id", "params"], - FunctionExpression: ["id", "params"], - - ClassDeclaration: ["id"], - ClassExpression: ["id"], - - RestElement: ["argument"], - UpdateExpression: ["argument"], - - SpreadProperty: ["argument"], - Property: ["value"], - - AssignmentPattern: ["left"], - ArrayPattern: ["elements"], - ObjectPattern: ["properties"], - - VariableDeclaration: ["declarations"], - VariableDeclarator: ["id"] -}; -},{"179":179}],181:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.isBinding = isBinding; -exports.isReferenced = isReferenced; -exports.isValidIdentifier = isValidIdentifier; -exports.isLet = isLet; -exports.isBlockScoped = isBlockScoped; -exports.isVar = isVar; -exports.isSpecifierDefault = isSpecifierDefault; -exports.isScope = isScope; -exports.isImmutable = isImmutable; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _retrievers = _dereq_(180); - -var _esutils = _dereq_(403); - -var _esutils2 = _interopRequireDefault(_esutils); - -var _index = _dereq_(179); - -var t = _interopRequireWildcard(_index); - -/** - * Check if the input `node` is a binding identifier. - */ - -function isBinding(node, parent) { - var keys = _retrievers.getBindingIdentifiers.keys[parent.type]; - if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var val = parent[key]; - if (Array.isArray(val)) { - if (val.indexOf(node) >= 0) return true; - } else { - if (val === node) return true; - } - } - } - - return false; -} - -/** - * Check if the input `node` is a reference to a bound variable. - */ - -function isReferenced(node, parent) { - switch (parent.type) { - // yes: PARENT[NODE] - // yes: NODE.child - // no: parent.NODE - case "MemberExpression": - case "JSXMemberExpression": - if (parent.property === node && parent.computed) { - return true; - } else if (parent.object === node) { - return true; - } else { - return false; - } - - // no: new.NODE - // no: NODE.target - case "MetaProperty": - return false; - - // yes: { [NODE]: "" } - // yes: { NODE } - // no: { NODE: "" } - case "Property": - if (parent.key === node) { - return parent.computed; - } - - // no: var NODE = init; - // yes: var id = NODE; - case "VariableDeclarator": - return parent.id !== node; - - // no: function NODE() {} - // no: function foo(NODE) {} - case "ArrowFunctionExpression": - case "FunctionDeclaration": - case "FunctionExpression": - var _arr = parent.params; - - for (var _i = 0; _i < _arr.length; _i++) { - var param = _arr[_i]; - if (param === node) return false; - } - - return parent.id !== node; - - // no: export { foo as NODE }; - // yes: export { NODE as foo }; - // no: export { NODE as foo } from "foo"; - case "ExportSpecifier": - if (parent.source) { - return false; - } else { - return parent.local === node; - } - - // no: <div NODE="foo" /> - case "JSXAttribute": - return parent.name !== node; - - // no: class { NODE = value; } - // yes: class { key = NODE; } - case "ClassProperty": - return parent.value === node; - - // no: import NODE from "foo"; - // no: import * as NODE from "foo"; - // no: import { NODE as foo } from "foo"; - // no: import { foo as NODE } from "foo"; - // no: import NODE from "bar"; - case "ImportDefaultSpecifier": - case "ImportNamespaceSpecifier": - case "ImportSpecifier": - return false; - - // no: class NODE {} - case "ClassDeclaration": - case "ClassExpression": - return parent.id !== node; - - // yes: class { [NODE](){} } - case "MethodDefinition": - return parent.key === node && parent.computed; - - // no: NODE: for (;;) {} - case "LabeledStatement": - return false; - - // no: try {} catch (NODE) {} - case "CatchClause": - return parent.param !== node; - - // no: function foo(...NODE) {} - case "RestElement": - return false; - - // yes: left = NODE; - // no: NODE = right; - case "AssignmentExpression": - return parent.right === node; - - // no: [NODE = foo] = []; - // yes: [foo = NODE] = []; - case "AssignmentPattern": - return parent.right === node; - - // no: [NODE] = []; - // no: ({ NODE }) = []; - case "ObjectPattern": - case "ArrayPattern": - return false; - } - - return true; -} - -/** - * Check if the input `name` is a valid identifier name - * and isn't a reserved word. - */ - -function isValidIdentifier(name) { - if (typeof name !== "string" || _esutils2["default"].keyword.isReservedWordES6(name, true)) { - return false; - } else { - return _esutils2["default"].keyword.isIdentifierNameES6(name); - } -} - -/** - * Check if the input `node` is a `let` variable declaration. - */ - -function isLet(node) { - return t.isVariableDeclaration(node) && (node.kind !== "var" || node._let); -} - -/** - * Check if the input `node` is block scoped. - */ - -function isBlockScoped(node) { - return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node); -} - -/** - * Check if the input `node` is a variable declaration. - */ - -function isVar(node) { - return t.isVariableDeclaration(node, { kind: "var" }) && !node._let; -} - -/** - * Check if the input `specifier` is a `default` import or export. - */ - -function isSpecifierDefault(specifier) { - return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" }); -} - -/** - * Check if the input `node` is a scope. - */ - -function isScope(node, parent) { - if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) { - return false; - } - - return t.isScopable(node); -} - -/** - * Check if the input `node` is definitely immutable. - */ - -function isImmutable(node) { - if (t.isType(node.type, "Immutable")) return true; - - if (t.isLiteral(node)) { - if (node.regex) { - // regexs are mutable - return false; - } else { - // immutable! - return true; - } - } else if (t.isIdentifier(node)) { - if (node.name === "undefined") { - // immutable! - return true; - } else { - // no idea... - return false; - } - } - - return false; -} -},{"179":179,"180":180,"403":403}],182:[function(_dereq_,module,exports){ -(function (__dirname){ -"use strict"; - -exports.__esModule = true; -exports.canCompile = canCompile; -exports.list = list; -exports.regexify = regexify; -exports.arrayify = arrayify; -exports.booleanify = booleanify; -exports.shouldIgnore = shouldIgnore; -exports.template = template; -exports.parseTemplate = parseTemplate; -// istanbul ignore next - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashStringEscapeRegExp = _dereq_(526); - -var _lodashStringEscapeRegExp2 = _interopRequireDefault(_lodashStringEscapeRegExp); - -var _lodashStringStartsWith = _dereq_(527); - -var _lodashStringStartsWith2 = _interopRequireDefault(_lodashStringStartsWith); - -var _lodashLangCloneDeep = _dereq_(503); - -var _lodashLangCloneDeep2 = _interopRequireDefault(_lodashLangCloneDeep); - -var _lodashLangIsBoolean = _dereq_(506); - -var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean); - -var _messages = _dereq_(43); - -var messages = _interopRequireWildcard(_messages); - -var _minimatch = _dereq_(530); - -var _minimatch2 = _interopRequireDefault(_minimatch); - -var _lodashCollectionContains = _dereq_(418); - -var _lodashCollectionContains2 = _interopRequireDefault(_lodashCollectionContains); - -var _traversal = _dereq_(148); - -var _traversal2 = _interopRequireDefault(_traversal); - -var _lodashLangIsString = _dereq_(514); - -var _lodashLangIsString2 = _interopRequireDefault(_lodashLangIsString); - -var _lodashLangIsRegExp = _dereq_(513); - -var _lodashLangIsRegExp2 = _interopRequireDefault(_lodashLangIsRegExp); - -var _lodashLangIsEmpty = _dereq_(507); - -var _lodashLangIsEmpty2 = _interopRequireDefault(_lodashLangIsEmpty); - -var _helpersParse = _dereq_(42); - -var _helpersParse2 = _interopRequireDefault(_helpersParse); - -var _path = _dereq_(9); - -var _path2 = _interopRequireDefault(_path); - -var _lodashObjectHas = _dereq_(520); - -var _lodashObjectHas2 = _interopRequireDefault(_lodashObjectHas); - -var _fs = _dereq_(1); - -var _fs2 = _interopRequireDefault(_fs); - -var _types = _dereq_(179); - -var t = _interopRequireWildcard(_types); - -var _slash = _dereq_(596); - -var _slash2 = _interopRequireDefault(_slash); - -var _pathExists = _dereq_(534); - -var _pathExists2 = _interopRequireDefault(_pathExists); - -var _util = _dereq_(13); - -exports.inherits = _util.inherits; -exports.inspect = _util.inspect; - -/** - * Test if a filename ends with a compilable extension. - */ - -function canCompile(filename, altExts) { - var exts = altExts || canCompile.EXTENSIONS; - var ext = _path2["default"].extname(filename); - return _lodashCollectionContains2["default"](exts, ext); -} - -/** - * Default set of compilable extensions. - */ - -canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"]; - -/** - * Create an array from any value, splitting strings by ",". - */ - -function list(val) { - if (!val) { - return []; - } else if (Array.isArray(val)) { - return val; - } else if (typeof val === "string") { - return val.split(","); - } else { - return [val]; - } -} - -/** - * Create a RegExp from a string, array, or regexp. - */ - -function regexify(val) { - if (!val) return new RegExp(/.^/); - - if (Array.isArray(val)) val = new RegExp(val.map(_lodashStringEscapeRegExp2["default"]).join("|"), "i"); - - if (_lodashLangIsString2["default"](val)) { - // normalise path separators - val = _slash2["default"](val); - - // remove starting wildcards or relative separator if present - if (_lodashStringStartsWith2["default"](val, "./") || _lodashStringStartsWith2["default"](val, "*/")) val = val.slice(2); - if (_lodashStringStartsWith2["default"](val, "**/")) val = val.slice(3); - - var regex = _minimatch2["default"].makeRe(val, { nocase: true }); - return new RegExp(regex.source.slice(1, -1), "i"); - } - - if (_lodashLangIsRegExp2["default"](val)) return val; - - throw new TypeError("illegal type for regexify"); -} - -/** - * Create an array from a boolean, string, or array, mapped by and optional function. - */ - -function arrayify(val, mapFn) { - if (!val) return []; - if (_lodashLangIsBoolean2["default"](val)) return arrayify([val], mapFn); - if (_lodashLangIsString2["default"](val)) return arrayify(list(val), mapFn); - - if (Array.isArray(val)) { - if (mapFn) val = val.map(mapFn); - return val; - } - - return [val]; -} - -/** - * Makes boolean-like strings into booleans. - */ - -function booleanify(val) { - if (val === "true") return true; - if (val === "false") return false; - return val; -} - -/** - * Tests if a filename should be ignored based on "ignore" and "only" options. - */ - -function shouldIgnore(filename, ignore, only) { - filename = _slash2["default"](filename); - - if (only) { - var _arr = only; - - for (var _i = 0; _i < _arr.length; _i++) { - var pattern = _arr[_i]; - if (_shouldIgnore(pattern, filename)) return false; - } - return true; - } else if (ignore.length) { - var _arr2 = ignore; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var pattern = _arr2[_i2]; - if (_shouldIgnore(pattern, filename)) return true; - } - } - - return false; -} - -/** - * Returns result of calling function with filename if pattern is a function. - * Otherwise returns result of matching pattern Regex with filename. - */ - -function _shouldIgnore(pattern, filename) { - if (typeof pattern === "function") { - return pattern(filename); - } else { - return pattern.test(filename); - } -} - -/** - * A visitor for Babel templates, replaces placeholder references. - */ - -var templateVisitor = { - - /** - * 360 NoScope PWNd - */ - noScope: true, - - enter: function enter(node, parent, scope, nodes) { - if (t.isExpressionStatement(node)) { - node = node.expression; - } - - if (t.isIdentifier(node) && _lodashObjectHas2["default"](nodes, node.name)) { - this.skip(); - this.replaceInline(nodes[node.name]); - } - }, - - exit: function exit(node) { - _traversal2["default"].clearNode(node); - } -}; - -/** - * Create an instance of a template to use in a transformer. - */ - -function template(name, nodes, keepExpression) { - var ast = exports.templates[name]; - if (!ast) throw new ReferenceError("unknown template " + name); - - if (nodes === true) { - keepExpression = true; - nodes = null; - } - - ast = _lodashLangCloneDeep2["default"](ast); - - if (!_lodashLangIsEmpty2["default"](nodes)) { - _traversal2["default"](ast, templateVisitor, null, nodes); - } - - if (ast.body.length > 1) return ast.body; - - var node = ast.body[0]; - - if (!keepExpression && t.isExpressionStatement(node)) { - return node.expression; - } else { - return node; - } -} - -/** - * Parse a template. - */ - -function parseTemplate(loc, code) { - var ast = _helpersParse2["default"](code, { filename: loc, looseModules: true }).program; - ast = _traversal2["default"].removeProperties(ast); - return ast; -} - -/** - * Load templates from transformation/templates directory. - */ - -function loadTemplates() { - var templates = {}; - - var templatesLoc = _path2["default"].join(__dirname, "transformation/templates"); - if (!_pathExists2["default"].sync(templatesLoc)) { - throw new ReferenceError(messages.get("missingTemplatesDirectory")); - } - - var _arr3 = _fs2["default"].readdirSync(templatesLoc); - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var name = _arr3[_i3]; - if (name[0] === ".") return; - - var key = _path2["default"].basename(name, _path2["default"].extname(name)); - var loc = _path2["default"].join(templatesLoc, name); - var code = _fs2["default"].readFileSync(loc, "utf8"); - - templates[key] = parseTemplate(loc, code); - } - - return templates; -} - -try { - exports.templates = _dereq_(612); -} catch (err) { - if (err.code !== "MODULE_NOT_FOUND") throw err; - exports.templates = loadTemplates(); -} -}).call(this,"/lib") -},{"1":1,"13":13,"148":148,"179":179,"418":418,"42":42,"43":43,"503":503,"506":506,"507":507,"513":513,"514":514,"520":520,"526":526,"527":527,"530":530,"534":534,"596":596,"612":612,"9":9}],183:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("constant-folding", { - metadata: { - group: "builtin-prepass", - experimental: true - }, - - visitor: { - AssignmentExpression: function AssignmentExpression() { - var left = this.get("left"); - if (!left.isIdentifier()) return; - - var binding = this.scope.getBinding(left.node.name); - if (!binding || binding.hasDeoptValue) return; - - var evaluated = this.get("right").evaluate(); - if (evaluated.confident) { - binding.setValue(evaluated.value); - } else { - binding.deoptValue(); - } - }, - - IfStatement: function IfStatement() { - var evaluated = this.get("test").evaluate(); - if (!evaluated.confident) { - // todo: deopt binding values for constant violations inside - return this.skip(); - } - - if (evaluated.value) { - this.skipKey("alternate"); - } else { - this.skipKey("consequent"); - } - }, - - Scopable: { - enter: function enter() { - var funcScope = this.scope.getFunctionParent(); - - for (var name in this.scope.bindings) { - var binding = this.scope.bindings[name]; - var deopt = false; - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = binding.constantViolations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var path = _step.value; - - var funcViolationScope = path.scope.getFunctionParent(); - if (funcViolationScope !== funcScope) { - deopt = true; - break; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator["return"]) { - _iterator["return"](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - if (deopt) binding.deoptValue(); - } - }, - - exit: function exit() { - for (var name in this.scope.bindings) { - var binding = this.scope.bindings[name]; - binding.clearValue(); - } - } - }, - - Expression: { - exit: function exit() { - var res = this.evaluate(); - if (res.confident) return t.valueToNode(res.value); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],184:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - function toStatements(node) { - if (t.isBlockStatement(node)) { - var hasBlockScoped = false; - - for (var i = 0; i < node.body.length; i++) { - var bodyNode = node.body[i]; - if (t.isBlockScoped(bodyNode)) hasBlockScoped = true; - } - - if (!hasBlockScoped) { - return node.body; - } - } - - return node; - } - - var visitor = { - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope) { - var binding = scope.getBinding(node.name); - if (!binding || binding.references > 1 || !binding.constant) return; - if (binding.kind === "param" || binding.kind === "module") return; - - var replacement = binding.path.node; - if (t.isVariableDeclarator(replacement)) { - replacement = replacement.init; - } - if (!replacement) return; - - // ensure it's a "pure" type - if (!scope.isPure(replacement, true)) return; - - if (t.isClass(replacement) || t.isFunction(replacement)) { - // don't change this if it's in a different scope, this can be bad - // for performance since it may be inside a loop or deeply nested in - // hot code - if (binding.path.scope.parent !== scope) return; - } - - if (this.findParent(function (path) { - return path.node === replacement; - })) { - return; - } - - t.toExpression(replacement); - scope.removeBinding(node.name); - binding.path.dangerouslyRemove(); - return replacement; - }, - - "ClassDeclaration|FunctionDeclaration": function ClassDeclarationFunctionDeclaration(node, parent, scope) { - var binding = scope.getBinding(node.id.name); - if (binding && !binding.referenced) { - this.dangerouslyRemove(); - } - }, - - VariableDeclarator: function VariableDeclarator(node, parent, scope) { - if (!t.isIdentifier(node.id) || !scope.isPure(node.init, true)) return; - visitor["ClassDeclaration|FunctionDeclaration"].apply(this, arguments); - }, - - ConditionalExpression: function ConditionalExpression(node) { - var evaluateTest = this.get("test").evaluateTruthy(); - if (evaluateTest === true) { - return node.consequent; - } else if (evaluateTest === false) { - return node.alternate; - } - }, - - BlockStatement: function BlockStatement() { - var paths = this.get("body"); - - var purge = false; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - - if (!purge && path.isCompletionStatement()) { - purge = true; - continue; - } - - if (purge && !path.isFunctionDeclaration()) { - path.dangerouslyRemove(); - } - } - }, - - IfStatement: { - exit: function exit(node) { - var consequent = node.consequent; - var alternate = node.alternate; - var test = node.test; - - var evaluateTest = this.get("test").evaluateTruthy(); - - // we can check if a test will be truthy 100% and if so then we can inline - // the consequent and completely ignore the alternate - // - // if (true) { foo; } -> { foo; } - // if ("foo") { foo; } -> { foo; } - // - - if (evaluateTest === true) { - return toStatements(consequent); - } - - // we can check if a test will be falsy 100% and if so we can inline the - // alternate if there is one and completely remove the consequent - // - // if ("") { bar; } else { foo; } -> { foo; } - // if ("") { bar; } -> - // - - if (evaluateTest === false) { - if (alternate) { - return toStatements(alternate); - } else { - return this.dangerouslyRemove(); - } - } - - // remove alternate blocks that are empty - // - // if (foo) { foo; } else {} -> if (foo) { foo; } - // - - if (t.isBlockStatement(alternate) && !alternate.body.length) { - alternate = node.alternate = null; - } - - // if the consequent block is empty turn alternate blocks into a consequent - // and flip the test - // - // if (foo) {} else { bar; } -> if (!foo) { bar; } - // - - if (t.isBlockStatement(consequent) && !consequent.body.length && t.isBlockStatement(alternate) && alternate.body.length) { - node.consequent = node.alternate; - node.alternate = null; - node.test = t.unaryExpression("!", test, true); - } - } - } - }; - - return new Plugin("dead-code-elimination", { - metadata: { - group: "builtin-pre", - experimental: true - }, - - visitor: visitor - }); -}; - -module.exports = exports["default"]; -},{}],185:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var parse = _ref.parse; - var traverse = _ref.traverse; - - return new Plugin("eval", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - CallExpression: function CallExpression(node) { - if (this.get("callee").isIdentifier({ name: "eval" }) && node.arguments.length === 1) { - var evaluate = this.get("arguments")[0].evaluate(); - if (!evaluate.confident) return; - - var code = evaluate.value; - if (typeof code !== "string") return; - - var ast = parse(code); - traverse.removeProperties(ast); - return ast.program; - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],186:[function(_dereq_,module,exports){ -(function (process){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("inline-environment-variables", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - MemberExpression: function MemberExpression(node) { - if (this.get("object").matchesPattern("process.env")) { - var key = this.toComputedKey(); - if (t.isLiteral(key)) { - return t.valueToNode(process.env[key.value]); - } - } - } - } - }); -}; - -module.exports = exports["default"]; -}).call(this,_dereq_(10)) -},{"10":10}],187:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("jscript", { - metadata: { - group: "builtin-trailing" - }, - - visitor: { - FunctionExpression: { - exit: function exit(node) { - if (!node.id) return; - node._ignoreUserWhitespace = true; - - return t.callExpression(t.functionExpression(null, [], t.blockStatement([t.toStatement(node), t.returnStatement(node.id)])), []); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],188:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("member-expression-literals", { - metadata: { - group: "builtin-trailing" - }, - - visitor: { - MemberExpression: { - exit: function exit(node) { - var prop = node.property; - if (node.computed && t.isLiteral(prop) && t.isValidIdentifier(prop.value)) { - // foo["bar"] => foo.bar - node.property = t.identifier(prop.value); - node.computed = false; - } - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],189:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("property-literals", { - metadata: { - group: "builtin-trailing" - }, - - visitor: { - Property: { - exit: function exit(node) { - var key = node.key; - if (t.isLiteral(key) && t.isValidIdentifier(key.value)) { - // "foo": "bar" -> foo: "bar" - node.key = t.identifier(key.value); - node.computed = false; - } - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],190:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _lodashArrayPull = _dereq_(416); - -var _lodashArrayPull2 = _interopRequireDefault(_lodashArrayPull); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - function isProtoKey(node) { - return t.isLiteral(t.toComputedKey(node, node.key), { value: "__proto__" }); - } - - function isProtoAssignmentExpression(node) { - var left = node.left; - return t.isMemberExpression(left) && t.isLiteral(t.toComputedKey(left, left.property), { value: "__proto__" }); - } - - function buildDefaultsCallExpression(expr, ref, file) { - return t.expressionStatement(t.callExpression(file.addHelper("defaults"), [ref, expr.right])); - } - - return new Plugin("proto-to-assign", { - metadata: { - secondPass: true - }, - - visitor: { - AssignmentExpression: function AssignmentExpression(node, parent, scope, file) { - if (!isProtoAssignmentExpression(node)) return; - - var nodes = []; - var left = node.left.object; - var temp = scope.maybeGenerateMemoised(left); - - if (temp) nodes.push(t.expressionStatement(t.assignmentExpression("=", temp, left))); - nodes.push(buildDefaultsCallExpression(node, temp || left, file)); - if (temp) nodes.push(temp); - - return nodes; - }, - - ExpressionStatement: function ExpressionStatement(node, parent, scope, file) { - var expr = node.expression; - if (!t.isAssignmentExpression(expr, { operator: "=" })) return; - - if (isProtoAssignmentExpression(expr)) { - return buildDefaultsCallExpression(expr, expr.left.object, file); - } - }, - - ObjectExpression: function ObjectExpression(node, parent, scope, file) { - var proto; - - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - - if (isProtoKey(prop)) { - proto = prop.value; - (0, _lodashArrayPull2["default"])(node.properties, prop); - } - } - - if (proto) { - var args = [t.objectExpression([]), proto]; - if (node.properties.length) args.push(node); - return t.callExpression(file.addHelper("extends"), args); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{"416":416}],191:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - - var immutabilityVisitor = { - enter: function enter(node, parent, scope, state) { - var _this = this; - - var stop = function stop() { - state.isImmutable = false; - _this.stop(); - }; - - if (this.isJSXClosingElement()) { - this.skip(); - return; - } - - if (this.isJSXIdentifier({ name: "ref" }) && this.parentPath.isJSXAttribute({ name: node })) { - return stop(); - } - - if (this.isJSXIdentifier() || this.isIdentifier() || this.isJSXMemberExpression()) { - return; - } - - if (!this.isImmutable()) stop(); - } - }; - - return new Plugin("react-constant-elements", { - metadata: { - group: "builtin-basic" - }, - - visitor: { - JSXElement: function JSXElement(node) { - if (node._hoisted) return; - - var state = { isImmutable: true }; - this.traverse(immutabilityVisitor, state); - - if (state.isImmutable) { - this.hoist(); - } else { - node._hoisted = true; - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],192:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - function addDisplayName(id, call) { - var props = call.arguments[0].properties; - var safe = true; - - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - var key = t.toComputedKey(prop); - if (t.isLiteral(key, { value: "displayName" })) { - safe = false; - break; - } - } - - if (safe) { - props.unshift(t.property("init", t.identifier("displayName"), t.literal(id))); - } - } - - var isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass"); - - function isCreateClass(node) { - if (!node || !t.isCallExpression(node)) return false; - - // not React.createClass call member object - if (!isCreateClassCallExpression(node.callee)) return false; - - // no call arguments - var args = node.arguments; - if (args.length !== 1) return false; - - // first node arg is not an object - var first = args[0]; - if (!t.isObjectExpression(first)) return false; - - return true; - } - - return new Plugin("react-display-name", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - ExportDefaultDeclaration: function ExportDefaultDeclaration(node, parent, scope, file) { - if (isCreateClass(node.declaration)) { - addDisplayName(file.opts.basename, node.declaration); - } - }, - - "AssignmentExpression|Property|VariableDeclarator": function AssignmentExpressionPropertyVariableDeclarator(node) { - var left, right; - - if (t.isAssignmentExpression(node)) { - left = node.left; - right = node.right; - } else if (t.isProperty(node)) { - left = node.key; - right = node.value; - } else if (t.isVariableDeclarator(node)) { - left = node.id; - right = node.init; - } - - if (t.isMemberExpression(left)) { - left = left.property; - } - - if (t.isIdentifier(left) && isCreateClass(right)) { - addDisplayName(left.name, right); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],193:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("remove-console", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - CallExpression: function CallExpression() { - if (this.get("callee").matchesPattern("console", true)) { - this.dangerouslyRemove(); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],194:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("remove-debugger", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - DebuggerStatement: function DebuggerStatement() { - this.dangerouslyRemove(); - } - } - }); -}; - -module.exports = exports["default"]; -},{}],195:[function(_dereq_,module,exports){ -module.exports={ - "builtins": { - "Symbol": "symbol", - "Promise": "promise", - "Map": "map", - "WeakMap": "weak-map", - "Set": "set", - "WeakSet": "weak-set" - }, - - "methods": { - "Array": { - "concat": "array/concat", - "copyWithin": "array/copy-within", - "entries": "array/entries", - "every": "array/every", - "fill": "array/fill", - "filter": "array/filter", - "findIndex": "array/find-index", - "find": "array/find", - "forEach": "array/for-each", - "from": "array/from", - "includes": "array/includes", - "indexOf": "array/index-of", - "join": "array/join", - "keys": "array/keys", - "lastIndexOf": "array/last-index-of", - "map": "array/map", - "of": "array/of", - "pop": "array/pop", - "push": "array/push", - "reduceRight": "array/reduce-right", - "reduce": "array/reduce", - "reverse": "array/reverse", - "shift": "array/shift", - "slice": "array/slice", - "some": "array/some", - "sort": "array/sort", - "splice": "array/splice", - "turn": "array/turn", - "unshift": "array/unshift", - "values": "array/values" - }, - - "Object": { - "assign": "object/assign", - "classof": "object/classof", - "create": "object/create", - "define": "object/define", - "defineProperties": "object/define-properties", - "defineProperty": "object/define-property", - "entries": "object/entries", - "freeze": "object/freeze", - "getOwnPropertyDescriptor": "object/get-own-property-descriptor", - "getOwnPropertyDescriptors": "object/get-own-property-descriptors", - "getOwnPropertyNames": "object/get-own-property-names", - "getOwnPropertySymbols": "object/get-own-property-symbols", - "getPrototypePf": "object/get-prototype-of", - "index": "object/index", - "isExtensible": "object/is-extensible", - "isFrozen": "object/is-frozen", - "isObject": "object/is-object", - "isSealed": "object/is-sealed", - "is": "object/is", - "keys": "object/keys", - "make": "object/make", - "preventExtensions": "object/prevent-extensions", - "seal": "object/seal", - "setPrototypeOf": "object/set-prototype-of", - "values": "object/values" - }, - - "RegExp": { - "escape": "regexp/escape" - }, - - "Function": { - "only": "function/only", - "part": "function/part" - }, - - "Math": { - "acosh": "math/acosh", - "asinh": "math/asinh", - "atanh": "math/atanh", - "cbrt": "math/cbrt", - "clz32": "math/clz32", - "cosh": "math/cosh", - "expm1": "math/expm1", - "fround": "math/fround", - "hypot": "math/hypot", - "pot": "math/pot", - "imul": "math/imul", - "log10": "math/log10", - "log1p": "math/log1p", - "log2": "math/log2", - "sign": "math/sign", - "sinh": "math/sinh", - "tanh": "math/tanh", - "trunc": "math/trunc" - }, - - "Date": { - "addLocale": "date/add-locale", - "formatUTC": "date/format-utc", - "format": "date/format" - }, - - "Symbol": { - "for": "symbol/for", - "hasInstance": "symbol/has-instance", - "is-concat-spreadable": "symbol/is-concat-spreadable", - "iterator": "symbol/iterator", - "keyFor": "symbol/key-for", - "match": "symbol/match", - "replace": "symbol/replace", - "search": "symbol/search", - "species": "symbol/species", - "split": "symbol/split", - "toPrimitive": "symbol/to-primitive", - "toStringTag": "symbol/to-string-tag", - "unscopables": "symbol/unscopables" - }, - - "String": { - "at": "string/at", - "codePointAt": "string/code-point-at", - "endsWith": "string/ends-with", - "escapeHTML": "string/escape-html", - "fromCodePoint": "string/from-code-point", - "includes": "string/includes", - "raw": "string/raw", - "repeat": "string/repeat", - "startsWith": "string/starts-with", - "unescapeHTML": "string/unescape-html" - }, - - "Number": { - "EPSILON": "number/epsilon", - "isFinite": "number/is-finite", - "isInteger": "number/is-integer", - "isNaN": "number/is-nan", - "isSafeInteger": "number/is-safe-integer", - "MAX_SAFE_INTEGER": "number/max-safe-integer", - "MIN_SAFE_INTEGER": "number/min-safe-integer", - "parseFloat": "number/parse-float", - "parseInt": "number/parse-int", - "random": "number/random" - }, - - "Reflect": { - "apply": "reflect/apply", - "construct": "reflect/construct", - "defineProperty": "reflect/define-property", - "deleteProperty": "reflect/delete-property", - "enumerate": "reflect/enumerate", - "getOwnPropertyDescriptor": "reflect/get-own-property-descriptor", - "getPrototypeOf": "reflect/get-prototype-of", - "get": "reflect/get", - "has": "reflect/has", - "isExtensible": "reflect/is-extensible", - "ownKeys": "reflect/own-keys", - "preventExtensions": "reflect/prevent-extensions", - "setPrototypeOf": "reflect/set-prototype-of", - "set": "reflect/set" - } - } -} - -},{}],196:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _definitions = _dereq_(195); - -var _definitions2 = _interopRequireDefault(_definitions); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - var RUNTIME_MODULE_NAME = "babel-runtime"; - - function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); - } - - return new Plugin("runtime", { - metadata: { - group: "builtin-post-modules" - }, - - pre: function pre(file) { - file.set("helperGenerator", function (name) { - return file.addImport(RUNTIME_MODULE_NAME + "/helpers/" + name, name, "absoluteDefault"); - }); - - file.setDynamic("regeneratorIdentifier", function () { - return file.addImport(RUNTIME_MODULE_NAME + "/regenerator", "regeneratorRuntime", "absoluteDefault"); - }); - }, - - visitor: { - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope, file) { - if (node.name === "regeneratorRuntime") { - return file.get("regeneratorIdentifier"); - } - - if (t.isMemberExpression(parent)) return; - if (!has(_definitions2["default"].builtins, node.name)) return; - if (scope.getBindingIdentifier(node.name)) return; - - // Symbol() -> _core.Symbol(); new Promise -> new _core.Promise - var modulePath = _definitions2["default"].builtins[node.name]; - return file.addImport(RUNTIME_MODULE_NAME + "/core-js/" + modulePath, node.name, "absoluteDefault"); - }, - - CallExpression: function CallExpression(node, parent, scope, file) { - // arr[Symbol.iterator]() -> _core.$for.getIterator(arr) - - if (node.arguments.length) return; - - var callee = node.callee; - if (!t.isMemberExpression(callee)) return; - if (!callee.computed) return; - if (!this.get("callee.property").matchesPattern("Symbol.iterator")) return; - - return t.callExpression(file.addImport(RUNTIME_MODULE_NAME + "/core-js/get-iterator", "getIterator", "absoluteDefault"), [callee.object]); - }, - - BinaryExpression: function BinaryExpression(node, parent, scope, file) { - // Symbol.iterator in arr -> core.$for.isIterable(arr) - - if (node.operator !== "in") return; - if (!this.get("left").matchesPattern("Symbol.iterator")) return; - - return t.callExpression(file.addImport(RUNTIME_MODULE_NAME + "/core-js/is-iterable", "isIterable", "absoluteDefault"), [node.right]); - }, - - MemberExpression: { - enter: function enter(node, parent, scope, file) { - // Array.from -> _core.Array.from - - if (!this.isReferenced()) return; - - var obj = node.object; - var prop = node.property; - - if (!t.isReferenced(obj, node)) return; - - if (node.computed) return; - - if (!has(_definitions2["default"].methods, obj.name)) return; - - var methods = _definitions2["default"].methods[obj.name]; - if (!has(methods, prop.name)) return; - - // doesn't reference the global - if (scope.getBindingIdentifier(obj.name)) return; - - // special case Object.defineProperty to not use core-js when using string keys - if (obj.name === "Object" && prop.name === "defineProperty" && this.parentPath.isCallExpression()) { - var call = this.parentPath.node; - if (call.arguments.length === 3 && t.isLiteral(call.arguments[1])) return; - } - - var modulePath = methods[prop.name]; - return file.addImport(RUNTIME_MODULE_NAME + "/core-js/" + modulePath, obj.name + "$" + prop.name, "absoluteDefault"); - }, - - exit: function exit(node, parent, scope, file) { - if (!this.isReferenced()) return; - - var prop = node.property; - var obj = node.object; - - if (!has(_definitions2["default"].builtins, obj.name)) return; - if (scope.getBindingIdentifier(obj.name)) return; - - var modulePath = _definitions2["default"].builtins[obj.name]; - return t.memberExpression(file.addImport(RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name, "absoluteDefault"), prop); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{"195":195}],197:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _leven = _dereq_(198); - -var _leven2 = _interopRequireDefault(_leven); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - var messages = _ref.messages; - - return new Plugin("undeclared-variables-check", { - metadata: { - group: "builtin-pre" - }, - - visitor: { - ReferencedIdentifier: function ReferencedIdentifier(node, parent, scope) { - var binding = scope.getBinding(node.name); - if (binding && binding.kind === "type" && !this.parentPath.isFlow()) { - throw this.errorWithNode(messages.get("undeclaredVariableType", node.name), ReferenceError); - } - - if (scope.hasBinding(node.name)) return; - - // get the closest declaration to offer as a suggestion - // the variable name may have just been mistyped - - var bindings = scope.getAllBindings(); - - var closest; - var shortest = -1; - - for (var name in bindings) { - var distance = (0, _leven2["default"])(node.name, name); - if (distance <= 0 || distance > 3) continue; - if (distance <= shortest) continue; - - closest = name; - shortest = distance; - } - - var msg; - if (closest) { - msg = messages.get("undeclaredVariableSuggestion", node.name, closest); - } else { - msg = messages.get("undeclaredVariable", node.name); - } - - // - - throw this.errorWithNode(msg, ReferenceError); - } - } - }); -}; - -module.exports = exports["default"]; -},{"198":198}],198:[function(_dereq_,module,exports){ -'use strict'; -var arr = []; -var charCodeCache = []; - -module.exports = function (a, b) { - if (a === b) { - return 0; - } - - var aLen = a.length; - var bLen = b.length; - - if (aLen === 0) { - return bLen; - } - - if (bLen === 0) { - return aLen; - } - - var bCharCode; - var ret; - var tmp; - var tmp2; - var i = 0; - var j = 0; - - while (i < aLen) { - charCodeCache[i] = a.charCodeAt(i); - arr[i] = ++i; - } - - while (j < bLen) { - bCharCode = b.charCodeAt(j); - tmp = j++; - ret = j; - - for (i = 0; i < aLen; i++) { - tmp2 = bCharCode === charCodeCache[i] ? tmp : tmp + 1; - tmp = arr[i]; - ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2; - } - } - - return ret; -}; - -},{}],199:[function(_dereq_,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports["default"] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - - return new Plugin("undefined-to-void", { - metadata: { - group: "builtin-basic" - }, - - visitor: { - ReferencedIdentifier: function ReferencedIdentifier(node, parent) { - if (node.name === "undefined") { - return t.unaryExpression("void", t.literal(0), true); - } - } - } - }); -}; - -module.exports = exports["default"]; -},{}],200:[function(_dereq_,module,exports){ -(function (process){ -'use strict'; -var escapeStringRegexp = _dereq_(202); -var ansiStyles = _dereq_(201); -var stripAnsi = _dereq_(205); -var hasAnsi = _dereq_(203); -var supportsColor = _dereq_(207); -var defineProps = Object.defineProperties; -var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM); - -function Chalk(options) { - // detect mode if not set manually - this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; -} - -// use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001b[94m'; -} - -var styles = (function () { - var ret = {}; - - Object.keys(ansiStyles).forEach(function (key) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - ret[key] = { - get: function () { - return build.call(this, this._styles.concat(key)); - } - }; + Object.defineProperty(exports, "__esModule", { + value: true }); + exports.version = exports.buildExternalHelpers = exports.availablePresets = exports.availablePlugins = undefined; - return ret; -})(); + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; -var proto = defineProps(function chalk() {}, styles); + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -function build(_styles) { - var builder = function () { - return applyStyle.apply(builder, arguments); + exports.transform = transform; + exports.transformFromAst = transformFromAst; + exports.registerPlugin = registerPlugin; + exports.registerPlugins = registerPlugins; + exports.registerPreset = registerPreset; + exports.registerPresets = registerPresets; + exports.transformScriptTags = transformScriptTags; + exports.disableScriptTags = disableScriptTags; + + var _babelCore = __webpack_require__(286); + + var Babel = _interopRequireWildcard(_babelCore); + + var _transformScriptTags = __webpack_require__(620); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + var isArray = Array.isArray || function (arg) { + return Object.prototype.toString.call(arg) === '[object Array]'; }; - builder._styles = _styles; - builder.enabled = this.enabled; - // __proto__ is used because we must return a function, but there is - // no way to create a function with a different prototype. - /* eslint-disable no-proto */ - builder.__proto__ = proto; - - return builder; -} - -function applyStyle() { - // support varags, but simply cast to string in case there's only one arg - var args = arguments; - var argsLen = args.length; - var str = argsLen !== 0 && String(arguments[0]); - - if (argsLen > 1) { - // don't slice `arguments`, it prevents v8 optimizations - for (var a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } + /** + * Loads the given name (or [name, options] pair) from the given table object + * holding the available presets or plugins. + * + * Returns undefined if the preset or plugin is not available; passes through + * name unmodified if it (or the first element of the pair) is not a string. + */ + function loadBuiltin(builtinTable, name) { + if (isArray(name) && typeof name[0] === 'string') { + if (builtinTable.hasOwnProperty(name[0])) { + return [builtinTable[name[0]]].concat(name.slice(1)); + } + return; + } else if (typeof name === 'string') { + return builtinTable[name]; + } + // Could be an actual preset/plugin module + return name; } - if (!this.enabled || !str) { - return str; + /** + * Parses plugin names and presets from the specified options. + */ + function processOptions(options) { + // Parse preset names + var presets = (options.presets || []).map(function (presetName) { + var preset = loadBuiltin(availablePresets, presetName); + + if (preset) { + // workaround for babel issue + // at some point, babel copies the preset, losing the non-enumerable + // buildPreset key; convert it into an enumerable key. + if (isArray(preset) && _typeof(preset[0]) === 'object' && preset[0].hasOwnProperty('buildPreset')) { + preset[0] = _extends({}, preset[0], { buildPreset: preset[0].buildPreset }); + } + } else { + throw new Error('Invalid preset specified in Babel options: "' + presetName + '"'); + } + return preset; + }); + + // Parse plugin names + var plugins = (options.plugins || []).map(function (pluginName) { + var plugin = loadBuiltin(availablePlugins, pluginName); + + if (!plugin) { + throw new Error('Invalid plugin specified in Babel options: "' + pluginName + '"'); + } + return plugin; + }); + + return _extends({ + babelrc: false + }, options, { + presets: presets, + plugins: plugins + }); } - var nestedStyles = this._styles; - var i = nestedStyles.length; - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - var originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { - ansiStyles.dim.open = ''; + function transform(code, options) { + return Babel.transform(code, processOptions(options)); } - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; + function transformFromAst(ast, code, options) { + return Babel.transformFromAst(ast, code, processOptions(options)); + } + var availablePlugins = exports.availablePlugins = {}; + var availablePresets = exports.availablePresets = {}; + var buildExternalHelpers = exports.buildExternalHelpers = Babel.buildExternalHelpers; + /** + * Registers a named plugin for use with Babel. + */ + function registerPlugin(name, plugin) { + if (availablePlugins.hasOwnProperty(name)) { + console.warn('A plugin named "' + name + '" is already registered, it will be overridden'); + } + availablePlugins[name] = plugin; + } + /** + * Registers multiple plugins for use with Babel. `newPlugins` should be an object where the key + * is the name of the plugin, and the value is the plugin itself. + */ + function registerPlugins(newPlugins) { + Object.keys(newPlugins).forEach(function (name) { + return registerPlugin(name, newPlugins[name]); + }); } - // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. - ansiStyles.dim.open = originalDim; + /** + * Registers a named preset for use with Babel. + */ + function registerPreset(name, preset) { + if (availablePresets.hasOwnProperty(name)) { + console.warn('A preset named "' + name + '" is already registered, it will be overridden'); + } + availablePresets[name] = preset; + } + /** + * Registers multiple presets for use with Babel. `newPresets` should be an object where the key + * is the name of the preset, and the value is the preset itself. + */ + function registerPresets(newPresets) { + Object.keys(newPresets).forEach(function (name) { + return registerPreset(name, newPresets[name]); + }); + } - return str; -} - -function init() { - var ret = {}; - - Object.keys(styles).forEach(function (name) { - ret[name] = { - get: function () { - return build.call(this, [name]); - } - }; + // All the plugins we should bundle + registerPlugins({ + 'check-es2015-constants': __webpack_require__(64), + 'external-helpers': __webpack_require__(318), + 'inline-replace-variables': __webpack_require__(319), + 'syntax-async-functions': __webpack_require__(65), + 'syntax-async-generators': __webpack_require__(191), + 'syntax-class-constructor-call': __webpack_require__(192), + 'syntax-class-properties': __webpack_require__(193), + 'syntax-decorators': __webpack_require__(124), + 'syntax-do-expressions': __webpack_require__(194), + 'syntax-exponentiation-operator': __webpack_require__(195), + 'syntax-export-extensions': __webpack_require__(196), + 'syntax-flow': __webpack_require__(125), + 'syntax-function-bind': __webpack_require__(197), + 'syntax-function-sent': __webpack_require__(321), + 'syntax-jsx': __webpack_require__(126), + 'syntax-object-rest-spread': __webpack_require__(198), + 'syntax-trailing-function-commas': __webpack_require__(127), + 'transform-async-functions': __webpack_require__(322), + 'transform-async-to-generator': __webpack_require__(128), + 'transform-async-to-module-method': __webpack_require__(324), + 'transform-class-constructor-call': __webpack_require__(199), + 'transform-class-properties': __webpack_require__(200), + 'transform-decorators': __webpack_require__(201), + 'transform-decorators-legacy': __webpack_require__(325).default, // <- No clue. Nope. + 'transform-do-expressions': __webpack_require__(202), + 'transform-es2015-arrow-functions': __webpack_require__(66), + 'transform-es2015-block-scoped-functions': __webpack_require__(67), + 'transform-es2015-block-scoping': __webpack_require__(68), + 'transform-es2015-classes': __webpack_require__(69), + 'transform-es2015-computed-properties': __webpack_require__(70), + 'transform-es2015-destructuring': __webpack_require__(71), + 'transform-es2015-duplicate-keys': __webpack_require__(129), + 'transform-es2015-for-of': __webpack_require__(72), + 'transform-es2015-function-name': __webpack_require__(73), + 'transform-es2015-instanceof': __webpack_require__(328), + 'transform-es2015-literals': __webpack_require__(74), + 'transform-es2015-modules-amd': __webpack_require__(130), + 'transform-es2015-modules-commonjs': __webpack_require__(75), + 'transform-es2015-modules-systemjs': __webpack_require__(204), + 'transform-es2015-modules-umd': __webpack_require__(205), + 'transform-es2015-object-super': __webpack_require__(76), + 'transform-es2015-parameters': __webpack_require__(77), + 'transform-es2015-shorthand-properties': __webpack_require__(78), + 'transform-es2015-spread': __webpack_require__(79), + 'transform-es2015-sticky-regex': __webpack_require__(80), + 'transform-es2015-template-literals': __webpack_require__(81), + 'transform-es2015-typeof-symbol': __webpack_require__(82), + 'transform-es2015-unicode-regex': __webpack_require__(83), + 'transform-es3-member-expression-literals': __webpack_require__(332), + 'transform-es3-property-literals': __webpack_require__(333), + 'transform-es5-property-mutators': __webpack_require__(334), + 'transform-eval': __webpack_require__(335), + 'transform-exponentiation-operator': __webpack_require__(131), + 'transform-export-extensions': __webpack_require__(206), + 'transform-flow-comments': __webpack_require__(336), + 'transform-flow-strip-types': __webpack_require__(207), + 'transform-function-bind': __webpack_require__(208), + 'transform-jscript': __webpack_require__(337), + 'transform-object-assign': __webpack_require__(338), + 'transform-object-rest-spread': __webpack_require__(209), + 'transform-object-set-prototype-of-to-assign': __webpack_require__(339), + 'transform-proto-to-assign': __webpack_require__(340), + 'transform-react-constant-elements': __webpack_require__(341), + 'transform-react-display-name': __webpack_require__(210), + 'transform-react-inline-elements': __webpack_require__(342), + 'transform-react-jsx': __webpack_require__(211), + 'transform-react-jsx-compat': __webpack_require__(343), + 'transform-react-jsx-self': __webpack_require__(345), + 'transform-react-jsx-source': __webpack_require__(346), + 'transform-regenerator': __webpack_require__(84), + 'transform-runtime': __webpack_require__(349), + 'transform-strict-mode': __webpack_require__(212), + 'undeclared-variables-check': __webpack_require__(350) }); - return ret; -} + // All the presets we should bundle + registerPresets({ + es2015: __webpack_require__(213), + es2016: __webpack_require__(214), + es2017: __webpack_require__(215), + latest: __webpack_require__(352), + react: __webpack_require__(353), + 'stage-0': __webpack_require__(354), + 'stage-1': __webpack_require__(216), + 'stage-2': __webpack_require__(217), + 'stage-3': __webpack_require__(218), -defineProps(Chalk.prototype, init()); + // ES2015 preset with es2015-modules-commonjs removed + // Plugin list copied from babel-preset-es2015/index.js + 'es2015-no-commonjs': { + plugins: [__webpack_require__(81), __webpack_require__(74), __webpack_require__(73), __webpack_require__(66), __webpack_require__(67), __webpack_require__(69), __webpack_require__(76), __webpack_require__(78), __webpack_require__(70), __webpack_require__(72), __webpack_require__(80), __webpack_require__(83), __webpack_require__(64), __webpack_require__(79), __webpack_require__(77), __webpack_require__(71), __webpack_require__(68), __webpack_require__(82), [__webpack_require__(84), { async: false, asyncGenerators: false }]] + }, -module.exports = new Chalk(); -module.exports.styles = ansiStyles; -module.exports.hasColor = hasAnsi; -module.exports.stripColor = stripAnsi; -module.exports.supportsColor = supportsColor; + // ES2015 preset with plugins set to loose mode. + // Based off https://github.com/bkonkle/babel-preset-es2015-loose/blob/master/index.js + 'es2015-loose': { + plugins: [[__webpack_require__(81), { loose: true }], __webpack_require__(74), __webpack_require__(73), __webpack_require__(66), __webpack_require__(67), [__webpack_require__(69), { loose: true }], __webpack_require__(76), __webpack_require__(78), __webpack_require__(129), [__webpack_require__(70), { loose: true }], [__webpack_require__(72), { loose: true }], __webpack_require__(80), __webpack_require__(83), __webpack_require__(64), [__webpack_require__(79), { loose: true }], __webpack_require__(77), [__webpack_require__(71), { loose: true }], __webpack_require__(68), __webpack_require__(82), [__webpack_require__(75), { loose: true }], [__webpack_require__(84), { async: false, asyncGenerators: false }]] + } + }); -}).call(this,_dereq_(10)) -},{"10":10,"201":201,"202":202,"203":203,"205":205,"207":207}],201:[function(_dereq_,module,exports){ -'use strict'; + var version = exports.version = ("6.25.0"); -function assembleStyles () { - var styles = { - modifiers: { - reset: [0, 0], - bold: [1, 22], // 21 isn't widely supported and 22 does the same thing - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - colors: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39] - }, - bgColors: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49] - } + // Listen for load event if we're in a browser and then kick off finding and + // running of scripts with "text/babel" type. + if (typeof window !== 'undefined' && window && window.addEventListener) { + window.addEventListener('DOMContentLoaded', function () { + return transformScriptTags(); + }, false); + } + + /** + * Transform <script> tags with "text/babel" type. + * @param {Array} scriptTags specify script tags to transform, transform all in the <head> if not given + */ + function transformScriptTags(scriptTags) { + (0, _transformScriptTags.runScripts)(transform, scriptTags); + } + + /** + * Disables automatic transformation of <script> tags with "text/babel" type. + */ + function disableScriptTags() { + window.removeEventListener('DOMContentLoaded', transformScriptTags); + } + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.createTypeAnnotationBasedOnTypeof = exports.removeTypeDuplicates = exports.createUnionTypeAnnotation = exports.valueToNode = exports.toBlock = exports.toExpression = exports.toStatement = exports.toBindingIdentifierName = exports.toIdentifier = exports.toKeyAlias = exports.toSequenceExpression = exports.toComputedKey = exports.isNodesEquivalent = exports.isImmutable = exports.isScope = exports.isSpecifierDefault = exports.isVar = exports.isBlockScoped = exports.isLet = exports.isValidIdentifier = exports.isReferenced = exports.isBinding = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.TYPES = exports.react = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; + + var _getOwnPropertySymbols = __webpack_require__(356); + + var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _constants = __webpack_require__(134); + + Object.defineProperty(exports, "STATEMENT_OR_BLOCK_KEYS", { + enumerable: true, + get: function get() { + return _constants.STATEMENT_OR_BLOCK_KEYS; + } + }); + Object.defineProperty(exports, "FLATTENABLE_KEYS", { + enumerable: true, + get: function get() { + return _constants.FLATTENABLE_KEYS; + } + }); + Object.defineProperty(exports, "FOR_INIT_KEYS", { + enumerable: true, + get: function get() { + return _constants.FOR_INIT_KEYS; + } + }); + Object.defineProperty(exports, "COMMENT_KEYS", { + enumerable: true, + get: function get() { + return _constants.COMMENT_KEYS; + } + }); + Object.defineProperty(exports, "LOGICAL_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.LOGICAL_OPERATORS; + } + }); + Object.defineProperty(exports, "UPDATE_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.UPDATE_OPERATORS; + } + }); + Object.defineProperty(exports, "BOOLEAN_NUMBER_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_NUMBER_BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "EQUALITY_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.EQUALITY_BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "COMPARISON_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.COMPARISON_BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "BOOLEAN_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "NUMBER_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.NUMBER_BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BINARY_OPERATORS; + } + }); + Object.defineProperty(exports, "BOOLEAN_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_UNARY_OPERATORS; + } + }); + Object.defineProperty(exports, "NUMBER_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.NUMBER_UNARY_OPERATORS; + } + }); + Object.defineProperty(exports, "STRING_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.STRING_UNARY_OPERATORS; + } + }); + Object.defineProperty(exports, "UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.UNARY_OPERATORS; + } + }); + Object.defineProperty(exports, "INHERIT_KEYS", { + enumerable: true, + get: function get() { + return _constants.INHERIT_KEYS; + } + }); + Object.defineProperty(exports, "BLOCK_SCOPED_SYMBOL", { + enumerable: true, + get: function get() { + return _constants.BLOCK_SCOPED_SYMBOL; + } + }); + Object.defineProperty(exports, "NOT_LOCAL_BINDING", { + enumerable: true, + get: function get() { + return _constants.NOT_LOCAL_BINDING; + } + }); + exports.is = is; + exports.isType = isType; + exports.validate = validate; + exports.shallowEqual = shallowEqual; + exports.appendToMemberExpression = appendToMemberExpression; + exports.prependToMemberExpression = prependToMemberExpression; + exports.ensureBlock = ensureBlock; + exports.clone = clone; + exports.cloneWithoutLoc = cloneWithoutLoc; + exports.cloneDeep = cloneDeep; + exports.buildMatchMemberExpression = buildMatchMemberExpression; + exports.removeComments = removeComments; + exports.inheritsComments = inheritsComments; + exports.inheritTrailingComments = inheritTrailingComments; + exports.inheritLeadingComments = inheritLeadingComments; + exports.inheritInnerComments = inheritInnerComments; + exports.inherits = inherits; + exports.assertNode = assertNode; + exports.isNode = isNode; + exports.traverseFast = traverseFast; + exports.removeProperties = removeProperties; + exports.removePropertiesDeep = removePropertiesDeep; + + var _retrievers = __webpack_require__(222); + + Object.defineProperty(exports, "getBindingIdentifiers", { + enumerable: true, + get: function get() { + return _retrievers.getBindingIdentifiers; + } + }); + Object.defineProperty(exports, "getOuterBindingIdentifiers", { + enumerable: true, + get: function get() { + return _retrievers.getOuterBindingIdentifiers; + } + }); + + var _validators = __webpack_require__(391); + + Object.defineProperty(exports, "isBinding", { + enumerable: true, + get: function get() { + return _validators.isBinding; + } + }); + Object.defineProperty(exports, "isReferenced", { + enumerable: true, + get: function get() { + return _validators.isReferenced; + } + }); + Object.defineProperty(exports, "isValidIdentifier", { + enumerable: true, + get: function get() { + return _validators.isValidIdentifier; + } + }); + Object.defineProperty(exports, "isLet", { + enumerable: true, + get: function get() { + return _validators.isLet; + } + }); + Object.defineProperty(exports, "isBlockScoped", { + enumerable: true, + get: function get() { + return _validators.isBlockScoped; + } + }); + Object.defineProperty(exports, "isVar", { + enumerable: true, + get: function get() { + return _validators.isVar; + } + }); + Object.defineProperty(exports, "isSpecifierDefault", { + enumerable: true, + get: function get() { + return _validators.isSpecifierDefault; + } + }); + Object.defineProperty(exports, "isScope", { + enumerable: true, + get: function get() { + return _validators.isScope; + } + }); + Object.defineProperty(exports, "isImmutable", { + enumerable: true, + get: function get() { + return _validators.isImmutable; + } + }); + Object.defineProperty(exports, "isNodesEquivalent", { + enumerable: true, + get: function get() { + return _validators.isNodesEquivalent; + } + }); + + var _converters = __webpack_require__(381); + + Object.defineProperty(exports, "toComputedKey", { + enumerable: true, + get: function get() { + return _converters.toComputedKey; + } + }); + Object.defineProperty(exports, "toSequenceExpression", { + enumerable: true, + get: function get() { + return _converters.toSequenceExpression; + } + }); + Object.defineProperty(exports, "toKeyAlias", { + enumerable: true, + get: function get() { + return _converters.toKeyAlias; + } + }); + Object.defineProperty(exports, "toIdentifier", { + enumerable: true, + get: function get() { + return _converters.toIdentifier; + } + }); + Object.defineProperty(exports, "toBindingIdentifierName", { + enumerable: true, + get: function get() { + return _converters.toBindingIdentifierName; + } + }); + Object.defineProperty(exports, "toStatement", { + enumerable: true, + get: function get() { + return _converters.toStatement; + } + }); + Object.defineProperty(exports, "toExpression", { + enumerable: true, + get: function get() { + return _converters.toExpression; + } + }); + Object.defineProperty(exports, "toBlock", { + enumerable: true, + get: function get() { + return _converters.toBlock; + } + }); + Object.defineProperty(exports, "valueToNode", { + enumerable: true, + get: function get() { + return _converters.valueToNode; + } + }); + + var _flow = __webpack_require__(389); + + Object.defineProperty(exports, "createUnionTypeAnnotation", { + enumerable: true, + get: function get() { + return _flow.createUnionTypeAnnotation; + } + }); + Object.defineProperty(exports, "removeTypeDuplicates", { + enumerable: true, + get: function get() { + return _flow.removeTypeDuplicates; + } + }); + Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { + enumerable: true, + get: function get() { + return _flow.createTypeAnnotationBasedOnTypeof; + } + }); + + var _toFastProperties = __webpack_require__(615); + + var _toFastProperties2 = _interopRequireDefault(_toFastProperties); + + var _clone = __webpack_require__(109); + + var _clone2 = _interopRequireDefault(_clone); + + var _uniq = __webpack_require__(591); + + var _uniq2 = _interopRequireDefault(_uniq); + + __webpack_require__(386); + + var _definitions = __webpack_require__(26); + + var _react2 = __webpack_require__(390); + + var _react = _interopRequireWildcard(_react2); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var t = exports; + + function registerType(type) { + var is = t["is" + type]; + if (!is) { + is = t["is" + type] = function (node, opts) { + return t.is(type, node, opts); + }; + } + + t["assert" + type] = function (node, opts) { + opts = opts || {}; + if (!is(node, opts)) { + throw new Error("Expected type " + (0, _stringify2.default)(type) + " with option " + (0, _stringify2.default)(opts)); + } + }; + } + + exports.VISITOR_KEYS = _definitions.VISITOR_KEYS; + exports.ALIAS_KEYS = _definitions.ALIAS_KEYS; + exports.NODE_FIELDS = _definitions.NODE_FIELDS; + exports.BUILDER_KEYS = _definitions.BUILDER_KEYS; + exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS; + exports.react = _react; + + for (var type in t.VISITOR_KEYS) { + registerType(type); + } + + t.FLIPPED_ALIAS_KEYS = {}; + + (0, _keys2.default)(t.ALIAS_KEYS).forEach(function (type) { + t.ALIAS_KEYS[type].forEach(function (alias) { + var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; + types.push(type); + }); + }); + + (0, _keys2.default)(t.FLIPPED_ALIAS_KEYS).forEach(function (type) { + t[type.toUpperCase() + "_TYPES"] = t.FLIPPED_ALIAS_KEYS[type]; + registerType(type); + }); + + var TYPES = exports.TYPES = (0, _keys2.default)(t.VISITOR_KEYS).concat((0, _keys2.default)(t.FLIPPED_ALIAS_KEYS)).concat((0, _keys2.default)(t.DEPRECATED_KEYS)); + + function is(type, node, opts) { + if (!node) return false; + + var matches = isType(node.type, type); + if (!matches) return false; + + if (typeof opts === "undefined") { + return true; + } else { + return t.shallowEqual(node, opts); + } + } + + function isType(nodeType, targetType) { + if (nodeType === targetType) return true; + + if (t.ALIAS_KEYS[targetType]) return false; + + var aliases = t.FLIPPED_ALIAS_KEYS[targetType]; + if (aliases) { + if (aliases[0] === nodeType) return true; + + for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var alias = _ref; + + if (nodeType === alias) return true; + } + } + + return false; + } + + (0, _keys2.default)(t.BUILDER_KEYS).forEach(function (type) { + var keys = t.BUILDER_KEYS[type]; + + function builder() { + if (arguments.length > keys.length) { + throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length)); + } + + var node = {}; + node.type = type; + + var i = 0; + + for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _key = _ref2; + + var field = t.NODE_FIELDS[type][_key]; + + var arg = arguments[i++]; + if (arg === undefined) arg = (0, _clone2.default)(field.default); + + node[_key] = arg; + } + + for (var key in node) { + validate(node, key, node[key]); + } + + return node; + } + + t[type] = builder; + t[type[0].toLowerCase() + type.slice(1)] = builder; + }); + + var _loop = function _loop(_type) { + var newType = t.DEPRECATED_KEYS[_type]; + + function proxy(fn) { + return function () { + console.trace("The node type " + _type + " has been renamed to " + newType); + return fn.apply(this, arguments); + }; + } + + t[_type] = t[_type[0].toLowerCase() + _type.slice(1)] = proxy(t[newType]); + t["is" + _type] = proxy(t["is" + newType]); + t["assert" + _type] = proxy(t["assert" + newType]); }; - // fix humans - styles.colors.grey = styles.colors.gray; + for (var _type in t.DEPRECATED_KEYS) { + _loop(_type); + } - Object.keys(styles).forEach(function (groupName) { - var group = styles[groupName]; + function validate(node, key, val) { + if (!node) return; - Object.keys(group).forEach(function (styleName) { - var style = group[styleName]; + var fields = t.NODE_FIELDS[node.type]; + if (!fields) return; - styles[styleName] = group[styleName] = { - open: '\u001b[' + style[0] + 'm', - close: '\u001b[' + style[1] + 'm' - }; - }); + var field = fields[key]; + if (!field || !field.validate) return; + if (field.optional && val == null) return; - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); + field.validate(node, key, val); + } + + function shallowEqual(actual, expected) { + var keys = (0, _keys2.default)(expected); + + for (var _iterator3 = keys, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var key = _ref3; + + if (actual[key] !== expected[key]) { + return false; + } + } + + return true; + } + + function appendToMemberExpression(member, append, computed) { + member.object = t.memberExpression(member.object, member.property, member.computed); + member.property = append; + member.computed = !!computed; + return member; + } + + function prependToMemberExpression(member, prepend) { + member.object = t.memberExpression(prepend, member.object); + return member; + } + + function ensureBlock(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body"; + + return node[key] = t.toBlock(node[key], node); + } + + function clone(node) { + if (!node) return node; + var newNode = {}; + for (var key in node) { + if (key[0] === "_") continue; + newNode[key] = node[key]; + } + return newNode; + } + + function cloneWithoutLoc(node) { + var newNode = clone(node); + delete newNode.loc; + return newNode; + } + + function cloneDeep(node) { + if (!node) return node; + var newNode = {}; + + for (var key in node) { + if (key[0] === "_") continue; + + var val = node[key]; + + if (val) { + if (val.type) { + val = t.cloneDeep(val); + } else if (Array.isArray(val)) { + val = val.map(t.cloneDeep); + } + } + + newNode[key] = val; + } + + return newNode; + } + + function buildMatchMemberExpression(match, allowPartial) { + var parts = match.split("."); + + return function (member) { + if (!t.isMemberExpression(member)) return false; + + var search = [member]; + var i = 0; + + while (search.length) { + var node = search.shift(); + + if (allowPartial && i === parts.length) { + return true; + } + + if (t.isIdentifier(node)) { + if (parts[i] !== node.name) return false; + } else if (t.isStringLiteral(node)) { + if (parts[i] !== node.value) return false; + } else if (t.isMemberExpression(node)) { + if (node.computed && !t.isStringLiteral(node.property)) { + return false; + } else { + search.push(node.object); + search.push(node.property); + continue; + } + } else { + return false; + } + + if (++i > parts.length) { + return false; + } + } + + return true; + }; + } + + function removeComments(node) { + for (var _iterator4 = t.COMMENT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var key = _ref4; + + delete node[key]; + } + return node; + } + + function inheritsComments(child, parent) { + inheritTrailingComments(child, parent); + inheritLeadingComments(child, parent); + inheritInnerComments(child, parent); + return child; + } + + function inheritTrailingComments(child, parent) { + _inheritComments("trailingComments", child, parent); + } + + function inheritLeadingComments(child, parent) { + _inheritComments("leadingComments", child, parent); + } + + function inheritInnerComments(child, parent) { + _inheritComments("innerComments", child, parent); + } + + function _inheritComments(key, child, parent) { + if (child && parent) { + child[key] = (0, _uniq2.default)([].concat(child[key], parent[key]).filter(Boolean)); + } + } + + function inherits(child, parent) { + if (!child || !parent) return child; + + for (var _iterator5 = t.INHERIT_KEYS.optional, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var _key2 = _ref5; + + if (child[_key2] == null) { + child[_key2] = parent[_key2]; + } + } + + for (var key in parent) { + if (key[0] === "_") child[key] = parent[key]; + } + + for (var _iterator6 = t.INHERIT_KEYS.force, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref6; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref6 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref6 = _i6.value; + } + + var _key3 = _ref6; + + child[_key3] = parent[_key3]; + } + + t.inheritsComments(child, parent); + + return child; + } + + function assertNode(node) { + if (!isNode(node)) { + throw new TypeError("Not a valid node " + (node && node.type)); + } + } + + function isNode(node) { + return !!(node && _definitions.VISITOR_KEYS[node.type]); + } + + (0, _toFastProperties2.default)(t); + (0, _toFastProperties2.default)(t.VISITOR_KEYS); + + function traverseFast(node, enter, opts) { + if (!node) return; + + var keys = t.VISITOR_KEYS[node.type]; + if (!keys) return; + + opts = opts || {}; + enter(node, opts); + + for (var _iterator7 = keys, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref7; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref7 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref7 = _i7.value; + } + + var key = _ref7; + + var subNode = node[key]; + + if (Array.isArray(subNode)) { + for (var _iterator8 = subNode, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) { + var _ref8; + + if (_isArray8) { + if (_i8 >= _iterator8.length) break; + _ref8 = _iterator8[_i8++]; + } else { + _i8 = _iterator8.next(); + if (_i8.done) break; + _ref8 = _i8.value; + } + + var _node = _ref8; + + traverseFast(_node, enter, opts); + } + } else { + traverseFast(subNode, enter, opts); + } + } + } + + var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; + + var CLEAR_KEYS_PLUS_COMMENTS = t.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); + + function removeProperties(node, opts) { + opts = opts || {}; + var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + for (var _iterator9 = map, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) { + var _ref9; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref9 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref9 = _i9.value; + } + + var _key4 = _ref9; + + if (node[_key4] != null) node[_key4] = undefined; + } + + for (var key in node) { + if (key[0] === "_" && node[key] != null) node[key] = undefined; + } + + var syms = (0, _getOwnPropertySymbols2.default)(node); + for (var _iterator10 = syms, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) { + var _ref10; + + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref10 = _iterator10[_i10++]; + } else { + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref10 = _i10.value; + } + + var sym = _ref10; + + node[sym] = null; + } + } + + function removePropertiesDeep(tree, opts) { + traverseFast(tree, removeProperties, opts); + return tree; + } + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(400), __esModule: true }; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (code, opts) { + var stack = void 0; + try { + throw new Error(); + } catch (error) { + if (error.stack) { + stack = error.stack.split("\n").slice(1).join("\n"); + } + } + + opts = (0, _assign2.default)({ + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + preserveComments: false + }, opts); + + var _getAst = function getAst() { + var ast = void 0; + + try { + ast = babylon.parse(code, opts); + + ast = _babelTraverse2.default.removeProperties(ast, { preserveComments: opts.preserveComments }); + + _babelTraverse2.default.cheap(ast, function (node) { + node[FROM_TEMPLATE] = true; + }); + } catch (err) { + err.stack = err.stack + "from\n" + stack; + throw err; + } + + _getAst = function getAst() { + return ast; + }; + + return ast; + }; + + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return useTemplate(_getAst(), args); + }; + }; + + var _cloneDeep = __webpack_require__(565); + + var _cloneDeep2 = _interopRequireDefault(_cloneDeep); + + var _assign = __webpack_require__(170); + + var _assign2 = _interopRequireDefault(_assign); + + var _has = __webpack_require__(269); + + var _has2 = _interopRequireDefault(_has); + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + var _babylon = __webpack_require__(87); + + var babylon = _interopRequireWildcard(_babylon); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var FROM_TEMPLATE = "_fromTemplate"; + var TEMPLATE_SKIP = (0, _symbol2.default)(); + + function useTemplate(ast, nodes) { + ast = (0, _cloneDeep2.default)(ast); + var _ast = ast, + program = _ast.program; + + if (nodes.length) { + (0, _babelTraverse2.default)(ast, templateVisitor, null, nodes); + } + + if (program.body.length > 1) { + return program.body; + } else { + return program.body[0]; + } + } + + var templateVisitor = { + noScope: true, + + enter: function enter(path, args) { + var node = path.node; + + if (node[TEMPLATE_SKIP]) return path.skip(); + + if (t.isExpressionStatement(node)) { + node = node.expression; + } + + var replacement = void 0; + + if (t.isIdentifier(node) && node[FROM_TEMPLATE]) { + if ((0, _has2.default)(args[0], node.name)) { + replacement = args[0][node.name]; + } else if (node.name[0] === "$") { + var i = +node.name.slice(1); + if (args[i]) replacement = args[i]; + } + } + + if (replacement === null) { + path.remove(); + } + + if (replacement) { + replacement[TEMPLATE_SKIP] = true; + path.replaceInline(replacement); + } + }, + exit: function exit(_ref) { + var node = _ref.node; + + if (!node.loc) _babelTraverse2.default.clearNode(node); + } + }; + module.exports = exports["default"]; + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + + 'use strict'; + + var core = module.exports = { version: '2.4.0' }; + if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + module.exports = isArray; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.visitors = exports.Hub = exports.Scope = exports.NodePath = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _path = __webpack_require__(35); + + Object.defineProperty(exports, "NodePath", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_path).default; + } }); - return styles; -} + var _scope = __webpack_require__(133); -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); + Object.defineProperty(exports, "Scope", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_scope).default; + } + }); -},{}],202:[function(_dereq_,module,exports){ -'use strict'; + var _hub = __webpack_require__(219); -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + Object.defineProperty(exports, "Hub", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_hub).default; + } + }); + exports.default = traverse; -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); + var _context = __webpack_require__(363); + + var _context2 = _interopRequireDefault(_context); + + var _visitors = __webpack_require__(380); + + var visitors = _interopRequireWildcard(_visitors); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _includes = __webpack_require__(111); + + var _includes2 = _interopRequireDefault(_includes); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _cache = __webpack_require__(86); + + var cache = _interopRequireWildcard(_cache); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } } - return str.replace(matchOperatorsRe, '\\$&'); -}; - -},{}],203:[function(_dereq_,module,exports){ -'use strict'; -var ansiRegex = _dereq_(204); -var re = new RegExp(ansiRegex().source); // remove the `g` flag -module.exports = re.test.bind(re); - -},{"204":204}],204:[function(_dereq_,module,exports){ -'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; -}; - -},{}],205:[function(_dereq_,module,exports){ -'use strict'; -var ansiRegex = _dereq_(206)(); - -module.exports = function (str) { - return typeof str === 'string' ? str.replace(ansiRegex, '') : str; -}; - -},{"206":206}],206:[function(_dereq_,module,exports){ -arguments[4][204][0].apply(exports,arguments) -},{"204":204}],207:[function(_dereq_,module,exports){ -(function (process){ -'use strict'; -var argv = process.argv; - -var terminator = argv.indexOf('--'); -var hasFlag = function (flag) { - flag = '--' + flag; - var pos = argv.indexOf(flag); - return pos !== -1 && (terminator !== -1 ? pos < terminator : true); -}; - -module.exports = (function () { - if ('FORCE_COLOR' in process.env) { - return true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; } - if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - return false; + exports.visitors = visitors; + function traverse(parent, opts, scope, state, parentPath) { + if (!parent) return; + if (!opts) opts = {}; + + if (!opts.noScope && !scope) { + if (parent.type !== "Program" && parent.type !== "File") { + throw new Error(messages.get("traverseNeedsParent", parent.type)); + } + } + + visitors.explode(opts); + + traverse.node(parent, opts, scope, state, parentPath); } - if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - return true; + traverse.visitors = visitors; + traverse.verify = visitors.verify; + traverse.explode = visitors.explode; + + traverse.NodePath = __webpack_require__(35); + traverse.Scope = __webpack_require__(133); + traverse.Hub = __webpack_require__(219); + + traverse.cheap = function (node, enter) { + return t.traverseFast(node, enter); + }; + + traverse.node = function (node, opts, scope, state, parentPath, skipKeys) { + var keys = t.VISITOR_KEYS[node.type]; + if (!keys) return; + + var context = new _context2.default(scope, opts, state, parentPath); + for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var key = _ref; + + if (skipKeys && skipKeys[key]) continue; + if (context.visit(node, key)) return; + } + }; + + traverse.clearNode = function (node, opts) { + t.removeProperties(node, opts); + + cache.path.delete(node); + }; + + traverse.removeProperties = function (tree, opts) { + t.traverseFast(tree, traverse.clearNode, opts); + return tree; + }; + + function hasBlacklistedType(path, state) { + if (path.node.type === state.type) { + state.has = true; + path.stop(); + } } - if (process.stdout && !process.stdout.isTTY) { - return false; + traverse.hasType = function (tree, scope, type, blacklistTypes) { + if ((0, _includes2.default)(blacklistTypes, tree.type)) return false; + + if (tree.type === type) return true; + + var state = { + has: false, + type: type + }; + + traverse(tree, { + blacklist: blacklistTypes, + enter: hasBlacklistedType + }, scope, state); + + return state.has; + }; + + traverse.clearCache = function () { + cache.clear(); + }; + + traverse.clearCache.clearPath = cache.clearPath; + traverse.clearCache.clearScope = cache.clearScope; + + traverse.copyCache = function (source, destination) { + if (cache.path.has(source)) { + cache.path.set(destination, cache.path.get(source)); + } + }; + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + 'use strict'; + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } } - if (process.platform === 'win32') { - return true; + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); } - if ('COLORTERM' in process.env) { - return true; + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function () { + return 0; + }; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(405), __esModule: true }; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(410), __esModule: true }; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + exports.__esModule = true; + + var _iterator = __webpack_require__(359); + + var _iterator2 = _interopRequireDefault(_iterator); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + var _typeof = typeof _symbol2.default === "function" && _typeof2(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof2(obj); + } : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj); + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; } - if (process.env.TERM === 'dumb') { - return false; + exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); + } : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); + }; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var store = __webpack_require__(147)('wks'), + uid = __webpack_require__(95), + _Symbol = __webpack_require__(14).Symbol, + USE_SYMBOL = typeof _Symbol == 'function'; + + var $exports = module.exports = function (name) { + return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name)); + }; + + $exports.store = store; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(407), __esModule: true }; + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + + 'use strict'; + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var freeGlobal = __webpack_require__(256); + + /** Detect free variable `self`. */ + var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + module.exports = root; + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); + return value != null && (type == 'object' || type == 'function'); } - if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { - return true; - } + module.exports = isObject; - return false; -})(); +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { -}).call(this,_dereq_(10)) -},{"10":10}],208:[function(_dereq_,module,exports){ -(function (Buffer){ -'use strict'; -var fs = _dereq_(1); -var path = _dereq_(9); + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; -var commentRx = /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/mg; -var mapFileCommentRx = - // //# sourceMappingURL=foo.js.map - /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg - -function decodeBase64(base64) { - return new Buffer(base64, 'base64').toString(); -} - -function stripComment(sm) { - return sm.split(',').pop(); -} - -function readFromFileMap(sm, dir) { - // NOTE: this will only work on the server since it attempts to read the map file - - var r = mapFileCommentRx.exec(sm); - mapFileCommentRx.lastIndex = 0; - - // for some odd reason //# .. captures in 1 and /* .. */ in 2 - var filename = r[1] || r[2]; - var filepath = path.join(dir, filename); - - try { - return fs.readFileSync(filepath, 'utf8'); - } catch (e) { - throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e); - } -} - -function Converter (sm, opts) { - opts = opts || {}; - - if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir); - if (opts.hasComment) sm = stripComment(sm); - if (opts.isEncoded) sm = decodeBase64(sm); - if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm); - - this.sourcemap = sm; -} - -function convertFromLargeSource(content){ - var lines = content.split('\n'); - var line; - // find first line which contains a source map starting at end of content - for (var i = lines.length - 1; i > 0; i--) { - line = lines[i] - if (~line.indexOf('sourceMappingURL=data:')) return exports.fromComment(line); - } -} - -Converter.prototype.toJSON = function (space) { - return JSON.stringify(this.sourcemap, null, space); -}; - -Converter.prototype.toBase64 = function () { - var json = this.toJSON(); - return new Buffer(json).toString('base64'); -}; - -Converter.prototype.toComment = function (options) { - var base64 = this.toBase64(); - var data = 'sourceMappingURL=data:application/json;base64,' + base64; - return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; -}; - -// returns copy instead of original -Converter.prototype.toObject = function () { - return JSON.parse(this.toJSON()); -}; - -Converter.prototype.addProperty = function (key, value) { - if (this.sourcemap.hasOwnProperty(key)) throw new Error('property %s already exists on the sourcemap, use set property instead'); - return this.setProperty(key, value); -}; - -Converter.prototype.setProperty = function (key, value) { - this.sourcemap[key] = value; - return this; -}; - -Converter.prototype.getProperty = function (key) { - return this.sourcemap[key]; -}; - -exports.fromObject = function (obj) { - return new Converter(obj); -}; - -exports.fromJSON = function (json) { - return new Converter(json, { isJSON: true }); -}; - -exports.fromBase64 = function (base64) { - return new Converter(base64, { isEncoded: true }); -}; - -exports.fromComment = function (comment) { - comment = comment - .replace(/^\/\*/g, '//') - .replace(/\*\/$/g, ''); - - return new Converter(comment, { isEncoded: true, hasComment: true }); -}; - -exports.fromMapFileComment = function (comment, dir) { - return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true }); -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromSource = function (content, largeSource) { - if (largeSource) { - var res = convertFromLargeSource(content); - return res ? res : null; - } - - var m = content.match(commentRx); - commentRx.lastIndex = 0; - return m ? exports.fromComment(m.pop()) : null; -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromMapFileSource = function (content, dir) { - var m = content.match(mapFileCommentRx); - mapFileCommentRx.lastIndex = 0; - return m ? exports.fromMapFileComment(m.pop(), dir) : null; -}; - -exports.removeComments = function (src) { - commentRx.lastIndex = 0; - return src.replace(commentRx, ''); -}; - -exports.removeMapFileComments = function (src) { - mapFileCommentRx.lastIndex = 0; - return src.replace(mapFileCommentRx, ''); -}; - -Object.defineProperty(exports, 'commentRegex', { - get: function getCommentRegex () { - commentRx.lastIndex = 0; - return commentRx; - } -}); - -Object.defineProperty(exports, 'mapFileCommentRegex', { - get: function getMapFileCommentRegex () { - mapFileCommentRx.lastIndex = 0; - return mapFileCommentRx; - } -}); - -}).call(this,_dereq_(3).Buffer) -},{"1":1,"3":3,"9":9}],209:[function(_dereq_,module,exports){ -module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; -}; -},{}],210:[function(_dereq_,module,exports){ -// 22.1.3.31 Array.prototype[@@unscopables] -var UNSCOPABLES = _dereq_(290)('unscopables') - , ArrayProto = Array.prototype; -if(ArrayProto[UNSCOPABLES] == undefined)_dereq_(238)(ArrayProto, UNSCOPABLES, {}); -module.exports = function(key){ - ArrayProto[UNSCOPABLES][key] = true; -}; -},{"238":238,"290":290}],211:[function(_dereq_,module,exports){ -var isObject = _dereq_(245); -module.exports = function(it){ - if(!isObject(it))throw TypeError(it + ' is not an object!'); - return it; -}; -},{"245":245}],212:[function(_dereq_,module,exports){ -// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) -'use strict'; -var toObject = _dereq_(287) - , toIndex = _dereq_(283) - , toLength = _dereq_(286); - -module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ - var O = toObject(this) - , len = toLength(O.length) - , to = toIndex(target, len) - , from = toIndex(start, len) - , $$ = arguments - , end = $$.length > 2 ? $$[2] : undefined - , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) - , inc = 1; - if(from < to && to < from + count){ - inc = -1; - from += count - 1; - to += count - 1; - } - while(count-- > 0){ - if(from in O)O[to] = O[from]; - else delete O[to]; - to += inc; - from += inc; - } return O; -}; -},{"283":283,"286":286,"287":287}],213:[function(_dereq_,module,exports){ -// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) -'use strict'; -var toObject = _dereq_(287) - , toIndex = _dereq_(283) - , toLength = _dereq_(286); -module.exports = [].fill || function fill(value /*, start = 0, end = @length */){ - var O = toObject(this) - , length = toLength(O.length) - , $$ = arguments - , $$len = $$.length - , index = toIndex($$len > 1 ? $$[1] : undefined, length) - , end = $$len > 2 ? $$[2] : undefined - , endPos = end === undefined ? length : toIndex(end, length); - while(endPos > index)O[index++] = value; - return O; -}; -},{"283":283,"286":286,"287":287}],214:[function(_dereq_,module,exports){ -// false -> Array#indexOf -// true -> Array#includes -var toIObject = _dereq_(285) - , toLength = _dereq_(286) - , toIndex = _dereq_(283); -module.exports = function(IS_INCLUDES){ - return function($this, el, fromIndex){ - var O = toIObject($this) - , length = toLength(O.length) - , index = toIndex(fromIndex, length) - , value; - // Array#includes uses SameValueZero equality algorithm - if(IS_INCLUDES && el != el)while(length > index){ - value = O[index++]; - if(value != value)return true; - // Array#toIndex ignores holes, Array#includes - not - } else for(;length > index; index++)if(IS_INCLUDES || index in O){ - if(O[index] === el)return IS_INCLUDES || index; - } return !IS_INCLUDES && -1; - }; -}; -},{"283":283,"285":285,"286":286}],215:[function(_dereq_,module,exports){ -// 0 -> Array#forEach -// 1 -> Array#map -// 2 -> Array#filter -// 3 -> Array#some -// 4 -> Array#every -// 5 -> Array#find -// 6 -> Array#findIndex -var ctx = _dereq_(224) - , IObject = _dereq_(241) - , toObject = _dereq_(287) - , toLength = _dereq_(286) - , asc = _dereq_(216); -module.exports = function(TYPE){ - var IS_MAP = TYPE == 1 - , IS_FILTER = TYPE == 2 - , IS_SOME = TYPE == 3 - , IS_EVERY = TYPE == 4 - , IS_FIND_INDEX = TYPE == 6 - , NO_HOLES = TYPE == 5 || IS_FIND_INDEX; - return function($this, callbackfn, that){ - var O = toObject($this) - , self = IObject(O) - , f = ctx(callbackfn, that, 3) - , length = toLength(self.length) - , index = 0 - , result = IS_MAP ? asc($this, length) : IS_FILTER ? asc($this, 0) : undefined - , val, res; - for(;length > index; index++)if(NO_HOLES || index in self){ - val = self[index]; - res = f(val, index, O); - if(TYPE){ - if(IS_MAP)result[index] = res; // map - else if(res)switch(TYPE){ - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if(IS_EVERY)return false; // every - } - } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; - }; -}; -},{"216":216,"224":224,"241":241,"286":286,"287":287}],216:[function(_dereq_,module,exports){ -// 9.4.2.3 ArraySpeciesCreate(originalArray, length) -var isObject = _dereq_(245) - , isArray = _dereq_(243) - , SPECIES = _dereq_(290)('species'); -module.exports = function(original, length){ - var C; - if(isArray(original)){ - C = original.constructor; - // cross-realm fallback - if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; - if(isObject(C)){ - C = C[SPECIES]; - if(C === null)C = undefined; - } - } return new (C === undefined ? Array : C)(length); -}; -},{"243":243,"245":245,"290":290}],217:[function(_dereq_,module,exports){ -// getting tag from 19.1.3.6 Object.prototype.toString() -var cof = _dereq_(218) - , TAG = _dereq_(290)('toStringTag') - // ES3 wrong here - , ARG = cof(function(){ return arguments; }()) == 'Arguments'; - -module.exports = function(it){ - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = (O = Object(it))[TAG]) == 'string' ? T - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; -},{"218":218,"290":290}],218:[function(_dereq_,module,exports){ -var toString = {}.toString; - -module.exports = function(it){ - return toString.call(it).slice(8, -1); -}; -},{}],219:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , hide = _dereq_(238) - , redefineAll = _dereq_(267) - , ctx = _dereq_(224) - , strictNew = _dereq_(276) - , defined = _dereq_(225) - , forOf = _dereq_(234) - , $iterDefine = _dereq_(249) - , step = _dereq_(251) - , ID = _dereq_(289)('id') - , $has = _dereq_(237) - , isObject = _dereq_(245) - , setSpecies = _dereq_(272) - , DESCRIPTORS = _dereq_(226) - , isExtensible = Object.isExtensible || isObject - , SIZE = DESCRIPTORS ? '_s' : 'size' - , id = 0; - -var fastKey = function(it, create){ - // return primitive with prefix - if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if(!$has(it, ID)){ - // can't set id to frozen object - if(!isExtensible(it))return 'F'; - // not necessary to add id - if(!create)return 'E'; - // add missing object id - hide(it, ID, ++id); - // return object id with prefix - } return 'O' + it[ID]; -}; - -var getEntry = function(that, key){ - // fast case - var index = fastKey(key), entry; - if(index !== 'F')return that._i[index]; - // frozen object case - for(entry = that._f; entry; entry = entry.n){ - if(entry.k == key)return entry; - } -}; - -module.exports = { - getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ - var C = wrapper(function(that, iterable){ - strictNew(that, C, NAME); - that._i = $.create(null); // index - that._f = undefined; // first entry - that._l = undefined; // last entry - that[SIZE] = 0; // size - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - }); - redefineAll(C.prototype, { - // 23.1.3.1 Map.prototype.clear() - // 23.2.3.2 Set.prototype.clear() - clear: function clear(){ - for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ - entry.r = true; - if(entry.p)entry.p = entry.p.n = undefined; - delete data[entry.i]; - } - that._f = that._l = undefined; - that[SIZE] = 0; - }, - // 23.1.3.3 Map.prototype.delete(key) - // 23.2.3.4 Set.prototype.delete(value) - 'delete': function(key){ - var that = this - , entry = getEntry(that, key); - if(entry){ - var next = entry.n - , prev = entry.p; - delete that._i[entry.i]; - entry.r = true; - if(prev)prev.n = next; - if(next)next.p = prev; - if(that._f == entry)that._f = next; - if(that._l == entry)that._l = prev; - that[SIZE]--; - } return !!entry; - }, - // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) - // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) - forEach: function forEach(callbackfn /*, that = undefined */){ - var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) - , entry; - while(entry = entry ? entry.n : this._f){ - f(entry.v, entry.k, this); - // revert to the last existing entry - while(entry && entry.r)entry = entry.p; - } - }, - // 23.1.3.7 Map.prototype.has(key) - // 23.2.3.7 Set.prototype.has(value) - has: function has(key){ - return !!getEntry(this, key); - } - }); - if(DESCRIPTORS)$.setDesc(C.prototype, 'size', { - get: function(){ - return defined(this[SIZE]); - } - }); - return C; - }, - def: function(that, key, value){ - var entry = getEntry(that, key) - , prev, index; - // change existing entry - if(entry){ - entry.v = value; - // create new entry - } else { - that._l = entry = { - i: index = fastKey(key, true), // <- index - k: key, // <- key - v: value, // <- value - p: prev = that._l, // <- previous entry - n: undefined, // <- next entry - r: false // <- removed - }; - if(!that._f)that._f = entry; - if(prev)prev.n = entry; - that[SIZE]++; - // add to index - if(index !== 'F')that._i[index] = entry; - } return that; - }, - getEntry: getEntry, - setStrong: function(C, NAME, IS_MAP){ - // add .keys, .values, .entries, [@@iterator] - // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 - $iterDefine(C, NAME, function(iterated, kind){ - this._t = iterated; // target - this._k = kind; // kind - this._l = undefined; // previous - }, function(){ - var that = this - , kind = that._k - , entry = that._l; - // revert to the last existing entry - while(entry && entry.r)entry = entry.p; - // get next entry - if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ - // or finish the iteration - that._t = undefined; - return step(1); - } - // return step by kind - if(kind == 'keys' )return step(0, entry.k); - if(kind == 'values')return step(0, entry.v); - return step(0, [entry.k, entry.v]); - }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); - - // add [@@species], 23.1.2.2, 23.2.2.2 - setSpecies(NAME); - } -}; -},{"224":224,"225":225,"226":226,"234":234,"237":237,"238":238,"245":245,"249":249,"251":251,"253":253,"267":267,"272":272,"276":276,"289":289}],220:[function(_dereq_,module,exports){ -// https://github.com/DavidBruant/Map-Set.prototype.toJSON -var forOf = _dereq_(234) - , classof = _dereq_(217); -module.exports = function(NAME){ - return function toJSON(){ - if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); - var arr = []; - forOf(this, false, arr.push, arr); - return arr; - }; -}; -},{"217":217,"234":234}],221:[function(_dereq_,module,exports){ -'use strict'; -var hide = _dereq_(238) - , redefineAll = _dereq_(267) - , anObject = _dereq_(211) - , isObject = _dereq_(245) - , strictNew = _dereq_(276) - , forOf = _dereq_(234) - , createArrayMethod = _dereq_(215) - , $has = _dereq_(237) - , WEAK = _dereq_(289)('weak') - , isExtensible = Object.isExtensible || isObject - , arrayFind = createArrayMethod(5) - , arrayFindIndex = createArrayMethod(6) - , id = 0; - -// fallback for frozen keys -var frozenStore = function(that){ - return that._l || (that._l = new FrozenStore); -}; -var FrozenStore = function(){ - this.a = []; -}; -var findFrozen = function(store, key){ - return arrayFind(store.a, function(it){ - return it[0] === key; - }); -}; -FrozenStore.prototype = { - get: function(key){ - var entry = findFrozen(this, key); - if(entry)return entry[1]; - }, - has: function(key){ - return !!findFrozen(this, key); - }, - set: function(key, value){ - var entry = findFrozen(this, key); - if(entry)entry[1] = value; - else this.a.push([key, value]); - }, - 'delete': function(key){ - var index = arrayFindIndex(this.a, function(it){ - return it[0] === key; - }); - if(~index)this.a.splice(index, 1); - return !!~index; - } -}; - -module.exports = { - getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ - var C = wrapper(function(that, iterable){ - strictNew(that, C, NAME); - that._i = id++; // collection id - that._l = undefined; // leak store for frozen objects - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - }); - redefineAll(C.prototype, { - // 23.3.3.2 WeakMap.prototype.delete(key) - // 23.4.3.3 WeakSet.prototype.delete(value) - 'delete': function(key){ - if(!isObject(key))return false; - if(!isExtensible(key))return frozenStore(this)['delete'](key); - return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i]; - }, - // 23.3.3.4 WeakMap.prototype.has(key) - // 23.4.3.4 WeakSet.prototype.has(value) - has: function has(key){ - if(!isObject(key))return false; - if(!isExtensible(key))return frozenStore(this).has(key); - return $has(key, WEAK) && $has(key[WEAK], this._i); - } - }); - return C; - }, - def: function(that, key, value){ - if(!isExtensible(anObject(key))){ - frozenStore(that).set(key, value); - } else { - $has(key, WEAK) || hide(key, WEAK, {}); - key[WEAK][that._i] = value; - } return that; - }, - frozenStore: frozenStore, - WEAK: WEAK -}; -},{"211":211,"215":215,"234":234,"237":237,"238":238,"245":245,"267":267,"276":276,"289":289}],222:[function(_dereq_,module,exports){ -'use strict'; -var global = _dereq_(236) - , $export = _dereq_(229) - , redefine = _dereq_(268) - , redefineAll = _dereq_(267) - , forOf = _dereq_(234) - , strictNew = _dereq_(276) - , isObject = _dereq_(245) - , fails = _dereq_(231) - , $iterDetect = _dereq_(250) - , setToStringTag = _dereq_(273); - -module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ - var Base = global[NAME] - , C = Base - , ADDER = IS_MAP ? 'set' : 'add' - , proto = C && C.prototype - , O = {}; - var fixMethod = function(KEY){ - var fn = proto[KEY]; - redefine(proto, KEY, - KEY == 'delete' ? function(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a){ - return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } - : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } - ); - }; - if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ - new C().entries().next(); - }))){ - // create collection constructor - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - redefineAll(C.prototype, methods); - } else { - var instance = new C - // early implementations not supports chaining - , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) - // most early implementations doesn't supports iterables, most modern - not close it correctly - , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new - // for early implementations -0 and +0 not the same - , BUGGY_ZERO; - if(!ACCEPT_ITERABLES){ - C = wrapper(function(target, iterable){ - strictNew(target, C, NAME); - var that = new Base; - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; - } - IS_WEAK || instance.forEach(function(val, key){ - BUGGY_ZERO = 1 / key === -Infinity; - }); - if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); - // weak collections should not contains .clear method - if(IS_WEAK && proto.clear)delete proto.clear; - } - - setToStringTag(C, NAME); - - O[NAME] = C; - $export($export.G + $export.W + $export.F * (C != Base), O); - - if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); - - return C; -}; -},{"229":229,"231":231,"234":234,"236":236,"245":245,"250":250,"267":267,"268":268,"273":273,"276":276}],223:[function(_dereq_,module,exports){ -var core = module.exports = {version: '1.2.6'}; -if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -},{}],224:[function(_dereq_,module,exports){ -// optional / simple context binding -var aFunction = _dereq_(209); -module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; -}; -},{"209":209}],225:[function(_dereq_,module,exports){ -// 7.2.1 RequireObjectCoercible(argument) -module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); - return it; -}; -},{}],226:[function(_dereq_,module,exports){ -// Thank's IE8 for his funny defineProperty -module.exports = !_dereq_(231)(function(){ - return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; -}); -},{"231":231}],227:[function(_dereq_,module,exports){ -var isObject = _dereq_(245) - , document = _dereq_(236).document - // in old IE typeof document.createElement is 'object' - , is = isObject(document) && isObject(document.createElement); -module.exports = function(it){ - return is ? document.createElement(it) : {}; -}; -},{"236":236,"245":245}],228:[function(_dereq_,module,exports){ -// all enumerable object keys, includes symbols -var $ = _dereq_(253); -module.exports = function(it){ - var keys = $.getKeys(it) - , getSymbols = $.getSymbols; - if(getSymbols){ - var symbols = getSymbols(it) - , isEnum = $.isEnum - , i = 0 - , key; - while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); - } - return keys; -}; -},{"253":253}],229:[function(_dereq_,module,exports){ -var global = _dereq_(236) - , core = _dereq_(223) - , hide = _dereq_(238) - , redefine = _dereq_(268) - , ctx = _dereq_(224) - , PROTOTYPE = 'prototype'; - -var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) - , key, own, out, exp; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - // export native or passed - out = (own ? target : source)[key]; - // bind timers to global for call from export context - exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // extend global - if(target && !own)redefine(target, key, out); - // export - if(exports[key] != out)hide(exports, key, exp); - if(IS_PROTO && expProto[key] != out)expProto[key] = out; - } -}; -global.core = core; -// type bitmap -$export.F = 1; // forced -$export.G = 2; // global -$export.S = 4; // static -$export.P = 8; // proto -$export.B = 16; // bind -$export.W = 32; // wrap -module.exports = $export; -},{"223":223,"224":224,"236":236,"238":238,"268":268}],230:[function(_dereq_,module,exports){ -var MATCH = _dereq_(290)('match'); -module.exports = function(KEY){ - var re = /./; - try { - '/./'[KEY](re); - } catch(e){ - try { - re[MATCH] = false; - return !'/./'[KEY](re); - } catch(f){ /* empty */ } - } return true; -}; -},{"290":290}],231:[function(_dereq_,module,exports){ -module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } -}; -},{}],232:[function(_dereq_,module,exports){ -'use strict'; -var hide = _dereq_(238) - , redefine = _dereq_(268) - , fails = _dereq_(231) - , defined = _dereq_(225) - , wks = _dereq_(290); - -module.exports = function(KEY, length, exec){ - var SYMBOL = wks(KEY) - , original = ''[KEY]; - if(fails(function(){ - var O = {}; - O[SYMBOL] = function(){ return 7; }; - return ''[KEY](O) != 7; - })){ - redefine(String.prototype, KEY, exec(defined, SYMBOL, original)); - hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function(string, arg){ return original.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function(string){ return original.call(string, this); } - ); - } -}; -},{"225":225,"231":231,"238":238,"268":268,"290":290}],233:[function(_dereq_,module,exports){ -'use strict'; -// 21.2.5.3 get RegExp.prototype.flags -var anObject = _dereq_(211); -module.exports = function(){ - var that = anObject(this) - , result = ''; - if(that.global) result += 'g'; - if(that.ignoreCase) result += 'i'; - if(that.multiline) result += 'm'; - if(that.unicode) result += 'u'; - if(that.sticky) result += 'y'; - return result; -}; -},{"211":211}],234:[function(_dereq_,module,exports){ -var ctx = _dereq_(224) - , call = _dereq_(247) - , isArrayIter = _dereq_(242) - , anObject = _dereq_(211) - , toLength = _dereq_(286) - , getIterFn = _dereq_(291); -module.exports = function(iterable, entries, fn, that){ - var iterFn = getIterFn(iterable) - , f = ctx(fn, that, entries ? 2 : 1) - , index = 0 - , length, step, iterator; - if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); - // fast case for arrays with default iterator - if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ - entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ - call(iterator, f, step.value, entries); - } -}; -},{"211":211,"224":224,"242":242,"247":247,"286":286,"291":291}],235:[function(_dereq_,module,exports){ -// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window -var toIObject = _dereq_(285) - , getNames = _dereq_(253).getNames - , toString = {}.toString; - -var windowNames = typeof window == 'object' && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; - -var getWindowNames = function(it){ - try { - return getNames(it); - } catch(e){ - return windowNames.slice(); - } -}; - -module.exports.get = function getOwnPropertyNames(it){ - if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); - return getNames(toIObject(it)); -}; -},{"253":253,"285":285}],236:[function(_dereq_,module,exports){ -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -},{}],237:[function(_dereq_,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function(it, key){ - return hasOwnProperty.call(it, key); -}; -},{}],238:[function(_dereq_,module,exports){ -var $ = _dereq_(253) - , createDesc = _dereq_(266); -module.exports = _dereq_(226) ? function(object, key, value){ - return $.setDesc(object, key, createDesc(1, value)); -} : function(object, key, value){ - object[key] = value; - return object; -}; -},{"226":226,"253":253,"266":266}],239:[function(_dereq_,module,exports){ -module.exports = _dereq_(236).document && document.documentElement; -},{"236":236}],240:[function(_dereq_,module,exports){ -// fast apply, http://jsperf.lnkit.com/fast-apply/5 -module.exports = function(fn, args, that){ - var un = that === undefined; - switch(args.length){ - case 0: return un ? fn() - : fn.call(that); - case 1: return un ? fn(args[0]) - : fn.call(that, args[0]); - case 2: return un ? fn(args[0], args[1]) - : fn.call(that, args[0], args[1]); - case 3: return un ? fn(args[0], args[1], args[2]) - : fn.call(that, args[0], args[1], args[2]); - case 4: return un ? fn(args[0], args[1], args[2], args[3]) - : fn.call(that, args[0], args[1], args[2], args[3]); - } return fn.apply(that, args); -}; -},{}],241:[function(_dereq_,module,exports){ -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = _dereq_(218); -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ - return cof(it) == 'String' ? it.split('') : Object(it); -}; -},{"218":218}],242:[function(_dereq_,module,exports){ -// check on default Array iterator -var Iterators = _dereq_(252) - , ITERATOR = _dereq_(290)('iterator') - , ArrayProto = Array.prototype; - -module.exports = function(it){ - return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); -}; -},{"252":252,"290":290}],243:[function(_dereq_,module,exports){ -// 7.2.2 IsArray(argument) -var cof = _dereq_(218); -module.exports = Array.isArray || function(arg){ - return cof(arg) == 'Array'; -}; -},{"218":218}],244:[function(_dereq_,module,exports){ -// 20.1.2.3 Number.isInteger(number) -var isObject = _dereq_(245) - , floor = Math.floor; -module.exports = function isInteger(it){ - return !isObject(it) && isFinite(it) && floor(it) === it; -}; -},{"245":245}],245:[function(_dereq_,module,exports){ -module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; -},{}],246:[function(_dereq_,module,exports){ -// 7.2.8 IsRegExp(argument) -var isObject = _dereq_(245) - , cof = _dereq_(218) - , MATCH = _dereq_(290)('match'); -module.exports = function(it){ - var isRegExp; - return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); -}; -},{"218":218,"245":245,"290":290}],247:[function(_dereq_,module,exports){ -// call something on iterator step with safe closing on error -var anObject = _dereq_(211); -module.exports = function(iterator, fn, value, entries){ - try { - return entries ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch(e){ - var ret = iterator['return']; - if(ret !== undefined)anObject(ret.call(iterator)); - throw e; - } -}; -},{"211":211}],248:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , descriptor = _dereq_(266) - , setToStringTag = _dereq_(273) - , IteratorPrototype = {}; - -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -_dereq_(238)(IteratorPrototype, _dereq_(290)('iterator'), function(){ return this; }); - -module.exports = function(Constructor, NAME, next){ - Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)}); - setToStringTag(Constructor, NAME + ' Iterator'); -}; -},{"238":238,"253":253,"266":266,"273":273,"290":290}],249:[function(_dereq_,module,exports){ -'use strict'; -var LIBRARY = _dereq_(255) - , $export = _dereq_(229) - , redefine = _dereq_(268) - , hide = _dereq_(238) - , has = _dereq_(237) - , Iterators = _dereq_(252) - , $iterCreate = _dereq_(248) - , setToStringTag = _dereq_(273) - , getProto = _dereq_(253).getProto - , ITERATOR = _dereq_(290)('iterator') - , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` - , FF_ITERATOR = '@@iterator' - , KEYS = 'keys' - , VALUES = 'values'; - -var returnThis = function(){ return this; }; - -module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ - $iterCreate(Constructor, NAME, next); - var getMethod = function(kind){ - if(!BUGGY && kind in proto)return proto[kind]; - switch(kind){ - case KEYS: return function keys(){ return new Constructor(this, kind); }; - case VALUES: return function values(){ return new Constructor(this, kind); }; - } return function entries(){ return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator' - , DEF_VALUES = DEFAULT == VALUES - , VALUES_BUG = false - , proto = Base.prototype - , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] - , $default = $native || getMethod(DEFAULT) - , methods, key; - // Fix native - if($native){ - var IteratorPrototype = getProto($default.call(new Base)); - // Set @@toStringTag to native iterators - setToStringTag(IteratorPrototype, TAG, true); - // FF fix - if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); - // fix Array#{values, @@iterator}.name in V8 / FF - if(DEF_VALUES && $native.name !== VALUES){ - VALUES_BUG = true; - $default = function values(){ return $native.call(this); }; - } - } - // Define iterator - if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ - hide(proto, ITERATOR, $default); - } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if(DEFAULT){ - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: !DEF_VALUES ? $default : getMethod('entries') - }; - if(FORCED)for(key in methods){ - if(!(key in proto))redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; -}; -},{"229":229,"237":237,"238":238,"248":248,"252":252,"253":253,"255":255,"268":268,"273":273,"290":290}],250:[function(_dereq_,module,exports){ -var ITERATOR = _dereq_(290)('iterator') - , SAFE_CLOSING = false; - -try { - var riter = [7][ITERATOR](); - riter['return'] = function(){ SAFE_CLOSING = true; }; - Array.from(riter, function(){ throw 2; }); -} catch(e){ /* empty */ } - -module.exports = function(exec, skipClosing){ - if(!skipClosing && !SAFE_CLOSING)return false; - var safe = false; - try { - var arr = [7] - , iter = arr[ITERATOR](); - iter.next = function(){ safe = true; }; - arr[ITERATOR] = function(){ return iter; }; - exec(arr); - } catch(e){ /* empty */ } - return safe; -}; -},{"290":290}],251:[function(_dereq_,module,exports){ -module.exports = function(done, value){ - return {value: value, done: !!done}; -}; -},{}],252:[function(_dereq_,module,exports){ -module.exports = {}; -},{}],253:[function(_dereq_,module,exports){ -var $Object = Object; -module.exports = { - create: $Object.create, - getProto: $Object.getPrototypeOf, - isEnum: {}.propertyIsEnumerable, - getDesc: $Object.getOwnPropertyDescriptor, - setDesc: $Object.defineProperty, - setDescs: $Object.defineProperties, - getKeys: $Object.keys, - getNames: $Object.getOwnPropertyNames, - getSymbols: $Object.getOwnPropertySymbols, - each: [].forEach -}; -},{}],254:[function(_dereq_,module,exports){ -var $ = _dereq_(253) - , toIObject = _dereq_(285); -module.exports = function(object, el){ - var O = toIObject(object) - , keys = $.getKeys(O) - , length = keys.length - , index = 0 - , key; - while(length > index)if(O[key = keys[index++]] === el)return key; -}; -},{"253":253,"285":285}],255:[function(_dereq_,module,exports){ -module.exports = false; -},{}],256:[function(_dereq_,module,exports){ -// 20.2.2.14 Math.expm1(x) -module.exports = Math.expm1 || function expm1(x){ - return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; -}; -},{}],257:[function(_dereq_,module,exports){ -// 20.2.2.20 Math.log1p(x) -module.exports = Math.log1p || function log1p(x){ - return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); -}; -},{}],258:[function(_dereq_,module,exports){ -// 20.2.2.28 Math.sign(x) -module.exports = Math.sign || function sign(x){ - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; -}; -},{}],259:[function(_dereq_,module,exports){ -var global = _dereq_(236) - , macrotask = _dereq_(282).set - , Observer = global.MutationObserver || global.WebKitMutationObserver - , process = global.process - , Promise = global.Promise - , isNode = _dereq_(218)(process) == 'process' - , head, last, notify; - -var flush = function(){ - var parent, domain, fn; - if(isNode && (parent = process.domain)){ - process.domain = null; - parent.exit(); - } - while(head){ - domain = head.domain; - fn = head.fn; - if(domain)domain.enter(); - fn(); // <- currently we use it only for Promise - try / catch not required - if(domain)domain.exit(); - head = head.next; - } last = undefined; - if(parent)parent.enter(); -}; - -// Node.js -if(isNode){ - notify = function(){ - process.nextTick(flush); - }; -// browsers with MutationObserver -} else if(Observer){ - var toggle = 1 - , node = document.createTextNode(''); - new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new - notify = function(){ - node.data = toggle = -toggle; - }; -// environments with maybe non-completely correct, but existent Promise -} else if(Promise && Promise.resolve){ - notify = function(){ - Promise.resolve().then(flush); - }; -// for other environments - macrotask based on: -// - setImmediate -// - MessageChannel -// - window.postMessag -// - onreadystatechange -// - setTimeout -} else { - notify = function(){ - // strange IE + webpack dev server bug - use .call(global) - macrotask.call(global, flush); - }; -} - -module.exports = function asap(fn){ - var task = {fn: fn, next: undefined, domain: isNode && process.domain}; - if(last)last.next = task; - if(!head){ - head = task; - notify(); - } last = task; -}; -},{"218":218,"236":236,"282":282}],260:[function(_dereq_,module,exports){ -// 19.1.2.1 Object.assign(target, source, ...) -var $ = _dereq_(253) - , toObject = _dereq_(287) - , IObject = _dereq_(241); - -// should work with symbols and should have deterministic property order (V8 bug) -module.exports = _dereq_(231)(function(){ - var a = Object.assign - , A = {} - , B = {} - , S = Symbol() - , K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function(k){ B[k] = k; }); - return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K; -}) ? function assign(target, source){ // eslint-disable-line no-unused-vars - var T = toObject(target) - , $$ = arguments - , $$len = $$.length - , index = 1 - , getKeys = $.getKeys - , getSymbols = $.getSymbols - , isEnum = $.isEnum; - while($$len > index){ - var S = IObject($$[index++]) - , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) - , length = keys.length - , j = 0 - , key; - while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; - } - return T; -} : Object.assign; -},{"231":231,"241":241,"253":253,"287":287}],261:[function(_dereq_,module,exports){ -// most Object methods by ES6 should accept primitives -var $export = _dereq_(229) - , core = _dereq_(223) - , fails = _dereq_(231); -module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); -}; -},{"223":223,"229":229,"231":231}],262:[function(_dereq_,module,exports){ -var $ = _dereq_(253) - , toIObject = _dereq_(285) - , isEnum = $.isEnum; -module.exports = function(isEntries){ - return function(it){ - var O = toIObject(it) - , keys = $.getKeys(O) - , length = keys.length - , i = 0 - , result = [] - , key; - while(length > i)if(isEnum.call(O, key = keys[i++])){ - result.push(isEntries ? [key, O[key]] : O[key]); - } return result; - }; -}; -},{"253":253,"285":285}],263:[function(_dereq_,module,exports){ -// all object keys, includes non-enumerable and symbols -var $ = _dereq_(253) - , anObject = _dereq_(211) - , Reflect = _dereq_(236).Reflect; -module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ - var keys = $.getNames(anObject(it)) - , getSymbols = $.getSymbols; - return getSymbols ? keys.concat(getSymbols(it)) : keys; -}; -},{"211":211,"236":236,"253":253}],264:[function(_dereq_,module,exports){ -'use strict'; -var path = _dereq_(265) - , invoke = _dereq_(240) - , aFunction = _dereq_(209); -module.exports = function(/* ...pargs */){ - var fn = aFunction(this) - , length = arguments.length - , pargs = Array(length) - , i = 0 - , _ = path._ - , holder = false; - while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true; - return function(/* ...args */){ - var that = this - , $$ = arguments - , $$len = $$.length - , j = 0, k = 0, args; - if(!holder && !$$len)return invoke(fn, pargs, that); - args = pargs.slice(); - if(holder)for(;length > j; j++)if(args[j] === _)args[j] = $$[k++]; - while($$len > k)args.push($$[k++]); - return invoke(fn, args, that); - }; -}; -},{"209":209,"240":240,"265":265}],265:[function(_dereq_,module,exports){ -module.exports = _dereq_(236); -},{"236":236}],266:[function(_dereq_,module,exports){ -module.exports = function(bitmap, value){ - return { - enumerable : !(bitmap & 1), - configurable: !(bitmap & 2), - writable : !(bitmap & 4), - value : value - }; -}; -},{}],267:[function(_dereq_,module,exports){ -var redefine = _dereq_(268); -module.exports = function(target, src){ - for(var key in src)redefine(target, key, src[key]); - return target; -}; -},{"268":268}],268:[function(_dereq_,module,exports){ -// add fake Function#toString -// for correct work wrapped methods / constructors with methods like LoDash isNative -var global = _dereq_(236) - , hide = _dereq_(238) - , SRC = _dereq_(289)('src') - , TO_STRING = 'toString' - , $toString = Function[TO_STRING] - , TPL = ('' + $toString).split(TO_STRING); - -_dereq_(223).inspectSource = function(it){ - return $toString.call(it); -}; - -(module.exports = function(O, key, val, safe){ - if(typeof val == 'function'){ - val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); - val.hasOwnProperty('name') || hide(val, 'name', key); - } - if(O === global){ - O[key] = val; - } else { - if(!safe)delete O[key]; - hide(O, key, val); - } -})(Function.prototype, TO_STRING, function toString(){ - return typeof this == 'function' && this[SRC] || $toString.call(this); -}); -},{"223":223,"236":236,"238":238,"289":289}],269:[function(_dereq_,module,exports){ -module.exports = function(regExp, replace){ - var replacer = replace === Object(replace) ? function(part){ - return replace[part]; - } : replace; - return function(it){ - return String(it).replace(regExp, replacer); - }; -}; -},{}],270:[function(_dereq_,module,exports){ -// 7.2.9 SameValue(x, y) -module.exports = Object.is || function is(x, y){ - return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; -}; -},{}],271:[function(_dereq_,module,exports){ -// Works with __proto__ only. Old v8 can't work with null proto objects. -/* eslint-disable no-proto */ -var getDesc = _dereq_(253).getDesc - , isObject = _dereq_(245) - , anObject = _dereq_(211); -var check = function(O, proto){ - anObject(O); - if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); -}; -module.exports = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function(test, buggy, set){ - try { - set = _dereq_(224)(Function.call, getDesc(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch(e){ buggy = true; } - return function setPrototypeOf(O, proto){ - check(O, proto); - if(buggy)O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check -}; -},{"211":211,"224":224,"245":245,"253":253}],272:[function(_dereq_,module,exports){ -'use strict'; -var global = _dereq_(236) - , $ = _dereq_(253) - , DESCRIPTORS = _dereq_(226) - , SPECIES = _dereq_(290)('species'); - -module.exports = function(KEY){ - var C = global[KEY]; - if(DESCRIPTORS && C && !C[SPECIES])$.setDesc(C, SPECIES, { - configurable: true, - get: function(){ return this; } - }); -}; -},{"226":226,"236":236,"253":253,"290":290}],273:[function(_dereq_,module,exports){ -var def = _dereq_(253).setDesc - , has = _dereq_(237) - , TAG = _dereq_(290)('toStringTag'); - -module.exports = function(it, tag, stat){ - if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); -}; -},{"237":237,"253":253,"290":290}],274:[function(_dereq_,module,exports){ -var global = _dereq_(236) - , SHARED = '__core-js_shared__' - , store = global[SHARED] || (global[SHARED] = {}); -module.exports = function(key){ - return store[key] || (store[key] = {}); -}; -},{"236":236}],275:[function(_dereq_,module,exports){ -// 7.3.20 SpeciesConstructor(O, defaultConstructor) -var anObject = _dereq_(211) - , aFunction = _dereq_(209) - , SPECIES = _dereq_(290)('species'); -module.exports = function(O, D){ - var C = anObject(O).constructor, S; - return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); -}; -},{"209":209,"211":211,"290":290}],276:[function(_dereq_,module,exports){ -module.exports = function(it, Constructor, name){ - if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!"); - return it; -}; -},{}],277:[function(_dereq_,module,exports){ -var toInteger = _dereq_(284) - , defined = _dereq_(225); -// true -> String#at -// false -> String#codePointAt -module.exports = function(TO_STRING){ - return function(that, pos){ - var s = String(defined(that)) - , i = toInteger(pos) - , l = s.length - , a, b; - if(i < 0 || i >= l)return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; -}; -},{"225":225,"284":284}],278:[function(_dereq_,module,exports){ -// helper for String#{startsWith, endsWith, includes} -var isRegExp = _dereq_(246) - , defined = _dereq_(225); - -module.exports = function(that, searchString, NAME){ - if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); - return String(defined(that)); -}; -},{"225":225,"246":246}],279:[function(_dereq_,module,exports){ -// https://github.com/ljharb/proposal-string-pad-left-right -var toLength = _dereq_(286) - , repeat = _dereq_(280) - , defined = _dereq_(225); - -module.exports = function(that, maxLength, fillString, left){ - var S = String(defined(that)) - , stringLength = S.length - , fillStr = fillString === undefined ? ' ' : String(fillString) - , intMaxLength = toLength(maxLength); - if(intMaxLength <= stringLength)return S; - if(fillStr == '')fillStr = ' '; - var fillLen = intMaxLength - stringLength - , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); - if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen); - return left ? stringFiller + S : S + stringFiller; -}; -},{"225":225,"280":280,"286":286}],280:[function(_dereq_,module,exports){ -'use strict'; -var toInteger = _dereq_(284) - , defined = _dereq_(225); - -module.exports = function repeat(count){ - var str = String(defined(this)) - , res = '' - , n = toInteger(count); - if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); - for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; - return res; -}; -},{"225":225,"284":284}],281:[function(_dereq_,module,exports){ -var $export = _dereq_(229) - , defined = _dereq_(225) - , fails = _dereq_(231) - , spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF' - , space = '[' + spaces + ']' - , non = '\u200b\u0085' - , ltrim = RegExp('^' + space + space + '*') - , rtrim = RegExp(space + space + '*$'); - -var exporter = function(KEY, exec){ - var exp = {}; - exp[KEY] = exec(trim); - $export($export.P + $export.F * fails(function(){ - return !!spaces[KEY]() || non[KEY]() != non; - }), 'String', exp); -}; - -// 1 -> String#trimLeft -// 2 -> String#trimRight -// 3 -> String#trim -var trim = exporter.trim = function(string, TYPE){ - string = String(defined(string)); - if(TYPE & 1)string = string.replace(ltrim, ''); - if(TYPE & 2)string = string.replace(rtrim, ''); - return string; -}; - -module.exports = exporter; -},{"225":225,"229":229,"231":231}],282:[function(_dereq_,module,exports){ -var ctx = _dereq_(224) - , invoke = _dereq_(240) - , html = _dereq_(239) - , cel = _dereq_(227) - , global = _dereq_(236) - , process = global.process - , setTask = global.setImmediate - , clearTask = global.clearImmediate - , MessageChannel = global.MessageChannel - , counter = 0 - , queue = {} - , ONREADYSTATECHANGE = 'onreadystatechange' - , defer, channel, port; -var run = function(){ - var id = +this; - if(queue.hasOwnProperty(id)){ - var fn = queue[id]; - delete queue[id]; - fn(); - } -}; -var listner = function(event){ - run.call(event.data); -}; -// Node.js 0.9+ & IE10+ has setImmediate, otherwise: -if(!setTask || !clearTask){ - setTask = function setImmediate(fn){ - var args = [], i = 1; - while(arguments.length > i)args.push(arguments[i++]); - queue[++counter] = function(){ - invoke(typeof fn == 'function' ? fn : Function(fn), args); - }; - defer(counter); - return counter; - }; - clearTask = function clearImmediate(id){ - delete queue[id]; - }; - // Node.js 0.8- - if(_dereq_(218)(process) == 'process'){ - defer = function(id){ - process.nextTick(ctx(run, id, 1)); - }; - // Browsers with MessageChannel, includes WebWorkers - } else if(MessageChannel){ - channel = new MessageChannel; - port = channel.port2; - channel.port1.onmessage = listner; - defer = ctx(port.postMessage, port, 1); - // Browsers with postMessage, skip WebWorkers - // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ - defer = function(id){ - global.postMessage(id + '', '*'); - }; - global.addEventListener('message', listner, false); - // IE8- - } else if(ONREADYSTATECHANGE in cel('script')){ - defer = function(id){ - html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ - html.removeChild(this); - run.call(id); - }; - }; - // Rest old browsers - } else { - defer = function(id){ - setTimeout(ctx(run, id, 1), 0); - }; - } -} -module.exports = { - set: setTask, - clear: clearTask -}; -},{"218":218,"224":224,"227":227,"236":236,"239":239,"240":240}],283:[function(_dereq_,module,exports){ -var toInteger = _dereq_(284) - , max = Math.max - , min = Math.min; -module.exports = function(index, length){ - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); -}; -},{"284":284}],284:[function(_dereq_,module,exports){ -// 7.1.4 ToInteger -var ceil = Math.ceil - , floor = Math.floor; -module.exports = function(it){ - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); -}; -},{}],285:[function(_dereq_,module,exports){ -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = _dereq_(241) - , defined = _dereq_(225); -module.exports = function(it){ - return IObject(defined(it)); -}; -},{"225":225,"241":241}],286:[function(_dereq_,module,exports){ -// 7.1.15 ToLength -var toInteger = _dereq_(284) - , min = Math.min; -module.exports = function(it){ - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 -}; -},{"284":284}],287:[function(_dereq_,module,exports){ -// 7.1.13 ToObject(argument) -var defined = _dereq_(225); -module.exports = function(it){ - return Object(defined(it)); -}; -},{"225":225}],288:[function(_dereq_,module,exports){ -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = _dereq_(245); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function(it, S){ - if(!isObject(it))return it; - var fn, val; - if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; - if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - throw TypeError("Can't convert object to primitive value"); -}; -},{"245":245}],289:[function(_dereq_,module,exports){ -var id = 0 - , px = Math.random(); -module.exports = function(key){ - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; -},{}],290:[function(_dereq_,module,exports){ -var store = _dereq_(274)('wks') - , uid = _dereq_(289) - , Symbol = _dereq_(236).Symbol; -module.exports = function(name){ - return store[name] || (store[name] = - Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); -}; -},{"236":236,"274":274,"289":289}],291:[function(_dereq_,module,exports){ -var classof = _dereq_(217) - , ITERATOR = _dereq_(290)('iterator') - , Iterators = _dereq_(252); -module.exports = _dereq_(223).getIteratorMethod = function(it){ - if(it != undefined)return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; -}; -},{"217":217,"223":223,"252":252,"290":290}],292:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , $export = _dereq_(229) - , DESCRIPTORS = _dereq_(226) - , createDesc = _dereq_(266) - , html = _dereq_(239) - , cel = _dereq_(227) - , has = _dereq_(237) - , cof = _dereq_(218) - , invoke = _dereq_(240) - , fails = _dereq_(231) - , anObject = _dereq_(211) - , aFunction = _dereq_(209) - , isObject = _dereq_(245) - , toObject = _dereq_(287) - , toIObject = _dereq_(285) - , toInteger = _dereq_(284) - , toIndex = _dereq_(283) - , toLength = _dereq_(286) - , IObject = _dereq_(241) - , IE_PROTO = _dereq_(289)('__proto__') - , createArrayMethod = _dereq_(215) - , arrayIndexOf = _dereq_(214)(false) - , ObjectProto = Object.prototype - , ArrayProto = Array.prototype - , arraySlice = ArrayProto.slice - , arrayJoin = ArrayProto.join - , defineProperty = $.setDesc - , getOwnDescriptor = $.getDesc - , defineProperties = $.setDescs - , factories = {} - , IE8_DOM_DEFINE; - -if(!DESCRIPTORS){ - IE8_DOM_DEFINE = !fails(function(){ - return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7; - }); - $.setDesc = function(O, P, Attributes){ - if(IE8_DOM_DEFINE)try { - return defineProperty(O, P, Attributes); - } catch(e){ /* empty */ } - if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); - if('value' in Attributes)anObject(O)[P] = Attributes.value; - return O; - }; - $.getDesc = function(O, P){ - if(IE8_DOM_DEFINE)try { - return getOwnDescriptor(O, P); - } catch(e){ /* empty */ } - if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]); - }; - $.setDescs = defineProperties = function(O, Properties){ - anObject(O); - var keys = $.getKeys(Properties) - , length = keys.length - , i = 0 - , P; - while(length > i)$.setDesc(O, P = keys[i++], Properties[P]); - return O; - }; -} -$export($export.S + $export.F * !DESCRIPTORS, 'Object', { - // 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $.getDesc, - // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) - defineProperty: $.setDesc, - // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) - defineProperties: defineProperties -}); - - // IE 8- don't enum bug keys -var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' + - 'toLocaleString,toString,valueOf').split(',') - // Additional keys for getOwnPropertyNames - , keys2 = keys1.concat('length', 'prototype') - , keysLen1 = keys1.length; - -// Create object with `null` prototype: use iframe Object with cleared prototype -var createDict = function(){ - // Thrash, waste and sodomy: IE GC bug - var iframe = cel('iframe') - , i = keysLen1 - , gt = '>' - , iframeDocument; - iframe.style.display = 'none'; - html.appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write('<script>document.F=Object</script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while(i--)delete createDict.prototype[keys1[i]]; - return createDict(); -}; -var createGetKeys = function(names, length){ - return function(object){ - var O = toIObject(object) - , i = 0 - , result = [] - , key; - for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while(length > i)if(has(O, key = names[i++])){ - ~arrayIndexOf(result, key) || result.push(key); - } - return result; - }; -}; -var Empty = function(){}; -$export($export.S, 'Object', { - // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) - getPrototypeOf: $.getProto = $.getProto || function(O){ - O = toObject(O); - if(has(O, IE_PROTO))return O[IE_PROTO]; - if(typeof O.constructor == 'function' && O instanceof O.constructor){ - return O.constructor.prototype; - } return O instanceof Object ? ObjectProto : null; - }, - // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true), - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - create: $.create = $.create || function(O, /*?*/Properties){ - var result; - if(O !== null){ - Empty.prototype = anObject(O); - result = new Empty(); - Empty.prototype = null; - // add "__proto__" for Object.getPrototypeOf shim - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : defineProperties(result, Properties); - }, - // 19.1.2.14 / 15.2.3.14 Object.keys(O) - keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false) -}); - -var construct = function(F, len, args){ - if(!(len in factories)){ - for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; - factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); - } - return factories[len](F, args); -}; - -// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) -$export($export.P, 'Function', { - bind: function bind(that /*, args... */){ - var fn = aFunction(this) - , partArgs = arraySlice.call(arguments, 1); - var bound = function(/* args... */){ - var args = partArgs.concat(arraySlice.call(arguments)); - return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); - }; - if(isObject(fn.prototype))bound.prototype = fn.prototype; - return bound; - } -}); - -// fallback for not array-like ES3 strings and DOM objects -$export($export.P + $export.F * fails(function(){ - if(html)arraySlice.call(html); -}), 'Array', { - slice: function(begin, end){ - var len = toLength(this.length) - , klass = cof(this); - end = end === undefined ? len : end; - if(klass == 'Array')return arraySlice.call(this, begin, end); - var start = toIndex(begin, len) - , upTo = toIndex(end, len) - , size = toLength(upTo - start) - , cloned = Array(size) - , i = 0; - for(; i < size; i++)cloned[i] = klass == 'String' - ? this.charAt(start + i) - : this[start + i]; - return cloned; - } -}); -$export($export.P + $export.F * (IObject != Object), 'Array', { - join: function join(separator){ - return arrayJoin.call(IObject(this), separator === undefined ? ',' : separator); - } -}); - -// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) -$export($export.S, 'Array', {isArray: _dereq_(243)}); - -var createArrayReduce = function(isRight){ - return function(callbackfn, memo){ - aFunction(callbackfn); - var O = IObject(this) - , length = toLength(O.length) - , index = isRight ? length - 1 : 0 - , i = isRight ? -1 : 1; - if(arguments.length < 2)for(;;){ - if(index in O){ - memo = O[index]; - index += i; - break; - } - index += i; - if(isRight ? index < 0 : length <= index){ - throw TypeError('Reduce of empty array with no initial value'); - } - } - for(;isRight ? index >= 0 : length > index; index += i)if(index in O){ - memo = callbackfn(memo, O[index], index, this); - } - return memo; - }; -}; - -var methodize = function($fn){ - return function(arg1/*, arg2 = undefined */){ - return $fn(this, arg1, arguments[1]); - }; -}; - -$export($export.P, 'Array', { - // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) - forEach: $.each = $.each || methodize(createArrayMethod(0)), - // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) - map: methodize(createArrayMethod(1)), - // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) - filter: methodize(createArrayMethod(2)), - // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) - some: methodize(createArrayMethod(3)), - // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) - every: methodize(createArrayMethod(4)), - // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) - reduce: createArrayReduce(false), - // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) - reduceRight: createArrayReduce(true), - // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) - indexOf: methodize(arrayIndexOf), - // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) - lastIndexOf: function(el, fromIndex /* = @[*-1] */){ - var O = toIObject(this) - , length = toLength(O.length) - , index = length - 1; - if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex)); - if(index < 0)index = toLength(length + index); - for(;index >= 0; index--)if(index in O)if(O[index] === el)return index; - return -1; - } -}); - -// 20.3.3.1 / 15.9.4.4 Date.now() -$export($export.S, 'Date', {now: function(){ return +new Date; }}); - -var lz = function(num){ - return num > 9 ? num : '0' + num; -}; - -// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() -// PhantomJS / old WebKit has a broken implementations -$export($export.P + $export.F * (fails(function(){ - return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z'; -}) || !fails(function(){ - new Date(NaN).toISOString(); -})), 'Date', { - toISOString: function toISOString(){ - if(!isFinite(this))throw RangeError('Invalid time value'); - var d = this - , y = d.getUTCFullYear() - , m = d.getUTCMilliseconds() - , s = y < 0 ? '-' : y > 9999 ? '+' : ''; - return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + - '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + - 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + - ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; - } -}); -},{"209":209,"211":211,"214":214,"215":215,"218":218,"226":226,"227":227,"229":229,"231":231,"237":237,"239":239,"240":240,"241":241,"243":243,"245":245,"253":253,"266":266,"283":283,"284":284,"285":285,"286":286,"287":287,"289":289}],293:[function(_dereq_,module,exports){ -// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) -var $export = _dereq_(229); - -$export($export.P, 'Array', {copyWithin: _dereq_(212)}); - -_dereq_(210)('copyWithin'); -},{"210":210,"212":212,"229":229}],294:[function(_dereq_,module,exports){ -// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) -var $export = _dereq_(229); - -$export($export.P, 'Array', {fill: _dereq_(213)}); - -_dereq_(210)('fill'); -},{"210":210,"213":213,"229":229}],295:[function(_dereq_,module,exports){ -'use strict'; -// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) -var $export = _dereq_(229) - , $find = _dereq_(215)(6) - , KEY = 'findIndex' - , forced = true; -// Shouldn't skip holes -if(KEY in [])Array(1)[KEY](function(){ forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - findIndex: function findIndex(callbackfn/*, that = undefined */){ - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -_dereq_(210)(KEY); -},{"210":210,"215":215,"229":229}],296:[function(_dereq_,module,exports){ -'use strict'; -// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) -var $export = _dereq_(229) - , $find = _dereq_(215)(5) - , KEY = 'find' - , forced = true; -// Shouldn't skip holes -if(KEY in [])Array(1)[KEY](function(){ forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - find: function find(callbackfn/*, that = undefined */){ - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -_dereq_(210)(KEY); -},{"210":210,"215":215,"229":229}],297:[function(_dereq_,module,exports){ -'use strict'; -var ctx = _dereq_(224) - , $export = _dereq_(229) - , toObject = _dereq_(287) - , call = _dereq_(247) - , isArrayIter = _dereq_(242) - , toLength = _dereq_(286) - , getIterFn = _dereq_(291); -$export($export.S + $export.F * !_dereq_(250)(function(iter){ Array.from(iter); }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ - var O = toObject(arrayLike) - , C = typeof this == 'function' ? this : Array - , $$ = arguments - , $$len = $$.length - , mapfn = $$len > 1 ? $$[1] : undefined - , mapping = mapfn !== undefined - , index = 0 - , iterFn = getIterFn(O) - , length, result, step, iterator; - if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ - for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ - result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value; - } - } else { - length = toLength(O.length); - for(result = new C(length); length > index; index++){ - result[index] = mapping ? mapfn(O[index], index) : O[index]; - } - } - result.length = index; - return result; - } -}); - -},{"224":224,"229":229,"242":242,"247":247,"250":250,"286":286,"287":287,"291":291}],298:[function(_dereq_,module,exports){ -'use strict'; -var addToUnscopables = _dereq_(210) - , step = _dereq_(251) - , Iterators = _dereq_(252) - , toIObject = _dereq_(285); - -// 22.1.3.4 Array.prototype.entries() -// 22.1.3.13 Array.prototype.keys() -// 22.1.3.29 Array.prototype.values() -// 22.1.3.30 Array.prototype[@@iterator]() -module.exports = _dereq_(249)(Array, 'Array', function(iterated, kind){ - this._t = toIObject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind -// 22.1.5.2.1 %ArrayIteratorPrototype%.next() -}, function(){ - var O = this._t - , kind = this._k - , index = this._i++; - if(!O || index >= O.length){ - this._t = undefined; - return step(1); - } - if(kind == 'keys' )return step(0, index); - if(kind == 'values')return step(0, O[index]); - return step(0, [index, O[index]]); -}, 'values'); - -// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) -Iterators.Arguments = Iterators.Array; - -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); -},{"210":210,"249":249,"251":251,"252":252,"285":285}],299:[function(_dereq_,module,exports){ -'use strict'; -var $export = _dereq_(229); - -// WebKit Array.of isn't generic -$export($export.S + $export.F * _dereq_(231)(function(){ - function F(){} - return !(Array.of.call(F) instanceof F); -}), 'Array', { - // 22.1.2.3 Array.of( ...items) - of: function of(/* ...args */){ - var index = 0 - , $$ = arguments - , $$len = $$.length - , result = new (typeof this == 'function' ? this : Array)($$len); - while($$len > index)result[index] = $$[index++]; - result.length = $$len; - return result; - } -}); -},{"229":229,"231":231}],300:[function(_dereq_,module,exports){ -_dereq_(272)('Array'); -},{"272":272}],301:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , isObject = _dereq_(245) - , HAS_INSTANCE = _dereq_(290)('hasInstance') - , FunctionProto = Function.prototype; -// 19.2.3.6 Function.prototype[@@hasInstance](V) -if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){ - if(typeof this != 'function' || !isObject(O))return false; - if(!isObject(this.prototype))return O instanceof this; - // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: - while(O = $.getProto(O))if(this.prototype === O)return true; - return false; -}}); -},{"245":245,"253":253,"290":290}],302:[function(_dereq_,module,exports){ -var setDesc = _dereq_(253).setDesc - , createDesc = _dereq_(266) - , has = _dereq_(237) - , FProto = Function.prototype - , nameRE = /^\s*function ([^ (]*)/ - , NAME = 'name'; -// 19.2.4.2 name -NAME in FProto || _dereq_(226) && setDesc(FProto, NAME, { - configurable: true, - get: function(){ - var match = ('' + this).match(nameRE) - , name = match ? match[1] : ''; - has(this, NAME) || setDesc(this, NAME, createDesc(5, name)); - return name; - } -}); -},{"226":226,"237":237,"253":253,"266":266}],303:[function(_dereq_,module,exports){ -'use strict'; -var strong = _dereq_(219); - -// 23.1 Map Objects -_dereq_(222)('Map', function(get){ - return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.1.3.6 Map.prototype.get(key) - get: function get(key){ - var entry = strong.getEntry(this, key); - return entry && entry.v; - }, - // 23.1.3.9 Map.prototype.set(key, value) - set: function set(key, value){ - return strong.def(this, key === 0 ? 0 : key, value); - } -}, strong, true); -},{"219":219,"222":222}],304:[function(_dereq_,module,exports){ -// 20.2.2.3 Math.acosh(x) -var $export = _dereq_(229) - , log1p = _dereq_(257) - , sqrt = Math.sqrt - , $acosh = Math.acosh; - -// V8 bug https://code.google.com/p/v8/issues/detail?id=3509 -$export($export.S + $export.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', { - acosh: function acosh(x){ - return (x = +x) < 1 ? NaN : x > 94906265.62425156 - ? Math.log(x) + Math.LN2 - : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); - } -}); -},{"229":229,"257":257}],305:[function(_dereq_,module,exports){ -// 20.2.2.5 Math.asinh(x) -var $export = _dereq_(229); - -function asinh(x){ - return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); -} - -$export($export.S, 'Math', {asinh: asinh}); -},{"229":229}],306:[function(_dereq_,module,exports){ -// 20.2.2.7 Math.atanh(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', { - atanh: function atanh(x){ - return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; - } -}); -},{"229":229}],307:[function(_dereq_,module,exports){ -// 20.2.2.9 Math.cbrt(x) -var $export = _dereq_(229) - , sign = _dereq_(258); - -$export($export.S, 'Math', { - cbrt: function cbrt(x){ - return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); - } -}); -},{"229":229,"258":258}],308:[function(_dereq_,module,exports){ -// 20.2.2.11 Math.clz32(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', { - clz32: function clz32(x){ - return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; - } -}); -},{"229":229}],309:[function(_dereq_,module,exports){ -// 20.2.2.12 Math.cosh(x) -var $export = _dereq_(229) - , exp = Math.exp; - -$export($export.S, 'Math', { - cosh: function cosh(x){ - return (exp(x = +x) + exp(-x)) / 2; - } -}); -},{"229":229}],310:[function(_dereq_,module,exports){ -// 20.2.2.14 Math.expm1(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', {expm1: _dereq_(256)}); -},{"229":229,"256":256}],311:[function(_dereq_,module,exports){ -// 20.2.2.16 Math.fround(x) -var $export = _dereq_(229) - , sign = _dereq_(258) - , pow = Math.pow - , EPSILON = pow(2, -52) - , EPSILON32 = pow(2, -23) - , MAX32 = pow(2, 127) * (2 - EPSILON32) - , MIN32 = pow(2, -126); - -var roundTiesToEven = function(n){ - return n + 1 / EPSILON - 1 / EPSILON; -}; - - -$export($export.S, 'Math', { - fround: function fround(x){ - var $abs = Math.abs(x) - , $sign = sign(x) - , a, result; - if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; - a = (1 + EPSILON32 / EPSILON) * $abs; - result = a - (a - $abs); - if(result > MAX32 || result != result)return $sign * Infinity; - return $sign * result; - } -}); -},{"229":229,"258":258}],312:[function(_dereq_,module,exports){ -// 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) -var $export = _dereq_(229) - , abs = Math.abs; - -$export($export.S, 'Math', { - hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars - var sum = 0 - , i = 0 - , $$ = arguments - , $$len = $$.length - , larg = 0 - , arg, div; - while(i < $$len){ - arg = abs($$[i++]); - if(larg < arg){ - div = larg / arg; - sum = sum * div * div + 1; - larg = arg; - } else if(arg > 0){ - div = arg / larg; - sum += div * div; - } else sum += arg; - } - return larg === Infinity ? Infinity : larg * Math.sqrt(sum); - } -}); -},{"229":229}],313:[function(_dereq_,module,exports){ -// 20.2.2.18 Math.imul(x, y) -var $export = _dereq_(229) - , $imul = Math.imul; - -// some WebKit versions fails with big numbers, some has wrong arity -$export($export.S + $export.F * _dereq_(231)(function(){ - return $imul(0xffffffff, 5) != -5 || $imul.length != 2; -}), 'Math', { - imul: function imul(x, y){ - var UINT16 = 0xffff - , xn = +x - , yn = +y - , xl = UINT16 & xn - , yl = UINT16 & yn; - return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); - } -}); -},{"229":229,"231":231}],314:[function(_dereq_,module,exports){ -// 20.2.2.21 Math.log10(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', { - log10: function log10(x){ - return Math.log(x) / Math.LN10; - } -}); -},{"229":229}],315:[function(_dereq_,module,exports){ -// 20.2.2.20 Math.log1p(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', {log1p: _dereq_(257)}); -},{"229":229,"257":257}],316:[function(_dereq_,module,exports){ -// 20.2.2.22 Math.log2(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', { - log2: function log2(x){ - return Math.log(x) / Math.LN2; - } -}); -},{"229":229}],317:[function(_dereq_,module,exports){ -// 20.2.2.28 Math.sign(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', {sign: _dereq_(258)}); -},{"229":229,"258":258}],318:[function(_dereq_,module,exports){ -// 20.2.2.30 Math.sinh(x) -var $export = _dereq_(229) - , expm1 = _dereq_(256) - , exp = Math.exp; - -// V8 near Chromium 38 has a problem with very small numbers -$export($export.S + $export.F * _dereq_(231)(function(){ - return !Math.sinh(-2e-17) != -2e-17; -}), 'Math', { - sinh: function sinh(x){ - return Math.abs(x = +x) < 1 - ? (expm1(x) - expm1(-x)) / 2 - : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); - } -}); -},{"229":229,"231":231,"256":256}],319:[function(_dereq_,module,exports){ -// 20.2.2.33 Math.tanh(x) -var $export = _dereq_(229) - , expm1 = _dereq_(256) - , exp = Math.exp; - -$export($export.S, 'Math', { - tanh: function tanh(x){ - var a = expm1(x = +x) - , b = expm1(-x); - return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); - } -}); -},{"229":229,"256":256}],320:[function(_dereq_,module,exports){ -// 20.2.2.34 Math.trunc(x) -var $export = _dereq_(229); - -$export($export.S, 'Math', { - trunc: function trunc(it){ - return (it > 0 ? Math.floor : Math.ceil)(it); - } -}); -},{"229":229}],321:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , global = _dereq_(236) - , has = _dereq_(237) - , cof = _dereq_(218) - , toPrimitive = _dereq_(288) - , fails = _dereq_(231) - , $trim = _dereq_(281).trim - , NUMBER = 'Number' - , $Number = global[NUMBER] - , Base = $Number - , proto = $Number.prototype - // Opera ~12 has broken Object#toString - , BROKEN_COF = cof($.create(proto)) == NUMBER - , TRIM = 'trim' in String.prototype; - -// 7.1.3 ToNumber(argument) -var toNumber = function(argument){ - var it = toPrimitive(argument, false); - if(typeof it == 'string' && it.length > 2){ - it = TRIM ? it.trim() : $trim(it, 3); - var first = it.charCodeAt(0) - , third, radix, maxCode; - if(first === 43 || first === 45){ - third = it.charCodeAt(2); - if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix - } else if(first === 48){ - switch(it.charCodeAt(1)){ - case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i - case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i - default : return +it; - } - for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){ - code = digits.charCodeAt(i); - // parseInt parses a string to a first unavailable symbol - // but ToNumber should return NaN if a string contains unavailable symbols - if(code < 48 || code > maxCode)return NaN; - } return parseInt(digits, radix); - } - } return +it; -}; - -if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){ - $Number = function Number(value){ - var it = arguments.length < 1 ? 0 : value - , that = this; - return that instanceof $Number - // check on 1..constructor(foo) case - && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER) - ? new Base(toNumber(it)) : toNumber(it); - }; - $.each.call(_dereq_(226) ? $.getNames(Base) : ( - // ES3: - 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + - // ES6 (in case, if modules with ES6 Number statics required before): - 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' - ).split(','), function(key){ - if(has(Base, key) && !has($Number, key)){ - $.setDesc($Number, key, $.getDesc(Base, key)); - } - }); - $Number.prototype = proto; - proto.constructor = $Number; - _dereq_(268)(global, NUMBER, $Number); -} -},{"218":218,"226":226,"231":231,"236":236,"237":237,"253":253,"268":268,"281":281,"288":288}],322:[function(_dereq_,module,exports){ -// 20.1.2.1 Number.EPSILON -var $export = _dereq_(229); - -$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); -},{"229":229}],323:[function(_dereq_,module,exports){ -// 20.1.2.2 Number.isFinite(number) -var $export = _dereq_(229) - , _isFinite = _dereq_(236).isFinite; - -$export($export.S, 'Number', { - isFinite: function isFinite(it){ - return typeof it == 'number' && _isFinite(it); - } -}); -},{"229":229,"236":236}],324:[function(_dereq_,module,exports){ -// 20.1.2.3 Number.isInteger(number) -var $export = _dereq_(229); - -$export($export.S, 'Number', {isInteger: _dereq_(244)}); -},{"229":229,"244":244}],325:[function(_dereq_,module,exports){ -// 20.1.2.4 Number.isNaN(number) -var $export = _dereq_(229); - -$export($export.S, 'Number', { - isNaN: function isNaN(number){ - return number != number; - } -}); -},{"229":229}],326:[function(_dereq_,module,exports){ -// 20.1.2.5 Number.isSafeInteger(number) -var $export = _dereq_(229) - , isInteger = _dereq_(244) - , abs = Math.abs; - -$export($export.S, 'Number', { - isSafeInteger: function isSafeInteger(number){ - return isInteger(number) && abs(number) <= 0x1fffffffffffff; - } -}); -},{"229":229,"244":244}],327:[function(_dereq_,module,exports){ -// 20.1.2.6 Number.MAX_SAFE_INTEGER -var $export = _dereq_(229); - -$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); -},{"229":229}],328:[function(_dereq_,module,exports){ -// 20.1.2.10 Number.MIN_SAFE_INTEGER -var $export = _dereq_(229); - -$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); -},{"229":229}],329:[function(_dereq_,module,exports){ -// 20.1.2.12 Number.parseFloat(string) -var $export = _dereq_(229); - -$export($export.S, 'Number', {parseFloat: parseFloat}); -},{"229":229}],330:[function(_dereq_,module,exports){ -// 20.1.2.13 Number.parseInt(string, radix) -var $export = _dereq_(229); - -$export($export.S, 'Number', {parseInt: parseInt}); -},{"229":229}],331:[function(_dereq_,module,exports){ -// 19.1.3.1 Object.assign(target, source) -var $export = _dereq_(229); - -$export($export.S + $export.F, 'Object', {assign: _dereq_(260)}); -},{"229":229,"260":260}],332:[function(_dereq_,module,exports){ -// 19.1.2.5 Object.freeze(O) -var isObject = _dereq_(245); - -_dereq_(261)('freeze', function($freeze){ - return function freeze(it){ - return $freeze && isObject(it) ? $freeze(it) : it; - }; -}); -},{"245":245,"261":261}],333:[function(_dereq_,module,exports){ -// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) -var toIObject = _dereq_(285); - -_dereq_(261)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){ - return function getOwnPropertyDescriptor(it, key){ - return $getOwnPropertyDescriptor(toIObject(it), key); - }; -}); -},{"261":261,"285":285}],334:[function(_dereq_,module,exports){ -// 19.1.2.7 Object.getOwnPropertyNames(O) -_dereq_(261)('getOwnPropertyNames', function(){ - return _dereq_(235).get; -}); -},{"235":235,"261":261}],335:[function(_dereq_,module,exports){ -// 19.1.2.9 Object.getPrototypeOf(O) -var toObject = _dereq_(287); - -_dereq_(261)('getPrototypeOf', function($getPrototypeOf){ - return function getPrototypeOf(it){ - return $getPrototypeOf(toObject(it)); - }; -}); -},{"261":261,"287":287}],336:[function(_dereq_,module,exports){ -// 19.1.2.11 Object.isExtensible(O) -var isObject = _dereq_(245); - -_dereq_(261)('isExtensible', function($isExtensible){ - return function isExtensible(it){ - return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; - }; -}); -},{"245":245,"261":261}],337:[function(_dereq_,module,exports){ -// 19.1.2.12 Object.isFrozen(O) -var isObject = _dereq_(245); - -_dereq_(261)('isFrozen', function($isFrozen){ - return function isFrozen(it){ - return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; - }; -}); -},{"245":245,"261":261}],338:[function(_dereq_,module,exports){ -// 19.1.2.13 Object.isSealed(O) -var isObject = _dereq_(245); - -_dereq_(261)('isSealed', function($isSealed){ - return function isSealed(it){ - return isObject(it) ? $isSealed ? $isSealed(it) : false : true; - }; -}); -},{"245":245,"261":261}],339:[function(_dereq_,module,exports){ -// 19.1.3.10 Object.is(value1, value2) -var $export = _dereq_(229); -$export($export.S, 'Object', {is: _dereq_(270)}); -},{"229":229,"270":270}],340:[function(_dereq_,module,exports){ -// 19.1.2.14 Object.keys(O) -var toObject = _dereq_(287); - -_dereq_(261)('keys', function($keys){ - return function keys(it){ - return $keys(toObject(it)); - }; -}); -},{"261":261,"287":287}],341:[function(_dereq_,module,exports){ -// 19.1.2.15 Object.preventExtensions(O) -var isObject = _dereq_(245); - -_dereq_(261)('preventExtensions', function($preventExtensions){ - return function preventExtensions(it){ - return $preventExtensions && isObject(it) ? $preventExtensions(it) : it; - }; -}); -},{"245":245,"261":261}],342:[function(_dereq_,module,exports){ -// 19.1.2.17 Object.seal(O) -var isObject = _dereq_(245); - -_dereq_(261)('seal', function($seal){ - return function seal(it){ - return $seal && isObject(it) ? $seal(it) : it; - }; -}); -},{"245":245,"261":261}],343:[function(_dereq_,module,exports){ -// 19.1.3.19 Object.setPrototypeOf(O, proto) -var $export = _dereq_(229); -$export($export.S, 'Object', {setPrototypeOf: _dereq_(271).set}); -},{"229":229,"271":271}],344:[function(_dereq_,module,exports){ -'use strict'; -// 19.1.3.6 Object.prototype.toString() -var classof = _dereq_(217) - , test = {}; -test[_dereq_(290)('toStringTag')] = 'z'; -if(test + '' != '[object z]'){ - _dereq_(268)(Object.prototype, 'toString', function toString(){ - return '[object ' + classof(this) + ']'; - }, true); -} -},{"217":217,"268":268,"290":290}],345:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , LIBRARY = _dereq_(255) - , global = _dereq_(236) - , ctx = _dereq_(224) - , classof = _dereq_(217) - , $export = _dereq_(229) - , isObject = _dereq_(245) - , anObject = _dereq_(211) - , aFunction = _dereq_(209) - , strictNew = _dereq_(276) - , forOf = _dereq_(234) - , setProto = _dereq_(271).set - , same = _dereq_(270) - , SPECIES = _dereq_(290)('species') - , speciesConstructor = _dereq_(275) - , asap = _dereq_(259) - , PROMISE = 'Promise' - , process = global.process - , isNode = classof(process) == 'process' - , P = global[PROMISE] - , Wrapper; - -var testResolve = function(sub){ - var test = new P(function(){}); - if(sub)test.constructor = Object; - return P.resolve(test) === test; -}; - -var USE_NATIVE = function(){ - var works = false; - function P2(x){ - var self = new P(x); - setProto(self, P2.prototype); - return self; - } - try { - works = P && P.resolve && testResolve(); - setProto(P2, P); - P2.prototype = $.create(P.prototype, {constructor: {value: P2}}); - // actual Firefox has broken subclass support, test that - if(!(P2.resolve(5).then(function(){}) instanceof P2)){ - works = false; - } - // actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162 - if(works && _dereq_(226)){ - var thenableThenGotten = false; - P.resolve($.setDesc({}, 'then', { - get: function(){ thenableThenGotten = true; } - })); - works = thenableThenGotten; - } - } catch(e){ works = false; } - return works; -}(); - -// helpers -var sameConstructor = function(a, b){ - // library wrapper special case - if(LIBRARY && a === P && b === Wrapper)return true; - return same(a, b); -}; -var getConstructor = function(C){ - var S = anObject(C)[SPECIES]; - return S != undefined ? S : C; -}; -var isThenable = function(it){ - var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; -}; -var PromiseCapability = function(C){ - var resolve, reject; - this.promise = new C(function($$resolve, $$reject){ - if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = aFunction(resolve), - this.reject = aFunction(reject) -}; -var perform = function(exec){ - try { - exec(); - } catch(e){ - return {error: e}; - } -}; -var notify = function(record, isReject){ - if(record.n)return; - record.n = true; - var chain = record.c; - asap(function(){ - var value = record.v - , ok = record.s == 1 - , i = 0; - var run = function(reaction){ - var handler = ok ? reaction.ok : reaction.fail - , resolve = reaction.resolve - , reject = reaction.reject - , result, then; - try { - if(handler){ - if(!ok)record.h = true; - result = handler === true ? value : handler(value); - if(result === reaction.promise){ - reject(TypeError('Promise-chain cycle')); - } else if(then = isThenable(result)){ - then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch(e){ - reject(e); - } - }; - while(chain.length > i)run(chain[i++]); // variable length - can't use forEach - chain.length = 0; - record.n = false; - if(isReject)setTimeout(function(){ - var promise = record.p - , handler, console; - if(isUnhandled(promise)){ - if(isNode){ - process.emit('unhandledRejection', value, promise); - } else if(handler = global.onunhandledrejection){ - handler({promise: promise, reason: value}); - } else if((console = global.console) && console.error){ - console.error('Unhandled promise rejection', value); - } - } record.a = undefined; - }, 1); - }); -}; -var isUnhandled = function(promise){ - var record = promise._d - , chain = record.a || record.c - , i = 0 - , reaction; - if(record.h)return false; - while(chain.length > i){ - reaction = chain[i++]; - if(reaction.fail || !isUnhandled(reaction.promise))return false; - } return true; -}; -var $reject = function(value){ - var record = this; - if(record.d)return; - record.d = true; - record = record.r || record; // unwrap - record.v = value; - record.s = 2; - record.a = record.c.slice(); - notify(record, true); -}; -var $resolve = function(value){ - var record = this - , then; - if(record.d)return; - record.d = true; - record = record.r || record; // unwrap - try { - if(record.p === value)throw TypeError("Promise can't be resolved itself"); - if(then = isThenable(value)){ - asap(function(){ - var wrapper = {r: record, d: false}; // wrap - try { - then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); - } catch(e){ - $reject.call(wrapper, e); - } - }); - } else { - record.v = value; - record.s = 1; - notify(record, false); - } - } catch(e){ - $reject.call({r: record, d: false}, e); // wrap - } -}; - -// constructor polyfill -if(!USE_NATIVE){ - // 25.4.3.1 Promise(executor) - P = function Promise(executor){ - aFunction(executor); - var record = this._d = { - p: strictNew(this, P, PROMISE), // <- promise - c: [], // <- awaiting reactions - a: undefined, // <- checked in isUnhandled reactions - s: 0, // <- state - d: false, // <- done - v: undefined, // <- value - h: false, // <- handled rejection - n: false // <- notify - }; - try { - executor(ctx($resolve, record, 1), ctx($reject, record, 1)); - } catch(err){ - $reject.call(record, err); - } - }; - _dereq_(267)(P.prototype, { - // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) - then: function then(onFulfilled, onRejected){ - var reaction = new PromiseCapability(speciesConstructor(this, P)) - , promise = reaction.promise - , record = this._d; - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - record.c.push(reaction); - if(record.a)record.a.push(reaction); - if(record.s)notify(record, false); - return promise; - }, - // 25.4.5.1 Promise.prototype.catch(onRejected) - 'catch': function(onRejected){ - return this.then(undefined, onRejected); - } - }); -} - -$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: P}); -_dereq_(273)(P, PROMISE); -_dereq_(272)(PROMISE); -Wrapper = _dereq_(223)[PROMISE]; - -// statics -$export($export.S + $export.F * !USE_NATIVE, PROMISE, { - // 25.4.4.5 Promise.reject(r) - reject: function reject(r){ - var capability = new PromiseCapability(this) - , $$reject = capability.reject; - $$reject(r); - return capability.promise; - } -}); -$export($export.S + $export.F * (!USE_NATIVE || testResolve(true)), PROMISE, { - // 25.4.4.6 Promise.resolve(x) - resolve: function resolve(x){ - // instanceof instead of internal slot check because we should fix it without replacement native Promise core - if(x instanceof P && sameConstructor(x.constructor, this))return x; - var capability = new PromiseCapability(this) - , $$resolve = capability.resolve; - $$resolve(x); - return capability.promise; - } -}); -$export($export.S + $export.F * !(USE_NATIVE && _dereq_(250)(function(iter){ - P.all(iter)['catch'](function(){}); -})), PROMISE, { - // 25.4.4.1 Promise.all(iterable) - all: function all(iterable){ - var C = getConstructor(this) - , capability = new PromiseCapability(C) - , resolve = capability.resolve - , reject = capability.reject - , values = []; - var abrupt = perform(function(){ - forOf(iterable, false, values.push, values); - var remaining = values.length - , results = Array(remaining); - if(remaining)$.each.call(values, function(promise, index){ - var alreadyCalled = false; - C.resolve(promise).then(function(value){ - if(alreadyCalled)return; - alreadyCalled = true; - results[index] = value; - --remaining || resolve(results); - }, reject); - }); - else resolve(results); - }); - if(abrupt)reject(abrupt.error); - return capability.promise; - }, - // 25.4.4.4 Promise.race(iterable) - race: function race(iterable){ - var C = getConstructor(this) - , capability = new PromiseCapability(C) - , reject = capability.reject; - var abrupt = perform(function(){ - forOf(iterable, false, function(promise){ - C.resolve(promise).then(capability.resolve, reject); - }); - }); - if(abrupt)reject(abrupt.error); - return capability.promise; - } -}); -},{"209":209,"211":211,"217":217,"223":223,"224":224,"226":226,"229":229,"234":234,"236":236,"245":245,"250":250,"253":253,"255":255,"259":259,"267":267,"270":270,"271":271,"272":272,"273":273,"275":275,"276":276,"290":290}],346:[function(_dereq_,module,exports){ -// 26.1.1 Reflect.apply(target, thisArgument, argumentsList) -var $export = _dereq_(229) - , _apply = Function.apply; - -$export($export.S, 'Reflect', { - apply: function apply(target, thisArgument, argumentsList){ - return _apply.call(target, thisArgument, argumentsList); - } -}); -},{"229":229}],347:[function(_dereq_,module,exports){ -// 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) -var $ = _dereq_(253) - , $export = _dereq_(229) - , aFunction = _dereq_(209) - , anObject = _dereq_(211) - , isObject = _dereq_(245) - , bind = Function.bind || _dereq_(223).Function.prototype.bind; - -// MS Edge supports only 2 arguments -// FF Nightly sets third argument as `new.target`, but does not create `this` from it -$export($export.S + $export.F * _dereq_(231)(function(){ - function F(){} - return !(Reflect.construct(function(){}, [], F) instanceof F); -}), 'Reflect', { - construct: function construct(Target, args /*, newTarget*/){ - aFunction(Target); - var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); - if(Target == newTarget){ - // w/o altered newTarget, optimization for 0-4 arguments - if(args != undefined)switch(anObject(args).length){ - case 0: return new Target; - case 1: return new Target(args[0]); - case 2: return new Target(args[0], args[1]); - case 3: return new Target(args[0], args[1], args[2]); - case 4: return new Target(args[0], args[1], args[2], args[3]); - } - // w/o altered newTarget, lot of arguments case - var $args = [null]; - $args.push.apply($args, args); - return new (bind.apply(Target, $args)); - } - // with altered newTarget, not support built-in constructors - var proto = newTarget.prototype - , instance = $.create(isObject(proto) ? proto : Object.prototype) - , result = Function.apply.call(Target, instance, args); - return isObject(result) ? result : instance; - } -}); -},{"209":209,"211":211,"223":223,"229":229,"231":231,"245":245,"253":253}],348:[function(_dereq_,module,exports){ -// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) -var $ = _dereq_(253) - , $export = _dereq_(229) - , anObject = _dereq_(211); - -// MS Edge has broken Reflect.defineProperty - throwing instead of returning false -$export($export.S + $export.F * _dereq_(231)(function(){ - Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2}); -}), 'Reflect', { - defineProperty: function defineProperty(target, propertyKey, attributes){ - anObject(target); - try { - $.setDesc(target, propertyKey, attributes); - return true; - } catch(e){ - return false; - } - } -}); -},{"211":211,"229":229,"231":231,"253":253}],349:[function(_dereq_,module,exports){ -// 26.1.4 Reflect.deleteProperty(target, propertyKey) -var $export = _dereq_(229) - , getDesc = _dereq_(253).getDesc - , anObject = _dereq_(211); - -$export($export.S, 'Reflect', { - deleteProperty: function deleteProperty(target, propertyKey){ - var desc = getDesc(anObject(target), propertyKey); - return desc && !desc.configurable ? false : delete target[propertyKey]; - } -}); -},{"211":211,"229":229,"253":253}],350:[function(_dereq_,module,exports){ -'use strict'; -// 26.1.5 Reflect.enumerate(target) -var $export = _dereq_(229) - , anObject = _dereq_(211); -var Enumerate = function(iterated){ - this._t = anObject(iterated); // target - this._i = 0; // next index - var keys = this._k = [] // keys - , key; - for(key in iterated)keys.push(key); -}; -_dereq_(248)(Enumerate, 'Object', function(){ - var that = this - , keys = that._k - , key; - do { - if(that._i >= keys.length)return {value: undefined, done: true}; - } while(!((key = keys[that._i++]) in that._t)); - return {value: key, done: false}; -}); - -$export($export.S, 'Reflect', { - enumerate: function enumerate(target){ - return new Enumerate(target); - } -}); -},{"211":211,"229":229,"248":248}],351:[function(_dereq_,module,exports){ -// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) -var $ = _dereq_(253) - , $export = _dereq_(229) - , anObject = _dereq_(211); - -$export($export.S, 'Reflect', { - getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){ - return $.getDesc(anObject(target), propertyKey); - } -}); -},{"211":211,"229":229,"253":253}],352:[function(_dereq_,module,exports){ -// 26.1.8 Reflect.getPrototypeOf(target) -var $export = _dereq_(229) - , getProto = _dereq_(253).getProto - , anObject = _dereq_(211); - -$export($export.S, 'Reflect', { - getPrototypeOf: function getPrototypeOf(target){ - return getProto(anObject(target)); - } -}); -},{"211":211,"229":229,"253":253}],353:[function(_dereq_,module,exports){ -// 26.1.6 Reflect.get(target, propertyKey [, receiver]) -var $ = _dereq_(253) - , has = _dereq_(237) - , $export = _dereq_(229) - , isObject = _dereq_(245) - , anObject = _dereq_(211); - -function get(target, propertyKey/*, receiver*/){ - var receiver = arguments.length < 3 ? target : arguments[2] - , desc, proto; - if(anObject(target) === receiver)return target[propertyKey]; - if(desc = $.getDesc(target, propertyKey))return has(desc, 'value') - ? desc.value - : desc.get !== undefined - ? desc.get.call(receiver) - : undefined; - if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver); -} - -$export($export.S, 'Reflect', {get: get}); -},{"211":211,"229":229,"237":237,"245":245,"253":253}],354:[function(_dereq_,module,exports){ -// 26.1.9 Reflect.has(target, propertyKey) -var $export = _dereq_(229); - -$export($export.S, 'Reflect', { - has: function has(target, propertyKey){ - return propertyKey in target; - } -}); -},{"229":229}],355:[function(_dereq_,module,exports){ -// 26.1.10 Reflect.isExtensible(target) -var $export = _dereq_(229) - , anObject = _dereq_(211) - , $isExtensible = Object.isExtensible; - -$export($export.S, 'Reflect', { - isExtensible: function isExtensible(target){ - anObject(target); - return $isExtensible ? $isExtensible(target) : true; - } -}); -},{"211":211,"229":229}],356:[function(_dereq_,module,exports){ -// 26.1.11 Reflect.ownKeys(target) -var $export = _dereq_(229); - -$export($export.S, 'Reflect', {ownKeys: _dereq_(263)}); -},{"229":229,"263":263}],357:[function(_dereq_,module,exports){ -// 26.1.12 Reflect.preventExtensions(target) -var $export = _dereq_(229) - , anObject = _dereq_(211) - , $preventExtensions = Object.preventExtensions; - -$export($export.S, 'Reflect', { - preventExtensions: function preventExtensions(target){ - anObject(target); - try { - if($preventExtensions)$preventExtensions(target); - return true; - } catch(e){ - return false; - } - } -}); -},{"211":211,"229":229}],358:[function(_dereq_,module,exports){ -// 26.1.14 Reflect.setPrototypeOf(target, proto) -var $export = _dereq_(229) - , setProto = _dereq_(271); - -if(setProto)$export($export.S, 'Reflect', { - setPrototypeOf: function setPrototypeOf(target, proto){ - setProto.check(target, proto); - try { - setProto.set(target, proto); - return true; - } catch(e){ - return false; - } - } -}); -},{"229":229,"271":271}],359:[function(_dereq_,module,exports){ -// 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) -var $ = _dereq_(253) - , has = _dereq_(237) - , $export = _dereq_(229) - , createDesc = _dereq_(266) - , anObject = _dereq_(211) - , isObject = _dereq_(245); - -function set(target, propertyKey, V/*, receiver*/){ - var receiver = arguments.length < 4 ? target : arguments[3] - , ownDesc = $.getDesc(anObject(target), propertyKey) - , existingDescriptor, proto; - if(!ownDesc){ - if(isObject(proto = $.getProto(target))){ - return set(proto, propertyKey, V, receiver); - } - ownDesc = createDesc(0); - } - if(has(ownDesc, 'value')){ - if(ownDesc.writable === false || !isObject(receiver))return false; - existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0); - existingDescriptor.value = V; - $.setDesc(receiver, propertyKey, existingDescriptor); - return true; - } - return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); -} - -$export($export.S, 'Reflect', {set: set}); -},{"211":211,"229":229,"237":237,"245":245,"253":253,"266":266}],360:[function(_dereq_,module,exports){ -var $ = _dereq_(253) - , global = _dereq_(236) - , isRegExp = _dereq_(246) - , $flags = _dereq_(233) - , $RegExp = global.RegExp - , Base = $RegExp - , proto = $RegExp.prototype - , re1 = /a/g - , re2 = /a/g - // "new" creates a new object, old webkit buggy here - , CORRECT_NEW = new $RegExp(re1) !== re1; - -if(_dereq_(226) && (!CORRECT_NEW || _dereq_(231)(function(){ - re2[_dereq_(290)('match')] = false; - // RegExp constructor can alter flags and IsRegExp works correct with @@match - return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; -}))){ - $RegExp = function RegExp(p, f){ - var piRE = isRegExp(p) - , fiU = f === undefined; - return !(this instanceof $RegExp) && piRE && p.constructor === $RegExp && fiU ? p - : CORRECT_NEW - ? new Base(piRE && !fiU ? p.source : p, f) - : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f); - }; - $.each.call($.getNames(Base), function(key){ - key in $RegExp || $.setDesc($RegExp, key, { - configurable: true, - get: function(){ return Base[key]; }, - set: function(it){ Base[key] = it; } - }); - }); - proto.constructor = $RegExp; - $RegExp.prototype = proto; - _dereq_(268)(global, 'RegExp', $RegExp); -} - -_dereq_(272)('RegExp'); -},{"226":226,"231":231,"233":233,"236":236,"246":246,"253":253,"268":268,"272":272,"290":290}],361:[function(_dereq_,module,exports){ -// 21.2.5.3 get RegExp.prototype.flags() -var $ = _dereq_(253); -if(_dereq_(226) && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', { - configurable: true, - get: _dereq_(233) -}); -},{"226":226,"233":233,"253":253}],362:[function(_dereq_,module,exports){ -// @@match logic -_dereq_(232)('match', 1, function(defined, MATCH){ - // 21.1.3.11 String.prototype.match(regexp) - return function match(regexp){ - 'use strict'; - var O = defined(this) - , fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }; -}); -},{"232":232}],363:[function(_dereq_,module,exports){ -// @@replace logic -_dereq_(232)('replace', 2, function(defined, REPLACE, $replace){ - // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) - return function replace(searchValue, replaceValue){ - 'use strict'; - var O = defined(this) - , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }; -}); -},{"232":232}],364:[function(_dereq_,module,exports){ -// @@search logic -_dereq_(232)('search', 1, function(defined, SEARCH){ - // 21.1.3.15 String.prototype.search(regexp) - return function search(regexp){ - 'use strict'; - var O = defined(this) - , fn = regexp == undefined ? undefined : regexp[SEARCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); - }; -}); -},{"232":232}],365:[function(_dereq_,module,exports){ -// @@split logic -_dereq_(232)('split', 2, function(defined, SPLIT, $split){ - // 21.1.3.17 String.prototype.split(separator, limit) - return function split(separator, limit){ - 'use strict'; - var O = defined(this) - , fn = separator == undefined ? undefined : separator[SPLIT]; - return fn !== undefined - ? fn.call(separator, O, limit) - : $split.call(String(O), separator, limit); - }; -}); -},{"232":232}],366:[function(_dereq_,module,exports){ -'use strict'; -var strong = _dereq_(219); - -// 23.2 Set Objects -_dereq_(222)('Set', function(get){ - return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.2.3.1 Set.prototype.add(value) - add: function add(value){ - return strong.def(this, value = value === 0 ? 0 : value, value); - } -}, strong); -},{"219":219,"222":222}],367:[function(_dereq_,module,exports){ -'use strict'; -var $export = _dereq_(229) - , $at = _dereq_(277)(false); -$export($export.P, 'String', { - // 21.1.3.3 String.prototype.codePointAt(pos) - codePointAt: function codePointAt(pos){ - return $at(this, pos); - } -}); -},{"229":229,"277":277}],368:[function(_dereq_,module,exports){ -// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) -'use strict'; -var $export = _dereq_(229) - , toLength = _dereq_(286) - , context = _dereq_(278) - , ENDS_WITH = 'endsWith' - , $endsWith = ''[ENDS_WITH]; - -$export($export.P + $export.F * _dereq_(230)(ENDS_WITH), 'String', { - endsWith: function endsWith(searchString /*, endPosition = @length */){ - var that = context(this, searchString, ENDS_WITH) - , $$ = arguments - , endPosition = $$.length > 1 ? $$[1] : undefined - , len = toLength(that.length) - , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) - , search = String(searchString); - return $endsWith - ? $endsWith.call(that, search, end) - : that.slice(end - search.length, end) === search; - } -}); -},{"229":229,"230":230,"278":278,"286":286}],369:[function(_dereq_,module,exports){ -var $export = _dereq_(229) - , toIndex = _dereq_(283) - , fromCharCode = String.fromCharCode - , $fromCodePoint = String.fromCodePoint; - -// length should be 1, old FF problem -$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { - // 21.1.2.2 String.fromCodePoint(...codePoints) - fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars - var res = [] - , $$ = arguments - , $$len = $$.length - , i = 0 - , code; - while($$len > i){ - code = +$$[i++]; - if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); - res.push(code < 0x10000 - ? fromCharCode(code) - : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) - ); - } return res.join(''); - } -}); -},{"229":229,"283":283}],370:[function(_dereq_,module,exports){ -// 21.1.3.7 String.prototype.includes(searchString, position = 0) -'use strict'; -var $export = _dereq_(229) - , context = _dereq_(278) - , INCLUDES = 'includes'; - -$export($export.P + $export.F * _dereq_(230)(INCLUDES), 'String', { - includes: function includes(searchString /*, position = 0 */){ - return !!~context(this, searchString, INCLUDES) - .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); - } -}); -},{"229":229,"230":230,"278":278}],371:[function(_dereq_,module,exports){ -'use strict'; -var $at = _dereq_(277)(true); - -// 21.1.3.27 String.prototype[@@iterator]() -_dereq_(249)(String, 'String', function(iterated){ - this._t = String(iterated); // target - this._i = 0; // next index -// 21.1.5.2.1 %StringIteratorPrototype%.next() -}, function(){ - var O = this._t - , index = this._i - , point; - if(index >= O.length)return {value: undefined, done: true}; - point = $at(O, index); - this._i += point.length; - return {value: point, done: false}; -}); -},{"249":249,"277":277}],372:[function(_dereq_,module,exports){ -var $export = _dereq_(229) - , toIObject = _dereq_(285) - , toLength = _dereq_(286); - -$export($export.S, 'String', { - // 21.1.2.4 String.raw(callSite, ...substitutions) - raw: function raw(callSite){ - var tpl = toIObject(callSite.raw) - , len = toLength(tpl.length) - , $$ = arguments - , $$len = $$.length - , res = [] - , i = 0; - while(len > i){ - res.push(String(tpl[i++])); - if(i < $$len)res.push(String($$[i])); - } return res.join(''); - } -}); -},{"229":229,"285":285,"286":286}],373:[function(_dereq_,module,exports){ -var $export = _dereq_(229); - -$export($export.P, 'String', { - // 21.1.3.13 String.prototype.repeat(count) - repeat: _dereq_(280) -}); -},{"229":229,"280":280}],374:[function(_dereq_,module,exports){ -// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) -'use strict'; -var $export = _dereq_(229) - , toLength = _dereq_(286) - , context = _dereq_(278) - , STARTS_WITH = 'startsWith' - , $startsWith = ''[STARTS_WITH]; - -$export($export.P + $export.F * _dereq_(230)(STARTS_WITH), 'String', { - startsWith: function startsWith(searchString /*, position = 0 */){ - var that = context(this, searchString, STARTS_WITH) - , $$ = arguments - , index = toLength(Math.min($$.length > 1 ? $$[1] : undefined, that.length)) - , search = String(searchString); - return $startsWith - ? $startsWith.call(that, search, index) - : that.slice(index, index + search.length) === search; - } -}); -},{"229":229,"230":230,"278":278,"286":286}],375:[function(_dereq_,module,exports){ -'use strict'; -// 21.1.3.25 String.prototype.trim() -_dereq_(281)('trim', function($trim){ - return function trim(){ - return $trim(this, 3); - }; -}); -},{"281":281}],376:[function(_dereq_,module,exports){ -'use strict'; -// ECMAScript 6 symbols shim -var $ = _dereq_(253) - , global = _dereq_(236) - , has = _dereq_(237) - , DESCRIPTORS = _dereq_(226) - , $export = _dereq_(229) - , redefine = _dereq_(268) - , $fails = _dereq_(231) - , shared = _dereq_(274) - , setToStringTag = _dereq_(273) - , uid = _dereq_(289) - , wks = _dereq_(290) - , keyOf = _dereq_(254) - , $names = _dereq_(235) - , enumKeys = _dereq_(228) - , isArray = _dereq_(243) - , anObject = _dereq_(211) - , toIObject = _dereq_(285) - , createDesc = _dereq_(266) - , getDesc = $.getDesc - , setDesc = $.setDesc - , _create = $.create - , getNames = $names.get - , $Symbol = global.Symbol - , $JSON = global.JSON - , _stringify = $JSON && $JSON.stringify - , setter = false - , HIDDEN = wks('_hidden') - , isEnum = $.isEnum - , SymbolRegistry = shared('symbol-registry') - , AllSymbols = shared('symbols') - , useNative = typeof $Symbol == 'function' - , ObjectProto = Object.prototype; - -// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDesc = DESCRIPTORS && $fails(function(){ - return _create(setDesc({}, 'a', { - get: function(){ return setDesc(this, 'a', {value: 7}).a; } - })).a != 7; -}) ? function(it, key, D){ - var protoDesc = getDesc(ObjectProto, key); - if(protoDesc)delete ObjectProto[key]; - setDesc(it, key, D); - if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); -} : setDesc; - -var wrap = function(tag){ - var sym = AllSymbols[tag] = _create($Symbol.prototype); - sym._k = tag; - DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, { - configurable: true, - set: function(value){ - if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, createDesc(1, value)); - } - }); - return sym; -}; - -var isSymbol = function(it){ - return typeof it == 'symbol'; -}; - -var $defineProperty = function defineProperty(it, key, D){ - if(D && has(AllSymbols, key)){ - if(!D.enumerable){ - if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; - D = _create(D, {enumerable: createDesc(0, false)}); - } return setSymbolDesc(it, key, D); - } return setDesc(it, key, D); -}; -var $defineProperties = function defineProperties(it, P){ - anObject(it); - var keys = enumKeys(P = toIObject(P)) - , i = 0 - , l = keys.length - , key; - while(l > i)$defineProperty(it, key = keys[i++], P[key]); - return it; -}; -var $create = function create(it, P){ - return P === undefined ? _create(it) : $defineProperties(_create(it), P); -}; -var $propertyIsEnumerable = function propertyIsEnumerable(key){ - var E = isEnum.call(this, key); - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] - ? E : true; -}; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ - var D = getDesc(it = toIObject(it), key); - if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; - return D; -}; -var $getOwnPropertyNames = function getOwnPropertyNames(it){ - var names = getNames(toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); - return result; -}; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ - var names = getNames(toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); - return result; -}; -var $stringify = function stringify(it){ - if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined - var args = [it] - , i = 1 - , $$ = arguments - , replacer, $replacer; - while($$.length > i)args.push($$[i++]); - replacer = args[1]; - if(typeof replacer == 'function')$replacer = replacer; - if($replacer || !isArray(replacer))replacer = function(key, value){ - if($replacer)value = $replacer.call(this, key, value); - if(!isSymbol(value))return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); -}; -var buggyJSON = $fails(function(){ - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; -}); - -// 19.4.1.1 Symbol([description]) -if(!useNative){ - $Symbol = function Symbol(){ - if(isSymbol(this))throw TypeError('Symbol is not a constructor'); - return wrap(uid(arguments.length > 0 ? arguments[0] : undefined)); - }; - redefine($Symbol.prototype, 'toString', function toString(){ - return this._k; - }); - - isSymbol = function(it){ - return it instanceof $Symbol; - }; - - $.create = $create; - $.isEnum = $propertyIsEnumerable; - $.getDesc = $getOwnPropertyDescriptor; - $.setDesc = $defineProperty; - $.setDescs = $defineProperties; - $.getNames = $names.get = $getOwnPropertyNames; - $.getSymbols = $getOwnPropertySymbols; - - if(DESCRIPTORS && !_dereq_(255)){ - redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); - } -} - -var symbolStatics = { - // 19.4.2.1 Symbol.for(key) - 'for': function(key){ - return has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(key){ - return keyOf(SymbolRegistry, key); - }, - useSetter: function(){ setter = true; }, - useSimple: function(){ setter = false; } -}; -// 19.4.2.2 Symbol.hasInstance -// 19.4.2.3 Symbol.isConcatSpreadable -// 19.4.2.4 Symbol.iterator -// 19.4.2.6 Symbol.match -// 19.4.2.8 Symbol.replace -// 19.4.2.9 Symbol.search -// 19.4.2.10 Symbol.species -// 19.4.2.11 Symbol.split -// 19.4.2.12 Symbol.toPrimitive -// 19.4.2.13 Symbol.toStringTag -// 19.4.2.14 Symbol.unscopables -$.each.call(( - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + - 'species,split,toPrimitive,toStringTag,unscopables' -).split(','), function(it){ - var sym = wks(it); - symbolStatics[it] = useNative ? sym : wrap(sym); -}); - -setter = true; - -$export($export.G + $export.W, {Symbol: $Symbol}); - -$export($export.S, 'Symbol', symbolStatics); - -$export($export.S + $export.F * !useNative, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols -}); - -// 24.3.2 JSON.stringify(value [, replacer [, space]]) -$JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); - -// 19.4.3.5 Symbol.prototype[@@toStringTag] -setToStringTag($Symbol, 'Symbol'); -// 20.2.1.9 Math[@@toStringTag] -setToStringTag(Math, 'Math', true); -// 24.3.3 JSON[@@toStringTag] -setToStringTag(global.JSON, 'JSON', true); -},{"211":211,"226":226,"228":228,"229":229,"231":231,"235":235,"236":236,"237":237,"243":243,"253":253,"254":254,"255":255,"266":266,"268":268,"273":273,"274":274,"285":285,"289":289,"290":290}],377:[function(_dereq_,module,exports){ -'use strict'; -var $ = _dereq_(253) - , redefine = _dereq_(268) - , weak = _dereq_(221) - , isObject = _dereq_(245) - , has = _dereq_(237) - , frozenStore = weak.frozenStore - , WEAK = weak.WEAK - , isExtensible = Object.isExtensible || isObject - , tmp = {}; - -// 23.3 WeakMap Objects -var $WeakMap = _dereq_(222)('WeakMap', function(get){ - return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.3.3.3 WeakMap.prototype.get(key) - get: function get(key){ - if(isObject(key)){ - if(!isExtensible(key))return frozenStore(this).get(key); - if(has(key, WEAK))return key[WEAK][this._i]; - } - }, - // 23.3.3.5 WeakMap.prototype.set(key, value) - set: function set(key, value){ - return weak.def(this, key, value); - } -}, weak, true, true); - -// IE11 WeakMap frozen keys fix -if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ - $.each.call(['delete', 'has', 'get', 'set'], function(key){ - var proto = $WeakMap.prototype - , method = proto[key]; - redefine(proto, key, function(a, b){ - // store frozen objects on leaky map - if(isObject(a) && !isExtensible(a)){ - var result = frozenStore(this)[key](a, b); - return key == 'set' ? this : result; - // store all the rest on native weakmap - } return method.call(this, a, b); - }); - }); -} -},{"221":221,"222":222,"237":237,"245":245,"253":253,"268":268}],378:[function(_dereq_,module,exports){ -'use strict'; -var weak = _dereq_(221); - -// 23.4 WeakSet Objects -_dereq_(222)('WeakSet', function(get){ - return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.4.3.1 WeakSet.prototype.add(value) - add: function add(value){ - return weak.def(this, value, true); - } -}, weak, false, true); -},{"221":221,"222":222}],379:[function(_dereq_,module,exports){ -'use strict'; -var $export = _dereq_(229) - , $includes = _dereq_(214)(true); - -$export($export.P, 'Array', { - // https://github.com/domenic/Array.prototype.includes - includes: function includes(el /*, fromIndex = 0 */){ - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -_dereq_(210)('includes'); -},{"210":210,"214":214,"229":229}],380:[function(_dereq_,module,exports){ -// https://github.com/DavidBruant/Map-Set.prototype.toJSON -var $export = _dereq_(229); - -$export($export.P, 'Map', {toJSON: _dereq_(220)('Map')}); -},{"220":220,"229":229}],381:[function(_dereq_,module,exports){ -// http://goo.gl/XkBrjD -var $export = _dereq_(229) - , $entries = _dereq_(262)(true); - -$export($export.S, 'Object', { - entries: function entries(it){ - return $entries(it); - } -}); -},{"229":229,"262":262}],382:[function(_dereq_,module,exports){ -// https://gist.github.com/WebReflection/9353781 -var $ = _dereq_(253) - , $export = _dereq_(229) - , ownKeys = _dereq_(263) - , toIObject = _dereq_(285) - , createDesc = _dereq_(266); - -$export($export.S, 'Object', { - getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ - var O = toIObject(object) - , setDesc = $.setDesc - , getDesc = $.getDesc - , keys = ownKeys(O) - , result = {} - , i = 0 - , key, D; - while(keys.length > i){ - D = getDesc(O, key = keys[i++]); - if(key in result)setDesc(result, key, createDesc(0, D)); - else result[key] = D; - } return result; - } -}); -},{"229":229,"253":253,"263":263,"266":266,"285":285}],383:[function(_dereq_,module,exports){ -// http://goo.gl/XkBrjD -var $export = _dereq_(229) - , $values = _dereq_(262)(false); - -$export($export.S, 'Object', { - values: function values(it){ - return $values(it); - } -}); -},{"229":229,"262":262}],384:[function(_dereq_,module,exports){ -// https://github.com/benjamingr/RexExp.escape -var $export = _dereq_(229) - , $re = _dereq_(269)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); - -$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }}); - -},{"229":229,"269":269}],385:[function(_dereq_,module,exports){ -// https://github.com/DavidBruant/Map-Set.prototype.toJSON -var $export = _dereq_(229); - -$export($export.P, 'Set', {toJSON: _dereq_(220)('Set')}); -},{"220":220,"229":229}],386:[function(_dereq_,module,exports){ -'use strict'; -// https://github.com/mathiasbynens/String.prototype.at -var $export = _dereq_(229) - , $at = _dereq_(277)(true); - -$export($export.P, 'String', { - at: function at(pos){ - return $at(this, pos); - } -}); -},{"229":229,"277":277}],387:[function(_dereq_,module,exports){ -'use strict'; -var $export = _dereq_(229) - , $pad = _dereq_(279); - -$export($export.P, 'String', { - padLeft: function padLeft(maxLength /*, fillString = ' ' */){ - return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); - } -}); -},{"229":229,"279":279}],388:[function(_dereq_,module,exports){ -'use strict'; -var $export = _dereq_(229) - , $pad = _dereq_(279); - -$export($export.P, 'String', { - padRight: function padRight(maxLength /*, fillString = ' ' */){ - return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); - } -}); -},{"229":229,"279":279}],389:[function(_dereq_,module,exports){ -'use strict'; -// https://github.com/sebmarkbage/ecmascript-string-left-right-trim -_dereq_(281)('trimLeft', function($trim){ - return function trimLeft(){ - return $trim(this, 1); - }; -}); -},{"281":281}],390:[function(_dereq_,module,exports){ -'use strict'; -// https://github.com/sebmarkbage/ecmascript-string-left-right-trim -_dereq_(281)('trimRight', function($trim){ - return function trimRight(){ - return $trim(this, 2); - }; -}); -},{"281":281}],391:[function(_dereq_,module,exports){ -// JavaScript 1.6 / Strawman array statics shim -var $ = _dereq_(253) - , $export = _dereq_(229) - , $ctx = _dereq_(224) - , $Array = _dereq_(223).Array || Array - , statics = {}; -var setStatics = function(keys, length){ - $.each.call(keys.split(','), function(key){ - if(length == undefined && key in $Array)statics[key] = $Array[key]; - else if(key in [])statics[key] = $ctx(Function.call, [][key], length); - }); -}; -setStatics('pop,reverse,shift,keys,values,entries', 1); -setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3); -setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' + - 'reduce,reduceRight,copyWithin,fill'); -$export($export.S, 'Array', statics); -},{"223":223,"224":224,"229":229,"253":253}],392:[function(_dereq_,module,exports){ -_dereq_(298); -var global = _dereq_(236) - , hide = _dereq_(238) - , Iterators = _dereq_(252) - , ITERATOR = _dereq_(290)('iterator') - , NL = global.NodeList - , HTC = global.HTMLCollection - , NLProto = NL && NL.prototype - , HTCProto = HTC && HTC.prototype - , ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; -if(NLProto && !NLProto[ITERATOR])hide(NLProto, ITERATOR, ArrayValues); -if(HTCProto && !HTCProto[ITERATOR])hide(HTCProto, ITERATOR, ArrayValues); -},{"236":236,"238":238,"252":252,"290":290,"298":298}],393:[function(_dereq_,module,exports){ -var $export = _dereq_(229) - , $task = _dereq_(282); -$export($export.G + $export.B, { - setImmediate: $task.set, - clearImmediate: $task.clear -}); -},{"229":229,"282":282}],394:[function(_dereq_,module,exports){ -// ie9- setTimeout & setInterval additional parameters fix -var global = _dereq_(236) - , $export = _dereq_(229) - , invoke = _dereq_(240) - , partial = _dereq_(264) - , navigator = global.navigator - , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check -var wrap = function(set){ - return MSIE ? function(fn, time /*, ...args */){ - return set(invoke( - partial, - [].slice.call(arguments, 2), - typeof fn == 'function' ? fn : Function(fn) - ), time); - } : set; -}; -$export($export.G + $export.B + $export.F * MSIE, { - setTimeout: wrap(global.setTimeout), - setInterval: wrap(global.setInterval) -}); -},{"229":229,"236":236,"240":240,"264":264}],395:[function(_dereq_,module,exports){ -_dereq_(292); -_dereq_(376); -_dereq_(331); -_dereq_(339); -_dereq_(343); -_dereq_(344); -_dereq_(332); -_dereq_(342); -_dereq_(341); -_dereq_(337); -_dereq_(338); -_dereq_(336); -_dereq_(333); -_dereq_(335); -_dereq_(340); -_dereq_(334); -_dereq_(302); -_dereq_(301); -_dereq_(321); -_dereq_(322); -_dereq_(323); -_dereq_(324); -_dereq_(325); -_dereq_(326); -_dereq_(327); -_dereq_(328); -_dereq_(329); -_dereq_(330); -_dereq_(304); -_dereq_(305); -_dereq_(306); -_dereq_(307); -_dereq_(308); -_dereq_(309); -_dereq_(310); -_dereq_(311); -_dereq_(312); -_dereq_(313); -_dereq_(314); -_dereq_(315); -_dereq_(316); -_dereq_(317); -_dereq_(318); -_dereq_(319); -_dereq_(320); -_dereq_(369); -_dereq_(372); -_dereq_(375); -_dereq_(371); -_dereq_(367); -_dereq_(368); -_dereq_(370); -_dereq_(373); -_dereq_(374); -_dereq_(297); -_dereq_(299); -_dereq_(298); -_dereq_(300); -_dereq_(293); -_dereq_(294); -_dereq_(296); -_dereq_(295); -_dereq_(360); -_dereq_(361); -_dereq_(362); -_dereq_(363); -_dereq_(364); -_dereq_(365); -_dereq_(345); -_dereq_(303); -_dereq_(366); -_dereq_(377); -_dereq_(378); -_dereq_(346); -_dereq_(347); -_dereq_(348); -_dereq_(349); -_dereq_(350); -_dereq_(353); -_dereq_(351); -_dereq_(352); -_dereq_(354); -_dereq_(355); -_dereq_(356); -_dereq_(357); -_dereq_(359); -_dereq_(358); -_dereq_(379); -_dereq_(386); -_dereq_(387); -_dereq_(388); -_dereq_(389); -_dereq_(390); -_dereq_(384); -_dereq_(382); -_dereq_(383); -_dereq_(381); -_dereq_(380); -_dereq_(385); -_dereq_(391); -_dereq_(394); -_dereq_(393); -_dereq_(392); -module.exports = _dereq_(223); -},{"223":223,"292":292,"293":293,"294":294,"295":295,"296":296,"297":297,"298":298,"299":299,"300":300,"301":301,"302":302,"303":303,"304":304,"305":305,"306":306,"307":307,"308":308,"309":309,"310":310,"311":311,"312":312,"313":313,"314":314,"315":315,"316":316,"317":317,"318":318,"319":319,"320":320,"321":321,"322":322,"323":323,"324":324,"325":325,"326":326,"327":327,"328":328,"329":329,"330":330,"331":331,"332":332,"333":333,"334":334,"335":335,"336":336,"337":337,"338":338,"339":339,"340":340,"341":341,"342":342,"343":343,"344":344,"345":345,"346":346,"347":347,"348":348,"349":349,"350":350,"351":351,"352":352,"353":353,"354":354,"355":355,"356":356,"357":357,"358":358,"359":359,"360":360,"361":361,"362":362,"363":363,"364":364,"365":365,"366":366,"367":367,"368":368,"369":369,"370":370,"371":371,"372":372,"373":373,"374":374,"375":375,"376":376,"377":377,"378":378,"379":379,"380":380,"381":381,"382":382,"383":383,"384":384,"385":385,"386":386,"387":387,"388":388,"389":389,"390":390,"391":391,"392":392,"393":393,"394":394}],396:[function(_dereq_,module,exports){ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = _dereq_(398); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -},{"398":398}],397:[function(_dereq_,module,exports){ -(function (process){ - -/** - * Module dependencies. - */ - -var tty = _dereq_(11); -var util = _dereq_(13); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = _dereq_(396); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[3' + c + ';1m' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = _dereq_(1); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = _dereq_(1); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); - -}).call(this,_dereq_(10)) -},{"1":1,"10":10,"11":11,"13":13,"396":396}],398:[function(_dereq_,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = '' + str; - if (str.length > 10000) return; - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} - -},{}],399:[function(_dereq_,module,exports){ -'use strict'; -var repeating = _dereq_(592); - -// detect either spaces or tabs but not both to properly handle tabs -// for indentation and spaces for alignment -var INDENT_RE = /^(?:( )+|\t+)/; - -function getMostUsed(indents) { - var result = 0; - var maxUsed = 0; - var maxWeight = 0; - - for (var n in indents) { - var indent = indents[n]; - var u = indent[0]; - var w = indent[1]; - - if (u > maxUsed || u === maxUsed && w > maxWeight) { - maxUsed = u; - maxWeight = w; - result = +n; - } - } - - return result; -} - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - // used to see if tabs or spaces are the most used - var tabs = 0; - var spaces = 0; - - // remember the size of previous line's indentation - var prev = 0; - - // remember how many indents/unindents as occurred for a given size - // and how much lines follow a given indentation + // Copyright Joyent, Inc. and other Node contributors. // - // indents = { - // 3: [1, 0], - // 4: [1, 5], - // 5: [1, 0], - // 12: [1, 0], - // } - var indents = {}; + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. - // pointer to the array of last used indent - var current; + // resolves . and .. elements in a path array with directory names there + // must be no slashes, empty elements, or device names (c:\) in the array + // (so also no leading and trailing slashes - it does not distinguish + // relative and absolute paths) + function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } - // whether the last action was an indent (opposed to an unindent) - var isIndent; + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } - str.split(/\n/g).forEach(function (line) { - if (!line) { - // ignore empty lines - return; - } + return parts; + } - var indent; - var matches = line.match(INDENT_RE); + // Split a filename into [root, dir, basename, ext], unix version + // 'root' is just a slash, or nothing. + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + var splitPath = function splitPath(filename) { + return splitPathRe.exec(filename).slice(1); + }; - if (!matches) { - indent = 0; - } else { - indent = matches[0].length; + // path.resolve([from ...], to) + // posix version + exports.resolve = function () { + var resolvedPath = '', + resolvedAbsolute = false; - if (matches[1]) { - spaces++; - } else { - tabs++; - } - } + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : process.cwd(); - var diff = indent - prev; - prev = indent; + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } - if (diff) { - // an indent or unindent has been detected + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } - isIndent = diff > 0; + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) - current = indents[isIndent ? diff : -diff]; + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) { + return !!p; + }), !resolvedAbsolute).join('/'); - if (current) { - current[0]++; - } else { - current = indents[diff] = [1, 0]; - } - } else if (current) { - // if the last action was an indent, increment the weight - current[1] += +isIndent; - } + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }; + + // path.normalize(path) + // posix version + exports.normalize = function (path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function (p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; + }; + + // posix version + exports.isAbsolute = function (path) { + return path.charAt(0) === '/'; + }; + + // posix version + exports.join = function () { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function (p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); + }; + + // path.relative(from, to) + // posix version + exports.relative = function (from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); + }; + + exports.sep = '/'; + exports.delimiter = ':'; + + exports.dirname = function (path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; + }; + + exports.basename = function (path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; + }; + + exports.extname = function (path) { + return splitPath(path)[3]; + }; + + function filter(xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; + } + + // String.prototype.substr - negative index don't work in IE8 + var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) { + return str.substr(start, len); + } : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.MESSAGES = undefined; + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + exports.get = get; + exports.parseArgs = parseArgs; + + var _util = __webpack_require__(116); + + var util = _interopRequireWildcard(_util); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var MESSAGES = exports.MESSAGES = { + tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence", + classesIllegalBareSuper: "Illegal use of bare super", + classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead", + scopeDuplicateDeclaration: "Duplicate declaration $1", + settersNoRest: "Setters aren't allowed to have a rest", + noAssignmentsInForHead: "No assignments allowed in for-in/of head", + expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier", + invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue", + readOnly: "$1 is read-only", + unknownForHead: "Unknown node type $1 in ForStatement", + didYouMean: "Did you mean $1?", + codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.", + missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues", + unsupportedOutputType: "Unsupported output type $1", + illegalMethodName: "Illegal method name $1", + lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated", + + modulesIllegalExportName: "Illegal export $1", + modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes", + + undeclaredVariable: "Reference to undeclared variable $1", + undeclaredVariableType: "Referencing a type alias outside of a type annotation", + undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?", + + traverseNeedsParent: "You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a $1 node without passing scope and parentPath.", + traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?", + traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2", + traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type", + + pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3", + pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3", + pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4", + pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3" + }; + + function get(key) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var msg = MESSAGES[key]; + if (!msg) throw new ReferenceError("Unknown message " + (0, _stringify2.default)(key)); + + args = parseArgs(args); + + return msg.replace(/\$(\d+)/g, function (str, i) { + return args[i - 1]; + }); + } + + function parseArgs(args) { + return args.map(function (val) { + if (val != null && val.inspect) { + return val.inspect(); + } else { + try { + return (0, _stringify2.default)(val) || val + ""; + } catch (e) { + return util.inspect(val); + } + } + }); + } + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(22); + module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; + }; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // Thank's IE8 for his funny defineProperty + module.exports = !__webpack_require__(36)(function () { + return Object.defineProperty({}, 'a', { get: function get() { + return 7; + } }).a != 7; }); - var amount = getMostUsed(indents); +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { - var type; - var actual; - if (!amount) { - type = null; - actual = ''; - } else if (spaces >= tabs) { - type = 'space'; - actual = repeating(' ', amount); - } else { - type = 'tab'; - actual = repeating('\t', amount); - } + 'use strict'; - return { - amount: amount, - type: type, - indent: actual + var global = __webpack_require__(14), + core = __webpack_require__(5), + ctx = __webpack_require__(54), + hide = __webpack_require__(28), + PROTOTYPE = 'prototype'; + + var $export = function $export(type, name, source) { + var IS_FORCED = type & $export.F, + IS_GLOBAL = type & $export.G, + IS_STATIC = type & $export.S, + IS_PROTO = type & $export.P, + IS_BIND = type & $export.B, + IS_WRAP = type & $export.W, + exports = IS_GLOBAL ? core : core[name] || (core[name] = {}), + expProto = exports[PROTOTYPE], + target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE], + key, + own, + out; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if (own && key in exports) continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global + // wrap global constructors for prevent change them in library + ) : IS_WRAP && target[key] == out ? function (C) { + var F = function F(a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: + return new C(); + case 1: + return new C(a); + case 2: + return new C(a, b); + }return new C(a, b, c); + }return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + }(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if (IS_PROTO) { + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + } + } }; -}; - -},{"592":592}],400:[function(_dereq_,module,exports){ -/* - Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - function isExpression(node) { - if (node == null) { return false; } - switch (node.type) { - case 'ArrayExpression': - case 'AssignmentExpression': - case 'BinaryExpression': - case 'CallExpression': - case 'ConditionalExpression': - case 'FunctionExpression': - case 'Identifier': - case 'Literal': - case 'LogicalExpression': - case 'MemberExpression': - case 'NewExpression': - case 'ObjectExpression': - case 'SequenceExpression': - case 'ThisExpression': - case 'UnaryExpression': - case 'UpdateExpression': - return true; - } - return false; - } - - function isIterationStatement(node) { - if (node == null) { return false; } - switch (node.type) { - case 'DoWhileStatement': - case 'ForInStatement': - case 'ForStatement': - case 'WhileStatement': - return true; - } - return false; - } - - function isStatement(node) { - if (node == null) { return false; } - switch (node.type) { - case 'BlockStatement': - case 'BreakStatement': - case 'ContinueStatement': - case 'DebuggerStatement': - case 'DoWhileStatement': - case 'EmptyStatement': - case 'ExpressionStatement': - case 'ForInStatement': - case 'ForStatement': - case 'IfStatement': - case 'LabeledStatement': - case 'ReturnStatement': - case 'SwitchStatement': - case 'ThrowStatement': - case 'TryStatement': - case 'VariableDeclaration': - case 'WhileStatement': - case 'WithStatement': - return true; - } - return false; - } - - function isSourceElement(node) { - return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; - } - - function trailingStatement(node) { - switch (node.type) { - case 'IfStatement': - if (node.alternate != null) { - return node.alternate; - } - return node.consequent; - - case 'LabeledStatement': - case 'ForStatement': - case 'ForInStatement': - case 'WhileStatement': - case 'WithStatement': - return node.body; - } - return null; - } - - function isProblematicIfStatement(node) { - var current; - - if (node.type !== 'IfStatement') { - return false; - } - if (node.alternate == null) { - return false; - } - current = node.consequent; - do { - if (current.type === 'IfStatement') { - if (current.alternate == null) { - return true; - } - } - current = trailingStatement(current); - } while (current); - - return false; - } - - module.exports = { - isExpression: isExpression, - isStatement: isStatement, - isIterationStatement: isIterationStatement, - isSourceElement: isSourceElement, - isProblematicIfStatement: isProblematicIfStatement, - - trailingStatement: trailingStatement - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ - -},{}],401:[function(_dereq_,module,exports){ -/* - Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com> - Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; - - // See `tools/generate-identifier-regex.js`. - ES5Regex = { - // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, - // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ - }; - - ES6Regex = { - // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/, - // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ - }; - - function isDecimalDigit(ch) { - return 0x30 <= ch && ch <= 0x39; // 0..9 - } - - function isHexDigit(ch) { - return 0x30 <= ch && ch <= 0x39 || // 0..9 - 0x61 <= ch && ch <= 0x66 || // a..f - 0x41 <= ch && ch <= 0x46; // A..F - } - - function isOctalDigit(ch) { - return ch >= 0x30 && ch <= 0x37; // 0..7 - } - - // 7.2 White Space - - NON_ASCII_WHITESPACES = [ - 0x1680, 0x180E, - 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, - 0x202F, 0x205F, - 0x3000, - 0xFEFF - ]; - - function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || - ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; - } - - // 7.6 Identifier Names and Identifiers - - function fromCodePoint(cp) { - if (cp <= 0xFFFF) { return String.fromCharCode(cp); } - var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); - var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00); - return cu1 + cu2; - } - - IDENTIFIER_START = new Array(0x80); - for(ch = 0; ch < 0x80; ++ch) { - IDENTIFIER_START[ch] = - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x41 && ch <= 0x5A || // A..Z - ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) - } - - IDENTIFIER_PART = new Array(0x80); - for(ch = 0; ch < 0x80; ++ch) { - IDENTIFIER_PART[ch] = - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) - } - - function isIdentifierStartES5(ch) { - return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); - } - - function isIdentifierPartES5(ch) { - return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); - } - - function isIdentifierStartES6(ch) { - return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); - } - - function isIdentifierPartES6(ch) { - return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); - } - - module.exports = { - isDecimalDigit: isDecimalDigit, - isHexDigit: isHexDigit, - isOctalDigit: isOctalDigit, - isWhiteSpace: isWhiteSpace, - isLineTerminator: isLineTerminator, - isIdentifierStartES5: isIdentifierStartES5, - isIdentifierPartES5: isIdentifierPartES5, - isIdentifierStartES6: isIdentifierStartES6, - isIdentifierPartES6: isIdentifierPartES6 - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ - -},{}],402:[function(_dereq_,module,exports){ -/* - Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - var code = _dereq_(401); - - function isStrictModeReservedWordES6(id) { - switch (id) { - case 'implements': - case 'interface': - case 'package': - case 'private': - case 'protected': - case 'public': - case 'static': - case 'let': - return true; - default: - return false; - } - } - - function isKeywordES5(id, strict) { - // yield should not be treated as keyword under non-strict mode. - if (!strict && id === 'yield') { - return false; - } - return isKeywordES6(id, strict); - } - - function isKeywordES6(id, strict) { - if (strict && isStrictModeReservedWordES6(id)) { - return true; - } - - switch (id.length) { - case 2: - return (id === 'if') || (id === 'in') || (id === 'do'); - case 3: - return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); - case 4: - return (id === 'this') || (id === 'else') || (id === 'case') || - (id === 'void') || (id === 'with') || (id === 'enum'); - case 5: - return (id === 'while') || (id === 'break') || (id === 'catch') || - (id === 'throw') || (id === 'const') || (id === 'yield') || - (id === 'class') || (id === 'super'); - case 6: - return (id === 'return') || (id === 'typeof') || (id === 'delete') || - (id === 'switch') || (id === 'export') || (id === 'import'); - case 7: - return (id === 'default') || (id === 'finally') || (id === 'extends'); - case 8: - return (id === 'function') || (id === 'continue') || (id === 'debugger'); - case 10: - return (id === 'instanceof'); - default: - return false; - } - } - - function isReservedWordES5(id, strict) { - return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); - } - - function isReservedWordES6(id, strict) { - return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); - } - - function isRestrictedWord(id) { - return id === 'eval' || id === 'arguments'; - } - - function isIdentifierNameES5(id) { - var i, iz, ch; - - if (id.length === 0) { return false; } - - ch = id.charCodeAt(0); - if (!code.isIdentifierStartES5(ch)) { - return false; - } - - for (i = 1, iz = id.length; i < iz; ++i) { - ch = id.charCodeAt(i); - if (!code.isIdentifierPartES5(ch)) { - return false; - } - } - return true; - } - - function decodeUtf16(lead, trail) { - return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; - } - - function isIdentifierNameES6(id) { - var i, iz, ch, lowCh, check; - - if (id.length === 0) { return false; } - - check = code.isIdentifierStartES6; - for (i = 0, iz = id.length; i < iz; ++i) { - ch = id.charCodeAt(i); - if (0xD800 <= ch && ch <= 0xDBFF) { - ++i; - if (i >= iz) { return false; } - lowCh = id.charCodeAt(i); - if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { - return false; - } - ch = decodeUtf16(ch, lowCh); - } - if (!check(ch)) { - return false; - } - check = code.isIdentifierPartES6; - } - return true; - } - - function isIdentifierES5(id, strict) { - return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); - } - - function isIdentifierES6(id, strict) { - return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); - } - - module.exports = { - isKeywordES5: isKeywordES5, - isKeywordES6: isKeywordES6, - isReservedWordES5: isReservedWordES5, - isReservedWordES6: isReservedWordES6, - isRestrictedWord: isRestrictedWord, - isIdentifierNameES5: isIdentifierNameES5, - isIdentifierNameES6: isIdentifierNameES6, - isIdentifierES5: isIdentifierES5, - isIdentifierES6: isIdentifierES6 - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ - -},{"401":401}],403:[function(_dereq_,module,exports){ -/* - Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -(function () { - 'use strict'; - - exports.ast = _dereq_(400); - exports.code = _dereq_(401); - exports.keyword = _dereq_(402); -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ - -},{"400":400,"401":401,"402":402}],404:[function(_dereq_,module,exports){ -module.exports={ - "builtin": { - "Array": false, - "ArrayBuffer": false, - "Boolean": false, - "constructor": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "System": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "nonstandard": { - "escape": false, - "unescape": false - }, - "browser": { - "addEventListener": false, - "alert": false, - "applicationCache": false, - "atob": false, - "Audio": false, - "AudioProcessingEvent": false, - "BeforeUnloadEvent": false, - "Blob": false, - "blur": false, - "btoa": false, - "cancelAnimationFrame": false, - "CanvasGradient": false, - "CanvasPattern": false, - "CanvasRenderingContext2D": false, - "clearInterval": false, - "clearTimeout": false, - "close": false, - "closed": false, - "CloseEvent": false, - "Comment": false, - "CompositionEvent": false, - "confirm": false, - "console": false, - "crypto": false, - "CSS": false, - "CustomEvent": false, - "DataView": false, - "Debug": false, - "defaultStatus": false, - "devicePixelRatio": false, - "dispatchEvent": false, - "document": false, - "Document": false, - "DocumentFragment": false, - "DOMParser": false, - "DragEvent": false, - "Element": false, - "ElementTimeControl": false, - "ErrorEvent": false, - "event": false, - "Event": false, - "FileReader": false, - "fetch": false, - "find": false, - "focus": false, - "FocusEvent": false, - "FormData": false, - "frameElement": false, - "frames": false, - "GamepadEvent": false, - "getComputedStyle": false, - "getSelection": false, - "HashChangeEvent": false, - "Headers": false, - "history": false, - "HTMLAnchorElement": false, - "HTMLBaseElement": false, - "HTMLBlockquoteElement": false, - "HTMLBodyElement": false, - "HTMLBRElement": false, - "HTMLButtonElement": false, - "HTMLCanvasElement": false, - "HTMLDirectoryElement": false, - "HTMLDivElement": false, - "HTMLDListElement": false, - "HTMLElement": false, - "HTMLFieldSetElement": false, - "HTMLFontElement": false, - "HTMLFormElement": false, - "HTMLFrameElement": false, - "HTMLFrameSetElement": false, - "HTMLHeadElement": false, - "HTMLHeadingElement": false, - "HTMLHRElement": false, - "HTMLHtmlElement": false, - "HTMLIFrameElement": false, - "HTMLImageElement": false, - "HTMLInputElement": false, - "HTMLIsIndexElement": false, - "HTMLLabelElement": false, - "HTMLLayerElement": false, - "HTMLLegendElement": false, - "HTMLLIElement": false, - "HTMLLinkElement": false, - "HTMLMapElement": false, - "HTMLMenuElement": false, - "HTMLMetaElement": false, - "HTMLModElement": false, - "HTMLObjectElement": false, - "HTMLOListElement": false, - "HTMLOptGroupElement": false, - "HTMLOptionElement": false, - "HTMLParagraphElement": false, - "HTMLParamElement": false, - "HTMLPreElement": false, - "HTMLQuoteElement": false, - "HTMLScriptElement": false, - "HTMLSelectElement": false, - "HTMLStyleElement": false, - "HTMLTableCaptionElement": false, - "HTMLTableCellElement": false, - "HTMLTableColElement": false, - "HTMLTableElement": false, - "HTMLTableRowElement": false, - "HTMLTableSectionElement": false, - "HTMLTextAreaElement": false, - "HTMLTitleElement": false, - "HTMLUListElement": false, - "HTMLVideoElement": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBEnvironment": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "Image": false, - "indexedDB": false, - "innerHeight": false, - "innerWidth": false, - "InputEvent": false, - "Intl": false, - "KeyboardEvent": false, - "length": false, - "localStorage": false, - "location": false, - "matchMedia": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "MouseEvent": false, - "moveBy": false, - "moveTo": false, - "MutationObserver": false, - "name": false, - "navigator": false, - "Node": false, - "NodeFilter": false, - "NodeList": false, - "Notification": false, - "OfflineAudioCompletionEvent": false, - "onbeforeunload": true, - "onblur": true, - "onerror": true, - "onfocus": true, - "onload": true, - "onresize": true, - "onunload": true, - "open": false, - "openDatabase": false, - "opener": false, - "opera": false, - "Option": false, - "outerHeight": false, - "outerWidth": false, - "PageTransitionEvent": false, - "pageXOffset": false, - "pageYOffset": false, - "parent": false, - "PopStateEvent": false, - "postMessage": false, - "print": false, - "ProgressEvent": false, - "prompt": false, - "Range": false, - "Request": false, - "Response": false, - "removeEventListener": false, - "requestAnimationFrame": false, - "resizeBy": false, - "resizeTo": false, - "screen": false, - "screenX": false, - "screenY": false, - "scroll": false, - "scrollbars": false, - "scrollBy": false, - "scrollTo": false, - "scrollX": false, - "scrollY": false, - "self": false, - "sessionStorage": false, - "setInterval": false, - "setTimeout": false, - "SharedWorker": false, - "showModalDialog": false, - "status": false, - "stop": false, - "StorageEvent": false, - "SVGAElement": false, - "SVGAltGlyphDefElement": false, - "SVGAltGlyphElement": false, - "SVGAltGlyphItemElement": false, - "SVGAngle": false, - "SVGAnimateColorElement": false, - "SVGAnimatedAngle": false, - "SVGAnimatedBoolean": false, - "SVGAnimatedEnumeration": false, - "SVGAnimatedInteger": false, - "SVGAnimatedLength": false, - "SVGAnimatedLengthList": false, - "SVGAnimatedNumber": false, - "SVGAnimatedNumberList": false, - "SVGAnimatedPathData": false, - "SVGAnimatedPoints": false, - "SVGAnimatedPreserveAspectRatio": false, - "SVGAnimatedRect": false, - "SVGAnimatedString": false, - "SVGAnimatedTransformList": false, - "SVGAnimateElement": false, - "SVGAnimateMotionElement": false, - "SVGAnimateTransformElement": false, - "SVGAnimationElement": false, - "SVGCircleElement": false, - "SVGClipPathElement": false, - "SVGColor": false, - "SVGColorProfileElement": false, - "SVGColorProfileRule": false, - "SVGComponentTransferFunctionElement": false, - "SVGCSSRule": false, - "SVGCursorElement": false, - "SVGDefsElement": false, - "SVGDescElement": false, - "SVGDocument": false, - "SVGElement": false, - "SVGElementInstance": false, - "SVGElementInstanceList": false, - "SVGEllipseElement": false, - "SVGEvent": false, - "SVGExternalResourcesRequired": false, - "SVGFEBlendElement": false, - "SVGFEColorMatrixElement": false, - "SVGFEComponentTransferElement": false, - "SVGFECompositeElement": false, - "SVGFEConvolveMatrixElement": false, - "SVGFEDiffuseLightingElement": false, - "SVGFEDisplacementMapElement": false, - "SVGFEDistantLightElement": false, - "SVGFEFloodElement": false, - "SVGFEFuncAElement": false, - "SVGFEFuncBElement": false, - "SVGFEFuncGElement": false, - "SVGFEFuncRElement": false, - "SVGFEGaussianBlurElement": false, - "SVGFEImageElement": false, - "SVGFEMergeElement": false, - "SVGFEMergeNodeElement": false, - "SVGFEMorphologyElement": false, - "SVGFEOffsetElement": false, - "SVGFEPointLightElement": false, - "SVGFESpecularLightingElement": false, - "SVGFESpotLightElement": false, - "SVGFETileElement": false, - "SVGFETurbulenceElement": false, - "SVGFilterElement": false, - "SVGFilterPrimitiveStandardAttributes": false, - "SVGFitToViewBox": false, - "SVGFontElement": false, - "SVGFontFaceElement": false, - "SVGFontFaceFormatElement": false, - "SVGFontFaceNameElement": false, - "SVGFontFaceSrcElement": false, - "SVGFontFaceUriElement": false, - "SVGForeignObjectElement": false, - "SVGGElement": false, - "SVGGlyphElement": false, - "SVGGlyphRefElement": false, - "SVGGradientElement": false, - "SVGHKernElement": false, - "SVGICCColor": false, - "SVGImageElement": false, - "SVGLangSpace": false, - "SVGLength": false, - "SVGLengthList": false, - "SVGLinearGradientElement": false, - "SVGLineElement": false, - "SVGLocatable": false, - "SVGMarkerElement": false, - "SVGMaskElement": false, - "SVGMatrix": false, - "SVGMetadataElement": false, - "SVGMissingGlyphElement": false, - "SVGMPathElement": false, - "SVGNumber": false, - "SVGNumberList": false, - "SVGPaint": false, - "SVGPathElement": false, - "SVGPathSeg": false, - "SVGPathSegArcAbs": false, - "SVGPathSegArcRel": false, - "SVGPathSegClosePath": false, - "SVGPathSegCurvetoCubicAbs": false, - "SVGPathSegCurvetoCubicRel": false, - "SVGPathSegCurvetoCubicSmoothAbs": false, - "SVGPathSegCurvetoCubicSmoothRel": false, - "SVGPathSegCurvetoQuadraticAbs": false, - "SVGPathSegCurvetoQuadraticRel": false, - "SVGPathSegCurvetoQuadraticSmoothAbs": false, - "SVGPathSegCurvetoQuadraticSmoothRel": false, - "SVGPathSegLinetoAbs": false, - "SVGPathSegLinetoHorizontalAbs": false, - "SVGPathSegLinetoHorizontalRel": false, - "SVGPathSegLinetoRel": false, - "SVGPathSegLinetoVerticalAbs": false, - "SVGPathSegLinetoVerticalRel": false, - "SVGPathSegList": false, - "SVGPathSegMovetoAbs": false, - "SVGPathSegMovetoRel": false, - "SVGPatternElement": false, - "SVGPoint": false, - "SVGPointList": false, - "SVGPolygonElement": false, - "SVGPolylineElement": false, - "SVGPreserveAspectRatio": false, - "SVGRadialGradientElement": false, - "SVGRect": false, - "SVGRectElement": false, - "SVGRenderingIntent": false, - "SVGScriptElement": false, - "SVGSetElement": false, - "SVGStopElement": false, - "SVGStringList": false, - "SVGStylable": false, - "SVGStyleElement": false, - "SVGSVGElement": false, - "SVGSwitchElement": false, - "SVGSymbolElement": false, - "SVGTests": false, - "SVGTextContentElement": false, - "SVGTextElement": false, - "SVGTextPathElement": false, - "SVGTextPositioningElement": false, - "SVGTitleElement": false, - "SVGTransform": false, - "SVGTransformable": false, - "SVGTransformList": false, - "SVGTRefElement": false, - "SVGTSpanElement": false, - "SVGUnitTypes": false, - "SVGURIReference": false, - "SVGUseElement": false, - "SVGViewElement": false, - "SVGViewSpec": false, - "SVGVKernElement": false, - "SVGZoomAndPan": false, - "Text": false, - "TextDecoder": false, - "TextEncoder": false, - "TimeEvent": false, - "top": false, - "TouchEvent": false, - "UIEvent": false, - "URL": false, - "WebGLActiveInfo": false, - "WebGLBuffer": false, - "WebGLContextEvent": false, - "WebGLFramebuffer": false, - "WebGLProgram": false, - "WebGLRenderbuffer": false, - "WebGLRenderingContext": false, - "WebGLShader": false, - "WebGLShaderPrecisionFormat": false, - "WebGLTexture": false, - "WebGLUniformLocation": false, - "WebSocket": false, - "WheelEvent": false, - "window": false, - "Window": false, - "Worker": false, - "XDomainRequest": false, - "XMLHttpRequest": false, - "XMLSerializer": false, - "XPathEvaluator": false, - "XPathException": false, - "XPathExpression": false, - "XPathNamespace": false, - "XPathNSResolver": false, - "XPathResult": false - }, - "worker": { - "importScripts": true, - "postMessage": true, - "self": true - }, - "node": { - "__dirname": false, - "__filename": false, - "arguments": false, - "Buffer": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "DataView": false, - "exports": true, - "GLOBAL": false, - "global": false, - "module": false, - "process": false, - "require": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false - }, - "amd": { - "define": false, - "require": false - }, - "mocha": { - "after": false, - "afterEach": false, - "before": false, - "beforeEach": false, - "context": false, - "describe": false, - "it": false, - "setup": false, - "specify": false, - "suite": false, - "suiteSetup": false, - "suiteTeardown": false, - "teardown": false, - "test": false, - "xcontext": false, - "xdescribe": false, - "xit": false, - "xspecify": false - }, - "jasmine": { - "afterAll": false, - "afterEach": false, - "beforeAll": false, - "beforeEach": false, - "describe": false, - "expect": false, - "fail": false, - "fdescribe": false, - "fit": false, - "it": false, - "jasmine": false, - "pending": false, - "runs": false, - "spyOn": false, - "waits": false, - "waitsFor": false, - "xdescribe": false, - "xit": false - }, - "qunit": { - "asyncTest": false, - "deepEqual": false, - "equal": false, - "expect": false, - "module": false, - "notDeepEqual": false, - "notEqual": false, - "notPropEqual": false, - "notStrictEqual": false, - "ok": false, - "propEqual": false, - "QUnit": false, - "raises": false, - "start": false, - "stop": false, - "strictEqual": false, - "test": false, - "throws": false - }, - "phantomjs": { - "console": true, - "exports": true, - "phantom": true, - "require": true, - "WebPage": true - }, - "couch": { - "emit": false, - "exports": false, - "getRow": false, - "log": false, - "module": false, - "provides": false, - "require": false, - "respond": false, - "send": false, - "start": false, - "sum": false - }, - "rhino": { - "defineClass": false, - "deserialize": false, - "gc": false, - "help": false, - "importClass": false, - "importPackage": false, - "java": false, - "load": false, - "loadClass": false, - "Packages": false, - "print": false, - "quit": false, - "readFile": false, - "readUrl": false, - "runCommand": false, - "seal": false, - "serialize": false, - "spawn": false, - "sync": false, - "toint32": false, - "version": false - }, - "wsh": { - "ActiveXObject": true, - "Enumerator": true, - "GetObject": true, - "ScriptEngine": true, - "ScriptEngineBuildVersion": true, - "ScriptEngineMajorVersion": true, - "ScriptEngineMinorVersion": true, - "VBArray": true, - "WScript": true, - "WSH": true, - "XDomainRequest": true - }, - "jquery": { - "$": false, - "jQuery": false - }, - "yui": { - "Y": false, - "YUI": false, - "YUI_config": false - }, - "shelljs": { - "cat": false, - "cd": false, - "chmod": false, - "config": false, - "cp": false, - "dirs": false, - "echo": false, - "env": false, - "error": false, - "exec": false, - "exit": false, - "find": false, - "grep": false, - "ls": false, - "mkdir": false, - "mv": false, - "popd": false, - "pushd": false, - "pwd": false, - "rm": false, - "sed": false, - "target": false, - "tempdir": false, - "test": false, - "which": false - }, - "prototypejs": { - "$": false, - "$$": false, - "$A": false, - "$break": false, - "$continue": false, - "$F": false, - "$H": false, - "$R": false, - "$w": false, - "Abstract": false, - "Ajax": false, - "Autocompleter": false, - "Builder": false, - "Class": false, - "Control": false, - "Draggable": false, - "Draggables": false, - "Droppables": false, - "Effect": false, - "Element": false, - "Enumerable": false, - "Event": false, - "Field": false, - "Form": false, - "Hash": false, - "Insertion": false, - "ObjectRange": false, - "PeriodicalExecuter": false, - "Position": false, - "Prototype": false, - "Scriptaculous": false, - "Selector": false, - "Sortable": false, - "SortableObserver": false, - "Sound": false, - "Template": false, - "Toggle": false, - "Try": false - }, - "meteor": { - "$": false, - "_": false, - "Accounts": false, - "App": false, - "Assets": false, - "Blaze": false, - "check": false, - "Cordova": false, - "DDP": false, - "DDPServer": false, - "Deps": false, - "EJSON": false, - "Email": false, - "HTTP": false, - "Log": false, - "Match": false, - "Meteor": false, - "Mongo": false, - "MongoInternals": false, - "Npm": false, - "Package": false, - "Plugin": false, - "process": false, - "Random": false, - "ReactiveDict": false, - "ReactiveVar": false, - "Router": false, - "Session": false, - "share": false, - "Spacebars": false, - "Template": false, - "Tinytest": false, - "Tracker": false, - "UI": false, - "Utils": false, - "WebApp": false, - "WebAppInternals": false - }, - "mongo": { - "_isWindows": false, - "_rand": false, - "BulkWriteResult": false, - "cat": false, - "cd": false, - "connect": false, - "db": false, - "getHostName": false, - "getMemInfo": false, - "hostname": false, - "listFiles": false, - "load": false, - "ls": false, - "md5sumFile": false, - "mkdir": false, - "Mongo": false, - "ObjectId": false, - "PlanCache": false, - "pwd": false, - "quit": false, - "removeFile": false, - "rs": false, - "sh": false, - "UUID": false, - "version": false, - "WriteResult": false - }, - "applescript": { - "$": false, - "Application": false, - "Automation": false, - "console": false, - "delay": false, - "Library": false, - "ObjC": false, - "ObjectSpecifier": false, - "Path": false, - "Progress": false, - "Ref": false + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + $export.U = 64; // safe + $export.R = 128; // real proto method for `library` + module.exports = $export; + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + module.exports = function (it) { + return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function'; + }; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var anObject = __webpack_require__(19), + IE8_DOM_DEFINE = __webpack_require__(226), + toPrimitive = __webpack_require__(150), + dP = Object.defineProperty; + + exports.f = __webpack_require__(20) ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) {/* empty */} + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isFunction = __webpack_require__(171), + isLength = __webpack_require__(172); + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); } -} - -},{}],405:[function(_dereq_,module,exports){ -module.exports = _dereq_(404); - -},{"404":404}],406:[function(_dereq_,module,exports){ -// https://github.com/paulmillr/es6-shim -// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger -var isFinite = _dereq_(407); -module.exports = Number.isInteger || function(val) { - return typeof val === "number" && - isFinite(val) && - Math.floor(val) === val; -}; - -},{"407":407}],407:[function(_dereq_,module,exports){ -'use strict'; -var numberIsNan = _dereq_(408); - -module.exports = Number.isFinite || function (val) { - return !(typeof val !== 'number' || numberIsNan(val) || val === Infinity || val === -Infinity); -}; - -},{"408":408}],408:[function(_dereq_,module,exports){ -'use strict'; -module.exports = Number.isNaN || function (x) { - return x !== x; -}; - -},{}],409:[function(_dereq_,module,exports){ -// Copyright 2014, 2015 Simon Lydell -// X11 (“MIT”) Licensed. (See LICENSE.) - -// This regex comes from regex.coffee, and is inserted here by generate-index.js -// (run `npm run build`). -module.exports = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g - -module.exports.matchToToken = function(match) { - var token = {type: "invalid", value: match[0]} - if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) - else if (match[ 5]) token.type = "comment" - else if (match[ 6]) token.type = "comment", token.closed = !!match[7] - else if (match[ 8]) token.type = "regex" - else if (match[ 9]) token.type = "number" - else if (match[10]) token.type = "name" - else if (match[11]) token.type = "punctuator" - else if (match[12]) token.type = "whitespace" - return token -} - -},{}],410:[function(_dereq_,module,exports){ -// json5.js -// Modern JSON. See README.md for details. -// -// This file is based directly off of Douglas Crockford's json_parse.js: -// https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js - -var JSON5 = (typeof exports === 'object' ? exports : {}); - -JSON5.parse = (function () { - "use strict"; - -// This is a function that can parse a JSON5 text, producing a JavaScript -// data structure. It is a simple, recursive descent parser. It does not use -// eval or regular expressions, so it can be used as a model for implementing -// a JSON5 parser in other languages. - -// We are defining the function inside of another function to avoid creating -// global variables. - - var at, // The index of the current character - ch, // The current character - escapee = { - "'": "'", - '"': '"', - '\\': '\\', - '/': '/', - '\n': '', // Replace escaped newlines in strings w/ empty string - b: '\b', - f: '\f', - n: '\n', - r: '\r', - t: '\t' - }, - ws = [ - ' ', - '\t', - '\r', - '\n', - '\v', - '\f', - '\xA0', - '\uFEFF' - ], - text, - - error = function (m) { - -// Call error when something is wrong. - - var error = new SyntaxError(); - error.message = m; - error.at = at; - error.text = text; - throw error; - }, - - next = function (c) { - -// If a c parameter is provided, verify that it matches the current character. - - if (c && c !== ch) { - error("Expected '" + c + "' instead of '" + ch + "'"); - } - -// Get the next character. When there are no more characters, -// return the empty string. - - ch = text.charAt(at); - at += 1; - return ch; - }, - - peek = function () { - -// Get the next character without consuming it or -// assigning it to the ch varaible. - - return text.charAt(at); - }, - - identifier = function () { - -// Parse an identifier. Normally, reserved words are disallowed here, but we -// only use this for unquoted object keys, where reserved words are allowed, -// so we don't check for those here. References: -// - http://es5.github.com/#x7.6 -// - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables -// - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm -// TODO Identifiers can have Unicode "letters" in them; add support for those. - - var key = ch; - - // Identifiers must start with a letter, _ or $. - if ((ch !== '_' && ch !== '$') && - (ch < 'a' || ch > 'z') && - (ch < 'A' || ch > 'Z')) { - error("Bad identifier"); - } - - // Subsequent characters can contain digits. - while (next() && ( - ch === '_' || ch === '$' || - (ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch <= '9'))) { - key += ch; - } - - return key; - }, - - number = function () { - -// Parse a number value. - - var number, - sign = '', - string = '', - base = 10; - - if (ch === '-' || ch === '+') { - sign = ch; - next(ch); - } - - // support for Infinity (could tweak to allow other words): - if (ch === 'I') { - number = word(); - if (typeof number !== 'number' || isNaN(number)) { - error('Unexpected word for number'); - } - return (sign === '-') ? -number : number; - } - - // support for NaN - if (ch === 'N' ) { - number = word(); - if (!isNaN(number)) { - error('expected word to be NaN'); - } - // ignore sign as -NaN also is NaN - return number; - } - - if (ch === '0') { - string += ch; - next(); - if (ch === 'x' || ch === 'X') { - string += ch; - next(); - base = 16; - } else if (ch >= '0' && ch <= '9') { - error('Octal literal'); - } - } - - switch (base) { - case 10: - while (ch >= '0' && ch <= '9' ) { - string += ch; - next(); - } - if (ch === '.') { - string += '.'; - while (next() && ch >= '0' && ch <= '9') { - string += ch; - } - } - if (ch === 'e' || ch === 'E') { - string += ch; - next(); - if (ch === '-' || ch === '+') { - string += ch; - next(); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - } - break; - case 16: - while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') { - string += ch; - next(); - } - break; - } - - if(sign === '-') { - number = -string; - } else { - number = +string; - } - - if (!isFinite(number)) { - error("Bad number"); - } else { - return number; - } - }, - - string = function () { - -// Parse a string value. - - var hex, - i, - string = '', - delim, // double quote or single quote - uffff; - -// When parsing for string values, we must look for ' or " and \ characters. - - if (ch === '"' || ch === "'") { - delim = ch; - while (next()) { - if (ch === delim) { - next(); - return string; - } else if (ch === '\\') { - next(); - if (ch === 'u') { - uffff = 0; - for (i = 0; i < 4; i += 1) { - hex = parseInt(next(), 16); - if (!isFinite(hex)) { - break; - } - uffff = uffff * 16 + hex; - } - string += String.fromCharCode(uffff); - } else if (ch === '\r') { - if (peek() === '\n') { - next(); - } - } else if (typeof escapee[ch] === 'string') { - string += escapee[ch]; - } else { - break; - } - } else if (ch === '\n') { - // unescaped newlines are invalid; see: - // https://github.com/aseemk/json5/issues/24 - // TODO this feels special-cased; are there other - // invalid unescaped chars? - break; - } else { - string += ch; - } - } - } - error("Bad string"); - }, - - inlineComment = function () { - -// Skip an inline comment, assuming this is one. The current character should -// be the second / character in the // pair that begins this inline comment. -// To finish the inline comment, we look for a newline or the end of the text. - - if (ch !== '/') { - error("Not an inline comment"); - } - - do { - next(); - if (ch === '\n' || ch === '\r') { - next(); - return; - } - } while (ch); - }, - - blockComment = function () { - -// Skip a block comment, assuming this is one. The current character should be -// the * character in the /* pair that begins this block comment. -// To finish the block comment, we look for an ending */ pair of characters, -// but we also watch for the end of text before the comment is terminated. - - if (ch !== '*') { - error("Not a block comment"); - } - - do { - next(); - while (ch === '*') { - next('*'); - if (ch === '/') { - next('/'); - return; - } - } - } while (ch); - - error("Unterminated block comment"); - }, - - comment = function () { - -// Skip a comment, whether inline or block-level, assuming this is one. -// Comments always begin with a / character. - - if (ch !== '/') { - error("Not a comment"); - } - - next('/'); - - if (ch === '/') { - inlineComment(); - } else if (ch === '*') { - blockComment(); - } else { - error("Unrecognized comment"); - } - }, - - white = function () { - -// Skip whitespace and comments. -// Note that we're detecting comments by only a single / character. -// This works since regular expressions are not valid JSON(5), but this will -// break if there are other valid values that begin with a / character! - - while (ch) { - if (ch === '/') { - comment(); - } else if (ws.indexOf(ch) >= 0) { - next(); - } else { - return; - } - } - }, - - word = function () { - -// true, false, or null. - - switch (ch) { - case 't': - next('t'); - next('r'); - next('u'); - next('e'); - return true; - case 'f': - next('f'); - next('a'); - next('l'); - next('s'); - next('e'); - return false; - case 'n': - next('n'); - next('u'); - next('l'); - next('l'); - return null; - case 'I': - next('I'); - next('n'); - next('f'); - next('i'); - next('n'); - next('i'); - next('t'); - next('y'); - return Infinity; - case 'N': - next( 'N' ); - next( 'a' ); - next( 'N' ); - return NaN; - } - error("Unexpected '" + ch + "'"); - }, - - value, // Place holder for the value function. - - array = function () { - -// Parse an array value. - - var array = []; - - if (ch === '[') { - next('['); - white(); - while (ch) { - if (ch === ']') { - next(']'); - return array; // Potentially empty array - } - // ES5 allows omitting elements in arrays, e.g. [,] and - // [,null]. We don't allow this in JSON5. - if (ch === ',') { - error("Missing array element"); - } else { - array.push(value()); - } - white(); - // If there's no comma after this value, this needs to - // be the end of the array. - if (ch !== ',') { - next(']'); - return array; - } - next(','); - white(); - } - } - error("Bad array"); - }, - - object = function () { - -// Parse an object value. - - var key, - object = {}; - - if (ch === '{') { - next('{'); - white(); - while (ch) { - if (ch === '}') { - next('}'); - return object; // Potentially empty object - } - - // Keys can be unquoted. If they are, they need to be - // valid JS identifiers. - if (ch === '"' || ch === "'") { - key = string(); - } else { - key = identifier(); - } - - white(); - next(':'); - object[key] = value(); - white(); - // If there's no comma after this pair, this needs to be - // the end of the object. - if (ch !== ',') { - next('}'); - return object; - } - next(','); - white(); - } - } - error("Bad object"); - }; - - value = function () { - -// Parse a JSON value. It could be an object, an array, a string, a number, -// or a word. - - white(); - switch (ch) { - case '{': - return object(); - case '[': - return array(); - case '"': - case "'": - return string(); - case '-': - case '+': - case '.': - return number(); - default: - return ch >= '0' && ch <= '9' ? number() : word(); - } - }; - -// Return the json_parse function. It will have access to all of the above -// functions and variables. - - return function (source, reviver) { - var result; - - text = String(source); - at = 0; - ch = ' '; - result = value(); - white(); - if (ch) { - error("Syntax error"); - } - -// If there is a reviver function, we recursively walk the new structure, -// passing each name/value pair to the reviver function for possible -// transformation, starting with a temporary root object that holds the result -// in an empty key. If there is not a reviver function, we simply return the -// result. - - return typeof reviver === 'function' ? (function walk(holder, key) { - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - }({'': result}, '')) : result; - }; -}()); - -// JSON5 stringify will not quote keys where appropriate -JSON5.stringify = function (obj, replacer, space) { - if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) { - throw new Error('Replacer must be a function or an array'); - } - var getReplacedValueOrUndefined = function(holder, key, isTopLevel) { - var value = holder[key]; - - // Replace the value with its toJSON value first, if possible - if (value && value.toJSON && typeof value.toJSON === "function") { - value = value.toJSON(); - } - - // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for - // presence in the array (removing the key/value pair from the resulting JSON if the key is missing). - if (typeof(replacer) === "function") { - return replacer.call(holder, key, value); - } else if(replacer) { - if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) { - return value; - } else { - return undefined; - } - } else { - return value; - } - }; - - function isWordChar(char) { - return (char >= 'a' && char <= 'z') || - (char >= 'A' && char <= 'Z') || - (char >= '0' && char <= '9') || - char === '_' || char === '$'; - } - - function isWordStart(char) { - return (char >= 'a' && char <= 'z') || - (char >= 'A' && char <= 'Z') || - char === '_' || char === '$'; - } - - function isWord(key) { - if (typeof key !== 'string') { - return false; - } - if (!isWordStart(key[0])) { - return false; - } - var i = 1, length = key.length; - while (i < length) { - if (!isWordChar(key[i])) { - return false; - } - i++; - } - return true; - } - - // export for use in tests - JSON5.isWord = isWord; - - // polyfills - function isArray(obj) { - if (Array.isArray) { - return Array.isArray(obj); - } else { - return Object.prototype.toString.call(obj) === '[object Array]'; - } - } - - function isDate(obj) { - return Object.prototype.toString.call(obj) === '[object Date]'; - } - - isNaN = isNaN || function(val) { - return typeof val === 'number' && val !== val; - }; - - var objStack = []; - function checkForCircular(obj) { - for (var i = 0; i < objStack.length; i++) { - if (objStack[i] === obj) { - throw new TypeError("Converting circular structure to JSON"); - } - } - } - - function makeIndent(str, num, noNewLine) { - if (!str) { - return ""; - } - // indentation no more than 10 chars - if (str.length > 10) { - str = str.substring(0, 10); - } - - var indent = noNewLine ? "" : "\n"; - for (var i = 0; i < num; i++) { - indent += str; - } - - return indent; - } - - var indentStr; - if (space) { - if (typeof space === "string") { - indentStr = space; - } else if (typeof space === "number" && space >= 0) { - indentStr = makeIndent(" ", space, true); - } else { - // ignore space parameter - } - } - - // Copied from Crokford's implementation of JSON - // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195 - // Begin - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }; - function escapeString(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? - c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - // End - - function internalStringify(holder, key, isTopLevel) { - var buffer, res; - - // Replace the value, if necessary - var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel); - - if (obj_part && !isDate(obj_part)) { - // unbox objects - // don't unbox dates, since will turn it into number - obj_part = obj_part.valueOf(); - } - switch(typeof obj_part) { - case "boolean": - return obj_part.toString(); - - case "number": - if (isNaN(obj_part) || !isFinite(obj_part)) { - return "null"; - } - return obj_part.toString(); - - case "string": - return escapeString(obj_part.toString()); - - case "object": - if (obj_part === null) { - return "null"; - } else if (isArray(obj_part)) { - checkForCircular(obj_part); - buffer = "["; - objStack.push(obj_part); - - for (var i = 0; i < obj_part.length; i++) { - res = internalStringify(obj_part, i, false); - buffer += makeIndent(indentStr, objStack.length); - if (res === null || typeof res === "undefined") { - buffer += "null"; - } else { - buffer += res; - } - if (i < obj_part.length-1) { - buffer += ","; - } else if (indentStr) { - buffer += "\n"; - } - } - objStack.pop(); - buffer += makeIndent(indentStr, objStack.length, true) + "]"; - } else { - checkForCircular(obj_part); - buffer = "{"; - var nonEmpty = false; - objStack.push(obj_part); - for (var prop in obj_part) { - if (obj_part.hasOwnProperty(prop)) { - var value = internalStringify(obj_part, prop, false); - isTopLevel = false; - if (typeof value !== "undefined" && value !== null) { - buffer += makeIndent(indentStr, objStack.length); - nonEmpty = true; - var key = isWord(prop) ? prop : escapeString(prop); - buffer += key + ":" + (indentStr ? ' ' : '') + value + ","; - } - } - } - objStack.pop(); - if (nonEmpty) { - buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}"; - } else { - buffer = '{}'; - } - } - return buffer; - default: - // functions and undefined should be ignored - return undefined; - } - } - - // special case...when undefined is used inside of - // a compound object/array, return null. - // but when top-level, return undefined - var topLevelHolder = {"":obj}; - if (obj === undefined) { - return getReplacedValueOrUndefined(topLevelHolder, '', true); - } - return internalStringify(topLevelHolder, '', true); -}; - -},{}],411:[function(_dereq_,module,exports){ -// Copyright 2014, 2015 Simon Lydell -// X11 (“MIT”) Licensed. (See LICENSE.) - -var leftPad = _dereq_(412) - -function get(options, key, defaultValue) { - return (key in options ? options[key] : defaultValue) -} - -function lineNumbers(code, options) { - var getOption = get.bind(null, options || {}) - var transform = getOption("transform", Function.prototype) - var padding = getOption("padding", " ") - var before = getOption("before", " ") - var after = getOption("after", " | ") - var start = getOption("start", 1) - var isArray = Array.isArray(code) - var lines = (isArray ? code : code.split("\n")) - var end = start + lines.length - 1 - var width = String(end).length - var numbered = lines.map(function(line, index) { - var number = start + index - var params = {before: before, number: number, width: width, after: after, - line: line} - transform(params) - return params.before + leftPad(params.number, width, padding) + - params.after + params.line - }) - return (isArray ? numbered : numbered.join("\n")) -} - -module.exports = lineNumbers - -},{"412":412}],412:[function(_dereq_,module,exports){ -module.exports = leftpad; - -function leftpad (str, len, ch) { - str = String(str); - - var i = -1; - - ch || (ch = ' '); - len = len - str.length; - - - while (++i < len) { - str = ch + str; - } - - return str; -} - -},{}],413:[function(_dereq_,module,exports){ -/** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ -function compact(array) { - var index = -1, - length = array ? array.length : 0, - resIndex = -1, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[++resIndex] = value; - } - } - return result; -} - -module.exports = compact; - -},{}],414:[function(_dereq_,module,exports){ -var baseFlatten = _dereq_(443), - isIterateeCall = _dereq_(493); - -/** - * Flattens a nested array. If `isDeep` is `true` the array is recursively - * flattened, otherwise it's only flattened a single level. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, 3, [4]]]); - * // => [1, 2, 3, [4]] - * - * // using `isDeep` - * _.flatten([1, [2, 3, [4]]], true); - * // => [1, 2, 3, 4] - */ -function flatten(array, isDeep, guard) { - var length = array ? array.length : 0; - if (guard && isIterateeCall(array, isDeep, guard)) { - isDeep = false; - } - return length ? baseFlatten(array, isDeep) : []; -} - -module.exports = flatten; - -},{"443":443,"493":493}],415:[function(_dereq_,module,exports){ -/** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ -function last(array) { - var length = array ? array.length : 0; - return length ? array[length - 1] : undefined; -} - -module.exports = last; - -},{}],416:[function(_dereq_,module,exports){ -var baseIndexOf = _dereq_(450); - -/** Used for native method references. */ -var arrayProto = Array.prototype; - -/** Native method references. */ -var splice = arrayProto.splice; - -/** - * Removes all provided values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ -function pull() { - var args = arguments, - array = args[0]; - - if (!(array && array.length)) { - return array; - } - var index = 0, - indexOf = baseIndexOf, - length = args.length; - - while (++index < length) { - var fromIndex = 0, - value = args[index]; - - while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { - splice.call(array, fromIndex, 1); - } - } - return array; -} - -module.exports = pull; - -},{"450":450}],417:[function(_dereq_,module,exports){ -var baseCallback = _dereq_(437), - baseUniq = _dereq_(466), - isIterateeCall = _dereq_(493), - sortedUniq = _dereq_(499); - -/** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurence of each element - * is kept. Providing `true` for `isSorted` performs a faster search algorithm - * for sorted arrays. If an iteratee function is provided it's invoked for - * each element in the array to generate the criterion by which uniqueness - * is computed. The `iteratee` is bound to `thisArg` and invoked with three - * arguments: (value, index, array). - * - * If a property name is provided for `iteratee` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `iteratee` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Array - * @param {Array} array The array to inspect. - * @param {boolean} [isSorted] Specify the array is sorted. - * @param {Function|Object|string} [iteratee] The function invoked per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array} Returns the new duplicate-value-free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - * - * // using `isSorted` - * _.uniq([1, 1, 2], true); - * // => [1, 2] - * - * // using an iteratee function - * _.uniq([1, 2.5, 1.5, 2], function(n) { - * return this.floor(n); - * }, Math); - * // => [1, 2.5] - * - * // using the `_.property` callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ -function uniq(array, isSorted, iteratee, thisArg) { - var length = array ? array.length : 0; - if (!length) { - return []; - } - if (isSorted != null && typeof isSorted != 'boolean') { - thisArg = iteratee; - iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted; - isSorted = false; - } - iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3); - return (isSorted) - ? sortedUniq(array, iteratee) - : baseUniq(array, iteratee); -} - -module.exports = uniq; - -},{"437":437,"466":466,"493":493,"499":499}],418:[function(_dereq_,module,exports){ -module.exports = _dereq_(421); - -},{"421":421}],419:[function(_dereq_,module,exports){ -module.exports = _dereq_(420); - -},{"420":420}],420:[function(_dereq_,module,exports){ -var arrayEach = _dereq_(429), - baseEach = _dereq_(441), - createForEach = _dereq_(478); - -/** - * Iterates over elements of `collection` invoking `iteratee` for each element. - * The `iteratee` is bound to `thisArg` and invoked with three arguments: - * (value, index|key, collection). Iteratee functions may exit iteration early - * by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` - * may be used for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2]).forEach(function(n) { - * console.log(n); - * }).value(); - * // => logs each value from left to right and returns the array - * - * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { - * console.log(n, key); - * }); - * // => logs each value-key pair and returns the object (iteration order is not guaranteed) - */ -var forEach = createForEach(arrayEach, baseEach); - -module.exports = forEach; - -},{"429":429,"441":441,"478":478}],421:[function(_dereq_,module,exports){ -var baseIndexOf = _dereq_(450), - getLength = _dereq_(484), - isArray = _dereq_(505), - isIterateeCall = _dereq_(493), - isLength = _dereq_(495), - isString = _dereq_(514), - values = _dereq_(525); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Checks if `target` is in `collection` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `collection`. - * - * @static - * @memberOf _ - * @alias contains, include - * @category Collection - * @param {Array|Object|string} collection The collection to search. - * @param {*} target The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. - * @returns {boolean} Returns `true` if a matching element is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); - * // => true - * - * _.includes('pebbles', 'eb'); - * // => true - */ -function includes(collection, target, fromIndex, guard) { - var length = collection ? getLength(collection) : 0; - if (!isLength(length)) { - collection = values(collection); - length = collection.length; - } - if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { - fromIndex = 0; - } else { - fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); - } - return (typeof collection == 'string' || !isArray(collection) && isString(collection)) - ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) - : (!!length && baseIndexOf(collection, target, fromIndex) > -1); -} - -module.exports = includes; - -},{"450":450,"484":484,"493":493,"495":495,"505":505,"514":514,"525":525}],422:[function(_dereq_,module,exports){ -var arrayMap = _dereq_(430), - baseCallback = _dereq_(437), - baseMap = _dereq_(454), - isArray = _dereq_(505); - -/** - * Creates an array of values by running each element in `collection` through - * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three - * arguments: (value, index|key, collection). - * - * If a property name is provided for `iteratee` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `iteratee` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, - * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, - * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, - * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, - * `sum`, `uniq`, and `words` - * - * @static - * @memberOf _ - * @alias collect - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array} Returns the new mapped array. - * @example - * - * function timesThree(n) { - * return n * 3; - * } - * - * _.map([1, 2], timesThree); - * // => [3, 6] - * - * _.map({ 'a': 1, 'b': 2 }, timesThree); - * // => [3, 6] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // using the `_.property` callback shorthand - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ -function map(collection, iteratee, thisArg) { - var func = isArray(collection) ? arrayMap : baseMap; - iteratee = baseCallback(iteratee, thisArg, 3); - return func(collection, iteratee); -} - -module.exports = map; - -},{"430":430,"437":437,"454":454,"505":505}],423:[function(_dereq_,module,exports){ -var arrayReduceRight = _dereq_(432), - baseEachRight = _dereq_(442), - createReduce = _dereq_(479); - -/** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {*} Returns the accumulated value. - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ -var reduceRight = createReduce(arrayReduceRight, baseEachRight); - -module.exports = reduceRight; - -},{"432":432,"442":442,"479":479}],424:[function(_dereq_,module,exports){ -var arraySome = _dereq_(433), - baseCallback = _dereq_(437), - baseSome = _dereq_(463), - isArray = _dereq_(505), - isIterateeCall = _dereq_(493); - -/** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * The function returns as soon as it finds a passing value and does not iterate - * over the entire collection. The predicate is bound to `thisArg` and invoked - * with three arguments: (value, index|key, collection). - * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // using the `_.matches` callback shorthand - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // using the `_.matchesProperty` callback shorthand - * _.some(users, 'active', false); - * // => true - * - * // using the `_.property` callback shorthand - * _.some(users, 'active'); - * // => true - */ -function some(collection, predicate, thisArg) { - var func = isArray(collection) ? arraySome : baseSome; - if (thisArg && isIterateeCall(collection, predicate, thisArg)) { - predicate = undefined; - } - if (typeof predicate != 'function' || thisArg !== undefined) { - predicate = baseCallback(predicate, thisArg, 3); - } - return func(collection, predicate); -} - -module.exports = some; - -},{"433":433,"437":437,"463":463,"493":493,"505":505}],425:[function(_dereq_,module,exports){ -var baseCallback = _dereq_(437), - baseMap = _dereq_(454), - baseSortBy = _dereq_(464), - compareAscending = _dereq_(472), - isIterateeCall = _dereq_(493); - -/** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through `iteratee`. This method performs - * a stable sort, that is, it preserves the original sort order of equal elements. - * The `iteratee` is bound to `thisArg` and invoked with three arguments: - * (value, index|key, collection). - * - * If a property name is provided for `iteratee` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `iteratee` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array} Returns the new sorted array. - * @example - * - * _.sortBy([1, 2, 3], function(n) { - * return Math.sin(n); - * }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(n) { - * return this.sin(n); - * }, Math); - * // => [3, 1, 2] - * - * var users = [ - * { 'user': 'fred' }, - * { 'user': 'pebbles' }, - * { 'user': 'barney' } - * ]; - * - * // using the `_.property` callback shorthand - * _.pluck(_.sortBy(users, 'user'), 'user'); - * // => ['barney', 'fred', 'pebbles'] - */ -function sortBy(collection, iteratee, thisArg) { - if (collection == null) { - return []; - } - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = undefined; - } - var index = -1; - iteratee = baseCallback(iteratee, thisArg, 3); - - var result = baseMap(collection, function(value, key, collection) { - return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; - }); - return baseSortBy(result, compareAscending); -} - -module.exports = sortBy; - -},{"437":437,"454":454,"464":464,"472":472,"493":493}],426:[function(_dereq_,module,exports){ -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. - * - * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.restParam(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ -function restParam(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - rest = Array(length); - - while (++index < length) { - rest[index] = args[start + index]; - } - switch (start) { - case 0: return func.call(this, rest); - case 1: return func.call(this, args[0], rest); - case 2: return func.call(this, args[0], args[1], rest); - } - var otherArgs = Array(start + 1); - index = -1; - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = rest; - return func.apply(this, otherArgs); - }; -} - -module.exports = restParam; - -},{}],427:[function(_dereq_,module,exports){ -(function (global){ -var cachePush = _dereq_(471), - getNative = _dereq_(486); - -/** Native method references. */ -var Set = getNative(global, 'Set'); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeCreate = getNative(Object, 'create'); - -/** - * - * Creates a cache object to store unique values. - * - * @private - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var length = values ? values.length : 0; - - this.data = { 'hash': nativeCreate(null), 'set': new Set }; - while (length--) { - this.push(values[length]); - } -} - -// Add functions to the `Set` cache. -SetCache.prototype.push = cachePush; - -module.exports = SetCache; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"471":471,"486":486}],428:[function(_dereq_,module,exports){ -/** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ -function arrayCopy(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} - -module.exports = arrayCopy; - -},{}],429:[function(_dereq_,module,exports){ -/** - * A specialized version of `_.forEach` for arrays without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} - -module.exports = arrayEach; - -},{}],430:[function(_dereq_,module,exports){ -/** - * A specialized version of `_.map` for arrays without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; -} - -module.exports = arrayMap; - -},{}],431:[function(_dereq_,module,exports){ -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; -} - -module.exports = arrayPush; - -},{}],432:[function(_dereq_,module,exports){ -/** - * A specialized version of `_.reduceRight` for arrays without support for - * callback shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initFromArray] Specify using the last element of `array` - * as the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduceRight(array, iteratee, accumulator, initFromArray) { - var length = array.length; - if (initFromArray && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; -} - -module.exports = arrayReduceRight; - -},{}],433:[function(_dereq_,module,exports){ -/** - * A specialized version of `_.some` for arrays without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function arraySome(array, predicate) { - var index = -1, - length = array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} - -module.exports = arraySome; - -},{}],434:[function(_dereq_,module,exports){ -/** - * Used by `_.defaults` to customize its `_.assign` use. - * - * @private - * @param {*} objectValue The destination object property value. - * @param {*} sourceValue The source object property value. - * @returns {*} Returns the value to assign to the destination object. - */ -function assignDefaults(objectValue, sourceValue) { - return objectValue === undefined ? sourceValue : objectValue; -} - -module.exports = assignDefaults; - -},{}],435:[function(_dereq_,module,exports){ -var keys = _dereq_(521); - -/** - * A specialized version of `_.assign` for customizing assigned values without - * support for argument juggling, multiple sources, and `this` binding `customizer` - * functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - */ -function assignWith(object, source, customizer) { - var index = -1, - props = keys(source), - length = props.length; - - while (++index < length) { - var key = props[index], - value = object[key], - result = customizer(value, source[key], key, object, source); - - if ((result === result ? (result !== value) : (value === value)) || - (value === undefined && !(key in object))) { - object[key] = result; - } - } - return object; -} - -module.exports = assignWith; - -},{"521":521}],436:[function(_dereq_,module,exports){ -var baseCopy = _dereq_(440), - keys = _dereq_(521); - -/** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return source == null - ? object - : baseCopy(source, keys(source), object); -} - -module.exports = baseAssign; - -},{"440":440,"521":521}],437:[function(_dereq_,module,exports){ -var baseMatches = _dereq_(455), - baseMatchesProperty = _dereq_(456), - bindCallback = _dereq_(468), - identity = _dereq_(528), - property = _dereq_(529); - -/** - * The base implementation of `_.callback` which supports specifying the - * number of arguments to provide to `func`. - * - * @private - * @param {*} [func=_.identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. - */ -function baseCallback(func, thisArg, argCount) { - var type = typeof func; - if (type == 'function') { - return thisArg === undefined - ? func - : bindCallback(func, thisArg, argCount); - } - if (func == null) { - return identity; - } - if (type == 'object') { - return baseMatches(func); - } - return thisArg === undefined - ? property(func) - : baseMatchesProperty(func, thisArg); -} - -module.exports = baseCallback; - -},{"455":455,"456":456,"468":468,"528":528,"529":529}],438:[function(_dereq_,module,exports){ -var arrayCopy = _dereq_(428), - arrayEach = _dereq_(429), - baseAssign = _dereq_(436), - baseForOwn = _dereq_(446), - initCloneArray = _dereq_(488), - initCloneByTag = _dereq_(489), - initCloneObject = _dereq_(490), - isArray = _dereq_(505), - isObject = _dereq_(511); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to identify `toStringTag` values supported by `_.clone`. */ -var cloneableTags = {}; -cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = -cloneableTags[dateTag] = cloneableTags[float32Tag] = -cloneableTags[float64Tag] = cloneableTags[int8Tag] = -cloneableTags[int16Tag] = cloneableTags[int32Tag] = -cloneableTags[numberTag] = cloneableTags[objectTag] = -cloneableTags[regexpTag] = cloneableTags[stringTag] = -cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = -cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; -cloneableTags[errorTag] = cloneableTags[funcTag] = -cloneableTags[mapTag] = cloneableTags[setTag] = -cloneableTags[weakMapTag] = false; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * The base implementation of `_.clone` without support for argument juggling - * and `this` binding `customizer` functions. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {Function} [customizer] The function to customize cloning values. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The object `value` belongs to. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned value. - */ -function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { - var result; - if (customizer) { - result = object ? customizer(value, key, object) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return arrayCopy(value, result); - } - } else { - var tag = objToString.call(value), - isFunc = tag == funcTag; - - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = initCloneObject(isFunc ? {} : value); - if (!isDeep) { - return baseAssign(result, value); - } - } else { - return cloneableTags[tag] - ? initCloneByTag(value, tag, isDeep) - : (object ? value : {}); - } - } - // Check for circular references and return its corresponding clone. - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - // Add the source value to the stack of traversed objects and associate it with its clone. - stackA.push(value); - stackB.push(result); - - // Recursively populate clone (susceptible to call stack limits). - (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { - result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); - }); - return result; -} - -module.exports = baseClone; - -},{"428":428,"429":429,"436":436,"446":446,"488":488,"489":489,"490":490,"505":505,"511":511}],439:[function(_dereq_,module,exports){ -/** - * The base implementation of `compareAscending` which compares values and - * sorts them in ascending order without guaranteeing a stable sort. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ -function baseCompareAscending(value, other) { - if (value !== other) { - var valIsNull = value === null, - valIsUndef = value === undefined, - valIsReflexive = value === value; - - var othIsNull = other === null, - othIsUndef = other === undefined, - othIsReflexive = other === other; - - if ((value > other && !othIsNull) || !valIsReflexive || - (valIsNull && !othIsUndef && othIsReflexive) || - (valIsUndef && othIsReflexive)) { - return 1; - } - if ((value < other && !valIsNull) || !othIsReflexive || - (othIsNull && !valIsUndef && valIsReflexive) || - (othIsUndef && valIsReflexive)) { - return -1; - } - } - return 0; -} - -module.exports = baseCompareAscending; - -},{}],440:[function(_dereq_,module,exports){ -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @returns {Object} Returns `object`. - */ -function baseCopy(source, props, object) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - object[key] = source[key]; - } - return object; -} - -module.exports = baseCopy; - -},{}],441:[function(_dereq_,module,exports){ -var baseForOwn = _dereq_(446), - createBaseEach = _dereq_(474); - -/** - * The base implementation of `_.forEach` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object|string} Returns `collection`. - */ -var baseEach = createBaseEach(baseForOwn); - -module.exports = baseEach; - -},{"446":446,"474":474}],442:[function(_dereq_,module,exports){ -var baseForOwnRight = _dereq_(447), - createBaseEach = _dereq_(474); - -/** - * The base implementation of `_.forEachRight` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object|string} Returns `collection`. - */ -var baseEachRight = createBaseEach(baseForOwnRight, true); - -module.exports = baseEachRight; - -},{"447":447,"474":474}],443:[function(_dereq_,module,exports){ -var arrayPush = _dereq_(431), - isArguments = _dereq_(504), - isArray = _dereq_(505), - isArrayLike = _dereq_(491), - isObjectLike = _dereq_(496); - -/** - * The base implementation of `_.flatten` with added support for restricting - * flattening and specifying the start index. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ -function baseFlatten(array, isDeep, isStrict, result) { - result || (result = []); - - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index]; - if (isObjectLike(value) && isArrayLike(value) && - (isStrict || isArray(value) || isArguments(value))) { - if (isDeep) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, isDeep, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; -} - -module.exports = baseFlatten; - -},{"431":431,"491":491,"496":496,"504":504,"505":505}],444:[function(_dereq_,module,exports){ -var createBaseFor = _dereq_(475); - -/** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); - -module.exports = baseFor; - -},{"475":475}],445:[function(_dereq_,module,exports){ -var baseFor = _dereq_(444), - keysIn = _dereq_(522); - -/** - * The base implementation of `_.forIn` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForIn(object, iteratee) { - return baseFor(object, iteratee, keysIn); -} - -module.exports = baseForIn; - -},{"444":444,"522":522}],446:[function(_dereq_,module,exports){ -var baseFor = _dereq_(444), - keys = _dereq_(521); - -/** - * The base implementation of `_.forOwn` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return baseFor(object, iteratee, keys); -} - -module.exports = baseForOwn; - -},{"444":444,"521":521}],447:[function(_dereq_,module,exports){ -var baseForRight = _dereq_(448), - keys = _dereq_(521); - -/** - * The base implementation of `_.forOwnRight` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwnRight(object, iteratee) { - return baseForRight(object, iteratee, keys); -} - -module.exports = baseForOwnRight; - -},{"448":448,"521":521}],448:[function(_dereq_,module,exports){ -var createBaseFor = _dereq_(475); - -/** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseForRight = createBaseFor(true); - -module.exports = baseForRight; - -},{"475":475}],449:[function(_dereq_,module,exports){ -var toObject = _dereq_(500); - -/** - * The base implementation of `get` without support for string paths - * and default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path of the property to get. - * @param {string} [pathKey] The key representation of path. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path, pathKey) { - if (object == null) { - return; - } - if (pathKey !== undefined && pathKey in toObject(object)) { - path = [pathKey]; - } - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -module.exports = baseGet; - -},{"500":500}],450:[function(_dereq_,module,exports){ -var indexOfNaN = _dereq_(487); - -/** - * The base implementation of `_.indexOf` without support for binary searches. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseIndexOf(array, value, fromIndex) { - if (value !== value) { - return indexOfNaN(array, fromIndex); - } - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; -} - -module.exports = baseIndexOf; - -},{"487":487}],451:[function(_dereq_,module,exports){ -var baseIsEqualDeep = _dereq_(452), - isObject = _dereq_(511), - isObjectLike = _dereq_(496); - -/** - * The base implementation of `_.isEqual` without support for `this` binding - * `customizer` functions. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ -function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); -} - -module.exports = baseIsEqual; - -},{"452":452,"496":496,"511":511}],452:[function(_dereq_,module,exports){ -var equalArrays = _dereq_(480), - equalByTag = _dereq_(481), - equalObjects = _dereq_(482), - isArray = _dereq_(505), - isTypedArray = _dereq_(515); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - objectTag = '[object Object]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing objects. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `value` objects. - * @param {Array} [stackB=[]] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; - - if (!objIsArr) { - objTag = objToString.call(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } - } - if (!othIsArr) { - othTag = objToString.call(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } - } - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag); - } - if (!isLoose) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); - } - } - if (!isSameTag) { - return false; - } - // Assume cyclic values are equal. - // For more information on detecting circular references see https://es5.github.io/#JO. - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == object) { - return stackB[length] == other; - } - } - // Add `object` and `other` to the stack of traversed objects. - stackA.push(object); - stackB.push(other); - - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); - - stackA.pop(); - stackB.pop(); - - return result; -} - -module.exports = baseIsEqualDeep; - -},{"480":480,"481":481,"482":482,"505":505,"515":515}],453:[function(_dereq_,module,exports){ -var baseIsEqual = _dereq_(451), - toObject = _dereq_(500); - -/** - * The base implementation of `_.isMatch` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} matchData The propery names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparing objects. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ -function baseIsMatch(object, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = toObject(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { - return false; - } - } - } - return true; -} - -module.exports = baseIsMatch; - -},{"451":451,"500":500}],454:[function(_dereq_,module,exports){ -var baseEach = _dereq_(441), - isArrayLike = _dereq_(491); - -/** - * The base implementation of `_.map` without support for callback shorthands - * and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; -} - -module.exports = baseMap; - -},{"441":441,"491":491}],455:[function(_dereq_,module,exports){ -var baseIsMatch = _dereq_(453), - getMatchData = _dereq_(485), - toObject = _dereq_(500); - -/** - * The base implementation of `_.matches` which does not clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && (value !== undefined || (key in toObject(object))); - }; - } - return function(object) { - return baseIsMatch(object, matchData); - }; -} - -module.exports = baseMatches; - -},{"453":453,"485":485,"500":500}],456:[function(_dereq_,module,exports){ -var baseGet = _dereq_(449), - baseIsEqual = _dereq_(451), - baseSlice = _dereq_(462), - isArray = _dereq_(505), - isKey = _dereq_(494), - isStrictComparable = _dereq_(497), - last = _dereq_(415), - toObject = _dereq_(500), - toPath = _dereq_(501); - -/** - * The base implementation of `_.matchesProperty` which does not clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to compare. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - var isArr = isArray(path), - isCommon = isKey(path) && isStrictComparable(srcValue), - pathKey = (path + ''); - - path = toPath(path); - return function(object) { - if (object == null) { - return false; - } - var key = pathKey; - object = toObject(object); - if ((isArr || !isCommon) && !(key in object)) { - object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); - if (object == null) { - return false; - } - key = last(path); - object = toObject(object); - } - return object[key] === srcValue - ? (srcValue !== undefined || (key in object)) - : baseIsEqual(srcValue, object[key], undefined, true); - }; -} - -module.exports = baseMatchesProperty; - -},{"415":415,"449":449,"451":451,"462":462,"494":494,"497":497,"500":500,"501":501,"505":505}],457:[function(_dereq_,module,exports){ -var arrayEach = _dereq_(429), - baseMergeDeep = _dereq_(458), - isArray = _dereq_(505), - isArrayLike = _dereq_(491), - isObject = _dereq_(511), - isObjectLike = _dereq_(496), - isTypedArray = _dereq_(515), - keys = _dereq_(521); - -/** - * The base implementation of `_.merge` without support for argument juggling, - * multiple sources, and `this` binding `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [customizer] The function to customize merged values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - * @returns {Object} Returns `object`. - */ -function baseMerge(object, source, customizer, stackA, stackB) { - if (!isObject(object)) { - return object; - } - var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), - props = isSrcArr ? undefined : keys(source); - - arrayEach(props || source, function(srcValue, key) { - if (props) { - key = srcValue; - srcValue = source[key]; - } - if (isObjectLike(srcValue)) { - stackA || (stackA = []); - stackB || (stackB = []); - baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); - } - else { - var value = object[key], - result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = result === undefined; - - if (isCommon) { - result = srcValue; - } - if ((result !== undefined || (isSrcArr && !(key in object))) && - (isCommon || (result === result ? (result !== value) : (value === value)))) { - object[key] = result; - } - } - }); - return object; -} - -module.exports = baseMerge; - -},{"429":429,"458":458,"491":491,"496":496,"505":505,"511":511,"515":515,"521":521}],458:[function(_dereq_,module,exports){ -var arrayCopy = _dereq_(428), - isArguments = _dereq_(504), - isArray = _dereq_(505), - isArrayLike = _dereq_(491), - isPlainObject = _dereq_(512), - isTypedArray = _dereq_(515), - toPlainObject = _dereq_(516); - -/** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize merged values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { - var length = stackA.length, - srcValue = source[key]; - - while (length--) { - if (stackA[length] == srcValue) { - object[key] = stackB[length]; - return; - } - } - var value = object[key], - result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = result === undefined; - - if (isCommon) { - result = srcValue; - if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { - result = isArray(value) - ? value - : (isArrayLike(value) ? arrayCopy(value) : []); - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - result = isArguments(value) - ? toPlainObject(value) - : (isPlainObject(value) ? value : {}); - } - else { - isCommon = false; - } - } - // Add the source value to the stack of traversed objects and associate - // it with its merged value. - stackA.push(srcValue); - stackB.push(result); - - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); - } else if (result === result ? (result !== value) : (value === value)) { - object[key] = result; - } -} - -module.exports = baseMergeDeep; - -},{"428":428,"491":491,"504":504,"505":505,"512":512,"515":515,"516":516}],459:[function(_dereq_,module,exports){ -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -module.exports = baseProperty; - -},{}],460:[function(_dereq_,module,exports){ -var baseGet = _dereq_(449), - toPath = _dereq_(501); - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - var pathKey = (path + ''); - path = toPath(path); - return function(object) { - return baseGet(object, path, pathKey); - }; -} - -module.exports = basePropertyDeep; - -},{"449":449,"501":501}],461:[function(_dereq_,module,exports){ -/** - * The base implementation of `_.reduce` and `_.reduceRight` without support - * for callback shorthands and `this` binding, which iterates over `collection` - * using the provided `eachFunc`. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initFromCollection Specify using the first or last element - * of `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ -function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initFromCollection - ? (initFromCollection = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; -} - -module.exports = baseReduce; - -},{}],462:[function(_dereq_,module,exports){ -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - start = start == null ? 0 : (+start || 0); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : (+end || 0); - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} - -module.exports = baseSlice; - -},{}],463:[function(_dereq_,module,exports){ -var baseEach = _dereq_(441); - -/** - * The base implementation of `_.some` without support for callback shorthands - * and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; -} - -module.exports = baseSome; - -},{"441":441}],464:[function(_dereq_,module,exports){ -/** - * The base implementation of `_.sortBy` which uses `comparer` to define - * the sort order of `array` and replaces criteria objects with their - * corresponding values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ -function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; -} - -module.exports = baseSortBy; - -},{}],465:[function(_dereq_,module,exports){ -/** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` or `undefined` values. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - return value == null ? '' : (value + ''); -} - -module.exports = baseToString; - -},{}],466:[function(_dereq_,module,exports){ -var baseIndexOf = _dereq_(450), - cacheIndexOf = _dereq_(470), - createCache = _dereq_(476); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** - * The base implementation of `_.uniq` without support for callback shorthands - * and `this` binding. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The function invoked per iteration. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee) { - var index = -1, - indexOf = baseIndexOf, - length = array.length, - isCommon = true, - isLarge = isCommon && length >= LARGE_ARRAY_SIZE, - seen = isLarge ? createCache() : null, - result = []; - - if (seen) { - indexOf = cacheIndexOf; - isCommon = false; - } else { - isLarge = false; - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value, index, array) : value; - - if (isCommon && value === value) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (indexOf(seen, computed, 0) < 0) { - if (iteratee || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -module.exports = baseUniq; - -},{"450":450,"470":470,"476":476}],467:[function(_dereq_,module,exports){ -/** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ -function baseValues(object, props) { - var index = -1, - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; -} - -module.exports = baseValues; - -},{}],468:[function(_dereq_,module,exports){ -var identity = _dereq_(528); - -/** - * A specialized version of `baseCallback` which only supports `this` binding - * and specifying the number of arguments to provide to `func`. - * - * @private - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. - */ -function bindCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - if (thisArg === undefined) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - case 5: return function(value, other, key, object, source) { - return func.call(thisArg, value, other, key, object, source); - }; - } - return function() { - return func.apply(thisArg, arguments); - }; -} - -module.exports = bindCallback; - -},{"528":528}],469:[function(_dereq_,module,exports){ -(function (global){ -/** Native method references. */ -var ArrayBuffer = global.ArrayBuffer, - Uint8Array = global.Uint8Array; - -/** - * Creates a clone of the given array buffer. - * - * @private - * @param {ArrayBuffer} buffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ -function bufferClone(buffer) { - var result = new ArrayBuffer(buffer.byteLength), - view = new Uint8Array(result); - - view.set(new Uint8Array(buffer)); - return result; -} - -module.exports = bufferClone; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],470:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** - * Checks if `value` is in `cache` mimicking the return signature of - * `_.indexOf` by returning `0` if the value is found, else `-1`. - * - * @private - * @param {Object} cache The cache to search. - * @param {*} value The value to search for. - * @returns {number} Returns `0` if `value` is found, else `-1`. - */ -function cacheIndexOf(cache, value) { - var data = cache.data, - result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; - - return result ? 0 : -1; -} - -module.exports = cacheIndexOf; - -},{"511":511}],471:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** - * Adds `value` to the cache. - * - * @private - * @name push - * @memberOf SetCache - * @param {*} value The value to cache. - */ -function cachePush(value) { - var data = this.data; - if (typeof value == 'string' || isObject(value)) { - data.set.add(value); - } else { - data.hash[value] = true; - } -} - -module.exports = cachePush; - -},{"511":511}],472:[function(_dereq_,module,exports){ -var baseCompareAscending = _dereq_(439); - -/** - * Used by `_.sortBy` to compare transformed elements of a collection and stable - * sort them in ascending order. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @returns {number} Returns the sort order indicator for `object`. - */ -function compareAscending(object, other) { - return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); -} - -module.exports = compareAscending; - -},{"439":439}],473:[function(_dereq_,module,exports){ -var bindCallback = _dereq_(468), - isIterateeCall = _dereq_(493), - restParam = _dereq_(426); - -/** - * Creates a `_.assign`, `_.defaults`, or `_.merge` function. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ -function createAssigner(assigner) { - return restParam(function(object, sources) { - var index = -1, - length = object == null ? 0 : sources.length, - customizer = length > 2 ? sources[length - 2] : undefined, - guard = length > 2 ? sources[2] : undefined, - thisArg = length > 1 ? sources[length - 1] : undefined; - - if (typeof customizer == 'function') { - customizer = bindCallback(customizer, thisArg, 5); - length -= 2; - } else { - customizer = typeof thisArg == 'function' ? thisArg : undefined; - length -= (customizer ? 1 : 0); - } - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, customizer); - } - } - return object; - }); -} - -module.exports = createAssigner; - -},{"426":426,"468":468,"493":493}],474:[function(_dereq_,module,exports){ -var getLength = _dereq_(484), - isLength = _dereq_(495), - toObject = _dereq_(500); - -/** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - var length = collection ? getLength(collection) : 0; - if (!isLength(length)) { - return eachFunc(collection, iteratee); - } - var index = fromRight ? length : -1, - iterable = toObject(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; -} - -module.exports = createBaseEach; - -},{"484":484,"495":495,"500":500}],475:[function(_dereq_,module,exports){ -var toObject = _dereq_(500); - -/** - * Creates a base function for `_.forIn` or `_.forInRight`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var iterable = toObject(object), - props = keysFunc(object), - length = props.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length)) { - var key = props[index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} - -module.exports = createBaseFor; - -},{"500":500}],476:[function(_dereq_,module,exports){ -(function (global){ -var SetCache = _dereq_(427), - getNative = _dereq_(486); - -/** Native method references. */ -var Set = getNative(global, 'Set'); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeCreate = getNative(Object, 'create'); - -/** - * Creates a `Set` cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [values] The values to cache. - * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. - */ -function createCache(values) { - return (nativeCreate && Set) ? new SetCache(values) : null; -} - -module.exports = createCache; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"427":427,"486":486}],477:[function(_dereq_,module,exports){ -var restParam = _dereq_(426); - -/** - * Creates a `_.defaults` or `_.defaultsDeep` function. - * - * @private - * @param {Function} assigner The function to assign values. - * @param {Function} customizer The function to customize assigned values. - * @returns {Function} Returns the new defaults function. - */ -function createDefaults(assigner, customizer) { - return restParam(function(args) { - var object = args[0]; - if (object == null) { - return object; - } - args.push(customizer); - return assigner.apply(undefined, args); - }); -} - -module.exports = createDefaults; - -},{"426":426}],478:[function(_dereq_,module,exports){ -var bindCallback = _dereq_(468), - isArray = _dereq_(505); - -/** - * Creates a function for `_.forEach` or `_.forEachRight`. - * - * @private - * @param {Function} arrayFunc The function to iterate over an array. - * @param {Function} eachFunc The function to iterate over a collection. - * @returns {Function} Returns the new each function. - */ -function createForEach(arrayFunc, eachFunc) { - return function(collection, iteratee, thisArg) { - return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) - ? arrayFunc(collection, iteratee) - : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); - }; -} - -module.exports = createForEach; - -},{"468":468,"505":505}],479:[function(_dereq_,module,exports){ -var baseCallback = _dereq_(437), - baseReduce = _dereq_(461), - isArray = _dereq_(505); - -/** - * Creates a function for `_.reduce` or `_.reduceRight`. - * - * @private - * @param {Function} arrayFunc The function to iterate over an array. - * @param {Function} eachFunc The function to iterate over a collection. - * @returns {Function} Returns the new each function. - */ -function createReduce(arrayFunc, eachFunc) { - return function(collection, iteratee, accumulator, thisArg) { - var initFromArray = arguments.length < 3; - return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) - ? arrayFunc(collection, iteratee, accumulator, initFromArray) - : baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); - }; -} - -module.exports = createReduce; - -},{"437":437,"461":461,"505":505}],480:[function(_dereq_,module,exports){ -var arraySome = _dereq_(433); - -/** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing arrays. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ -function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { - var index = -1, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isLoose && othLength > arrLength)) { - return false; - } - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index], - result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; - - if (result !== undefined) { - if (result) { - continue; - } - return false; - } - // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); - })) { - return false; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { - return false; - } - } - return true; -} - -module.exports = equalArrays; - -},{"433":433}],481:[function(_dereq_,module,exports){ -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - numberTag = '[object Number]', - regexpTag = '[object RegExp]', - stringTag = '[object String]'; - -/** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalByTag(object, other, tag) { - switch (tag) { - case boolTag: - case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. - return +object == +other; - - case errorTag: - return object.name == other.name && object.message == other.message; - - case numberTag: - // Treat `NaN` vs. `NaN` as equal. - return (object != +object) - ? other != +other - : object == +other; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. - return object == (other + ''); - } - return false; -} - -module.exports = equalByTag; - -},{}],482:[function(_dereq_,module,exports){ -var keys = _dereq_(521); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { - var objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; - - if (objLength != othLength && !isLoose) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - var skipCtor = isLoose; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key], - result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; - - // Recursively compare objects (susceptible to call stack limits). - if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { - return false; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (!skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - return false; - } - } - return true; -} - -module.exports = equalObjects; - -},{"521":521}],483:[function(_dereq_,module,exports){ -/** Used to escape characters for inclusion in compiled regexes. */ -var regexpEscapes = { - '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34', - '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39', - 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46', - 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66', - 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78' -}; - -/** Used to escape characters for inclusion in compiled string literals. */ -var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' -}; - -/** - * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes. - * - * @private - * @param {string} chr The matched character to escape. - * @param {string} leadingChar The capture group for a leading character. - * @param {string} whitespaceChar The capture group for a whitespace character. - * @returns {string} Returns the escaped character. - */ -function escapeRegExpChar(chr, leadingChar, whitespaceChar) { - if (leadingChar) { - chr = regexpEscapes[chr]; - } else if (whitespaceChar) { - chr = stringEscapes[chr]; - } - return '\\' + chr; -} - -module.exports = escapeRegExpChar; - -},{}],484:[function(_dereq_,module,exports){ -var baseProperty = _dereq_(459); - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -module.exports = getLength; - -},{"459":459}],485:[function(_dereq_,module,exports){ -var isStrictComparable = _dereq_(497), - pairs = _dereq_(524); - -/** - * Gets the propery names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = pairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -module.exports = getMatchData; - -},{"497":497,"524":524}],486:[function(_dereq_,module,exports){ -var isNative = _dereq_(509); - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -module.exports = getNative; - -},{"509":509}],487:[function(_dereq_,module,exports){ -/** - * Gets the index at which the first occurrence of `NaN` is found in `array`. - * - * @private - * @param {Array} array The array to search. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched `NaN`, else `-1`. - */ -function indexOfNaN(array, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 0 : -1); - - while ((fromRight ? index-- : ++index < length)) { - var other = array[index]; - if (other !== other) { - return index; - } - } - return -1; -} - -module.exports = indexOfNaN; - -},{}],488:[function(_dereq_,module,exports){ -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ -function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add array properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; -} - -module.exports = initCloneArray; - -},{}],489:[function(_dereq_,module,exports){ -var bufferClone = _dereq_(469); - -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]', - dateTag = '[object Date]', - numberTag = '[object Number]', - regexpTag = '[object RegExp]', - stringTag = '[object String]'; - -var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; - -/** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return bufferClone(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - var buffer = object.buffer; - return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - var result = new Ctor(object.source, reFlags.exec(object)); - result.lastIndex = object.lastIndex; - } - return result; -} - -module.exports = initCloneByTag; - -},{"469":469}],490:[function(_dereq_,module,exports){ -/** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneObject(object) { - var Ctor = object.constructor; - if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { - Ctor = Object; - } - return new Ctor; -} - -module.exports = initCloneObject; - -},{}],491:[function(_dereq_,module,exports){ -var getLength = _dereq_(484), - isLength = _dereq_(495); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -module.exports = isArrayLike; - -},{"484":484,"495":495}],492:[function(_dereq_,module,exports){ -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -module.exports = isIndex; - -},{}],493:[function(_dereq_,module,exports){ -var isArrayLike = _dereq_(491), - isIndex = _dereq_(492), - isObject = _dereq_(511); - -/** - * Checks if the provided arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. - */ -function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { - var other = object[index]; - return value === value ? (value === other) : (other !== other); - } - return false; -} - -module.exports = isIterateeCall; - -},{"491":491,"492":492,"511":511}],494:[function(_dereq_,module,exports){ -var isArray = _dereq_(505), - toObject = _dereq_(500); - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/; - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - var type = typeof value; - if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { - return true; - } - if (isArray(value)) { - return false; - } - var result = !reIsDeepProp.test(value); - return result || (object != null && value in toObject(object)); -} - -module.exports = isKey; - -},{"500":500,"505":505}],495:[function(_dereq_,module,exports){ -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -module.exports = isLength; - -},{}],496:[function(_dereq_,module,exports){ -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -module.exports = isObjectLike; - -},{}],497:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -module.exports = isStrictComparable; - -},{"511":511}],498:[function(_dereq_,module,exports){ -var isArguments = _dereq_(504), - isArray = _dereq_(505), - isIndex = _dereq_(492), - isLength = _dereq_(495), - keysIn = _dereq_(522); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * A fallback implementation of `Object.keys` which creates an array of the - * own enumerable property names of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function shimKeys(object) { - var props = keysIn(object), - propsLength = props.length, - length = propsLength && object.length; - - var allowIndexes = !!length && isLength(length) && - (isArray(object) || isArguments(object)); - - var index = -1, - result = []; - - while (++index < propsLength) { - var key = props[index]; - if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { - result.push(key); - } - } - return result; -} - -module.exports = shimKeys; - -},{"492":492,"495":495,"504":504,"505":505,"522":522}],499:[function(_dereq_,module,exports){ -/** - * An implementation of `_.uniq` optimized for sorted arrays without support - * for callback shorthands and `this` binding. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The function invoked per iteration. - * @returns {Array} Returns the new duplicate free array. - */ -function sortedUniq(array, iteratee) { - var seen, - index = -1, - length = array.length, - resIndex = -1, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value, index, array) : value; - - if (!index || seen !== computed) { - seen = computed; - result[++resIndex] = value; - } - } - return result; -} - -module.exports = sortedUniq; - -},{}],500:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** - * Converts `value` to an object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. - */ -function toObject(value) { - return isObject(value) ? value : Object(value); -} - -module.exports = toObject; - -},{"511":511}],501:[function(_dereq_,module,exports){ -var baseToString = _dereq_(465), - isArray = _dereq_(505); - -/** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * Converts `value` to property path array if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function toPath(value) { - if (isArray(value)) { - return value; - } - var result = []; - baseToString(value).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -module.exports = toPath; - -},{"465":465,"505":505}],502:[function(_dereq_,module,exports){ -var baseClone = _dereq_(438), - bindCallback = _dereq_(468), - isIterateeCall = _dereq_(493); - -/** - * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, - * otherwise they are assigned by reference. If `customizer` is provided it's - * invoked to produce the cloned values. If `customizer` returns `undefined` - * cloning is handled by the method instead. The `customizer` is bound to - * `thisArg` and invoked with up to three argument; (value [, index|key, object]). - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). - * The enumerable properties of `arguments` objects and objects created by - * constructors other than `Object` are cloned to plain `Object` objects. An - * empty object is returned for uncloneable values such as functions, DOM nodes, - * Maps, Sets, and WeakMaps. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {Function} [customizer] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {*} Returns the cloned value. - * @example - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * var shallow = _.clone(users); - * shallow[0] === users[0]; - * // => true - * - * var deep = _.clone(users, true); - * deep[0] === users[0]; - * // => false - * - * // using a customizer callback - * var el = _.clone(document.body, function(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * }); - * - * el === document.body - * // => false - * el.nodeName - * // => BODY - * el.childNodes.length; - * // => 0 - */ -function clone(value, isDeep, customizer, thisArg) { - if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) { - isDeep = false; - } - else if (typeof isDeep == 'function') { - thisArg = customizer; - customizer = isDeep; - isDeep = false; - } - return typeof customizer == 'function' - ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3)) - : baseClone(value, isDeep); -} - -module.exports = clone; - -},{"438":438,"468":468,"493":493}],503:[function(_dereq_,module,exports){ -var baseClone = _dereq_(438), - bindCallback = _dereq_(468); - -/** - * Creates a deep clone of `value`. If `customizer` is provided it's invoked - * to produce the cloned values. If `customizer` returns `undefined` cloning - * is handled by the method instead. The `customizer` is bound to `thisArg` - * and invoked with up to three argument; (value [, index|key, object]). - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). - * The enumerable properties of `arguments` objects and objects created by - * constructors other than `Object` are cloned to plain `Object` objects. An - * empty object is returned for uncloneable values such as functions, DOM nodes, - * Maps, Sets, and WeakMaps. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to deep clone. - * @param {Function} [customizer] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {*} Returns the deep cloned value. - * @example - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * var deep = _.cloneDeep(users); - * deep[0] === users[0]; - * // => false - * - * // using a customizer callback - * var el = _.cloneDeep(document.body, function(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * }); - * - * el === document.body - * // => false - * el.nodeName - * // => BODY - * el.childNodes.length; - * // => 20 - */ -function cloneDeep(value, customizer, thisArg) { - return typeof customizer == 'function' - ? baseClone(value, true, bindCallback(customizer, thisArg, 3)) - : baseClone(value, true); -} - -module.exports = cloneDeep; - -},{"438":438,"468":468}],504:[function(_dereq_,module,exports){ -var isArrayLike = _dereq_(491), - isObjectLike = _dereq_(496); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Native method references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Checks if `value` is classified as an `arguments` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - return isObjectLike(value) && isArrayLike(value) && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); -} - -module.exports = isArguments; - -},{"491":491,"496":496}],505:[function(_dereq_,module,exports){ -var getNative = _dereq_(486), - isLength = _dereq_(495), - isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var arrayTag = '[object Array]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsArray = getNative(Array, 'isArray'); - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(function() { return arguments; }()); - * // => false - */ -var isArray = nativeIsArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; -}; - -module.exports = isArray; - -},{"486":486,"495":495,"496":496}],506:[function(_dereq_,module,exports){ -var isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var boolTag = '[object Boolean]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ -function isBoolean(value) { - return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag); -} - -module.exports = isBoolean; - -},{"496":496}],507:[function(_dereq_,module,exports){ -var isArguments = _dereq_(504), - isArray = _dereq_(505), - isArrayLike = _dereq_(491), - isFunction = _dereq_(508), - isObjectLike = _dereq_(496), - isString = _dereq_(514), - keys = _dereq_(521); - -/** - * Checks if `value` is empty. A value is considered empty unless it's an - * `arguments` object, array, string, or jQuery-like collection with a length - * greater than `0` or an object with own enumerable properties. - * - * @static - * @memberOf _ - * @category Lang - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ -function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || - (isObjectLike(value) && isFunction(value.splice)))) { - return !value.length; - } - return !keys(value).length; -} - -module.exports = isEmpty; - -},{"491":491,"496":496,"504":504,"505":505,"508":508,"514":514,"521":521}],508:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** `Object#toString` result references. */ -var funcTag = '[object Function]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 which returns 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -module.exports = isFunction; - -},{"511":511}],509:[function(_dereq_,module,exports){ -var isFunction = _dereq_(508), - isObjectLike = _dereq_(496); - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = isNative; - -},{"496":496,"508":508}],510:[function(_dereq_,module,exports){ -var isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var numberTag = '[object Number]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified - * as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isNumber(8.4); - * // => true - * - * _.isNumber(NaN); - * // => true - * - * _.isNumber('8.4'); - * // => false - */ -function isNumber(value) { - return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag); -} - -module.exports = isNumber; - -},{"496":496}],511:[function(_dereq_,module,exports){ -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = isObject; - -},{}],512:[function(_dereq_,module,exports){ -var baseForIn = _dereq_(445), - isArguments = _dereq_(504), - isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var objectTag = '[object Object]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * **Note:** This method assumes objects created by the `Object` constructor - * have no inherited enumerable properties. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ -function isPlainObject(value) { - var Ctor; - - // Exit early for non `Object` objects. - if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) || - (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - var result; - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - baseForIn(value, function(subValue, key) { - result = key; - }); - return result === undefined || hasOwnProperty.call(value, result); -} - -module.exports = isPlainObject; - -},{"445":445,"496":496,"504":504}],513:[function(_dereq_,module,exports){ -var isObject = _dereq_(511); - -/** `Object#toString` result references. */ -var regexpTag = '[object RegExp]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ -function isRegExp(value) { - return isObject(value) && objToString.call(value) == regexpTag; -} - -module.exports = isRegExp; - -},{"511":511}],514:[function(_dereq_,module,exports){ -var isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var stringTag = '[object String]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); -} - -module.exports = isString; - -},{"496":496}],515:[function(_dereq_,module,exports){ -var isLength = _dereq_(495), - isObjectLike = _dereq_(496); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dateTag] = typedArrayTags[errorTag] = -typedArrayTags[funcTag] = typedArrayTags[mapTag] = -typedArrayTags[numberTag] = typedArrayTags[objectTag] = -typedArrayTags[regexpTag] = typedArrayTags[setTag] = -typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ -function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; -} - -module.exports = isTypedArray; - -},{"495":495,"496":496}],516:[function(_dereq_,module,exports){ -var baseCopy = _dereq_(440), - keysIn = _dereq_(522); - -/** - * Converts `value` to a plain object flattening inherited enumerable - * properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ -function toPlainObject(value) { - return baseCopy(value, keysIn(value)); -} - -module.exports = toPlainObject; - -},{"440":440,"522":522}],517:[function(_dereq_,module,exports){ -var assignWith = _dereq_(435), - baseAssign = _dereq_(436), - createAssigner = _dereq_(473); - -/** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources overwrite property assignments of previous sources. - * If `customizer` is provided it's invoked to produce the assigned values. - * The `customizer` is bound to `thisArg` and invoked with five arguments: - * (objectValue, sourceValue, key, object, source). - * - * **Note:** This method mutates `object` and is based on - * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). - * - * @static - * @memberOf _ - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns `object`. - * @example - * - * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); - * // => { 'user': 'fred', 'age': 40 } - * - * // using a customizer callback - * var defaults = _.partialRight(_.assign, function(value, other) { - * return _.isUndefined(value) ? other : value; - * }); - * - * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); - * // => { 'user': 'barney', 'age': 36 } - */ -var assign = createAssigner(function(object, source, customizer) { - return customizer - ? assignWith(object, source, customizer) - : baseAssign(object, source); -}); - -module.exports = assign; - -},{"435":435,"436":436,"473":473}],518:[function(_dereq_,module,exports){ -var assign = _dereq_(517), - assignDefaults = _dereq_(434), - createDefaults = _dereq_(477); - -/** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); - * // => { 'user': 'barney', 'age': 36 } - */ -var defaults = createDefaults(assign, assignDefaults); - -module.exports = defaults; - -},{"434":434,"477":477,"517":517}],519:[function(_dereq_,module,exports){ -module.exports = _dereq_(517); - -},{"517":517}],520:[function(_dereq_,module,exports){ -var baseGet = _dereq_(449), - baseSlice = _dereq_(462), - isArguments = _dereq_(504), - isArray = _dereq_(505), - isIndex = _dereq_(492), - isKey = _dereq_(494), - isLength = _dereq_(495), - last = _dereq_(415), - toPath = _dereq_(501); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Checks if `path` is a direct property. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` is a direct property, else `false`. - * @example - * - * var object = { 'a': { 'b': { 'c': 3 } } }; - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b.c'); - * // => true - * - * _.has(object, ['a', 'b', 'c']); - * // => true - */ -function has(object, path) { - if (object == null) { - return false; - } - var result = hasOwnProperty.call(object, path); - if (!result && !isKey(path)) { - path = toPath(path); - object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); - if (object == null) { - return false; - } - path = last(path); - result = hasOwnProperty.call(object, path); - } - return result || (isLength(object.length) && isIndex(path, object.length) && - (isArray(object) || isArguments(object))); -} - -module.exports = has; - -},{"415":415,"449":449,"462":462,"492":492,"494":494,"495":495,"501":501,"504":504,"505":505}],521:[function(_dereq_,module,exports){ -var getNative = _dereq_(486), - isArrayLike = _dereq_(491), - isObject = _dereq_(511), - shimKeys = _dereq_(498); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeKeys = getNative(Object, 'keys'); - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -var keys = !nativeKeys ? shimKeys : function(object) { - var Ctor = object == null ? undefined : object.constructor; - if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isArrayLike(object))) { - return shimKeys(object); - } - return isObject(object) ? nativeKeys(object) : []; -}; - -module.exports = keys; - -},{"486":486,"491":491,"498":498,"511":511}],522:[function(_dereq_,module,exports){ -var isArguments = _dereq_(504), - isArray = _dereq_(505), - isIndex = _dereq_(492), - isLength = _dereq_(495), - isObject = _dereq_(511); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - if (object == null) { - return []; - } - if (!isObject(object)) { - object = Object(object); - } - var length = object.length; - length = (length && isLength(length) && - (isArray(object) || isArguments(object)) && length) || 0; - - var Ctor = object.constructor, - index = -1, - isProto = typeof Ctor == 'function' && Ctor.prototype === object, - result = Array(length), - skipIndexes = length > 0; - - while (++index < length) { - result[index] = (index + ''); - } - for (var key in object) { - if (!(skipIndexes && isIndex(key, length)) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} - -module.exports = keysIn; - -},{"492":492,"495":495,"504":504,"505":505,"511":511}],523:[function(_dereq_,module,exports){ -var baseMerge = _dereq_(457), - createAssigner = _dereq_(473); - -/** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * overwrite property assignments of previous sources. If `customizer` is - * provided it's invoked to produce the merged values of the destination and - * source properties. If `customizer` returns `undefined` merging is handled - * by the method instead. The `customizer` is bound to `thisArg` and invoked - * with five arguments: (objectValue, sourceValue, key, object, source). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns `object`. - * @example - * - * var users = { - * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] - * }; - * - * var ages = { - * 'data': [{ 'age': 36 }, { 'age': 40 }] - * }; - * - * _.merge(users, ages); - * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } - * - * // using a customizer callback - * var object = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var other = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(object, other, function(a, b) { - * if (_.isArray(a)) { - * return a.concat(b); - * } - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } - */ -var merge = createAssigner(baseMerge); - -module.exports = merge; - -},{"457":457,"473":473}],524:[function(_dereq_,module,exports){ -var keys = _dereq_(521), - toObject = _dereq_(500); - -/** - * Creates a two dimensional array of the key-value pairs for `object`, - * e.g. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. - * @example - * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) - */ -function pairs(object) { - object = toObject(object); - - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; -} - -module.exports = pairs; - -},{"500":500,"521":521}],525:[function(_dereq_,module,exports){ -var baseValues = _dereq_(467), - keys = _dereq_(521); - -/** - * Creates an array of the own enumerable property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ -function values(object) { - return baseValues(object, keys(object)); -} - -module.exports = values; - -},{"467":467,"521":521}],526:[function(_dereq_,module,exports){ -var baseToString = _dereq_(465), - escapeRegExpChar = _dereq_(483); - -/** - * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) - * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern). - */ -var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g, - reHasRegExpChars = RegExp(reRegExpChars.source); - -/** - * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", - * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' - */ -function escapeRegExp(string) { - string = baseToString(string); - return (string && reHasRegExpChars.test(string)) - ? string.replace(reRegExpChars, escapeRegExpChar) - : (string || '(?:)'); -} - -module.exports = escapeRegExp; - -},{"465":465,"483":483}],527:[function(_dereq_,module,exports){ -var baseToString = _dereq_(465); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMin = Math.min; - -/** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to search. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ -function startsWith(string, target, position) { - string = baseToString(string); - position = position == null - ? 0 - : nativeMin(position < 0 ? 0 : (+position || 0), string.length); - - return string.lastIndexOf(target, position) == position; -} - -module.exports = startsWith; - -},{"465":465}],528:[function(_dereq_,module,exports){ -/** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utility - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -module.exports = identity; - -},{}],529:[function(_dereq_,module,exports){ -var baseProperty = _dereq_(459), - basePropertyDeep = _dereq_(460), - isKey = _dereq_(494); - -/** - * Creates a function that returns the property value at `path` on a - * given object. - * - * @static - * @memberOf _ - * @category Utility - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - -module.exports = property; - -},{"459":459,"460":460,"494":494}],530:[function(_dereq_,module,exports){ -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = { sep: '/' } -try { - path = _dereq_(9) -} catch (er) {} - -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = _dereq_(531) - -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' - -// * => any number of characters -var star = qmark + '*?' - -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') - -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} - -// normalizes slashes. -var slashSplit = /\/+/ - -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} - -function ext (a, b) { - a = a || {} - b = b || {} - var t = {} - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - return t -} - -minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return minimatch - - var orig = minimatch - - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) - } - - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - - return m -} - -Minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return Minimatch - return minimatch.defaults(def).Minimatch -} - -function minimatch (p, pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - // "" only matches "" - if (pattern.trim() === '') return p === '' - - return new Minimatch(pattern, options).match(p) -} - -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - pattern = pattern.trim() - - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - - // make the set of regexps etc. - this.make() -} - -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return - - var pattern = this.pattern - var options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - - // step 1: figure out negation, etc. - this.parseNegate() - - // step 2: expand braces - var set = this.globSet = this.braceExpand() - - if (options.debug) this.debug = console.error - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - - this.debug(this.pattern, set) - - this.set = set -} - -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 - - if (options.nonegate) return - - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} - } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - - if (typeof pattern === 'undefined') { - throw new Error('undefined pattern') - } - - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } - - return expand(pattern) -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - var options = this.options - - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var plType - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) - - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } - - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } - - plType = stateChar - patternListStack.push({ - type: plType, - start: i - 1, - reStart: re.length - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue - - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } - - clearStateChar() - hasMagic = true - re += ')' - var pl = patternListStack.pop() - plType = pl.type - // negation is (?:(?!js)[^/]*) - // The others are (?:<pattern>)<type> - switch (plType) { - case '!': - negativeLists.push(pl) - re += ')[^/]*?)' - pl.reEnd = re.length - break - case '?': - case '+': - case '*': - re += plType - break - case '@': break // the default anyway - } - continue - - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } - - clearStateChar() - re += '|' - continue - - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - - if (inClass) { - re += '\\' + c - continue - } - - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } - - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - } - - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - - default: - // swallow any state char that wasn't consumed - clearStateChar() - - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } - - re += c - - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } - - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + 3) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } - - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } - - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true - } - - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] - - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) - - nlLast += nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter - - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } - - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } - - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } - - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } - - var flags = options.nocase ? 'i' : '' - var regExp = new RegExp('^' + re + '$', flags) - - regExp._glob = pattern - regExp._src = re - - return regExp -} - -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} - -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set - - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options - - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) { - this.regexp = false - } - return this.regexp -} - -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} - -Minimatch.prototype.match = match -function match (f, partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' - - if (f === '/' && partial) return true - - var options = this.options - - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } - - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) - - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. - - var set = this.set - this.debug(this.pattern, 'set', set) - - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} - -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } - - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] - - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } - - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } - - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase() - } else { - hit = f === p - } - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } - - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') - return emptyFileEnd - } - - // should be unreachable. - throw new Error('wtf?') -} - -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} - -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} - -},{"531":531,"9":9}],531:[function(_dereq_,module,exports){ -var concatMap = _dereq_(533); -var balanced = _dereq_(532); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = /^(.*,)+(.+)?$/.test(m.body); - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - - -},{"532":532,"533":533}],532:[function(_dereq_,module,exports){ -module.exports = balanced; -function balanced(a, b, str) { - var bal = 0; - var m = {}; - var ended = false; - - for (var i = 0; i < str.length; i++) { - if (a == str.substr(i, a.length)) { - if (!('start' in m)) m.start = i; - bal++; - } - else if (b == str.substr(i, b.length) && 'start' in m) { - ended = true; - bal--; - if (!bal) { - m.end = i; - m.pre = str.substr(0, m.start); - m.body = (m.end - m.start > 1) - ? str.substring(m.start + a.length, m.end) - : ''; - m.post = str.slice(m.end + b.length); - return m; - } - } - } - - // if we opened more than we closed, find the one we closed - if (bal && ended) { - var start = m.start + a.length; - m = balanced(a, b, str.substr(start)); - if (m) { - m.start += start; - m.end += start; - m.pre = str.slice(0, start) + m.pre; - } - return m; - } -} - -},{}],533:[function(_dereq_,module,exports){ -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],534:[function(_dereq_,module,exports){ -'use strict'; -var fs = _dereq_(1) - -module.exports = function (pth, cb) { - var fn = typeof fs.access === 'function' ? fs.access : fs.stat; - - fn(pth, function (err) { - cb(null, !err); + + module.exports = isArrayLike; + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object'; + } + + module.exports = isObjectLike; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + exports.assertEach = assertEach; + exports.assertOneOf = assertOneOf; + exports.assertNodeType = assertNodeType; + exports.assertNodeOrValueType = assertNodeOrValueType; + exports.assertValueType = assertValueType; + exports.chain = chain; + exports.default = defineType; + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var VISITOR_KEYS = exports.VISITOR_KEYS = {}; + var ALIAS_KEYS = exports.ALIAS_KEYS = {}; + var NODE_FIELDS = exports.NODE_FIELDS = {}; + var BUILDER_KEYS = exports.BUILDER_KEYS = {}; + var DEPRECATED_KEYS = exports.DEPRECATED_KEYS = {}; + + function getType(val) { + if (Array.isArray(val)) { + return "array"; + } else if (val === null) { + return "null"; + } else if (val === undefined) { + return "undefined"; + } else { + return typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val); + } + } + + function assertEach(callback) { + function validator(node, key, val) { + if (!Array.isArray(val)) return; + + for (var i = 0; i < val.length; i++) { + callback(node, key + "[" + i + "]", val[i]); + } + } + validator.each = callback; + return validator; + } + + function assertOneOf() { + for (var _len = arguments.length, vals = Array(_len), _key = 0; _key < _len; _key++) { + vals[_key] = arguments[_key]; + } + + function validate(node, key, val) { + if (vals.indexOf(val) < 0) { + throw new TypeError("Property " + key + " expected value to be one of " + (0, _stringify2.default)(vals) + " but got " + (0, _stringify2.default)(val)); + } + } + + validate.oneOf = vals; + + return validate; + } + + function assertNodeType() { + for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + types[_key2] = arguments[_key2]; + } + + function validate(node, key, val) { + var valid = false; + + for (var _iterator = types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var type = _ref; + + if (t.is(type, val)) { + valid = true; + break; + } + } + + if (!valid) { + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); + } + } + + validate.oneOfNodeTypes = types; + + return validate; + } + + function assertNodeOrValueType() { + for (var _len3 = arguments.length, types = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + types[_key3] = arguments[_key3]; + } + + function validate(node, key, val) { + var valid = false; + + for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var type = _ref2; + + if (getType(val) === type || t.is(type, val)) { + valid = true; + break; + } + } + + if (!valid) { + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); + } + } + + validate.oneOfNodeOrValueTypes = types; + + return validate; + } + + function assertValueType(type) { + function validate(node, key, val) { + var valid = getType(val) === type; + + if (!valid) { + throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val)); + } + } + + validate.type = type; + + return validate; + } + + function chain() { + for (var _len4 = arguments.length, fns = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + fns[_key4] = arguments[_key4]; + } + + function validate() { + for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var fn = _ref3; + + fn.apply(undefined, arguments); + } + } + validate.chainOf = fns; + return validate; + } + + function defineType(type) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var inherits = opts.inherits && store[opts.inherits] || {}; + + opts.fields = opts.fields || inherits.fields || {}; + opts.visitor = opts.visitor || inherits.visitor || []; + opts.aliases = opts.aliases || inherits.aliases || []; + opts.builder = opts.builder || inherits.builder || opts.visitor || []; + + if (opts.deprecatedAlias) { + DEPRECATED_KEYS[opts.deprecatedAlias] = type; + } + + for (var _iterator4 = opts.visitor.concat(opts.builder), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var _key5 = _ref4; + + opts.fields[_key5] = opts.fields[_key5] || {}; + } + + for (var key in opts.fields) { + var field = opts.fields[key]; + + if (opts.builder.indexOf(key) === -1) { + field.optional = true; + } + if (field.default === undefined) { + field.default = null; + } else if (!field.validate) { + field.validate = assertValueType(getType(field.default)); + } + } + + VISITOR_KEYS[type] = opts.visitor; + BUILDER_KEYS[type] = opts.builder; + NODE_FIELDS[type] = opts.fields; + ALIAS_KEYS[type] = opts.aliases; + + store[type] = opts; + } + + var store = {}; + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + + "use strict"; + + var hasOwnProperty = {}.hasOwnProperty; + module.exports = function (it, key) { + return hasOwnProperty.call(it, key); + }; + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var dP = __webpack_require__(23), + createDesc = __webpack_require__(92); + module.exports = __webpack_require__(20) ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44), + getRawTag = __webpack_require__(525), + objectToString = __webpack_require__(550); + + /** `Object#toString` result references. */ + var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + + /** Built-in value references. */ + var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); + } + + module.exports = baseGetTag; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assignValue = __webpack_require__(158), + baseAssignValue = __webpack_require__(159); + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + + module.exports = copyObject; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayLikeKeys = __webpack_require__(240), + baseKeys = __webpack_require__(491), + isArrayLike = __webpack_require__(24); + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + module.exports = keys; + +/***/ }), +/* 32 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = { + filename: { + type: "filename", + description: "filename to use when reading from stdin - this will be used in source-maps, errors etc", + default: "unknown", + shorthand: "f" + }, + + filenameRelative: { + hidden: true, + type: "string" + }, + + inputSourceMap: { + hidden: true + }, + + env: { + hidden: true, + default: {} + }, + + mode: { + description: "", + hidden: true + }, + + retainLines: { + type: "boolean", + default: false, + description: "retain line numbers - will result in really ugly code" + }, + + highlightCode: { + description: "enable/disable ANSI syntax highlighting of code frames (on by default)", + type: "boolean", + default: true + }, + + suppressDeprecationMessages: { + type: "boolean", + default: false, + hidden: true + }, + + presets: { + type: "list", + description: "", + default: [] + }, + + plugins: { + type: "list", + default: [], + description: "" + }, + + ignore: { + type: "list", + description: "list of glob paths to **not** compile", + default: [] + }, + + only: { + type: "list", + description: "list of glob paths to **only** compile" + }, + + code: { + hidden: true, + default: true, + type: "boolean" + }, + + metadata: { + hidden: true, + default: true, + type: "boolean" + }, + + ast: { + hidden: true, + default: true, + type: "boolean" + }, + + extends: { + type: "string", + hidden: true + }, + + comments: { + type: "boolean", + default: true, + description: "write comments to generated output (true by default)" + }, + + shouldPrintComment: { + hidden: true, + description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored" + }, + + wrapPluginVisitorMethod: { + hidden: true, + description: "optional callback to wrap all visitor methods" + }, + + compact: { + type: "booleanString", + default: "auto", + description: "do not include superfluous whitespace characters and line terminators [true|false|auto]" + }, + + minified: { + type: "boolean", + default: false, + description: "save as much bytes when printing [true|false]" + }, + + sourceMap: { + alias: "sourceMaps", + hidden: true + }, + + sourceMaps: { + type: "booleanString", + description: "[true|false|inline]", + default: false, + shorthand: "s" + }, + + sourceMapTarget: { + type: "string", + description: "set `file` on returned source map" + }, + + sourceFileName: { + type: "string", + description: "set `sources[0]` on returned source map" + }, + + sourceRoot: { + type: "filename", + description: "the root from which all sources are relative" + }, + + babelrc: { + description: "Whether or not to look up .babelrc and .babelignore files", + type: "boolean", + default: true + }, + + sourceType: { + description: "", + default: "module" + }, + + auxiliaryCommentBefore: { + type: "string", + description: "print a comment before any injected non-user code" + }, + + auxiliaryCommentAfter: { + type: "string", + description: "print a comment after any injected non-user code" + }, + + resolveModuleSource: { + hidden: true + }, + + getModuleId: { + hidden: true + }, + + moduleRoot: { + type: "filename", + description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions" + }, + + moduleIds: { + type: "boolean", + default: false, + shorthand: "M", + description: "insert an explicit id for modules" + }, + + moduleId: { + description: "specify a custom name for module ids", + type: "string" + }, + + passPerPreset: { + description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.", + type: "boolean", + default: false, + hidden: true + }, + + parserOpts: { + description: "Options to pass into the parser, or to change parsers (parserOpts.parser)", + default: false + }, + + generatorOpts: { + description: "Options to pass into the generator, or to change generators (generatorOpts.generator)", + default: false + } + }; + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + + var _objectWithoutProperties2 = __webpack_require__(362); + + var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _assign = __webpack_require__(85); + + var _assign2 = _interopRequireDefault(_assign); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _node = __webpack_require__(178); + + var context = _interopRequireWildcard(_node); + + var _plugin2 = __webpack_require__(63); + + var _plugin3 = _interopRequireDefault(_plugin2); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _index = __webpack_require__(51); + + var _resolvePlugin = __webpack_require__(180); + + var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin); + + var _resolvePreset = __webpack_require__(181); + + var _resolvePreset2 = _interopRequireDefault(_resolvePreset); + + var _cloneDeepWith = __webpack_require__(566); + + var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith); + + var _clone = __webpack_require__(109); + + var _clone2 = _interopRequireDefault(_clone); + + var _merge = __webpack_require__(289); + + var _merge2 = _interopRequireDefault(_merge); + + var _config2 = __webpack_require__(32); + + var _config3 = _interopRequireDefault(_config2); + + var _removed = __webpack_require__(53); + + var _removed2 = _interopRequireDefault(_removed); + + var _buildConfigChain = __webpack_require__(50); + + var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain); + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var OptionManager = function () { + function OptionManager(log) { + (0, _classCallCheck3.default)(this, OptionManager); + + this.resolvedConfigs = []; + this.options = OptionManager.createBareOptions(); + this.log = log; + } + + OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) { + for (var _iterator = OptionManager.memoisedPlugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var cache = _ref; + + if (cache.container === fn) return cache.plugin; + } + + var obj = void 0; + + if (typeof fn === "function") { + obj = fn(context); + } else { + obj = fn; + } + + if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") { + var _plugin = new _plugin3.default(obj, alias); + OptionManager.memoisedPlugins.push({ + container: fn, + plugin: _plugin + }); + return _plugin; + } else { + throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i); + } + }; + + OptionManager.createBareOptions = function createBareOptions() { + var opts = {}; + + for (var _key in _config3.default) { + var opt = _config3.default[_key]; + opts[_key] = (0, _clone2.default)(opt.default); + } + + return opts; + }; + + OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) { + plugin = plugin.__esModule ? plugin.default : plugin; + + if (!(plugin instanceof _plugin3.default)) { + if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") { + plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias); + } else { + throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin))); + } + } + + plugin.init(loc, i); + + return plugin; + }; + + OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) { + return plugins.map(function (val, i) { + var plugin = void 0, + options = void 0; + + if (!val) { + throw new TypeError("Falsy value found in plugins"); + } + + if (Array.isArray(val)) { + plugin = val[0]; + options = val[1]; + } else { + plugin = val; + } + + var alias = typeof plugin === "string" ? plugin : loc + "$" + i; + + if (typeof plugin === "string") { + var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname); + if (pluginLoc) { + plugin = __webpack_require__(175)(pluginLoc); + } else { + throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname)); + } + } + + plugin = OptionManager.normalisePlugin(plugin, loc, i, alias); + + return [plugin, options]; + }); + }; + + OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) { + var _this = this; + + var rawOpts = _ref2.options, + extendingOpts = _ref2.extending, + alias = _ref2.alias, + loc = _ref2.loc, + dirname = _ref2.dirname; + + alias = alias || "foreign"; + if (!rawOpts) return; + + if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) { + this.log.error("Invalid options type for " + alias, TypeError); + } + + var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) { + if (val instanceof _plugin3.default) { + return val; + } + }); + + dirname = dirname || process.cwd(); + loc = loc || alias; + + for (var _key2 in opts) { + var option = _config3.default[_key2]; + + if (!option && this.log) { + if (_removed2.default[_key2]) { + this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError); + } else { + var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options."; + var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; + + this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError); + } + } + } + + (0, _index.normaliseOptions)(opts); + + if (opts.plugins) { + opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins); + } + + if (opts.presets) { + if (opts.passPerPreset) { + opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) { + _this.mergeOptions({ + options: preset, + extending: preset, + alias: presetLoc, + loc: presetLoc, + dirname: dirname + }); + }); + } else { + this.mergePresets(opts.presets, dirname); + delete opts.presets; + } + } + + if (rawOpts === extendingOpts) { + (0, _assign2.default)(extendingOpts, opts); + } else { + (0, _merge2.default)(extendingOpts || this.options, opts); + } + }; + + OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) { + var _this2 = this; + + this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) { + _this2.mergeOptions({ + options: presetOpts, + alias: presetLoc, + loc: presetLoc, + dirname: _path2.default.dirname(presetLoc || "") + }); + }); + }; + + OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) { + return presets.map(function (val) { + var options = void 0; + if (Array.isArray(val)) { + if (val.length > 2) { + throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset."); + } + + var _val = val; + val = _val[0]; + options = _val[1]; + } + + var presetLoc = void 0; + try { + if (typeof val === "string") { + presetLoc = (0, _resolvePreset2.default)(val, dirname); + + if (!presetLoc) { + throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname)); + } + + val = __webpack_require__(175)(presetLoc); + } + + if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) { + if (val.default) { + val = val.default; + } else { + var _val2 = val, + __esModule = _val2.__esModule, + rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]); + + val = rest; + } + } + + if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset; + + if (typeof val !== "function" && options !== undefined) { + throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options."); + } + + if (typeof val === "function") val = val(context, options, { dirname: dirname }); + + if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") { + throw new Error("Unsupported preset format: " + val + "."); + } + + onResolve && onResolve(val, presetLoc); + } catch (e) { + if (presetLoc) { + e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")"; + } + throw e; + } + return val; + }); + }; + + OptionManager.prototype.normaliseOptions = function normaliseOptions() { + var opts = this.options; + + for (var _key3 in _config3.default) { + var option = _config3.default[_key3]; + var val = opts[_key3]; + + if (!val && option.optional) continue; + + if (option.alias) { + opts[option.alias] = opts[option.alias] || val; + } else { + opts[_key3] = val; + } + } + }; + + OptionManager.prototype.init = function init() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var _config = _ref3; + + this.mergeOptions(_config); + } + + this.normaliseOptions(opts); + + return this.options; + }; + + return OptionManager; + }(); + + exports.default = OptionManager; + + OptionManager.memoisedPlugins = []; + module.exports = exports["default"]; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(401), __esModule: true }; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _virtualTypes = __webpack_require__(220); + + var virtualTypes = _interopRequireWildcard(_virtualTypes); + + var _debug2 = __webpack_require__(234); + + var _debug3 = _interopRequireDefault(_debug2); + + var _invariant = __webpack_require__(457); + + var _invariant2 = _interopRequireDefault(_invariant); + + var _index = __webpack_require__(7); + + var _index2 = _interopRequireDefault(_index); + + var _assign = __webpack_require__(170); + + var _assign2 = _interopRequireDefault(_assign); + + var _scope = __webpack_require__(133); + + var _scope2 = _interopRequireDefault(_scope); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _cache = __webpack_require__(86); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var _debug = (0, _debug3.default)("babel"); + + var NodePath = function () { + function NodePath(hub, parent) { + (0, _classCallCheck3.default)(this, NodePath); + + this.parent = parent; + this.hub = hub; + this.contexts = []; + this.data = {}; + this.shouldSkip = false; + this.shouldStop = false; + this.removed = false; + this.state = null; + this.opts = null; + this.skipKeys = null; + this.parentPath = null; + this.context = null; + this.container = null; + this.listKey = null; + this.inList = false; + this.parentKey = null; + this.key = null; + this.node = null; + this.scope = null; + this.type = null; + this.typeAnnotation = null; + } + + NodePath.get = function get(_ref) { + var hub = _ref.hub, + parentPath = _ref.parentPath, + parent = _ref.parent, + container = _ref.container, + listKey = _ref.listKey, + key = _ref.key; + + if (!hub && parentPath) { + hub = parentPath.hub; + } + + (0, _invariant2.default)(parent, "To get a node path the parent needs to exist"); + + var targetNode = container[key]; + + var paths = _cache.path.get(parent) || []; + if (!_cache.path.has(parent)) { + _cache.path.set(parent, paths); + } + + var path = void 0; + + for (var i = 0; i < paths.length; i++) { + var pathCheck = paths[i]; + if (pathCheck.node === targetNode) { + path = pathCheck; + break; + } + } + + if (!path) { + path = new NodePath(hub, parent); + paths.push(path); + } + + path.setup(parentPath, container, listKey, key); + + return path; + }; + + NodePath.prototype.getScope = function getScope(scope) { + var ourScope = scope; + + if (this.isScope()) { + ourScope = new _scope2.default(this, scope); + } + + return ourScope; + }; + + NodePath.prototype.setData = function setData(key, val) { + return this.data[key] = val; + }; + + NodePath.prototype.getData = function getData(key, def) { + var val = this.data[key]; + if (!val && def) val = this.data[key] = def; + return val; + }; + + NodePath.prototype.buildCodeFrameError = function buildCodeFrameError(msg) { + var Error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SyntaxError; + + return this.hub.file.buildCodeFrameError(this.node, msg, Error); + }; + + NodePath.prototype.traverse = function traverse(visitor, state) { + (0, _index2.default)(this.node, visitor, this.scope, state, this); + }; + + NodePath.prototype.mark = function mark(type, message) { + this.hub.file.metadata.marked.push({ + type: type, + message: message, + loc: this.node.loc + }); + }; + + NodePath.prototype.set = function set(key, node) { + t.validate(this.node, key, node); + this.node[key] = node; + }; + + NodePath.prototype.getPathLocation = function getPathLocation() { + var parts = []; + var path = this; + do { + var key = path.key; + if (path.inList) key = path.listKey + "[" + key + "]"; + parts.unshift(key); + } while (path = path.parentPath); + return parts.join("."); + }; + + NodePath.prototype.debug = function debug(buildMessage) { + if (!_debug.enabled) return; + _debug(this.getPathLocation() + " " + this.type + ": " + buildMessage()); + }; + + return NodePath; + }(); + + exports.default = NodePath; + + (0, _assign2.default)(NodePath.prototype, __webpack_require__(364)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(370)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(378)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(368)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(367)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(373)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(366)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(377)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(376)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(369)); + (0, _assign2.default)(NodePath.prototype, __webpack_require__(365)); + + var _loop2 = function _loop2() { + if (_isArray) { + if (_i >= _iterator.length) return "break"; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) return "break"; + _ref2 = _i.value; + } + + var type = _ref2; + + var typeKey = "is" + type; + NodePath.prototype[typeKey] = function (opts) { + return t[typeKey](this.node, opts); + }; + + NodePath.prototype["assert" + type] = function (opts) { + if (!this[typeKey](opts)) { + throw new TypeError("Expected node path of type " + type); + } + }; + }; + + for (var _iterator = t.TYPES, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + var _ret2 = _loop2(); + + if (_ret2 === "break") break; + } + + var _loop = function _loop(type) { + if (type[0] === "_") return "continue"; + if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type); + + var virtualType = virtualTypes[type]; + + NodePath.prototype["is" + type] = function (opts) { + return virtualType.checkPath(this, opts); + }; + }; + + for (var type in virtualTypes) { + var _ret = _loop(type); + + if (_ret === "continue") continue; + } + module.exports = exports["default"]; + +/***/ }), +/* 36 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } + }; + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // to indexed object, toObject with fallback for non-array-like ES3 strings + var IObject = __webpack_require__(140), + defined = __webpack_require__(88); + module.exports = function (it) { + return IObject(defined(it)); + }; + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsNative = __webpack_require__(488), + getValue = __webpack_require__(526); + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; + } + + module.exports = getNative; + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function (module) { + if (!module.webpackPolyfill) { + module.deprecate = function () {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + }; + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var node = _ref.node, + parent = _ref.parent, + scope = _ref.scope, + id = _ref.id; + + if (node.id) return; + + if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key))) { + id = parent.key; + } else if (t.isVariableDeclarator(parent)) { + id = parent.id; + + if (t.isIdentifier(id)) { + var binding = scope.parent.getBinding(id.name); + if (binding && binding.constant && scope.getBinding(id.name) === binding) { + node.id = id; + node.id[t.NOT_LOCAL_BINDING] = true; + return; + } + } + } else if (t.isAssignmentExpression(parent)) { + id = parent.left; + } else if (!id) { + return; + } + + var name = void 0; + if (id && t.isLiteral(id)) { + name = id.value; + } else if (id && t.isIdentifier(id)) { + name = id.name; + } else { + return; + } + + name = t.toBindingIdentifierName(name); + id = t.identifier(name); + + id[t.NOT_LOCAL_BINDING] = true; + + var state = visit(node, name, scope); + return wrap(state, node, id, scope) || node; + }; + + var _babelHelperGetFunctionArity = __webpack_require__(185); + + var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n"); + + var buildGeneratorPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n"); + + var visitor = { + "ReferencedIdentifier|BindingIdentifier": function ReferencedIdentifierBindingIdentifier(path, state) { + if (path.node.name !== state.name) return; + + var localDeclar = path.scope.getBindingIdentifier(state.name); + if (localDeclar !== state.outerDeclar) return; + + state.selfReference = true; + path.stop(); + } + }; + + function wrap(state, method, id, scope) { + if (state.selfReference) { + if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { + scope.rename(id.name); + } else { + if (!t.isFunction(method)) return; + + var build = buildPropertyMethodAssignmentWrapper; + if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper; + var _template = build({ + FUNCTION: method, + FUNCTION_ID: id, + FUNCTION_KEY: scope.generateUidIdentifier(id.name) + }).expression; + _template.callee._skipModulesRemap = true; + + var params = _template.callee.body.body[0].params; + for (var i = 0, len = (0, _babelHelperGetFunctionArity2.default)(method); i < len; i++) { + params.push(scope.generateUidIdentifier("x")); + } + + return _template; + } + } + + method.id = id; + scope.getProgramParent().references[id.name] = true; + } + + function visit(node, name, scope) { + var state = { + selfAssignment: false, + selfReference: false, + outerDeclar: scope.getBindingIdentifier(name), + references: [], + name: name + }; + + var binding = scope.getOwnBinding(name); + + if (binding) { + if (binding.kind === "param") { + state.selfReference = true; + } else {} + } else if (state.outerDeclar || scope.hasGlobal(name)) { + scope.traverse(node, visitor, state); + } + + return state; + } + + module.exports = exports["default"]; + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _setPrototypeOf = __webpack_require__(357); + + var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); + } + + subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; + }; + +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; + }; + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.2.14 / 15.2.3.14 Object.keys(O) + var $keys = __webpack_require__(232), + enumBugKeys = __webpack_require__(139); + + module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); + }; + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var root = __webpack_require__(15); + + /** Built-in value references. */ + var _Symbol = root.Symbol; + + module.exports = _Symbol; + +/***/ }), +/* 45 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || value !== value && other !== other; + } + + module.exports = eq; + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayLikeKeys = __webpack_require__(240), + baseKeysIn = __webpack_require__(492), + isArrayLike = __webpack_require__(24); + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + + module.exports = keysIn; + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toFinite = __webpack_require__(588); + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? remainder ? result - remainder : result : 0; + } + + module.exports = toInteger; + +/***/ }), +/* 48 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__; + + /* WEBPACK VAR INJECTION */}.call(exports, {})) + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + exports.File = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _assign = __webpack_require__(85); + + var _assign2 = _interopRequireDefault(_assign); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _babelHelpers = __webpack_require__(190); + + var _babelHelpers2 = _interopRequireDefault(_babelHelpers); + + var _metadata = __webpack_require__(120); + + var metadataVisitor = _interopRequireWildcard(_metadata); + + var _convertSourceMap = __webpack_require__(399); + + var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap); + + var _optionManager = __webpack_require__(33); + + var _optionManager2 = _interopRequireDefault(_optionManager); + + var _pluginPass = __webpack_require__(295); + + var _pluginPass2 = _interopRequireDefault(_pluginPass); + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + var _sourceMap = __webpack_require__(284); + + var _sourceMap2 = _interopRequireDefault(_sourceMap); + + var _babelGenerator = __webpack_require__(182); + + var _babelGenerator2 = _interopRequireDefault(_babelGenerator); + + var _babelCodeFrame = __webpack_require__(177); + + var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame); + + var _defaults = __webpack_require__(268); + + var _defaults2 = _interopRequireDefault(_defaults); + + var _logger = __webpack_require__(119); + + var _logger2 = _interopRequireDefault(_logger); + + var _store = __webpack_require__(118); + + var _store2 = _interopRequireDefault(_store); + + var _babylon = __webpack_require__(87); + + var _util = __webpack_require__(121); + + var util = _interopRequireWildcard(_util); + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _resolve = __webpack_require__(117); + + var _resolve2 = _interopRequireDefault(_resolve); + + var _blockHoist = __webpack_require__(292); + + var _blockHoist2 = _interopRequireDefault(_blockHoist); + + var _shadowFunctions = __webpack_require__(293); + + var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var shebangRegex = /^#!.*/; + + var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]]; + + var errorVisitor = { + enter: function enter(path, state) { + var loc = path.node.loc; + if (loc) { + state.loc = loc; + path.stop(); + } + } + }; + + var File = function (_Store) { + (0, _inherits3.default)(File, _Store); + + function File() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var pipeline = arguments[1]; + (0, _classCallCheck3.default)(this, File); + + var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this)); + + _this.pipeline = pipeline; + + _this.log = new _logger2.default(_this, opts.filename || "unknown"); + _this.opts = _this.initOptions(opts); + + _this.parserOpts = { + sourceType: _this.opts.sourceType, + sourceFileName: _this.opts.filename, + plugins: [] + }; + + _this.pluginVisitors = []; + _this.pluginPasses = []; + + _this.buildPluginsForOptions(_this.opts); + + if (_this.opts.passPerPreset) { + _this.perPresetOpts = []; + _this.opts.presets.forEach(function (presetOpts) { + var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts); + _this.perPresetOpts.push(perPresetOpts); + _this.buildPluginsForOptions(perPresetOpts); + }); + } + + _this.metadata = { + usedHelpers: [], + marked: [], + modules: { + imports: [], + exports: { + exported: [], + specifiers: [] + } + } + }; + + _this.dynamicImportTypes = {}; + _this.dynamicImportIds = {}; + _this.dynamicImports = []; + _this.declarations = {}; + _this.usedHelpers = {}; + + _this.path = null; + _this.ast = {}; + + _this.code = ""; + _this.shebang = ""; + + _this.hub = new _babelTraverse.Hub(_this); + return _this; + } + + File.prototype.getMetadata = function getMetadata() { + var has = false; + for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var node = _ref; + + if (t.isModuleDeclaration(node)) { + has = true; + break; + } + } + if (has) { + this.path.traverse(metadataVisitor, this); + } + }; + + File.prototype.initOptions = function initOptions(opts) { + opts = new _optionManager2.default(this.log, this.pipeline).init(opts); + + if (opts.inputSourceMap) { + opts.sourceMaps = true; + } + + if (opts.moduleId) { + opts.moduleIds = true; + } + + opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename)); + + opts.ignore = util.arrayify(opts.ignore, util.regexify); + + if (opts.only) opts.only = util.arrayify(opts.only, util.regexify); + + (0, _defaults2.default)(opts, { + moduleRoot: opts.sourceRoot + }); + + (0, _defaults2.default)(opts, { + sourceRoot: opts.moduleRoot + }); + + (0, _defaults2.default)(opts, { + filenameRelative: opts.filename + }); + + var basenameRelative = _path2.default.basename(opts.filenameRelative); + + (0, _defaults2.default)(opts, { + sourceFileName: basenameRelative, + sourceMapTarget: basenameRelative + }); + + return opts; + }; + + File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) { + if (!Array.isArray(opts.plugins)) { + return; + } + + var plugins = opts.plugins.concat(INTERNAL_PLUGINS); + var currentPluginVisitors = []; + var currentPluginPasses = []; + + for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var ref = _ref2; + var plugin = ref[0], + pluginOpts = ref[1]; + + currentPluginVisitors.push(plugin.visitor); + currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts)); + + if (plugin.manipulateOptions) { + plugin.manipulateOptions(opts, this.parserOpts, this); + } + } + + this.pluginVisitors.push(currentPluginVisitors); + this.pluginPasses.push(currentPluginPasses); + }; + + File.prototype.getModuleName = function getModuleName() { + var opts = this.opts; + if (!opts.moduleIds) { + return null; + } + + if (opts.moduleId != null && !opts.getModuleId) { + return opts.moduleId; + } + + var filenameRelative = opts.filenameRelative; + var moduleName = ""; + + if (opts.moduleRoot != null) { + moduleName = opts.moduleRoot + "/"; + } + + if (!opts.filenameRelative) { + return moduleName + opts.filename.replace(/^\//, ""); + } + + if (opts.sourceRoot != null) { + var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); + filenameRelative = filenameRelative.replace(sourceRootRegEx, ""); + } + + filenameRelative = filenameRelative.replace(/\.(\w*?)$/, ""); + + moduleName += filenameRelative; + + moduleName = moduleName.replace(/\\/g, "/"); + + if (opts.getModuleId) { + return opts.getModuleId(moduleName) || moduleName; + } else { + return moduleName; + } + }; + + File.prototype.resolveModuleSource = function resolveModuleSource(source) { + var resolveModuleSource = this.opts.resolveModuleSource; + if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename); + return source; + }; + + File.prototype.addImport = function addImport(source, imported) { + var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported; + + var alias = source + ":" + imported; + var id = this.dynamicImportIds[alias]; + + if (!id) { + source = this.resolveModuleSource(source); + id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name); + + var specifiers = []; + + if (imported === "*") { + specifiers.push(t.importNamespaceSpecifier(id)); + } else if (imported === "default") { + specifiers.push(t.importDefaultSpecifier(id)); + } else { + specifiers.push(t.importSpecifier(id, t.identifier(imported))); + } + + var declar = t.importDeclaration(specifiers, t.stringLiteral(source)); + declar._blockHoist = 3; + + this.path.unshiftContainer("body", declar); + } + + return id; + }; + + File.prototype.addHelper = function addHelper(name) { + var declar = this.declarations[name]; + if (declar) return declar; + + if (!this.usedHelpers[name]) { + this.metadata.usedHelpers.push(name); + this.usedHelpers[name] = true; + } + + var generator = this.get("helperGenerator"); + var runtime = this.get("helpersNamespace"); + if (generator) { + var res = generator(name); + if (res) return res; + } else if (runtime) { + return t.memberExpression(runtime, t.identifier(name)); + } + + var ref = (0, _babelHelpers2.default)(name); + var uid = this.declarations[name] = this.scope.generateUidIdentifier(name); + + if (t.isFunctionExpression(ref) && !ref.id) { + ref.body._compact = true; + ref._generated = true; + ref.id = uid; + ref.type = "FunctionDeclaration"; + this.path.unshiftContainer("body", ref); + } else { + ref._compact = true; + this.scope.push({ + id: uid, + init: ref, + unique: true + }); + } + + return uid; + }; + + File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) { + var stringIds = raw.elements.map(function (string) { + return string.value; + }); + var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(","); + + var declar = this.declarations[name]; + if (declar) return declar; + + var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); + + var helperId = this.addHelper(helperName); + var init = t.callExpression(helperId, [strings, raw]); + init._compact = true; + this.scope.push({ + id: uid, + init: init, + _blockHoist: 1.9 }); + return uid; + }; + + File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) { + var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError; + + var loc = node && (node.loc || node._loc); + + var err = new Error(msg); + + if (loc) { + err.loc = loc.start; + } else { + (0, _babelTraverse2.default)(node, errorVisitor, this.scope, err); + + err.message += " (This is an error on an internal node. Probably an internal error"; + + if (err.loc) { + err.message += ". Location has been estimated."; + } + + err.message += ")"; + } + + return err; + }; + + File.prototype.mergeSourceMap = function mergeSourceMap(map) { + var inputMap = this.opts.inputSourceMap; + + if (inputMap) { + var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap); + var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map); + + var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({ + file: inputMapConsumer.file, + sourceRoot: inputMapConsumer.sourceRoot + }); + + var source = outputMapConsumer.sources[0]; + + inputMapConsumer.eachMapping(function (mapping) { + var generatedPosition = outputMapConsumer.generatedPositionFor({ + line: mapping.generatedLine, + column: mapping.generatedColumn, + source: source + }); + if (generatedPosition.column != null) { + mergedGenerator.addMapping({ + source: mapping.source, + + original: mapping.source == null ? null : { + line: mapping.originalLine, + column: mapping.originalColumn + }, + + generated: generatedPosition + }); + } + }); + + var mergedMap = mergedGenerator.toJSON(); + inputMap.mappings = mergedMap.mappings; + return inputMap; + } else { + return map; + } + }; + + File.prototype.parse = function parse(code) { + var parseCode = _babylon.parse; + var parserOpts = this.opts.parserOpts; + + if (parserOpts) { + parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts); + + if (parserOpts.parser) { + if (typeof parserOpts.parser === "string") { + var dirname = _path2.default.dirname(this.opts.filename) || process.cwd(); + var parser = (0, _resolve2.default)(parserOpts.parser, dirname); + if (parser) { + parseCode = __webpack_require__(174)(parser).parse; + } else { + throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname)); + } + } else { + parseCode = parserOpts.parser; + } + + parserOpts.parser = { + parse: function parse(source) { + return (0, _babylon.parse)(source, parserOpts); + } + }; + } + } + + this.log.debug("Parse start"); + var ast = parseCode(code, parserOpts || this.parserOpts); + this.log.debug("Parse stop"); + return ast; + }; + + File.prototype._addAst = function _addAst(ast) { + this.path = _babelTraverse.NodePath.get({ + hub: this.hub, + parentPath: null, + parent: ast, + container: ast, + key: "program" + }).setContext(); + this.scope = this.path.scope; + this.ast = ast; + this.getMetadata(); + }; + + File.prototype.addAst = function addAst(ast) { + this.log.debug("Start set AST"); + this._addAst(ast); + this.log.debug("End set AST"); + }; + + File.prototype.transform = function transform() { + for (var i = 0; i < this.pluginPasses.length; i++) { + var pluginPasses = this.pluginPasses[i]; + this.call("pre", pluginPasses); + this.log.debug("Start transform traverse"); + + var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod); + (0, _babelTraverse2.default)(this.ast, visitor, this.scope); + + this.log.debug("End transform traverse"); + this.call("post", pluginPasses); + } + + return this.generate(); + }; + + File.prototype.wrap = function wrap(code, callback) { + code = code + ""; + + try { + if (this.shouldIgnore()) { + return this.makeResult({ code: code, ignored: true }); + } else { + return callback(); + } + } catch (err) { + if (err._babel) { + throw err; + } else { + err._babel = true; + } + + var message = err.message = this.opts.filename + ": " + err.message; + + var loc = err.loc; + if (loc) { + err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts); + message += "\n" + err.codeFrame; + } + + if (process.browser) { + err.message = message; + } + + if (err.stack) { + var newStack = err.stack.replace(err.message, message); + err.stack = newStack; + } + + throw err; + } + }; + + File.prototype.addCode = function addCode(code) { + code = (code || "") + ""; + code = this.parseInputSourceMap(code); + this.code = code; + }; + + File.prototype.parseCode = function parseCode() { + this.parseShebang(); + var ast = this.parse(this.code); + this.addAst(ast); + }; + + File.prototype.shouldIgnore = function shouldIgnore() { + var opts = this.opts; + return util.shouldIgnore(opts.filename, opts.ignore, opts.only); + }; + + File.prototype.call = function call(key, pluginPasses) { + for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var pass = _ref3; + + var plugin = pass.plugin; + var fn = plugin[key]; + if (fn) fn.call(pass, this); + } + }; + + File.prototype.parseInputSourceMap = function parseInputSourceMap(code) { + var opts = this.opts; + + if (opts.inputSourceMap !== false) { + var inputMap = _convertSourceMap2.default.fromSource(code); + if (inputMap) { + opts.inputSourceMap = inputMap.toObject(); + code = _convertSourceMap2.default.removeComments(code); + } + } + + return code; + }; + + File.prototype.parseShebang = function parseShebang() { + var shebangMatch = shebangRegex.exec(this.code); + if (shebangMatch) { + this.shebang = shebangMatch[0]; + this.code = this.code.replace(shebangRegex, ""); + } + }; + + File.prototype.makeResult = function makeResult(_ref4) { + var code = _ref4.code, + map = _ref4.map, + ast = _ref4.ast, + ignored = _ref4.ignored; + + var result = { + metadata: null, + options: this.opts, + ignored: !!ignored, + code: null, + ast: null, + map: map || null + }; + + if (this.opts.code) { + result.code = code; + } + + if (this.opts.ast) { + result.ast = ast; + } + + if (this.opts.metadata) { + result.metadata = this.metadata; + } + + return result; + }; + + File.prototype.generate = function generate() { + var opts = this.opts; + var ast = this.ast; + + var result = { ast: ast }; + if (!opts.code) return this.makeResult(result); + + var gen = _babelGenerator2.default; + if (opts.generatorOpts.generator) { + gen = opts.generatorOpts.generator; + + if (typeof gen === "string") { + var dirname = _path2.default.dirname(this.opts.filename) || process.cwd(); + var generator = (0, _resolve2.default)(gen, dirname); + if (generator) { + gen = __webpack_require__(174)(generator).print; + } else { + throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname)); + } + } + } + + this.log.debug("Generation start"); + + var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code); + result.code = _result.code; + result.map = _result.map; + + this.log.debug("Generation end"); + + if (this.shebang) { + result.code = this.shebang + "\n" + result.code; + } + + if (result.map) { + result.map = this.mergeSourceMap(result.map); + } + + if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { + result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment(); + } + + if (opts.sourceMaps === "inline") { + result.map = null; + } + + return this.makeResult(result); + }; + + return File; + }(_store2.default); + + exports.default = File; + exports.File = File; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + + var _assign = __webpack_require__(85); + + var _assign2 = _interopRequireDefault(_assign); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + exports.default = buildConfigChain; + + var _resolve = __webpack_require__(117); + + var _resolve2 = _interopRequireDefault(_resolve); + + var _json = __webpack_require__(461); + + var _json2 = _interopRequireDefault(_json); + + var _pathIsAbsolute = __webpack_require__(595); + + var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute); + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + var _fs = __webpack_require__(115); + + var _fs2 = _interopRequireDefault(_fs); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var existsCache = {}; + var jsonCache = {}; + + var BABELIGNORE_FILENAME = ".babelignore"; + var BABELRC_FILENAME = ".babelrc"; + var PACKAGE_FILENAME = "package.json"; + + function exists(filename) { + var cached = existsCache[filename]; + if (cached == null) { + return existsCache[filename] = _fs2.default.existsSync(filename); + } else { + return cached; + } + } + + function buildConfigChain() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var log = arguments[1]; + + var filename = opts.filename; + var builder = new ConfigChainBuilder(log); + + if (opts.babelrc !== false) { + builder.findConfigs(filename); + } + + builder.mergeConfig({ + options: opts, + alias: "base", + dirname: filename && _path2.default.dirname(filename) + }); + + return builder.configs; + } + + var ConfigChainBuilder = function () { + function ConfigChainBuilder(log) { + (0, _classCallCheck3.default)(this, ConfigChainBuilder); + + this.resolvedConfigs = []; + this.configs = []; + this.log = log; + } + + ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) { + if (!loc) return; + + if (!(0, _pathIsAbsolute2.default)(loc)) { + loc = _path2.default.join(process.cwd(), loc); + } + + var foundConfig = false; + var foundIgnore = false; + + while (loc !== (loc = _path2.default.dirname(loc))) { + if (!foundConfig) { + var configLoc = _path2.default.join(loc, BABELRC_FILENAME); + if (exists(configLoc)) { + this.addConfig(configLoc); + foundConfig = true; + } + + var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME); + if (!foundConfig && exists(pkgLoc)) { + foundConfig = this.addConfig(pkgLoc, "babel", JSON); + } + } + + if (!foundIgnore) { + var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME); + if (exists(ignoreLoc)) { + this.addIgnoreConfig(ignoreLoc); + foundIgnore = true; + } + } + + if (foundIgnore && foundConfig) return; + } + }; + + ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) { + var file = _fs2.default.readFileSync(loc, "utf8"); + var lines = file.split("\n"); + + lines = lines.map(function (line) { + return line.replace(/#(.*?)$/, "").trim(); + }).filter(function (line) { + return !!line; + }); + + if (lines.length) { + this.mergeConfig({ + options: { ignore: lines }, + alias: loc, + dirname: _path2.default.dirname(loc) + }); + } + }; + + ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) { + var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default; + + if (this.resolvedConfigs.indexOf(loc) >= 0) { + return false; + } + + this.resolvedConfigs.push(loc); + + var content = _fs2.default.readFileSync(loc, "utf8"); + var options = void 0; + + try { + options = jsonCache[content] = jsonCache[content] || json.parse(content); + if (key) options = options[key]; + } catch (err) { + err.message = loc + ": Error while parsing JSON - " + err.message; + throw err; + } + + this.mergeConfig({ + options: options, + alias: loc, + dirname: _path2.default.dirname(loc) + }); + + return !!options; + }; + + ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) { + var options = _ref.options, + alias = _ref.alias, + loc = _ref.loc, + dirname = _ref.dirname; + + if (!options) { + return false; + } + + options = (0, _assign2.default)({}, options); + + dirname = dirname || process.cwd(); + loc = loc || alias; + + if (options.extends) { + var extendsLoc = (0, _resolve2.default)(options.extends, dirname); + if (extendsLoc) { + this.addConfig(extendsLoc); + } else { + if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias); + } + delete options.extends; + } + + this.configs.push({ + options: options, + alias: alias, + loc: loc, + dirname: dirname + }); + + var envOpts = void 0; + var envKey = process.env.BABEL_ENV || ("production") || "development"; + if (options.env) { + envOpts = options.env[envKey]; + delete options.env; + } + + this.mergeConfig({ + options: envOpts, + alias: alias + ".env." + envKey, + dirname: dirname + }); + }; + + return ConfigChainBuilder; + }(); + + module.exports = exports["default"]; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.config = undefined; + exports.normaliseOptions = normaliseOptions; + + var _parsers = __webpack_require__(52); + + var parsers = _interopRequireWildcard(_parsers); + + var _config = __webpack_require__(32); + + var _config2 = _interopRequireDefault(_config); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + exports.config = _config2.default; + function normaliseOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + for (var key in options) { + var val = options[key]; + if (val == null) continue; + + var opt = _config2.default[key]; + if (opt && opt.alias) opt = _config2.default[opt.alias]; + if (!opt) continue; + + var parser = parsers[opt.type]; + if (parser) val = parser(val); + + options[key] = val; + } + + return options; + } + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.filename = undefined; + exports.boolean = boolean; + exports.booleanString = booleanString; + exports.list = list; + + var _slash = __webpack_require__(280); + + var _slash2 = _interopRequireDefault(_slash); + + var _util = __webpack_require__(121); + + var util = _interopRequireWildcard(_util); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var filename = exports.filename = _slash2.default; + + function boolean(val) { + return !!val; + } + + function booleanString(val) { + return util.booleanify(val); + } + + function list(val) { + return util.list(val); + } + +/***/ }), +/* 53 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = { + "auxiliaryComment": { + "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`" + }, + "blacklist": { + "message": "Put the specific transforms you want in the `plugins` option" + }, + "breakConfig": { + "message": "This is not a necessary option in Babel 6" + }, + "experimental": { + "message": "Put the specific transforms you want in the `plugins` option" + }, + "externalHelpers": { + "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/" + }, + "extra": { + "message": "" + }, + "jsxPragma": { + "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/" + }, + + "loose": { + "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option." + }, + "metadataUsedHelpers": { + "message": "Not required anymore as this is enabled by default" + }, + "modules": { + "message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules" + }, + "nonStandard": { + "message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/" + }, + "optional": { + "message": "Put the specific transforms you want in the `plugins` option" + }, + "sourceMapName": { + "message": "Use the `sourceMapTarget` option" + }, + "stage": { + "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets" + }, + "whitelist": { + "message": "Put the specific transforms you want in the `plugins` option" + } + }; + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // optional / simple context binding + var aFunction = __webpack_require__(414); + module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: + return function (a) { + return fn.call(that, a); + }; + case 2: + return function (a, b) { + return fn.call(that, a, b); + }; + case 3: + return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function () /* ...args */{ + return fn.apply(that, arguments); + }; + }; + +/***/ }), +/* 55 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = {}; + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var META = __webpack_require__(95)('meta'), + isObject = __webpack_require__(22), + has = __webpack_require__(27), + setDesc = __webpack_require__(23).f, + id = 0; + var isExtensible = Object.isExtensible || function () { + return true; + }; + var FREEZE = !__webpack_require__(36)(function () { + return isExtensible(Object.preventExtensions({})); }); -}; - -module.exports.sync = function (pth) { - var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync; - - try { - fn(pth); - return true; - } catch (err) { - return false; - } -}; - -},{"1":1}],535:[function(_dereq_,module,exports){ -(function (process){ -'use strict'; - -function posix(path) { - return path.charAt(0) === '/'; -}; - -function win32(path) { - // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path); - var device = result[1] || ''; - var isUnc = !!device && device.charAt(1) !== ':'; - - // UNC paths are always absolute - return !!result[2] || isUnc; -}; - -module.exports = process.platform === 'win32' ? win32 : posix; -module.exports.posix = posix; -module.exports.win32 = win32; - -}).call(this,_dereq_(10)) -},{"10":10}],536:[function(_dereq_,module,exports){ -"use strict"; - -var originalObject = Object; -var originalDefProp = Object.defineProperty; -var originalCreate = Object.create; - -function defProp(obj, name, value) { - if (originalDefProp) try { - originalDefProp.call(originalObject, obj, name, { value: value }); - } catch (definePropertyIsBrokenInIE8) { - obj[name] = value; - } else { - obj[name] = value; - } -} - -// For functions that will be invoked using .call or .apply, we need to -// define those methods on the function objects themselves, rather than -// inheriting them from Function.prototype, so that a malicious or clumsy -// third party cannot interfere with the functionality of this module by -// redefining Function.prototype.call or .apply. -function makeSafeToCall(fun) { - if (fun) { - defProp(fun, "call", fun.call); - defProp(fun, "apply", fun.apply); - } - return fun; -} - -makeSafeToCall(originalDefProp); -makeSafeToCall(originalCreate); - -var hasOwn = makeSafeToCall(Object.prototype.hasOwnProperty); -var numToStr = makeSafeToCall(Number.prototype.toString); -var strSlice = makeSafeToCall(String.prototype.slice); - -var cloner = function(){}; -function create(prototype) { - if (originalCreate) { - return originalCreate.call(originalObject, prototype); - } - cloner.prototype = prototype || null; - return new cloner; -} - -var rand = Math.random; -var uniqueKeys = create(null); - -function makeUniqueKey() { - // Collisions are highly unlikely, but this module is in the business of - // making guarantees rather than safe bets. - do var uniqueKey = internString(strSlice.call(numToStr.call(rand(), 36), 2)); - while (hasOwn.call(uniqueKeys, uniqueKey)); - return uniqueKeys[uniqueKey] = uniqueKey; -} - -function internString(str) { - var obj = {}; - obj[str] = true; - return Object.keys(obj)[0]; -} - -// External users might find this function useful, but it is not necessary -// for the typical use of this module. -defProp(exports, "makeUniqueKey", makeUniqueKey); - -// Object.getOwnPropertyNames is the only way to enumerate non-enumerable -// properties, so if we wrap it to ignore our secret keys, there should be -// no way (except guessing) to access those properties. -var originalGetOPNs = Object.getOwnPropertyNames; -Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - for (var names = originalGetOPNs(object), - src = 0, - dst = 0, - len = names.length; - src < len; - ++src) { - if (!hasOwn.call(uniqueKeys, names[src])) { - if (src > dst) { - names[dst] = names[src]; - } - ++dst; - } - } - names.length = dst; - return names; -}; - -function defaultCreatorFn(object) { - return create(null); -} - -function makeAccessor(secretCreatorFn) { - var brand = makeUniqueKey(); - var passkey = create(null); - - secretCreatorFn = secretCreatorFn || defaultCreatorFn; - - function register(object) { - var secret; // Created lazily. - - function vault(key, forget) { - // Only code that has access to the passkey can retrieve (or forget) - // the secret object. - if (key === passkey) { - return forget - ? secret = null - : secret || (secret = secretCreatorFn(object)); - } - } - - defProp(object, brand, vault); - } - - function accessor(object) { - if (!hasOwn.call(object, brand)) - register(object); - return object[brand](passkey); - } - - accessor.forget = function(object) { - if (hasOwn.call(object, brand)) - object[brand](passkey, true); - }; - - return accessor; -} - -defProp(exports, "makeAccessor", makeAccessor); - -},{}],537:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var types = _dereq_(568).types; -var isArray = types.builtInTypes.array; -var b = types.builders; -var n = types.namedTypes; -var leap = _dereq_(539); -var meta = _dereq_(540); -var util = _dereq_(541); -var runtimeProperty = util.runtimeProperty; -var hasOwn = Object.prototype.hasOwnProperty; - -function Emitter(contextId) { - assert.ok(this instanceof Emitter); - n.Identifier.assert(contextId); - - // Used to generate unique temporary names. - this.nextTempId = 0; - - Object.defineProperties(this, { - // In order to make sure the context object does not collide with - // anything in the local scope, we might have to rename it, so we - // refer to it symbolically instead of just assuming that it will be - // called "context". - contextId: { value: contextId }, - - // An append-only list of Statements that grows each time this.emit is - // called. - listing: { value: [] }, - - // A sparse array whose keys correspond to locations in this.listing - // that have been marked as branch/jump targets. - marked: { value: [true] }, - - // The last location will be marked when this.getDispatchLoop is - // called. - finalLoc: { value: loc() }, - - // A list of all leap.TryEntry statements emitted. - tryEntries: { value: [] } - }); - - // The .leapManager property needs to be defined by a separate - // defineProperties call so that .finalLoc will be visible to the - // leap.LeapManager constructor. - Object.defineProperties(this, { - // Each time we evaluate the body of a loop, we tell this.leapManager - // to enter a nested loop context that determines the meaning of break - // and continue statements therein. - leapManager: { value: new leap.LeapManager(this) } - }); -} - -var Ep = Emitter.prototype; -exports.Emitter = Emitter; - -// Offsets into this.listing that could be used as targets for branches or -// jumps are represented as numeric Literal nodes. This representation has -// the amazingly convenient benefit of allowing the exact value of the -// location to be determined at any time, even after generating code that -// refers to the location. -function loc() { - return b.literal(-1); -} - -// Sets the exact value of the given location to the offset of the next -// Statement emitted. -Ep.mark = function(loc) { - n.Literal.assert(loc); - var index = this.listing.length; - if (loc.value === -1) { - loc.value = index; - } else { - // Locations can be marked redundantly, but their values cannot change - // once set the first time. - assert.strictEqual(loc.value, index); - } - this.marked[index] = true; - return loc; -}; - -Ep.emit = function(node) { - if (n.Expression.check(node)) - node = b.expressionStatement(node); - n.Statement.assert(node); - this.listing.push(node); -}; - -// Shorthand for emitting assignment statements. This will come in handy -// for assignments to temporary variables. -Ep.emitAssign = function(lhs, rhs) { - this.emit(this.assign(lhs, rhs)); - return lhs; -}; - -// Shorthand for an assignment statement. -Ep.assign = function(lhs, rhs) { - return b.expressionStatement( - b.assignmentExpression("=", lhs, rhs)); -}; - -// Convenience function for generating expressions like context.next, -// context.sent, and context.rval. -Ep.contextProperty = function(name, computed) { - return b.memberExpression( - this.contextId, - computed ? b.literal(name) : b.identifier(name), - !!computed - ); -}; - -// Shorthand for setting context.rval and jumping to `context.stop()`. -Ep.stop = function(rval) { - if (rval) { - this.setReturnValue(rval); - } - - this.jump(this.finalLoc); -}; - -Ep.setReturnValue = function(valuePath) { - n.Expression.assert(valuePath.value); - - this.emitAssign( - this.contextProperty("rval"), - this.explodeExpression(valuePath) - ); -}; - -Ep.clearPendingException = function(tryLoc, assignee) { - n.Literal.assert(tryLoc); - - var catchCall = b.callExpression( - this.contextProperty("catch", true), - [tryLoc] - ); - - if (assignee) { - this.emitAssign(assignee, catchCall); - } else { - this.emit(catchCall); - } -}; - -// Emits code for an unconditional jump to the given location, even if the -// exact value of the location is not yet known. -Ep.jump = function(toLoc) { - this.emitAssign(this.contextProperty("next"), toLoc); - this.emit(b.breakStatement()); -}; - -// Conditional jump. -Ep.jumpIf = function(test, toLoc) { - n.Expression.assert(test); - n.Literal.assert(toLoc); - - this.emit(b.ifStatement( - test, - b.blockStatement([ - this.assign(this.contextProperty("next"), toLoc), - b.breakStatement() - ]) - )); -}; - -// Conditional jump, with the condition negated. -Ep.jumpIfNot = function(test, toLoc) { - n.Expression.assert(test); - n.Literal.assert(toLoc); - - var negatedTest; - if (n.UnaryExpression.check(test) && - test.operator === "!") { - // Avoid double negation. - negatedTest = test.argument; - } else { - negatedTest = b.unaryExpression("!", test); - } - - this.emit(b.ifStatement( - negatedTest, - b.blockStatement([ - this.assign(this.contextProperty("next"), toLoc), - b.breakStatement() - ]) - )); -}; - -// Returns a unique MemberExpression that can be used to store and -// retrieve temporary values. Since the object of the member expression is -// the context object, which is presumed to coexist peacefully with all -// other local variables, and since we just increment `nextTempId` -// monotonically, uniqueness is assured. -Ep.makeTempVar = function() { - return this.contextProperty("t" + this.nextTempId++); -}; - -Ep.getContextFunction = function(id) { - return b.functionExpression( - id || null/*Anonymous*/, - [this.contextId], - b.blockStatement([this.getDispatchLoop()]), - false, // Not a generator anymore! - false // Nor an expression. - ); -}; - -// Turns this.listing into a loop of the form -// -// while (1) switch (context.next) { -// case 0: -// ... -// case n: -// return context.stop(); -// } -// -// Each marked location in this.listing will correspond to one generated -// case statement. -Ep.getDispatchLoop = function() { - var self = this; - var cases = []; - var current; - - // If we encounter a break, continue, or return statement in a switch - // case, we can skip the rest of the statements until the next case. - var alreadyEnded = false; - - self.listing.forEach(function(stmt, i) { - if (self.marked.hasOwnProperty(i)) { - cases.push(b.switchCase( - b.literal(i), - current = [])); - alreadyEnded = false; - } - - if (!alreadyEnded) { - current.push(stmt); - if (isSwitchCaseEnder(stmt)) - alreadyEnded = true; - } - }); - - // Now that we know how many statements there will be in this.listing, - // we can finally resolve this.finalLoc.value. - this.finalLoc.value = this.listing.length; - - cases.push( - b.switchCase(this.finalLoc, [ - // Intentionally fall through to the "end" case... - ]), - - // So that the runtime can jump to the final location without having - // to know its offset, we provide the "end" case as a synonym. - b.switchCase(b.literal("end"), [ - // This will check/clear both context.thrown and context.rval. - b.returnStatement( - b.callExpression(this.contextProperty("stop"), []) - ) - ]) - ); - - return b.whileStatement( - b.literal(1), - b.switchStatement( - b.assignmentExpression( - "=", - this.contextProperty("prev"), - this.contextProperty("next") - ), - cases - ) - ); -}; - -// See comment above re: alreadyEnded. -function isSwitchCaseEnder(stmt) { - return n.BreakStatement.check(stmt) - || n.ContinueStatement.check(stmt) - || n.ReturnStatement.check(stmt) - || n.ThrowStatement.check(stmt); -} - -Ep.getTryLocsList = function() { - if (this.tryEntries.length === 0) { - // To avoid adding a needless [] to the majority of runtime.wrap - // argument lists, force the caller to handle this case specially. - return null; - } - - var lastLocValue = 0; - - return b.arrayExpression( - this.tryEntries.map(function(tryEntry) { - var thisLocValue = tryEntry.firstLoc.value; - assert.ok(thisLocValue >= lastLocValue, "try entries out of order"); - lastLocValue = thisLocValue; - - var ce = tryEntry.catchEntry; - var fe = tryEntry.finallyEntry; - - var locs = [ - tryEntry.firstLoc, - // The null here makes a hole in the array. - ce ? ce.firstLoc : null - ]; - - if (fe) { - locs[2] = fe.firstLoc; - locs[3] = fe.afterLoc; - } - - return b.arrayExpression(locs); - }) - ); -}; - -// All side effects must be realized in order. - -// If any subexpression harbors a leap, all subexpressions must be -// neutered of side effects. - -// No destructive modification of AST nodes. - -Ep.explode = function(path, ignoreResult) { - assert.ok(path instanceof types.NodePath); - - var node = path.value; - var self = this; - - n.Node.assert(node); - - if (n.Statement.check(node)) - return self.explodeStatement(path); - - if (n.Expression.check(node)) - return self.explodeExpression(path, ignoreResult); - - if (n.Declaration.check(node)) - throw getDeclError(node); - - switch (node.type) { - case "Program": - return path.get("body").map( - self.explodeStatement, - self - ); - - case "VariableDeclarator": - throw getDeclError(node); - - // These node types should be handled by their parent nodes - // (ObjectExpression, SwitchStatement, and TryStatement, respectively). - case "Property": - case "SwitchCase": - case "CatchClause": - throw new Error( - node.type + " nodes should be handled by their parents"); - - default: - throw new Error( - "unknown Node of type " + - JSON.stringify(node.type)); - } -}; - -function getDeclError(node) { - return new Error( - "all declarations should have been transformed into " + - "assignments before the Exploder began its work: " + - JSON.stringify(node)); -} - -Ep.explodeStatement = function(path, labelId) { - assert.ok(path instanceof types.NodePath); - - var stmt = path.value; - var self = this; - - n.Statement.assert(stmt); - - if (labelId) { - n.Identifier.assert(labelId); - } else { - labelId = null; - } - - // Explode BlockStatement nodes even if they do not contain a yield, - // because we don't want or need the curly braces. - if (n.BlockStatement.check(stmt)) { - return path.get("body").each( - self.explodeStatement, - self - ); - } - - if (!meta.containsLeap(stmt)) { - // Technically we should be able to avoid emitting the statement - // altogether if !meta.hasSideEffects(stmt), but that leads to - // confusing generated code (for instance, `while (true) {}` just - // disappears) and is probably a more appropriate job for a dedicated - // dead code elimination pass. - self.emit(stmt); - return; - } - - switch (stmt.type) { - case "ExpressionStatement": - self.explodeExpression(path.get("expression"), true); - break; - - case "LabeledStatement": - var after = loc(); - - // Did you know you can break from any labeled block statement or - // control structure? Well, you can! Note: when a labeled loop is - // encountered, the leap.LabeledEntry created here will immediately - // enclose a leap.LoopEntry on the leap manager's stack, and both - // entries will have the same label. Though this works just fine, it - // may seem a bit redundant. In theory, we could check here to - // determine if stmt knows how to handle its own label; for example, - // stmt happens to be a WhileStatement and so we know it's going to - // establish its own LoopEntry when we explode it (below). Then this - // LabeledEntry would be unnecessary. Alternatively, we might be - // tempted not to pass stmt.label down into self.explodeStatement, - // because we've handled the label here, but that's a mistake because - // labeled loops may contain labeled continue statements, which is not - // something we can handle in this generic case. All in all, I think a - // little redundancy greatly simplifies the logic of this case, since - // it's clear that we handle all possible LabeledStatements correctly - // here, regardless of whether they interact with the leap manager - // themselves. Also remember that labels and break/continue-to-label - // statements are rare, and all of this logic happens at transform - // time, so it has no additional runtime cost. - self.leapManager.withEntry( - new leap.LabeledEntry(after, stmt.label), - function() { - self.explodeStatement(path.get("body"), stmt.label); - } - ); - - self.mark(after); - - break; - - case "WhileStatement": - var before = loc(); - var after = loc(); - - self.mark(before); - self.jumpIfNot(self.explodeExpression(path.get("test")), after); - self.leapManager.withEntry( - new leap.LoopEntry(after, before, labelId), - function() { self.explodeStatement(path.get("body")); } - ); - self.jump(before); - self.mark(after); - - break; - - case "DoWhileStatement": - var first = loc(); - var test = loc(); - var after = loc(); - - self.mark(first); - self.leapManager.withEntry( - new leap.LoopEntry(after, test, labelId), - function() { self.explode(path.get("body")); } - ); - self.mark(test); - self.jumpIf(self.explodeExpression(path.get("test")), first); - self.mark(after); - - break; - - case "ForStatement": - var head = loc(); - var update = loc(); - var after = loc(); - - if (stmt.init) { - // We pass true here to indicate that if stmt.init is an expression - // then we do not care about its result. - self.explode(path.get("init"), true); - } - - self.mark(head); - - if (stmt.test) { - self.jumpIfNot(self.explodeExpression(path.get("test")), after); - } else { - // No test means continue unconditionally. - } - - self.leapManager.withEntry( - new leap.LoopEntry(after, update, labelId), - function() { self.explodeStatement(path.get("body")); } - ); - - self.mark(update); - - if (stmt.update) { - // We pass true here to indicate that if stmt.update is an - // expression then we do not care about its result. - self.explode(path.get("update"), true); - } - - self.jump(head); - - self.mark(after); - - break; - - case "ForInStatement": - var head = loc(); - var after = loc(); - - var keyIterNextFn = self.makeTempVar(); - self.emitAssign( - keyIterNextFn, - b.callExpression( - runtimeProperty("keys"), - [self.explodeExpression(path.get("right"))] - ) - ); - - self.mark(head); - - var keyInfoTmpVar = self.makeTempVar(); - self.jumpIf( - b.memberExpression( - b.assignmentExpression( - "=", - keyInfoTmpVar, - b.callExpression(keyIterNextFn, []) - ), - b.identifier("done"), - false - ), - after - ); - - self.emitAssign( - stmt.left, - b.memberExpression( - keyInfoTmpVar, - b.identifier("value"), - false - ) - ); - - self.leapManager.withEntry( - new leap.LoopEntry(after, head, labelId), - function() { self.explodeStatement(path.get("body")); } - ); - - self.jump(head); - - self.mark(after); - - break; - - case "BreakStatement": - self.emitAbruptCompletion({ - type: "break", - target: self.leapManager.getBreakLoc(stmt.label) - }); - - break; - - case "ContinueStatement": - self.emitAbruptCompletion({ - type: "continue", - target: self.leapManager.getContinueLoc(stmt.label) - }); - - break; - - case "SwitchStatement": - // Always save the discriminant into a temporary variable in case the - // test expressions overwrite values like context.sent. - var disc = self.emitAssign( - self.makeTempVar(), - self.explodeExpression(path.get("discriminant")) - ); - - var after = loc(); - var defaultLoc = loc(); - var condition = defaultLoc; - var caseLocs = []; - - // If there are no cases, .cases might be undefined. - var cases = stmt.cases || []; - - for (var i = cases.length - 1; i >= 0; --i) { - var c = cases[i]; - n.SwitchCase.assert(c); - - if (c.test) { - condition = b.conditionalExpression( - b.binaryExpression("===", disc, c.test), - caseLocs[i] = loc(), - condition - ); - } else { - caseLocs[i] = defaultLoc; - } - } - - self.jump(self.explodeExpression( - new types.NodePath(condition, path, "discriminant") - )); - - self.leapManager.withEntry( - new leap.SwitchEntry(after), - function() { - path.get("cases").each(function(casePath) { - var c = casePath.value; - var i = casePath.name; - - self.mark(caseLocs[i]); - - casePath.get("consequent").each( - self.explodeStatement, - self - ); - }); - } - ); - - self.mark(after); - if (defaultLoc.value === -1) { - self.mark(defaultLoc); - assert.strictEqual(after.value, defaultLoc.value); - } - - break; - - case "IfStatement": - var elseLoc = stmt.alternate && loc(); - var after = loc(); - - self.jumpIfNot( - self.explodeExpression(path.get("test")), - elseLoc || after - ); - - self.explodeStatement(path.get("consequent")); - - if (elseLoc) { - self.jump(after); - self.mark(elseLoc); - self.explodeStatement(path.get("alternate")); - } - - self.mark(after); - - break; - - case "ReturnStatement": - self.emitAbruptCompletion({ - type: "return", - value: self.explodeExpression(path.get("argument")) - }); - - break; - - case "WithStatement": - throw new Error( - node.type + " not supported in generator functions."); - - case "TryStatement": - var after = loc(); - - var handler = stmt.handler; - if (!handler && stmt.handlers) { - handler = stmt.handlers[0] || null; - } - - var catchLoc = handler && loc(); - var catchEntry = catchLoc && new leap.CatchEntry( - catchLoc, - handler.param - ); - - var finallyLoc = stmt.finalizer && loc(); - var finallyEntry = finallyLoc && - new leap.FinallyEntry(finallyLoc, after); - - var tryEntry = new leap.TryEntry( - self.getUnmarkedCurrentLoc(), - catchEntry, - finallyEntry - ); - - self.tryEntries.push(tryEntry); - self.updateContextPrevLoc(tryEntry.firstLoc); - - self.leapManager.withEntry(tryEntry, function() { - self.explodeStatement(path.get("block")); - - if (catchLoc) { - if (finallyLoc) { - // If we have both a catch block and a finally block, then - // because we emit the catch block first, we need to jump over - // it to the finally block. - self.jump(finallyLoc); - - } else { - // If there is no finally block, then we need to jump over the - // catch block to the fall-through location. - self.jump(after); - } - - self.updateContextPrevLoc(self.mark(catchLoc)); - - var bodyPath = path.get("handler", "body"); - var safeParam = self.makeTempVar(); - self.clearPendingException(tryEntry.firstLoc, safeParam); - - var catchScope = bodyPath.scope; - var catchParamName = handler.param.name; - n.CatchClause.assert(catchScope.node); - assert.strictEqual(catchScope.lookup(catchParamName), catchScope); - - types.visit(bodyPath, { - visitIdentifier: function(path) { - if (util.isReference(path, catchParamName) && - path.scope.lookup(catchParamName) === catchScope) { - return safeParam; - } - - this.traverse(path); - }, - - visitFunction: function(path) { - if (path.scope.declares(catchParamName)) { - // Don't descend into nested scopes that shadow the catch - // parameter with their own declarations. This isn't - // logically necessary because of the path.scope.lookup we - // do in visitIdentifier, but it saves time. - return false; - } - - this.traverse(path); - } - }); - - self.leapManager.withEntry(catchEntry, function() { - self.explodeStatement(bodyPath); - }); - } - - if (finallyLoc) { - self.updateContextPrevLoc(self.mark(finallyLoc)); - - self.leapManager.withEntry(finallyEntry, function() { - self.explodeStatement(path.get("finalizer")); - }); - - self.emit(b.returnStatement(b.callExpression( - self.contextProperty("finish"), - [finallyEntry.firstLoc] - ))); - } - }); - - self.mark(after); - - break; - - case "ThrowStatement": - self.emit(b.throwStatement( - self.explodeExpression(path.get("argument")) - )); - - break; - - default: - throw new Error( - "unknown Statement of type " + - JSON.stringify(stmt.type)); - } -}; - -Ep.emitAbruptCompletion = function(record) { - if (!isValidCompletion(record)) { - assert.ok( - false, - "invalid completion record: " + - JSON.stringify(record) - ); - } - - assert.notStrictEqual( - record.type, "normal", - "normal completions are not abrupt" - ); - - var abruptArgs = [b.literal(record.type)]; - - if (record.type === "break" || - record.type === "continue") { - n.Literal.assert(record.target); - abruptArgs[1] = record.target; - } else if (record.type === "return" || - record.type === "throw") { - if (record.value) { - n.Expression.assert(record.value); - abruptArgs[1] = record.value; - } - } - - this.emit( - b.returnStatement( - b.callExpression( - this.contextProperty("abrupt"), - abruptArgs - ) - ) - ); -}; - -function isValidCompletion(record) { - var type = record.type; - - if (type === "normal") { - return !hasOwn.call(record, "target"); - } - - if (type === "break" || - type === "continue") { - return !hasOwn.call(record, "value") - && n.Literal.check(record.target); - } - - if (type === "return" || - type === "throw") { - return hasOwn.call(record, "value") - && !hasOwn.call(record, "target"); - } - - return false; -} - - -// Not all offsets into emitter.listing are potential jump targets. For -// example, execution typically falls into the beginning of a try block -// without jumping directly there. This method returns the current offset -// without marking it, so that a switch case will not necessarily be -// generated for this offset (I say "not necessarily" because the same -// location might end up being marked in the process of emitting other -// statements). There's no logical harm in marking such locations as jump -// targets, but minimizing the number of switch cases keeps the generated -// code shorter. -Ep.getUnmarkedCurrentLoc = function() { - return b.literal(this.listing.length); -}; - -// The context.prev property takes the value of context.next whenever we -// evaluate the switch statement discriminant, which is generally good -// enough for tracking the last location we jumped to, but sometimes -// context.prev needs to be more precise, such as when we fall -// successfully out of a try block and into a finally block without -// jumping. This method exists to update context.prev to the freshest -// available location. If we were implementing a full interpreter, we -// would know the location of the current instruction with complete -// precision at all times, but we don't have that luxury here, as it would -// be costly and verbose to set context.prev before every statement. -Ep.updateContextPrevLoc = function(loc) { - if (loc) { - n.Literal.assert(loc); - - if (loc.value === -1) { - // If an uninitialized location literal was passed in, set its value - // to the current this.listing.length. - loc.value = this.listing.length; - } else { - // Otherwise assert that the location matches the current offset. - assert.strictEqual(loc.value, this.listing.length); - } - - } else { - loc = this.getUnmarkedCurrentLoc(); - } - - // Make sure context.prev is up to date in case we fell into this try - // statement without jumping to it. TODO Consider avoiding this - // assignment when we know control must have jumped here. - this.emitAssign(this.contextProperty("prev"), loc); -}; - -Ep.explodeExpression = function(path, ignoreResult) { - assert.ok(path instanceof types.NodePath); - - var expr = path.value; - if (expr) { - n.Expression.assert(expr); - } else { - return expr; - } - - var self = this; - var result; // Used optionally by several cases below. - - function finish(expr) { - n.Expression.assert(expr); - if (ignoreResult) { - self.emit(expr); - } else { - return expr; - } - } - - // If the expression does not contain a leap, then we either emit the - // expression as a standalone statement or return it whole. - if (!meta.containsLeap(expr)) { - return finish(expr); - } - - // If any child contains a leap (such as a yield or labeled continue or - // break statement), then any sibling subexpressions will almost - // certainly have to be exploded in order to maintain the order of their - // side effects relative to the leaping child(ren). - var hasLeapingChildren = meta.containsLeap.onlyChildren(expr); - - // In order to save the rest of explodeExpression from a combinatorial - // trainwreck of special cases, explodeViaTempVar is responsible for - // deciding when a subexpression needs to be "exploded," which is my - // very technical term for emitting the subexpression as an assignment - // to a temporary variable and the substituting the temporary variable - // for the original subexpression. Think of exploded view diagrams, not - // Michael Bay movies. The point of exploding subexpressions is to - // control the precise order in which the generated code realizes the - // side effects of those subexpressions. - function explodeViaTempVar(tempVar, childPath, ignoreChildResult) { - assert.ok(childPath instanceof types.NodePath); - - assert.ok( - !ignoreChildResult || !tempVar, - "Ignoring the result of a child expression but forcing it to " + - "be assigned to a temporary variable?" - ); - - var result = self.explodeExpression(childPath, ignoreChildResult); - - if (ignoreChildResult) { - // Side effects already emitted above. - - } else if (tempVar || (hasLeapingChildren && - !n.Literal.check(result))) { - // If tempVar was provided, then the result will always be assigned - // to it, even if the result does not otherwise need to be assigned - // to a temporary variable. When no tempVar is provided, we have - // the flexibility to decide whether a temporary variable is really - // necessary. Unfortunately, in general, a temporary variable is - // required whenever any child contains a yield expression, since it - // is difficult to prove (at all, let alone efficiently) whether - // this result would evaluate to the same value before and after the - // yield (see #206). One narrow case where we can prove it doesn't - // matter (and thus we do not need a temporary variable) is when the - // result in question is a Literal value. - result = self.emitAssign( - tempVar || self.makeTempVar(), - result - ); - } - return result; - } - - // If ignoreResult is true, then we must take full responsibility for - // emitting the expression with all its side effects, and we should not - // return a result. - - switch (expr.type) { - case "MemberExpression": - return finish(b.memberExpression( - self.explodeExpression(path.get("object")), - expr.computed - ? explodeViaTempVar(null, path.get("property")) - : expr.property, - expr.computed - )); - - case "CallExpression": - var calleePath = path.get("callee"); - var argsPath = path.get("arguments"); - - var newCallee; - var newArgs = []; - - var hasLeapingArgs = false; - argsPath.each(function(argPath) { - hasLeapingArgs = hasLeapingArgs || - meta.containsLeap(argPath.value); - }); - - if (n.MemberExpression.check(calleePath.value)) { - if (hasLeapingArgs) { - // If the arguments of the CallExpression contained any yield - // expressions, then we need to be sure to evaluate the callee - // before evaluating the arguments, but if the callee was a member - // expression, then we must be careful that the object of the - // member expression still gets bound to `this` for the call. - - var newObject = explodeViaTempVar( - // Assign the exploded callee.object expression to a temporary - // variable so that we can use it twice without reevaluating it. - self.makeTempVar(), - calleePath.get("object") - ); - - var newProperty = calleePath.value.computed - ? explodeViaTempVar(null, calleePath.get("property")) - : calleePath.value.property; - - newArgs.unshift(newObject); - - newCallee = b.memberExpression( - b.memberExpression( - newObject, - newProperty, - calleePath.value.computed - ), - b.identifier("call"), - false - ); - - } else { - newCallee = self.explodeExpression(calleePath); - } - - } else { - newCallee = self.explodeExpression(calleePath); - - if (n.MemberExpression.check(newCallee)) { - // If the callee was not previously a MemberExpression, then the - // CallExpression was "unqualified," meaning its `this` object - // should be the global object. If the exploded expression has - // become a MemberExpression (e.g. a context property, probably a - // temporary variable), then we need to force it to be unqualified - // by using the (0, object.property)(...) trick; otherwise, it - // will receive the object of the MemberExpression as its `this` - // object. - newCallee = b.sequenceExpression([ - b.literal(0), - newCallee - ]); - } - } - - argsPath.each(function(argPath) { - newArgs.push(explodeViaTempVar(null, argPath)); - }); - - return finish(b.callExpression( - newCallee, - newArgs - )); - - case "NewExpression": - return finish(b.newExpression( - explodeViaTempVar(null, path.get("callee")), - path.get("arguments").map(function(argPath) { - return explodeViaTempVar(null, argPath); - }) - )); - - case "ObjectExpression": - return finish(b.objectExpression( - path.get("properties").map(function(propPath) { - return b.property( - propPath.value.kind, - propPath.value.key, - explodeViaTempVar(null, propPath.get("value")) - ); - }) - )); - - case "ArrayExpression": - return finish(b.arrayExpression( - path.get("elements").map(function(elemPath) { - return explodeViaTempVar(null, elemPath); - }) - )); - - case "SequenceExpression": - var lastIndex = expr.expressions.length - 1; - - path.get("expressions").each(function(exprPath) { - if (exprPath.name === lastIndex) { - result = self.explodeExpression(exprPath, ignoreResult); - } else { - self.explodeExpression(exprPath, true); - } - }); - - return result; - - case "LogicalExpression": - var after = loc(); - - if (!ignoreResult) { - result = self.makeTempVar(); - } - - var left = explodeViaTempVar(result, path.get("left")); - - if (expr.operator === "&&") { - self.jumpIfNot(left, after); - } else { - assert.strictEqual(expr.operator, "||"); - self.jumpIf(left, after); - } - - explodeViaTempVar(result, path.get("right"), ignoreResult); - - self.mark(after); - - return result; - - case "ConditionalExpression": - var elseLoc = loc(); - var after = loc(); - var test = self.explodeExpression(path.get("test")); - - self.jumpIfNot(test, elseLoc); - - if (!ignoreResult) { - result = self.makeTempVar(); - } - - explodeViaTempVar(result, path.get("consequent"), ignoreResult); - self.jump(after); - - self.mark(elseLoc); - explodeViaTempVar(result, path.get("alternate"), ignoreResult); - - self.mark(after); - - return result; - - case "UnaryExpression": - return finish(b.unaryExpression( - expr.operator, - // Can't (and don't need to) break up the syntax of the argument. - // Think about delete a[b]. - self.explodeExpression(path.get("argument")), - !!expr.prefix - )); - - case "BinaryExpression": - return finish(b.binaryExpression( - expr.operator, - explodeViaTempVar(null, path.get("left")), - explodeViaTempVar(null, path.get("right")) - )); - - case "AssignmentExpression": - return finish(b.assignmentExpression( - expr.operator, - self.explodeExpression(path.get("left")), - self.explodeExpression(path.get("right")) - )); - - case "UpdateExpression": - return finish(b.updateExpression( - expr.operator, - self.explodeExpression(path.get("argument")), - expr.prefix - )); - - case "YieldExpression": - var after = loc(); - var arg = expr.argument && self.explodeExpression(path.get("argument")); - - if (arg && expr.delegate) { - var result = self.makeTempVar(); - - self.emit(b.returnStatement(b.callExpression( - self.contextProperty("delegateYield"), [ - arg, - b.literal(result.property.name), - after - ] - ))); - - self.mark(after); - - return result; - } - - self.emitAssign(self.contextProperty("next"), after); - self.emit(b.returnStatement(arg || null)); - self.mark(after); - - return self.contextProperty("sent"); - - default: - throw new Error( - "unknown Expression of type " + - JSON.stringify(expr.type)); - } -}; - -},{"2":2,"539":539,"540":540,"541":541,"568":568}],538:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var types = _dereq_(568).types; -var n = types.namedTypes; -var b = types.builders; -var hasOwn = Object.prototype.hasOwnProperty; - -// The hoist function takes a FunctionExpression or FunctionDeclaration -// and replaces any Declaration nodes in its body with assignments, then -// returns a VariableDeclaration containing just the names of the removed -// declarations. -exports.hoist = function(funPath) { - assert.ok(funPath instanceof types.NodePath); - n.Function.assert(funPath.value); - - var vars = {}; - - function varDeclToExpr(vdec, includeIdentifiers) { - n.VariableDeclaration.assert(vdec); - var exprs = []; - - vdec.declarations.forEach(function(dec) { - vars[dec.id.name] = dec.id; - - if (dec.init) { - exprs.push(b.assignmentExpression( - "=", dec.id, dec.init - )); - } else if (includeIdentifiers) { - exprs.push(dec.id); - } - }); - - if (exprs.length === 0) - return null; - - if (exprs.length === 1) - return exprs[0]; - - return b.sequenceExpression(exprs); - } - - types.visit(funPath.get("body"), { - visitVariableDeclaration: function(path) { - var expr = varDeclToExpr(path.value, false); - if (expr === null) { - path.replace(); - } else { - // We don't need to traverse this expression any further because - // there can't be any new declarations inside an expression. - return b.expressionStatement(expr); - } - - // Since the original node has been either removed or replaced, - // avoid traversing it any further. - return false; - }, - - visitForStatement: function(path) { - var init = path.value.init; - if (n.VariableDeclaration.check(init)) { - path.get("init").replace(varDeclToExpr(init, false)); - } - this.traverse(path); - }, - - visitForInStatement: function(path) { - var left = path.value.left; - if (n.VariableDeclaration.check(left)) { - path.get("left").replace(varDeclToExpr(left, true)); - } - this.traverse(path); - }, - - visitFunctionDeclaration: function(path) { - var node = path.value; - vars[node.id.name] = node.id; - - var parentNode = path.parent.node; - var assignment = b.expressionStatement( - b.assignmentExpression( - "=", - node.id, - b.functionExpression( - node.id, - node.params, - node.body, - node.generator, - node.expression - ) - ) - ); - - if (n.BlockStatement.check(path.parent.node)) { - // Insert the assignment form before the first statement in the - // enclosing block. - path.parent.get("body").unshift(assignment); - - // Remove the function declaration now that we've inserted the - // equivalent assignment form at the beginning of the block. - path.replace(); - - } else { - // If the parent node is not a block statement, then we can just - // replace the declaration with the equivalent assignment form - // without worrying about hoisting it. - path.replace(assignment); - } - - // Don't hoist variables out of inner functions. - return false; - }, - - visitFunctionExpression: function(path) { - // Don't descend into nested function expressions. - return false; - } - }); - - var paramNames = {}; - funPath.get("params").each(function(paramPath) { - var param = paramPath.value; - if (n.Identifier.check(param)) { - paramNames[param.name] = param; - } else { - // Variables declared by destructuring parameter patterns will be - // harmlessly re-declared. - } - }); - - var declarations = []; - - Object.keys(vars).forEach(function(name) { - if (!hasOwn.call(paramNames, name)) { - declarations.push(b.variableDeclarator(vars[name], null)); - } - }); - - if (declarations.length === 0) { - return null; // Be sure to handle this case! - } - - return b.variableDeclaration("var", declarations); -}; - -},{"2":2,"568":568}],539:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var types = _dereq_(568).types; -var n = types.namedTypes; -var b = types.builders; -var inherits = _dereq_(13).inherits; -var hasOwn = Object.prototype.hasOwnProperty; - -function Entry() { - assert.ok(this instanceof Entry); -} - -function FunctionEntry(returnLoc) { - Entry.call(this); - n.Literal.assert(returnLoc); - this.returnLoc = returnLoc; -} - -inherits(FunctionEntry, Entry); -exports.FunctionEntry = FunctionEntry; - -function LoopEntry(breakLoc, continueLoc, label) { - Entry.call(this); - - n.Literal.assert(breakLoc); - n.Literal.assert(continueLoc); - - if (label) { - n.Identifier.assert(label); - } else { - label = null; - } - - this.breakLoc = breakLoc; - this.continueLoc = continueLoc; - this.label = label; -} - -inherits(LoopEntry, Entry); -exports.LoopEntry = LoopEntry; - -function SwitchEntry(breakLoc) { - Entry.call(this); - n.Literal.assert(breakLoc); - this.breakLoc = breakLoc; -} - -inherits(SwitchEntry, Entry); -exports.SwitchEntry = SwitchEntry; - -function TryEntry(firstLoc, catchEntry, finallyEntry) { - Entry.call(this); - - n.Literal.assert(firstLoc); - - if (catchEntry) { - assert.ok(catchEntry instanceof CatchEntry); - } else { - catchEntry = null; - } - - if (finallyEntry) { - assert.ok(finallyEntry instanceof FinallyEntry); - } else { - finallyEntry = null; - } - - // Have to have one or the other (or both). - assert.ok(catchEntry || finallyEntry); - - this.firstLoc = firstLoc; - this.catchEntry = catchEntry; - this.finallyEntry = finallyEntry; -} - -inherits(TryEntry, Entry); -exports.TryEntry = TryEntry; - -function CatchEntry(firstLoc, paramId) { - Entry.call(this); - - n.Literal.assert(firstLoc); - n.Identifier.assert(paramId); - - this.firstLoc = firstLoc; - this.paramId = paramId; -} - -inherits(CatchEntry, Entry); -exports.CatchEntry = CatchEntry; - -function FinallyEntry(firstLoc, afterLoc) { - Entry.call(this); - n.Literal.assert(firstLoc); - n.Literal.assert(afterLoc); - this.firstLoc = firstLoc; - this.afterLoc = afterLoc; -} - -inherits(FinallyEntry, Entry); -exports.FinallyEntry = FinallyEntry; - -function LabeledEntry(breakLoc, label) { - Entry.call(this); - - n.Literal.assert(breakLoc); - n.Identifier.assert(label); - - this.breakLoc = breakLoc; - this.label = label; -} - -inherits(LabeledEntry, Entry); -exports.LabeledEntry = LabeledEntry; - -function LeapManager(emitter) { - assert.ok(this instanceof LeapManager); - - var Emitter = _dereq_(537).Emitter; - assert.ok(emitter instanceof Emitter); - - this.emitter = emitter; - this.entryStack = [new FunctionEntry(emitter.finalLoc)]; -} - -var LMp = LeapManager.prototype; -exports.LeapManager = LeapManager; - -LMp.withEntry = function(entry, callback) { - assert.ok(entry instanceof Entry); - this.entryStack.push(entry); - try { - callback.call(this.emitter); - } finally { - var popped = this.entryStack.pop(); - assert.strictEqual(popped, entry); - } -}; - -LMp._findLeapLocation = function(property, label) { - for (var i = this.entryStack.length - 1; i >= 0; --i) { - var entry = this.entryStack[i]; - var loc = entry[property]; - if (loc) { - if (label) { - if (entry.label && - entry.label.name === label.name) { - return loc; - } - } else if (entry instanceof LabeledEntry) { - // Ignore LabeledEntry entries unless we are actually breaking to - // a label. - } else { - return loc; - } - } - } - - return null; -}; - -LMp.getBreakLoc = function(label) { - return this._findLeapLocation("breakLoc", label); -}; - -LMp.getContinueLoc = function(label) { - return this._findLeapLocation("continueLoc", label); -}; - -},{"13":13,"2":2,"537":537,"568":568}],540:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var m = _dereq_(536).makeAccessor(); -var types = _dereq_(568).types; -var isArray = types.builtInTypes.array; -var n = types.namedTypes; -var hasOwn = Object.prototype.hasOwnProperty; - -function makePredicate(propertyName, knownTypes) { - function onlyChildren(node) { - n.Node.assert(node); - - // Assume no side effects until we find out otherwise. - var result = false; - - function check(child) { - if (result) { - // Do nothing. - } else if (isArray.check(child)) { - child.some(check); - } else if (n.Node.check(child)) { - assert.strictEqual(result, false); - result = predicate(child); - } - return result; - } - - types.eachField(node, function(name, child) { - check(child); - }); - - return result; - } - - function predicate(node) { - n.Node.assert(node); - - var meta = m(node); - if (hasOwn.call(meta, propertyName)) - return meta[propertyName]; - - // Certain types are "opaque," which means they have no side - // effects or leaps and we don't care about their subexpressions. - if (hasOwn.call(opaqueTypes, node.type)) - return meta[propertyName] = false; - - if (hasOwn.call(knownTypes, node.type)) - return meta[propertyName] = true; - - return meta[propertyName] = onlyChildren(node); - } - - predicate.onlyChildren = onlyChildren; - - return predicate; -} - -var opaqueTypes = { - FunctionExpression: true -}; - -// These types potentially have side effects regardless of what side -// effects their subexpressions have. -var sideEffectTypes = { - CallExpression: true, // Anything could happen! - ForInStatement: true, // Modifies the key variable. - UnaryExpression: true, // Think delete. - BinaryExpression: true, // Might invoke .toString() or .valueOf(). - AssignmentExpression: true, // Side-effecting by definition. - UpdateExpression: true, // Updates are essentially assignments. - NewExpression: true // Similar to CallExpression. -}; - -// These types are the direct cause of all leaps in control flow. -var leapTypes = { - YieldExpression: true, - BreakStatement: true, - ContinueStatement: true, - ReturnStatement: true, - ThrowStatement: true -}; - -// All leap types are also side effect types. -for (var type in leapTypes) { - if (hasOwn.call(leapTypes, type)) { - sideEffectTypes[type] = leapTypes[type]; - } -} - -exports.hasSideEffects = makePredicate("hasSideEffects", sideEffectTypes); -exports.containsLeap = makePredicate("containsLeap", leapTypes); - -},{"2":2,"536":536,"568":568}],541:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var types = _dereq_(568).types; -var n = types.namedTypes; -var b = types.builders; -var hasOwn = Object.prototype.hasOwnProperty; - -exports.defaults = function(obj) { - var len = arguments.length; - var extension; - - for (var i = 1; i < len; ++i) { - if ((extension = arguments[i])) { - for (var key in extension) { - if (hasOwn.call(extension, key) && !hasOwn.call(obj, key)) { - obj[key] = extension[key]; - } - } - } - } - - return obj; -}; - -exports.runtimeProperty = function(name) { - return b.memberExpression( - b.identifier("regeneratorRuntime"), - b.identifier(name), - false - ); -}; - -// Inspired by the isReference function from ast-util: -// https://github.com/eventualbuddha/ast-util/blob/9bf91c5ce8/lib/index.js#L466-L506 -exports.isReference = function(path, name) { - var node = path.value; - - if (!n.Identifier.check(node)) { - return false; - } - - if (name && node.name !== name) { - return false; - } - - var parent = path.parent.value; - - switch (parent.type) { - case "VariableDeclarator": - return path.name === "init"; - - case "MemberExpression": - return path.name === "object" || ( - parent.computed && path.name === "property" - ); - - case "FunctionExpression": - case "FunctionDeclaration": - case "ArrowFunctionExpression": - if (path.name === "id") { - return false; - } - - if (path.parentPath.name === "params" && - parent.params === path.parentPath.value && - parent.params[path.name] === node) { - return false; - } - - return true; - - case "ClassDeclaration": - case "ClassExpression": - return path.name !== "id"; - - case "CatchClause": - return path.name !== "param"; - - case "Property": - case "MethodDefinition": - return path.name !== "key"; - - case "ImportSpecifier": - case "ImportDefaultSpecifier": - case "ImportNamespaceSpecifier": - case "LabeledStatement": - return false; - - default: - return true; - } -}; - -},{"2":2,"568":568}],542:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var fs = _dereq_(1); -var recast = _dereq_(568); -var types = recast.types; -var n = types.namedTypes; -var b = types.builders; -var isArray = types.builtInTypes.array; -var isObject = types.builtInTypes.object; -var NodePath = types.NodePath; -var hoist = _dereq_(538).hoist; -var Emitter = _dereq_(537).Emitter; -var util = _dereq_(541); -var runtimeProperty = util.runtimeProperty; -var getMarkInfo = _dereq_(536).makeAccessor(); - -exports.transform = function transform(node, options) { - options = options || {}; - - var path = node instanceof NodePath ? node : new NodePath(node); - visitor.visit(path, options); - node = path.value; - - if (options.includeRuntime === true || - (options.includeRuntime === 'if used' && visitor.wasChangeReported())) { - injectRuntime(n.File.check(node) ? node.program : node); - } - - options.madeChanges = visitor.wasChangeReported(); - - return node; -}; - -function injectRuntime(program) { - n.Program.assert(program); - - // Include the runtime by modifying the AST rather than by concatenating - // strings. This technique will allow for more accurate source mapping. - var runtimePath = _dereq_(543).runtime.path; - var runtime = fs.readFileSync(runtimePath, "utf8"); - var runtimeBody = recast.parse(runtime, { - sourceFileName: runtimePath - }).program.body; - - var body = program.body; - body.unshift.apply(body, runtimeBody); -} - -var visitor = types.PathVisitor.fromMethodsObject({ - reset: function(node, options) { - this.options = options; - }, - - visitFunction: function(path) { - // Calling this.traverse(path) first makes for a post-order traversal. - this.traverse(path); - - var node = path.value; - var shouldTransformAsync = node.async && !this.options.disableAsync; - - if (!node.generator && !shouldTransformAsync) { - return; - } - - this.reportChanged(); - - if (node.expression) { - // Transform expression lambdas into normal functions. - node.expression = false; - node.body = b.blockStatement([ - b.returnStatement(node.body) - ]); - } - - if (shouldTransformAsync) { - awaitVisitor.visit(path.get("body")); - } - - var outerBody = []; - var innerBody = []; - var bodyPath = path.get("body", "body"); - - bodyPath.each(function(childPath) { - var node = childPath.value; - if (node && node._blockHoist != null) { - outerBody.push(node); - } else { - innerBody.push(node); - } - }); - - if (outerBody.length > 0) { - // Only replace the inner body if we actually hoisted any statements - // to the outer body. - bodyPath.replace(innerBody); - } - - var outerFnExpr = getOuterFnExpr(path); - // Note that getOuterFnExpr has the side-effect of ensuring that the - // function has a name (so node.id will always be an Identifier), even - // if a temporary name has to be synthesized. - n.Identifier.assert(node.id); - var innerFnId = b.identifier(node.id.name + "$"); - var contextId = path.scope.declareTemporary("context$"); - var argsId = path.scope.declareTemporary("args$"); - - // Turn all declarations into vars, and replace the original - // declarations with equivalent assignment expressions. - var vars = hoist(path); - - var didRenameArguments = renameArguments(path, argsId); - if (didRenameArguments) { - vars = vars || b.variableDeclaration("var", []); - vars.declarations.push(b.variableDeclarator( - argsId, b.identifier("arguments") - )); - } - - var emitter = new Emitter(contextId); - emitter.explode(path.get("body")); - - if (vars && vars.declarations.length > 0) { - outerBody.push(vars); - } - - var wrapArgs = [ - emitter.getContextFunction(innerFnId), - // Async functions that are not generators don't care about the - // outer function because they don't need it to be marked and don't - // inherit from its .prototype. - node.generator ? outerFnExpr : b.literal(null), - b.thisExpression() - ]; - - var tryLocsList = emitter.getTryLocsList(); - if (tryLocsList) { - wrapArgs.push(tryLocsList); - } - - var wrapCall = b.callExpression( - runtimeProperty(shouldTransformAsync ? "async" : "wrap"), - wrapArgs - ); - - outerBody.push(b.returnStatement(wrapCall)); - node.body = b.blockStatement(outerBody); - - var wasGeneratorFunction = node.generator; - if (wasGeneratorFunction) { - node.generator = false; - } - - if (shouldTransformAsync) { - node.async = false; - } - - if (wasGeneratorFunction && - n.Expression.check(node)) { - return b.callExpression(runtimeProperty("mark"), [node]); - } - }, - - visitForOfStatement: function(path) { - this.traverse(path); - - var node = path.value; - var tempIterId = path.scope.declareTemporary("t$"); - var tempIterDecl = b.variableDeclarator( - tempIterId, - b.callExpression( - runtimeProperty("values"), - [node.right] - ) - ); - - var tempInfoId = path.scope.declareTemporary("t$"); - var tempInfoDecl = b.variableDeclarator(tempInfoId, null); - - var init = node.left; - var loopId; - if (n.VariableDeclaration.check(init)) { - loopId = init.declarations[0].id; - init.declarations.push(tempIterDecl, tempInfoDecl); - } else { - loopId = init; - init = b.variableDeclaration("var", [ - tempIterDecl, - tempInfoDecl - ]); - } - n.Identifier.assert(loopId); - - var loopIdAssignExprStmt = b.expressionStatement( - b.assignmentExpression( - "=", - loopId, - b.memberExpression( - tempInfoId, - b.identifier("value"), - false - ) - ) - ); - - if (n.BlockStatement.check(node.body)) { - node.body.body.unshift(loopIdAssignExprStmt); - } else { - node.body = b.blockStatement([ - loopIdAssignExprStmt, - node.body - ]); - } - - return b.forStatement( - init, - b.unaryExpression( - "!", - b.memberExpression( - b.assignmentExpression( - "=", - tempInfoId, - b.callExpression( - b.memberExpression( - tempIterId, - b.identifier("next"), - false - ), - [] - ) - ), - b.identifier("done"), - false - ) - ), - null, - node.body - ); - } -}); - -// Given a NodePath for a Function, return an Expression node that can be -// used to refer reliably to the function object from inside the function. -// This expression is essentially a replacement for arguments.callee, with -// the key advantage that it works in strict mode. -function getOuterFnExpr(funPath) { - var node = funPath.value; - n.Function.assert(node); - - if (node.generator && // Non-generator functions don't need to be marked. - n.FunctionDeclaration.check(node)) { - var pp = funPath.parent; - - while (pp && !(n.BlockStatement.check(pp.value) || - n.Program.check(pp.value))) { - pp = pp.parent; - } - - if (!pp) { - return node.id; - } - - var markDecl = getRuntimeMarkDecl(pp); - var markedArray = markDecl.declarations[0].id; - var funDeclIdArray = markDecl.declarations[0].init.callee.object; - n.ArrayExpression.assert(funDeclIdArray); - - var index = funDeclIdArray.elements.length; - funDeclIdArray.elements.push(node.id); - - return b.memberExpression( - markedArray, - b.literal(index), - true - ); - } - - return node.id || ( - node.id = funPath.scope.parent.declareTemporary("callee$") - ); -} - -function getRuntimeMarkDecl(blockPath) { - assert.ok(blockPath instanceof NodePath); - var block = blockPath.node; - isArray.assert(block.body); - - var info = getMarkInfo(block); - if (info.decl) { - return info.decl; - } - - info.decl = b.variableDeclaration("var", [ - b.variableDeclarator( - blockPath.scope.declareTemporary("marked"), - b.callExpression( - b.memberExpression( - b.arrayExpression([]), - b.identifier("map"), - false - ), - [runtimeProperty("mark")] - ) - ) - ]); - - for (var i = 0; i < block.body.length; ++i) { - if (!shouldNotHoistAbove(blockPath.get("body", i))) { - break; - } - } - - blockPath.get("body").insertAt(i, info.decl); - - return info.decl; -} - -function shouldNotHoistAbove(stmtPath) { - var value = stmtPath.value; - n.Statement.assert(value); - - // If the first statement is a "use strict" declaration, make sure to - // insert hoisted declarations afterwards. - return n.ExpressionStatement.check(value) && - n.Literal.check(value.expression) && - value.expression.value === "use strict"; -} - -function renameArguments(funcPath, argsId) { - assert.ok(funcPath instanceof types.NodePath); - var func = funcPath.value; - var didRenameArguments = false; - - recast.visit(funcPath, { - visitFunction: function(path) { - if (path.value === func) { - this.traverse(path); - } else { - return false; - } - }, - - visitIdentifier: function(path) { - if (path.value.name === "arguments" && - util.isReference(path)) { - path.replace(argsId); - didRenameArguments = true; - return false; - } - - this.traverse(path); - } - }); - - // If the traversal replaced any arguments references, then we need to - // alias the outer function's arguments binding (be it the implicit - // arguments object or some other parameter or variable) to the variable - // named by argsId. - return didRenameArguments; -} - -var awaitVisitor = types.PathVisitor.fromMethodsObject({ - visitFunction: function(path) { - return false; // Don't descend into nested function scopes. - }, - - visitAwaitExpression: function(path) { - // Convert await and await* expressions to yield expressions. - var argument = path.value.argument; - - // If the parser supports await* syntax using a boolean .all property - // (#171), desugar that syntax to yield Promise.all(argument). - if (path.value.all) { - argument = b.callExpression( - b.memberExpression( - b.identifier("Promise"), - b.identifier("all"), - false - ), - [argument] - ); - } - - // Transforming `await x` to `yield regeneratorRuntime.awrap(x)` - // causes the argument to be wrapped in such a way that the runtime - // can distinguish between awaited and merely yielded values. - return b.yieldExpression( - b.callExpression( - runtimeProperty("awrap"), - [argument] - ), - false - ); - } -}); - -},{"1":1,"2":2,"536":536,"537":537,"538":538,"541":541,"543":543,"568":568}],543:[function(_dereq_,module,exports){ -(function (__dirname){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -var assert = _dereq_(2); -var path = _dereq_(9); -var fs = _dereq_(1); -var through = _dereq_(1); -var transform = _dereq_(542).transform; -var utils = _dereq_(541); -var recast = _dereq_(568); -var types = recast.types; -var genOrAsyncFunExp = /\bfunction\s*\*|\basync\b/; -var blockBindingExp = /\b(let|const)\s+/; - -function exports(file, options) { - var data = []; - return through(write, end); - - function write(buf) { - data.push(buf); - } - - function end() { - this.queue(compile(data.join(""), options).code); - this.queue(null); - } -} - -// To get a writable stream for use as a browserify transform, call -// require("regenerator")(). -module.exports = exports; - -// To include the runtime globally in the current node process, call -// require("regenerator").runtime(). -function runtime() { - _dereq_(585); -} -exports.runtime = runtime; -runtime.path = path.join(__dirname, "runtime.js"); - -function compile(source, options) { - options = normalizeOptions(options); - - if (!genOrAsyncFunExp.test(source)) { - return { - // Shortcut: no generators or async functions to transform. - code: (options.includeRuntime === true ? fs.readFileSync( - path.join(__dirname, "runtime.js"), "utf-8" - ) + "\n" : "") + source - }; - } - - var recastOptions = getRecastOptions(options); - var ast = recast.parse(source, recastOptions); - var nodePath = new types.NodePath(ast); - var programPath = nodePath.get("program"); - - if (shouldVarify(source, options)) { - // Transpile let/const into var declarations. - varifyAst(programPath.node); - } - - transform(programPath, options); - - return recast.print(nodePath, recastOptions); -} - -function normalizeOptions(options) { - options = utils.defaults(options || {}, { - includeRuntime: false, - supportBlockBinding: true - }); - - if (!options.esprima) { - options.esprima = _dereq_(1); - } - - assert.ok( - /harmony/.test(options.esprima.version), - "Bad esprima version: " + options.esprima.version - ); - - return options; -} - -function getRecastOptions(options) { - var recastOptions = { - range: true - }; - - function copy(name) { - if (name in options) { - recastOptions[name] = options[name]; - } - } - - copy("esprima"); - copy("sourceFileName"); - copy("sourceMapName"); - copy("inputSourceMap"); - copy("sourceRoot"); - - return recastOptions; -} - -function shouldVarify(source, options) { - var supportBlockBinding = !!options.supportBlockBinding; - if (supportBlockBinding) { - if (!blockBindingExp.test(source)) { - supportBlockBinding = false; - } - } - - return supportBlockBinding; -} - -function varify(source, options) { - var recastOptions = getRecastOptions(normalizeOptions(options)); - var ast = recast.parse(source, recastOptions); - varifyAst(ast.program); - return recast.print(ast, recastOptions).code; -} - -function varifyAst(ast) { - types.namedTypes.Program.assert(ast); - - var defsResult = _dereq_(544)(ast, { - ast: true, - disallowUnknownReferences: false, - disallowDuplicated: false, - disallowVars: false, - loopClosures: "iife" - }); - - if (defsResult.errors) { - throw new Error(defsResult.errors.join("\n")) - } - - return ast; -} - -// Convenience for just translating let/const to var declarations. -exports.varify = varify; - -// Allow packages that depend on Regenerator to use the same copy of -// ast-types, in case multiple versions are installed by NPM. -exports.types = types; - -// Transforms a string of source code, returning the { code, map? } result -// from recast.print. -exports.compile = compile; - -// To modify an AST directly, call require("regenerator").transform(ast). -exports.transform = transform; - -}).call(this,"/node_modules/regenerator") -},{"1":1,"2":2,"541":541,"542":542,"544":544,"568":568,"585":585,"9":9}],544:[function(_dereq_,module,exports){ -"use strict"; - -var assert = _dereq_(2); -var is = _dereq_(555); -var fmt = _dereq_(554); -var stringmap = _dereq_(556); -var stringset = _dereq_(557); -var alter = _dereq_(550); -var traverse = _dereq_(552); -var breakable = _dereq_(553); -var Scope = _dereq_(548); -var error = _dereq_(545); -var getline = error.getline; -var options = _dereq_(547); -var Stats = _dereq_(549); -var jshint_vars = _dereq_(546); - - -function isConstLet(kind) { - return is.someof(kind, ["const", "let"]); -} - -function isVarConstLet(kind) { - return is.someof(kind, ["var", "const", "let"]); -} - -function isNonFunctionBlock(node) { - return node.type === "BlockStatement" && is.noneof(node.$parent.type, ["FunctionDeclaration", "FunctionExpression"]); -} - -function isForWithConstLet(node) { - return node.type === "ForStatement" && node.init && node.init.type === "VariableDeclaration" && isConstLet(node.init.kind); -} - -function isForInOfWithConstLet(node) { - return isForInOf(node) && node.left.type === "VariableDeclaration" && isConstLet(node.left.kind); -} - -function isForInOf(node) { - return is.someof(node.type, ["ForInStatement", "ForOfStatement"]); -} - -function isFunction(node) { - return is.someof(node.type, ["FunctionDeclaration", "FunctionExpression"]); -} - -function isLoop(node) { - return is.someof(node.type, ["ForStatement", "ForInStatement", "ForOfStatement", "WhileStatement", "DoWhileStatement"]); -} - -function isReference(node) { - var parent = node.$parent; - return node.$refToScope || - node.type === "Identifier" && - !(parent.type === "VariableDeclarator" && parent.id === node) && // var|let|const $ - !(parent.type === "MemberExpression" && parent.computed === false && parent.property === node) && // obj.$ - !(parent.type === "Property" && parent.key === node) && // {$: ...} - !(parent.type === "LabeledStatement" && parent.label === node) && // $: ... - !(parent.type === "CatchClause" && parent.param === node) && // catch($) - !(isFunction(parent) && parent.id === node) && // function $(.. - !(isFunction(parent) && is.someof(node, parent.params)) && // function f($).. - true; -} - -function isLvalue(node) { - return isReference(node) && - ((node.$parent.type === "AssignmentExpression" && node.$parent.left === node) || - (node.$parent.type === "UpdateExpression" && node.$parent.argument === node)); -} - -function createScopes(node, parent) { - assert(!node.$scope); - - node.$parent = parent; - node.$scope = node.$parent ? node.$parent.$scope : null; // may be overridden - - if (node.type === "Program") { - // Top-level program is a scope - // There's no block-scope under it - node.$scope = new Scope({ - kind: "hoist", - node: node, - parent: null, - }); - - } else if (isFunction(node)) { - // Function is a scope, with params in it - // There's no block-scope under it - - node.$scope = new Scope({ - kind: "hoist", - node: node, - parent: node.$parent.$scope, - }); - - // function has a name - if (node.id) { - assert(node.id.type === "Identifier"); - - if (node.type === "FunctionDeclaration") { - // Function name goes in parent scope for declared functions - node.$parent.$scope.add(node.id.name, "fun", node.id, null); - } else if (node.type === "FunctionExpression") { - // Function name goes in function's scope for named function expressions - node.$scope.add(node.id.name, "fun", node.id, null); - } else { - assert(false); - } - } - - node.params.forEach(function(param) { - node.$scope.add(param.name, "param", param, null); - }); - - } else if (node.type === "VariableDeclaration") { - // Variable declarations names goes in current scope - assert(isVarConstLet(node.kind)); - node.declarations.forEach(function(declarator) { - assert(declarator.type === "VariableDeclarator"); - var name = declarator.id.name; - if (options.disallowVars && node.kind === "var") { - error(getline(declarator), "var {0} is not allowed (use let or const)", name); - } - node.$scope.add(name, node.kind, declarator.id, declarator.range[1]); - }); - - } else if (isForWithConstLet(node) || isForInOfWithConstLet(node)) { - // For(In/Of) loop with const|let declaration is a scope, with declaration in it - // There may be a block-scope under it - node.$scope = new Scope({ - kind: "block", - node: node, - parent: node.$parent.$scope, - }); - - } else if (isNonFunctionBlock(node)) { - // A block node is a scope unless parent is a function - node.$scope = new Scope({ - kind: "block", - node: node, - parent: node.$parent.$scope, - }); - - } else if (node.type === "CatchClause") { - var identifier = node.param; - - node.$scope = new Scope({ - kind: "catch-block", - node: node, - parent: node.$parent.$scope, - }); - node.$scope.add(identifier.name, "caught", identifier, null); - - // All hoist-scope keeps track of which variables that are propagated through, - // i.e. an reference inside the scope points to a declaration outside the scope. - // This is used to mark "taint" the name since adding a new variable in the scope, - // with a propagated name, would change the meaning of the existing references. - // - // catch(e) is special because even though e is a variable in its own scope, - // we want to make sure that catch(e){let e} is never transformed to - // catch(e){var e} (but rather var e$0). For that reason we taint the use of e - // in the closest hoist-scope, i.e. where var e$0 belongs. - node.$scope.closestHoistScope().markPropagates(identifier.name); - } -} - -function createTopScope(programScope, environments, globals) { - function inject(obj) { - for (var name in obj) { - var writeable = obj[name]; - var kind = (writeable ? "var" : "const"); - if (topScope.hasOwn(name)) { - topScope.remove(name); - } - topScope.add(name, kind, {loc: {start: {line: -1}}}, -1); - } - } - - var topScope = new Scope({ - kind: "hoist", - node: {}, - parent: null, - }); - - var complementary = { - undefined: false, - Infinity: false, - console: false, - }; - - inject(complementary); - inject(jshint_vars.reservedVars); - inject(jshint_vars.ecmaIdentifiers); - if (environments) { - environments.forEach(function(env) { - if (!jshint_vars[env]) { - error(-1, 'environment "{0}" not found', env); - } else { - inject(jshint_vars[env]); - } - }); - } - if (globals) { - inject(globals); - } - - // link it in - programScope.parent = topScope; - topScope.children.push(programScope); - - return topScope; -} - -function setupReferences(ast, allIdentifiers, opts) { - var analyze = (is.own(opts, "analyze") ? opts.analyze : true); - - function visit(node) { - if (!isReference(node)) { - return; - } - allIdentifiers.add(node.name); - - var scope = node.$scope.lookup(node.name); - if (analyze && !scope && options.disallowUnknownReferences) { - error(getline(node), "reference to unknown global variable {0}", node.name); - } - // check const and let for referenced-before-declaration - if (analyze && scope && is.someof(scope.getKind(node.name), ["const", "let"])) { - var allowedFromPos = scope.getFromPos(node.name); - var referencedAtPos = node.range[0]; - assert(is.finitenumber(allowedFromPos)); - assert(is.finitenumber(referencedAtPos)); - if (referencedAtPos < allowedFromPos) { - if (!node.$scope.hasFunctionScopeBetween(scope)) { - error(getline(node), "{0} is referenced before its declaration", node.name); - } - } - } - node.$refToScope = scope; - } - - traverse(ast, {pre: visit}); -} - -// TODO for loops init and body props are parallel to each other but init scope is outer that of body -// TODO is this a problem? - -function varify(ast, stats, allIdentifiers, changes) { - function unique(name) { - assert(allIdentifiers.has(name)); - for (var cnt = 0; ; cnt++) { - var genName = name + "$" + String(cnt); - if (!allIdentifiers.has(genName)) { - return genName; - } - } - } - - function renameDeclarations(node) { - if (node.type === "VariableDeclaration" && isConstLet(node.kind)) { - var hoistScope = node.$scope.closestHoistScope(); - var origScope = node.$scope; - - // text change const|let => var - changes.push({ - start: node.range[0], - end: node.range[0] + node.kind.length, - str: "var", - }); - - node.declarations.forEach(function(declarator) { - assert(declarator.type === "VariableDeclarator"); - var name = declarator.id.name; - - stats.declarator(node.kind); - - // rename if - // 1) name already exists in hoistScope, or - // 2) name is already propagated (passed) through hoistScope or manually tainted - var rename = (origScope !== hoistScope && - (hoistScope.hasOwn(name) || hoistScope.doesPropagate(name))); - - var newName = (rename ? unique(name) : name); - - origScope.remove(name); - hoistScope.add(newName, "var", declarator.id, declarator.range[1]); - - origScope.moves = origScope.moves || stringmap(); - origScope.moves.set(name, { - name: newName, - scope: hoistScope, - }); - - allIdentifiers.add(newName); - - if (newName !== name) { - stats.rename(name, newName, getline(declarator)); - - declarator.id.originalName = name; - declarator.id.name = newName; - - // textchange var x => var x$1 - changes.push({ - start: declarator.id.range[0], - end: declarator.id.range[1], - str: newName, - }); - } - }); - - // ast change const|let => var - node.kind = "var"; - } - } - - function renameReferences(node) { - if (!node.$refToScope) { - return; - } - var move = node.$refToScope.moves && node.$refToScope.moves.get(node.name); - if (!move) { - return; - } - node.$refToScope = move.scope; - - if (node.name !== move.name) { - node.originalName = node.name; - node.name = move.name; - - if (node.alterop) { - // node has no range because it is the result of another alter operation - var existingOp = null; - for (var i = 0; i < changes.length; i++) { - var op = changes[i]; - if (op.node === node) { - existingOp = op; - break; - } - } - assert(existingOp); - - // modify op - existingOp.str = move.name; - } else { - changes.push({ - start: node.range[0], - end: node.range[1], - str: move.name, - }); - } - } - } - - traverse(ast, {pre: renameDeclarations}); - traverse(ast, {pre: renameReferences}); - ast.$scope.traverse({pre: function(scope) { - delete scope.moves; - }}); -} - - -function detectLoopClosures(ast) { - traverse(ast, {pre: visit}); - - function detectIifyBodyBlockers(body, node) { - return breakable(function(brk) { - traverse(body, {pre: function(n) { - // if we hit an inner function of the loop body, don't traverse further - if (isFunction(n)) { - return false; - } - - var err = true; // reset to false in else-statement below - var msg = "loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}"; - if (n.type === "BreakStatement") { - error(getline(node), msg, node.name, "break", getline(n)); - } else if (n.type === "ContinueStatement") { - error(getline(node), msg, node.name, "continue", getline(n)); - } else if (n.type === "ReturnStatement") { - error(getline(node), msg, node.name, "return", getline(n)); - } else if (n.type === "YieldExpression") { - error(getline(node), msg, node.name, "yield", getline(n)); - } else if (n.type === "Identifier" && n.name === "arguments") { - error(getline(node), msg, node.name, "arguments", getline(n)); - } else if (n.type === "VariableDeclaration" && n.kind === "var") { - error(getline(node), msg, node.name, "var", getline(n)); - } else { - err = false; - } - if (err) { - brk(true); // break traversal - } - }}); - return false; - }); - } - - function visit(node) { - // forbidden pattern: - // <any>* <loop> <non-fn>* <constlet-def> <any>* <fn> <any>* <constlet-ref> - var loopNode = null; - if (isReference(node) && node.$refToScope && isConstLet(node.$refToScope.getKind(node.name))) { - // traverse nodes up towards root from constlet-def - // if we hit a function (before a loop) - ok! - // if we hit a loop - maybe-ouch - // if we reach root - ok! - for (var n = node.$refToScope.node; ; ) { - if (isFunction(n)) { - // we're ok (function-local) - return; - } else if (isLoop(n)) { - loopNode = n; - // maybe not ok (between loop and function) - break; - } - n = n.$parent; - if (!n) { - // ok (reached root) - return; - } - } - - assert(isLoop(loopNode)); - - // traverse scopes from reference-scope up towards definition-scope - // if we hit a function, ouch! - var defScope = node.$refToScope; - var generateIIFE = (options.loopClosures === "iife"); - - for (var s = node.$scope; s; s = s.parent) { - if (s === defScope) { - // we're ok - return; - } else if (isFunction(s.node)) { - // not ok (there's a function between the reference and definition) - // may be transformable via IIFE - - if (!generateIIFE) { - var msg = "loop-variable {0} is captured by a loop-closure. Tried \"loopClosures\": \"iife\" in defs-config.json?"; - return error(getline(node), msg, node.name); - } - - // here be dragons - // for (let x = ..; .. ; ..) { (function(){x})() } is forbidden because of current - // spec and VM status - if (loopNode.type === "ForStatement" && defScope.node === loopNode) { - var declarationNode = defScope.getNode(node.name); - return error(getline(declarationNode), "Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure", declarationNode.name); - } - - // speak now or forever hold your peace - if (detectIifyBodyBlockers(loopNode.body, node)) { - // error already generated - return; - } - - // mark loop for IIFE-insertion - loopNode.$iify = true; - } - } - } - } -} - -function transformLoopClosures(root, ops, options) { - function insertOp(pos, str, node) { - var op = { - start: pos, - end: pos, - str: str, - } - if (node) { - op.node = node; - } - ops.push(op); - } - - traverse(root, {pre: function(node) { - if (!node.$iify) { - return; - } - - var hasBlock = (node.body.type === "BlockStatement"); - - var insertHead = (hasBlock ? - node.body.range[0] + 1 : // just after body { - node.body.range[0]); // just before existing expression - var insertFoot = (hasBlock ? - node.body.range[1] - 1 : // just before body } - node.body.range[1]); // just after existing expression - - var forInName = (isForInOf(node) && node.left.declarations[0].id.name);; - var iifeHead = fmt("(function({0}){", forInName ? forInName : ""); - var iifeTail = fmt("}).call(this{0});", forInName ? ", " + forInName : ""); - - // modify AST - var iifeFragment = options.parse(iifeHead + iifeTail); - var iifeExpressionStatement = iifeFragment.body[0]; - var iifeBlockStatement = iifeExpressionStatement.expression.callee.object.body; - - if (hasBlock) { - var forBlockStatement = node.body; - var tmp = forBlockStatement.body; - forBlockStatement.body = [iifeExpressionStatement]; - iifeBlockStatement.body = tmp; - } else { - var tmp$0 = node.body; - node.body = iifeExpressionStatement; - iifeBlockStatement.body[0] = tmp$0; - } - - // create ops - insertOp(insertHead, iifeHead); - - if (forInName) { - insertOp(insertFoot, "}).call(this, "); - - var args = iifeExpressionStatement.expression.arguments; - var iifeArgumentIdentifier = args[1]; - iifeArgumentIdentifier.alterop = true; - insertOp(insertFoot, forInName, iifeArgumentIdentifier); - - insertOp(insertFoot, ");"); - } else { - insertOp(insertFoot, iifeTail); - } - }}); -} - -function detectConstAssignment(ast) { - traverse(ast, {pre: function(node) { - if (isLvalue(node)) { - var scope = node.$scope.lookup(node.name); - if (scope && scope.getKind(node.name) === "const") { - error(getline(node), "can't assign to const variable {0}", node.name); - } - } - }}); -} - -function detectConstantLets(ast) { - traverse(ast, {pre: function(node) { - if (isLvalue(node)) { - var scope = node.$scope.lookup(node.name); - if (scope) { - scope.markWrite(node.name); - } - } - }}); - - ast.$scope.detectUnmodifiedLets(); -} - -function setupScopeAndReferences(root, opts) { - // setup scopes - traverse(root, {pre: createScopes}); - var topScope = createTopScope(root.$scope, options.environments, options.globals); - - // allIdentifiers contains all declared and referenced vars - // collect all declaration names (including those in topScope) - var allIdentifiers = stringset(); - topScope.traverse({pre: function(scope) { - allIdentifiers.addMany(scope.decls.keys()); - }}); - - // setup node.$refToScope, check for errors. - // also collects all referenced names to allIdentifiers - setupReferences(root, allIdentifiers, opts); - return allIdentifiers; -} - -function cleanupTree(root) { - traverse(root, {pre: function(node) { - for (var prop in node) { - if (prop[0] === "$") { - delete node[prop]; - } - } - }}); -} - -function run(src, config) { - // alter the options singleton with user configuration - for (var key in config) { - options[key] = config[key]; - } - - var parsed; - - if (is.object(src)) { - if (!options.ast) { - return { - errors: [ - "Can't produce string output when input is an AST. " + - "Did you forget to set options.ast = true?" - ], - }; - } - - // Received an AST object as src, so no need to parse it. - parsed = src; - - } else if (is.string(src)) { - try { - parsed = options.parse(src, { - loc: true, - range: true, - }); - } catch (e) { - return { - errors: [ - fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}", - e.lineNumber, - e.column, - src.split("\n")[e.lineNumber - 1], - fmt.repeat(" ", e.column - 1) + "^") - ], - }; - } - - } else { - return { - errors: ["Input was neither an AST object nor a string."], - }; - } - - var ast = parsed; - - // TODO detect unused variables (never read) - error.reset(); - - var allIdentifiers = setupScopeAndReferences(ast, {}); - - // static analysis passes - detectLoopClosures(ast); - detectConstAssignment(ast); - //detectConstantLets(ast); - - var changes = []; - transformLoopClosures(ast, changes, options); - - //ast.$scope.print(); process.exit(-1); - - if (error.errors.length >= 1) { - return { - errors: error.errors, - }; - } - - if (changes.length > 0) { - cleanupTree(ast); - allIdentifiers = setupScopeAndReferences(ast, {analyze: false}); - } - assert(error.errors.length === 0); - - // change constlet declarations to var, renamed if needed - // varify modifies the scopes and AST accordingly and - // returns a list of change fragments (to use with alter) - var stats = new Stats(); - varify(ast, stats, allIdentifiers, changes); - - if (options.ast) { - // return the modified AST instead of src code - // get rid of all added $ properties first, such as $parent and $scope - cleanupTree(ast); - return { - stats: stats, - ast: ast, - }; - } else { - // apply changes produced by varify and return the transformed src - var transformedSrc = alter(src, changes); - return { - stats: stats, - src: transformedSrc, - }; - } -} - -module.exports = run; - -},{"2":2,"545":545,"546":546,"547":547,"548":548,"549":549,"550":550,"552":552,"553":553,"554":554,"555":555,"556":556,"557":557}],545:[function(_dereq_,module,exports){ -"use strict"; - -var fmt = _dereq_(554); -var assert = _dereq_(2); - -function error(line, var_args) { - assert(arguments.length >= 2); - - var msg = (arguments.length === 2 ? - String(var_args) : fmt.apply(fmt, Array.prototype.slice.call(arguments, 1))); - - error.errors.push(line === -1 ? msg : fmt("line {0}: {1}", line, msg)); -} - -error.reset = function() { - error.errors = []; -}; - -error.getline = function(node) { - if (node && node.loc && node.loc.start) { - return node.loc.start.line; - } - return -1; -}; - -error.reset(); - -module.exports = error; - -},{"2":2,"554":554}],546:[function(_dereq_,module,exports){ -// jshint -W001 - -"use strict"; - -// Identifiers provided by the ECMAScript standard. - -exports.reservedVars = { - arguments : false, - NaN : false -}; - -exports.ecmaIdentifiers = { - Array : false, - Boolean : false, - Date : false, - decodeURI : false, - decodeURIComponent : false, - encodeURI : false, - encodeURIComponent : false, - Error : false, - "eval" : false, - EvalError : false, - Function : false, - hasOwnProperty : false, - isFinite : false, - isNaN : false, - JSON : false, - Math : false, - Map : false, - Number : false, - Object : false, - parseInt : false, - parseFloat : false, - RangeError : false, - ReferenceError : false, - RegExp : false, - Set : false, - String : false, - SyntaxError : false, - TypeError : false, - URIError : false, - WeakMap : false -}; - -// Global variables commonly provided by a web browser environment. - -exports.browser = { - ArrayBuffer : false, - ArrayBufferView : false, - Audio : false, - Blob : false, - addEventListener : false, - applicationCache : false, - atob : false, - blur : false, - btoa : false, - clearInterval : false, - clearTimeout : false, - close : false, - closed : false, - DataView : false, - DOMParser : false, - defaultStatus : false, - document : false, - Element : false, - event : false, - FileReader : false, - Float32Array : false, - Float64Array : false, - FormData : false, - focus : false, - frames : false, - getComputedStyle : false, - HTMLElement : false, - HTMLAnchorElement : false, - HTMLBaseElement : false, - HTMLBlockquoteElement: false, - HTMLBodyElement : false, - HTMLBRElement : false, - HTMLButtonElement : false, - HTMLCanvasElement : false, - HTMLDirectoryElement : false, - HTMLDivElement : false, - HTMLDListElement : false, - HTMLFieldSetElement : false, - HTMLFontElement : false, - HTMLFormElement : false, - HTMLFrameElement : false, - HTMLFrameSetElement : false, - HTMLHeadElement : false, - HTMLHeadingElement : false, - HTMLHRElement : false, - HTMLHtmlElement : false, - HTMLIFrameElement : false, - HTMLImageElement : false, - HTMLInputElement : false, - HTMLIsIndexElement : false, - HTMLLabelElement : false, - HTMLLayerElement : false, - HTMLLegendElement : false, - HTMLLIElement : false, - HTMLLinkElement : false, - HTMLMapElement : false, - HTMLMenuElement : false, - HTMLMetaElement : false, - HTMLModElement : false, - HTMLObjectElement : false, - HTMLOListElement : false, - HTMLOptGroupElement : false, - HTMLOptionElement : false, - HTMLParagraphElement : false, - HTMLParamElement : false, - HTMLPreElement : false, - HTMLQuoteElement : false, - HTMLScriptElement : false, - HTMLSelectElement : false, - HTMLStyleElement : false, - HTMLTableCaptionElement: false, - HTMLTableCellElement : false, - HTMLTableColElement : false, - HTMLTableElement : false, - HTMLTableRowElement : false, - HTMLTableSectionElement: false, - HTMLTextAreaElement : false, - HTMLTitleElement : false, - HTMLUListElement : false, - HTMLVideoElement : false, - history : false, - Int16Array : false, - Int32Array : false, - Int8Array : false, - Image : false, - length : false, - localStorage : false, - location : false, - MessageChannel : false, - MessageEvent : false, - MessagePort : false, - moveBy : false, - moveTo : false, - MutationObserver : false, - name : false, - Node : false, - NodeFilter : false, - navigator : false, - onbeforeunload : true, - onblur : true, - onerror : true, - onfocus : true, - onload : true, - onresize : true, - onunload : true, - open : false, - openDatabase : false, - opener : false, - Option : false, - parent : false, - print : false, - removeEventListener : false, - resizeBy : false, - resizeTo : false, - screen : false, - scroll : false, - scrollBy : false, - scrollTo : false, - sessionStorage : false, - setInterval : false, - setTimeout : false, - SharedWorker : false, - status : false, - top : false, - Uint16Array : false, - Uint32Array : false, - Uint8Array : false, - Uint8ClampedArray : false, - WebSocket : false, - window : false, - Worker : false, - XMLHttpRequest : false, - XMLSerializer : false, - XPathEvaluator : false, - XPathException : false, - XPathExpression : false, - XPathNamespace : false, - XPathNSResolver : false, - XPathResult : false -}; - -exports.devel = { - alert : false, - confirm: false, - console: false, - Debug : false, - opera : false, - prompt : false -}; - -exports.worker = { - importScripts: true, - postMessage : true, - self : true -}; - -// Widely adopted global names that are not part of ECMAScript standard -exports.nonstandard = { - escape : false, - unescape: false -}; - -// Globals provided by popular JavaScript environments. - -exports.couch = { - "require" : false, - respond : false, - getRow : false, - emit : false, - send : false, - start : false, - sum : false, - log : false, - exports : false, - module : false, - provides : false -}; - -exports.node = { - __filename : false, - __dirname : false, - Buffer : false, - DataView : false, - console : false, - exports : true, // In Node it is ok to exports = module.exports = foo(); - GLOBAL : false, - global : false, - module : false, - process : false, - require : false, - setTimeout : false, - clearTimeout : false, - setInterval : false, - clearInterval: false -}; - -exports.phantom = { - phantom : true, - require : true, - WebPage : true -}; - -exports.rhino = { - defineClass : false, - deserialize : false, - gc : false, - help : false, - importPackage: false, - "java" : false, - load : false, - loadClass : false, - print : false, - quit : false, - readFile : false, - readUrl : false, - runCommand : false, - seal : false, - serialize : false, - spawn : false, - sync : false, - toint32 : false, - version : false -}; - -exports.wsh = { - ActiveXObject : true, - Enumerator : true, - GetObject : true, - ScriptEngine : true, - ScriptEngineBuildVersion : true, - ScriptEngineMajorVersion : true, - ScriptEngineMinorVersion : true, - VBArray : true, - WSH : true, - WScript : true, - XDomainRequest : true -}; - -// Globals provided by popular JavaScript libraries. - -exports.dojo = { - dojo : false, - dijit : false, - dojox : false, - define : false, - "require": false -}; - -exports.jquery = { - "$" : false, - jQuery : false -}; - -exports.mootools = { - "$" : false, - "$$" : false, - Asset : false, - Browser : false, - Chain : false, - Class : false, - Color : false, - Cookie : false, - Core : false, - Document : false, - DomReady : false, - DOMEvent : false, - DOMReady : false, - Drag : false, - Element : false, - Elements : false, - Event : false, - Events : false, - Fx : false, - Group : false, - Hash : false, - HtmlTable : false, - Iframe : false, - IframeShim : false, - InputValidator: false, - instanceOf : false, - Keyboard : false, - Locale : false, - Mask : false, - MooTools : false, - Native : false, - Options : false, - OverText : false, - Request : false, - Scroller : false, - Slick : false, - Slider : false, - Sortables : false, - Spinner : false, - Swiff : false, - Tips : false, - Type : false, - typeOf : false, - URI : false, - Window : false -}; - -exports.prototypejs = { - "$" : false, - "$$" : false, - "$A" : false, - "$F" : false, - "$H" : false, - "$R" : false, - "$break" : false, - "$continue" : false, - "$w" : false, - Abstract : false, - Ajax : false, - Class : false, - Enumerable : false, - Element : false, - Event : false, - Field : false, - Form : false, - Hash : false, - Insertion : false, - ObjectRange : false, - PeriodicalExecuter: false, - Position : false, - Prototype : false, - Selector : false, - Template : false, - Toggle : false, - Try : false, - Autocompleter : false, - Builder : false, - Control : false, - Draggable : false, - Draggables : false, - Droppables : false, - Effect : false, - Sortable : false, - SortableObserver : false, - Sound : false, - Scriptaculous : false -}; - -exports.yui = { - YUI : false, - Y : false, - YUI_config: false -}; - - -},{}],547:[function(_dereq_,module,exports){ -// default configuration - -module.exports = { - disallowVars: false, - disallowDuplicated: true, - disallowUnknownReferences: true, - parse: _dereq_(1).parse, -}; - -},{"1":1}],548:[function(_dereq_,module,exports){ -"use strict"; - -var assert = _dereq_(2); -var stringmap = _dereq_(556); -var stringset = _dereq_(557); -var is = _dereq_(555); -var fmt = _dereq_(554); -var error = _dereq_(545); -var getline = error.getline; -var options = _dereq_(547); - -function Scope(args) { - assert(is.someof(args.kind, ["hoist", "block", "catch-block"])); - assert(is.object(args.node)); - assert(args.parent === null || is.object(args.parent)); - - // kind === "hoist": function scopes, program scope, injected globals - // kind === "block": ES6 block scopes - // kind === "catch-block": catch block scopes - this.kind = args.kind; - - // the AST node the block corresponds to - this.node = args.node; - - // parent scope - this.parent = args.parent; - - // children scopes for easier traversal (populated internally) - this.children = []; - - // scope declarations. decls[variable_name] = { - // kind: "fun" for functions, - // "param" for function parameters, - // "caught" for catch parameter - // "var", - // "const", - // "let" - // node: the AST node the declaration corresponds to - // from: source code index from which it is visible at earliest - // (only stored for "const", "let" [and "var"] nodes) - // } - this.decls = stringmap(); - - // names of all declarations within this scope that was ever written - // TODO move to decls.w? - // TODO create corresponding read? - this.written = stringset(); - - // names of all variables declared outside this hoist scope but - // referenced in this scope (immediately or in child). - // only stored on hoist scopes for efficiency - // (because we currently generate lots of empty block scopes) - this.propagates = (this.kind === "hoist" ? stringset() : null); - - // scopes register themselves with their parents for easier traversal - if (this.parent) { - this.parent.children.push(this); - } -} - -Scope.prototype.print = function(indent) { - indent = indent || 0; - var scope = this; - var names = this.decls.keys().map(function(name) { - return fmt("{0} [{1}]", name, scope.decls.get(name).kind); - }).join(", "); - var propagates = this.propagates ? this.propagates.items().join(", ") : ""; - console.log(fmt("{0}{1}: {2}. propagates: {3}", fmt.repeat(" ", indent), this.node.type, names, propagates)); - this.children.forEach(function(c) { - c.print(indent + 2); - }); -}; - -Scope.prototype.add = function(name, kind, node, referableFromPos) { - assert(is.someof(kind, ["fun", "param", "var", "caught", "const", "let"])); - - function isConstLet(kind) { - return is.someof(kind, ["const", "let"]); - } - - var scope = this; - - // search nearest hoist-scope for fun, param and var's - // const, let and caught variables go directly in the scope (which may be hoist, block or catch-block) - if (is.someof(kind, ["fun", "param", "var"])) { - while (scope.kind !== "hoist") { - if (scope.decls.has(name) && isConstLet(scope.decls.get(name).kind)) { // could be caught - return error(getline(node), "{0} is already declared", name); - } - scope = scope.parent; - } - } - // name exists in scope and either new or existing kind is const|let => error - if (scope.decls.has(name) && (options.disallowDuplicated || isConstLet(scope.decls.get(name).kind) || isConstLet(kind))) { - return error(getline(node), "{0} is already declared", name); - } - - var declaration = { - kind: kind, - node: node, - }; - if (referableFromPos) { - assert(is.someof(kind, ["var", "const", "let"])); - declaration.from = referableFromPos; - } - scope.decls.set(name, declaration); -}; - -Scope.prototype.getKind = function(name) { - assert(is.string(name)); - var decl = this.decls.get(name); - return decl ? decl.kind : null; -}; - -Scope.prototype.getNode = function(name) { - assert(is.string(name)); - var decl = this.decls.get(name); - return decl ? decl.node : null; -}; - -Scope.prototype.getFromPos = function(name) { - assert(is.string(name)); - var decl = this.decls.get(name); - return decl ? decl.from : null; -}; - -Scope.prototype.hasOwn = function(name) { - return this.decls.has(name); -}; - -Scope.prototype.remove = function(name) { - return this.decls.remove(name); -}; - -Scope.prototype.doesPropagate = function(name) { - return this.propagates.has(name); -}; - -Scope.prototype.markPropagates = function(name) { - this.propagates.add(name); -}; - -Scope.prototype.closestHoistScope = function() { - var scope = this; - while (scope.kind !== "hoist") { - scope = scope.parent; - } - return scope; -}; - -Scope.prototype.hasFunctionScopeBetween = function(outer) { - function isFunction(node) { - return is.someof(node.type, ["FunctionDeclaration", "FunctionExpression"]); - } - - for (var scope = this; scope; scope = scope.parent) { - if (scope === outer) { - return false; - } - if (isFunction(scope.node)) { - return true; - } - } - - throw new Error("wasn't inner scope of outer"); -}; - -Scope.prototype.lookup = function(name) { - for (var scope = this; scope; scope = scope.parent) { - if (scope.decls.has(name)) { - return scope; - } else if (scope.kind === "hoist") { - scope.propagates.add(name); - } - } - return null; -}; - -Scope.prototype.markWrite = function(name) { - assert(is.string(name)); - this.written.add(name); -}; - -// detects let variables that are never modified (ignores top-level) -Scope.prototype.detectUnmodifiedLets = function() { - var outmost = this; - - function detect(scope) { - if (scope !== outmost) { - scope.decls.keys().forEach(function(name) { - if (scope.getKind(name) === "let" && !scope.written.has(name)) { - return error(getline(scope.getNode(name)), "{0} is declared as let but never modified so could be const", name); - } - }); - } - - scope.children.forEach(function(childScope) { - detect(childScope); - }); - } - detect(this); -}; - -Scope.prototype.traverse = function(options) { - options = options || {}; - var pre = options.pre; - var post = options.post; - - function visit(scope) { - if (pre) { - pre(scope); - } - scope.children.forEach(function(childScope) { - visit(childScope); - }); - if (post) { - post(scope); - } - } - - visit(this); -}; - -module.exports = Scope; - -},{"2":2,"545":545,"547":547,"554":554,"555":555,"556":556,"557":557}],549:[function(_dereq_,module,exports){ -var fmt = _dereq_(554); -var is = _dereq_(555); -var assert = _dereq_(2); - -function Stats() { - this.lets = 0; - this.consts = 0; - this.renames = []; -} - -Stats.prototype.declarator = function(kind) { - assert(is.someof(kind, ["const", "let"])); - if (kind === "const") { - this.consts++; - } else { - this.lets++; - } -}; - -Stats.prototype.rename = function(oldName, newName, line) { - this.renames.push({ - oldName: oldName, - newName: newName, - line: line, - }); -}; - -Stats.prototype.toString = function() { -// console.log("defs.js stats for file {0}:", filename) - - var renames = this.renames.map(function(r) { - return r; - }).sort(function(a, b) { - return a.line - b.line; - }); // sort a copy of renames - - var renameStr = renames.map(function(rename) { - return fmt("\nline {0}: {1} => {2}", rename.line, rename.oldName, rename.newName); - }).join(""); - - var sum = this.consts + this.lets; - var constlets = (sum === 0 ? - "can't calculate const coverage (0 consts, 0 lets)" : - fmt("{0}% const coverage ({1} consts, {2} lets)", - Math.floor(100 * this.consts / sum), this.consts, this.lets)); - - return constlets + renameStr + "\n"; -}; - -module.exports = Stats; - -},{"2":2,"554":554,"555":555}],550:[function(_dereq_,module,exports){ -// alter.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013 Olov Lassus <olov.lassus@gmail.com> - -var assert = _dereq_(2); -var stableSort = _dereq_(551); - -// fragments is a list of {start: index, end: index, str: string to replace with} -function alter(str, fragments) { - "use strict"; - - var isArray = Array.isArray || function(v) { - return Object.prototype.toString.call(v) === "[object Array]"; - };; - - assert(typeof str === "string"); - assert(isArray(fragments)); - - // stableSort isn't in-place so no need to copy array first - var sortedFragments = stableSort(fragments, function(a, b) { - return a.start - b.start; - }); - - var outs = []; - - var pos = 0; - for (var i = 0; i < sortedFragments.length; i++) { - var frag = sortedFragments[i]; - - assert(pos <= frag.start); - assert(frag.start <= frag.end); - outs.push(str.slice(pos, frag.start)); - outs.push(frag.str); - pos = frag.end; - } - if (pos < str.length) { - outs.push(str.slice(pos)); - } - - return outs.join(""); -} - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = alter; -} - -},{"2":2,"551":551}],551:[function(_dereq_,module,exports){ -//! stable.js 0.1.5, https://github.com/Two-Screen/stable -//! © 2014 Angry Bytes and contributors. MIT licensed. - -(function() { - -// A stable array sort, because `Array#sort()` is not guaranteed stable. -// This is an implementation of merge sort, without recursion. - -var stable = function(arr, comp) { - return exec(arr.slice(), comp); -}; - -stable.inplace = function(arr, comp) { - var result = exec(arr, comp); - - // This simply copies back if the result isn't in the original array, - // which happens on an odd number of passes. - if (result !== arr) { - pass(result, null, arr.length, arr); - } - - return arr; -}; - -// Execute the sort using the input array and a second buffer as work space. -// Returns one of those two, containing the final result. -function exec(arr, comp) { - if (typeof(comp) !== 'function') { - comp = function(a, b) { - return String(a).localeCompare(b); - }; - } - - // Short-circuit when there's nothing to sort. - var len = arr.length; - if (len <= 1) { - return arr; - } - - // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. - // Chunks are the size of the left or right hand in merge sort. - // Stop when the left-hand covers all of the array. - var buffer = new Array(len); - for (var chk = 1; chk < len; chk *= 2) { - pass(arr, comp, chk, buffer); - - var tmp = arr; - arr = buffer; - buffer = tmp; - } - - return arr; -} - -// Run a single pass with the given chunk size. -var pass = function(arr, comp, chk, result) { - var len = arr.length; - var i = 0; - // Step size / double chunk size. - var dbl = chk * 2; - // Bounds of the left and right chunks. - var l, r, e; - // Iterators over the left and right chunk. - var li, ri; - - // Iterate over pairs of chunks. - for (l = 0; l < len; l += dbl) { - r = l + chk; - e = r + chk; - if (r > len) r = len; - if (e > len) e = len; - - // Iterate both chunks in parallel. - li = l; - ri = r; - while (true) { - // Compare the chunks. - if (li < r && ri < e) { - // This works for a regular `sort()` compatible comparator, - // but also for a simple comparator like: `a > b` - if (comp(arr[li], arr[ri]) <= 0) { - result[i++] = arr[li++]; - } - else { - result[i++] = arr[ri++]; - } - } - // Nothing to compare, just flush what's left. - else if (li < r) { - result[i++] = arr[li++]; - } - else if (ri < e) { - result[i++] = arr[ri++]; - } - // Both iterators are at the chunk ends. - else { - break; - } - } - } -}; - -// Export using CommonJS or to the window. -if (typeof(module) !== 'undefined') { - module.exports = stable; -} -else { - window.stable = stable; -} - -})(); - -},{}],552:[function(_dereq_,module,exports){ -function traverse(root, options) { - "use strict"; - - options = options || {}; - var pre = options.pre; - var post = options.post; - var skipProperty = options.skipProperty; - - function visit(node, parent, prop, idx) { - if (!node || typeof node.type !== "string") { - return; - } - - var res = undefined; - if (pre) { - res = pre(node, parent, prop, idx); - } - - if (res !== false) { - for (var prop in node) { - if (skipProperty ? skipProperty(prop, node) : prop[0] === "$") { - continue; - } - - var child = node[prop]; - - if (Array.isArray(child)) { - for (var i = 0; i < child.length; i++) { - visit(child[i], node, prop, i); - } - } else { - visit(child, node, prop); - } - } - } - - if (post) { - post(node, parent, prop, idx); - } - } - - visit(root, null); -}; - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = traverse; -} - -},{}],553:[function(_dereq_,module,exports){ -// breakable.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013-2014 Olov Lassus <olov.lassus@gmail.com> - -var breakable = (function() { - "use strict"; - - function Val(val, brk) { - this.val = val; - this.brk = brk; - } - - function make_brk() { - return function brk(val) { - throw new Val(val, brk); - }; - } - - function breakable(fn) { - var brk = make_brk(); - try { - return fn(brk); - } catch (e) { - if (e instanceof Val && e.brk === brk) { - return e.val; - } - throw e; - } - } - - return breakable; -})(); - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = breakable; -} - -},{}],554:[function(_dereq_,module,exports){ -// simple-fmt.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013 Olov Lassus <olov.lassus@gmail.com> - -var fmt = (function() { - "use strict"; - - function fmt(str, var_args) { - var args = Array.prototype.slice.call(arguments, 1); - return str.replace(/\{(\d+)\}/g, function(s, match) { - return (match in args ? args[match] : s); - }); - } - - function obj(str, obj) { - return str.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g, function(s, match) { - return (match in obj ? obj[match] : s); - }); - } - - function repeat(str, n) { - return (new Array(n + 1)).join(str); - } - - fmt.fmt = fmt; - fmt.obj = obj; - fmt.repeat = repeat; - return fmt; -})(); - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = fmt; -} - -},{}],555:[function(_dereq_,module,exports){ -// simple-is.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013 Olov Lassus <olov.lassus@gmail.com> - -var is = (function() { - "use strict"; - - var hasOwnProperty = Object.prototype.hasOwnProperty; - var toString = Object.prototype.toString; - var _undefined = void 0; - - return { - nan: function(v) { - return v !== v; - }, - boolean: function(v) { - return typeof v === "boolean"; - }, - number: function(v) { - return typeof v === "number"; - }, - string: function(v) { - return typeof v === "string"; - }, - fn: function(v) { - return typeof v === "function"; - }, - object: function(v) { - return v !== null && typeof v === "object"; - }, - primitive: function(v) { - var t = typeof v; - return v === null || v === _undefined || - t === "boolean" || t === "number" || t === "string"; - }, - array: Array.isArray || function(v) { - return toString.call(v) === "[object Array]"; - }, - finitenumber: function(v) { - return typeof v === "number" && isFinite(v); - }, - someof: function(v, values) { - return values.indexOf(v) >= 0; - }, - noneof: function(v, values) { - return values.indexOf(v) === -1; - }, - own: function(obj, prop) { - return hasOwnProperty.call(obj, prop); - }, - }; -})(); - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = is; -} - -},{}],556:[function(_dereq_,module,exports){ -// stringmap.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013 Olov Lassus <olov.lassus@gmail.com> - -var StringMap = (function() { - "use strict"; - - // to save us a few characters - var hasOwnProperty = Object.prototype.hasOwnProperty; - - var create = (function() { - function hasOwnEnumerableProps(obj) { - for (var prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - return true; - } - } - return false; - } - // FF <= 3.6: - // o = {}; o.hasOwnProperty("__proto__" or "__count__" or "__parent__") => true - // o = {"__proto__": null}; Object.prototype.hasOwnProperty.call(o, "__proto__" or "__count__" or "__parent__") => false - function hasOwnPollutedProps(obj) { - return hasOwnProperty.call(obj, "__count__") || hasOwnProperty.call(obj, "__parent__"); - } - - var useObjectCreate = false; - if (typeof Object.create === "function") { - if (!hasOwnEnumerableProps(Object.create(null))) { - useObjectCreate = true; - } - } - if (useObjectCreate === false) { - if (hasOwnEnumerableProps({})) { - throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues"); - } - } - // no throw yet means we can create objects without own enumerable props (safe-guard against VMs and shims) - - var o = (useObjectCreate ? Object.create(null) : {}); - var useProtoClear = false; - if (hasOwnPollutedProps(o)) { - o.__proto__ = null; - if (hasOwnEnumerableProps(o) || hasOwnPollutedProps(o)) { - throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues"); - } - useProtoClear = true; - } - // no throw yet means we can create objects without own polluted props (safe-guard against VMs and shims) - - return function() { - var o = (useObjectCreate ? Object.create(null) : {}); - if (useProtoClear) { - o.__proto__ = null; - } - return o; - }; - })(); - - // stringmap ctor - function stringmap(optional_object) { - // use with or without new - if (!(this instanceof stringmap)) { - return new stringmap(optional_object); - } - this.obj = create(); - this.hasProto = false; // false (no __proto__ key) or true (has __proto__ key) - this.proto = undefined; // value for __proto__ key when hasProto is true, undefined otherwise - - if (optional_object) { - this.setMany(optional_object); - } - }; - - // primitive methods that deals with data representation - stringmap.prototype.has = function(key) { - // The type-check of key in has, get, set and delete is important because otherwise an object - // {toString: function() { return "__proto__"; }} can avoid the key === "__proto__" test. - // The alternative to type-checking would be to force string conversion, i.e. key = String(key); - if (typeof key !== "string") { - throw new Error("StringMap expected string key"); - } - return (key === "__proto__" ? - this.hasProto : - hasOwnProperty.call(this.obj, key)); - }; - - stringmap.prototype.get = function(key) { - if (typeof key !== "string") { - throw new Error("StringMap expected string key"); - } - return (key === "__proto__" ? - this.proto : - (hasOwnProperty.call(this.obj, key) ? this.obj[key] : undefined)); - }; - - stringmap.prototype.set = function(key, value) { - if (typeof key !== "string") { - throw new Error("StringMap expected string key"); - } - if (key === "__proto__") { - this.hasProto = true; - this.proto = value; - } else { - this.obj[key] = value; - } - }; - - stringmap.prototype.remove = function(key) { - if (typeof key !== "string") { - throw new Error("StringMap expected string key"); - } - var didExist = this.has(key); - if (key === "__proto__") { - this.hasProto = false; - this.proto = undefined; - } else { - delete this.obj[key]; - } - return didExist; - }; - - // alias remove to delete but beware: - // sm.delete("key"); // OK in ES5 and later - // sm['delete']("key"); // OK in all ES versions - // sm.remove("key"); // OK in all ES versions - stringmap.prototype['delete'] = stringmap.prototype.remove; - - stringmap.prototype.isEmpty = function() { - for (var key in this.obj) { - if (hasOwnProperty.call(this.obj, key)) { - return false; - } - } - return !this.hasProto; - }; - - stringmap.prototype.size = function() { - var len = 0; - for (var key in this.obj) { - if (hasOwnProperty.call(this.obj, key)) { - ++len; - } - } - return (this.hasProto ? len + 1 : len); - }; - - stringmap.prototype.keys = function() { - var keys = []; - for (var key in this.obj) { - if (hasOwnProperty.call(this.obj, key)) { - keys.push(key); - } - } - if (this.hasProto) { - keys.push("__proto__"); - } - return keys; - }; - - stringmap.prototype.values = function() { - var values = []; - for (var key in this.obj) { - if (hasOwnProperty.call(this.obj, key)) { - values.push(this.obj[key]); - } - } - if (this.hasProto) { - values.push(this.proto); - } - return values; - }; - - stringmap.prototype.items = function() { - var items = []; - for (var key in this.obj) { - if (hasOwnProperty.call(this.obj, key)) { - items.push([key, this.obj[key]]); - } - } - if (this.hasProto) { - items.push(["__proto__", this.proto]); - } - return items; - }; - - - // methods that rely on the above primitives - stringmap.prototype.setMany = function(object) { - if (object === null || (typeof object !== "object" && typeof object !== "function")) { - throw new Error("StringMap expected Object"); - } - for (var key in object) { - if (hasOwnProperty.call(object, key)) { - this.set(key, object[key]); - } - } - return this; - }; - - stringmap.prototype.merge = function(other) { - var keys = other.keys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - this.set(key, other.get(key)); - } - return this; - }; - - stringmap.prototype.map = function(fn) { - var keys = this.keys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - keys[i] = fn(this.get(key), key); // re-use keys array for results - } - return keys; - }; - - stringmap.prototype.forEach = function(fn) { - var keys = this.keys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - fn(this.get(key), key); - } - }; - - stringmap.prototype.clone = function() { - var other = stringmap(); - return other.merge(this); - }; - - stringmap.prototype.toString = function() { - var self = this; - return "{" + this.keys().map(function(key) { - return JSON.stringify(key) + ":" + JSON.stringify(self.get(key)); - }).join(",") + "}"; - }; - - return stringmap; -})(); - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = StringMap; -} - -},{}],557:[function(_dereq_,module,exports){ -// stringset.js -// MIT licensed, see LICENSE file -// Copyright (c) 2013 Olov Lassus <olov.lassus@gmail.com> - -var StringSet = (function() { - "use strict"; - - // to save us a few characters - var hasOwnProperty = Object.prototype.hasOwnProperty; - - var create = (function() { - function hasOwnEnumerableProps(obj) { - for (var prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - return true; - } - } - return false; - } - - // FF <= 3.6: - // o = {}; o.hasOwnProperty("__proto__" or "__count__" or "__parent__") => true - // o = {"__proto__": null}; Object.prototype.hasOwnProperty.call(o, "__proto__" or "__count__" or "__parent__") => false - function hasOwnPollutedProps(obj) { - return hasOwnProperty.call(obj, "__count__") || hasOwnProperty.call(obj, "__parent__"); - } - - var useObjectCreate = false; - if (typeof Object.create === "function") { - if (!hasOwnEnumerableProps(Object.create(null))) { - useObjectCreate = true; - } - } - if (useObjectCreate === false) { - if (hasOwnEnumerableProps({})) { - throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues"); - } - } - // no throw yet means we can create objects without own enumerable props (safe-guard against VMs and shims) - - var o = (useObjectCreate ? Object.create(null) : {}); - var useProtoClear = false; - if (hasOwnPollutedProps(o)) { - o.__proto__ = null; - if (hasOwnEnumerableProps(o) || hasOwnPollutedProps(o)) { - throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues"); - } - useProtoClear = true; - } - // no throw yet means we can create objects without own polluted props (safe-guard against VMs and shims) - - return function() { - var o = (useObjectCreate ? Object.create(null) : {}); - if (useProtoClear) { - o.__proto__ = null; - } - return o; - }; - })(); - - // stringset ctor - function stringset(optional_array) { - // use with or without new - if (!(this instanceof stringset)) { - return new stringset(optional_array); - } - this.obj = create(); - this.hasProto = false; // false (no __proto__ item) or true (has __proto__ item) - - if (optional_array) { - this.addMany(optional_array); - } - }; - - // primitive methods that deals with data representation - stringset.prototype.has = function(item) { - // The type-check of item in has, get, set and delete is important because otherwise an object - // {toString: function() { return "__proto__"; }} can avoid the item === "__proto__" test. - // The alternative to type-checking would be to force string conversion, i.e. item = String(item); - if (typeof item !== "string") { - throw new Error("StringSet expected string item"); - } - return (item === "__proto__" ? - this.hasProto : - hasOwnProperty.call(this.obj, item)); - }; - - stringset.prototype.add = function(item) { - if (typeof item !== "string") { - throw new Error("StringSet expected string item"); - } - if (item === "__proto__") { - this.hasProto = true; - } else { - this.obj[item] = true; - } - }; - - stringset.prototype.remove = function(item) { - if (typeof item !== "string") { - throw new Error("StringSet expected string item"); - } - var didExist = this.has(item); - if (item === "__proto__") { - this.hasProto = false; - } else { - delete this.obj[item]; - } - return didExist; - }; - - // alias remove to delete but beware: - // ss.delete("key"); // OK in ES5 and later - // ss['delete']("key"); // OK in all ES versions - // ss.remove("key"); // OK in all ES versions - stringset.prototype['delete'] = stringset.prototype.remove; - - stringset.prototype.isEmpty = function() { - for (var item in this.obj) { - if (hasOwnProperty.call(this.obj, item)) { - return false; - } - } - return !this.hasProto; - }; - - stringset.prototype.size = function() { - var len = 0; - for (var item in this.obj) { - if (hasOwnProperty.call(this.obj, item)) { - ++len; - } - } - return (this.hasProto ? len + 1 : len); - }; - - stringset.prototype.items = function() { - var items = []; - for (var item in this.obj) { - if (hasOwnProperty.call(this.obj, item)) { - items.push(item); - } - } - if (this.hasProto) { - items.push("__proto__"); - } - return items; - }; - - - // methods that rely on the above primitives - stringset.prototype.addMany = function(items) { - if (!Array.isArray(items)) { - throw new Error("StringSet expected array"); - } - for (var i = 0; i < items.length; i++) { - this.add(items[i]); - } - return this; - }; - - stringset.prototype.merge = function(other) { - this.addMany(other.items()); - return this; - }; - - stringset.prototype.clone = function() { - var other = stringset(); - return other.merge(this); - }; - - stringset.prototype.toString = function() { - return "{" + this.items().map(JSON.stringify).join(",") + "}"; - }; - - return stringset; -})(); - -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { - module.exports = StringSet; -} - -},{}],558:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var types = _dereq_(566); -var n = types.namedTypes; -var isArray = types.builtInTypes.array; -var isObject = types.builtInTypes.object; -var linesModule = _dereq_(560); -var fromString = linesModule.fromString; -var Lines = linesModule.Lines; -var concat = linesModule.concat; -var util = _dereq_(567); -var comparePos = util.comparePos; -var childNodesCacheKey = _dereq_(536).makeUniqueKey(); - -// TODO Move a non-caching implementation of this function into ast-types, -// and implement a caching wrapper function here. -function getSortedChildNodes(node, resultArray) { - if (!node) { - return; - } - - // The .loc checks below are sensitive to some of the problems that - // are fixed by this utility function. Specifically, if it decides to - // set node.loc to null, indicating that the node's .loc information - // is unreliable, then we don't want to add node to the resultArray. - util.fixFaultyLocations(node); - - if (resultArray) { - if (n.Node.check(node) && - n.SourceLocation.check(node.loc)) { - // This reverse insertion sort almost always takes constant - // time because we almost always (maybe always?) append the - // nodes in order anyway. - for (var i = resultArray.length - 1; i >= 0; --i) { - if (comparePos(resultArray[i].loc.end, - node.loc.start) <= 0) { - break; - } - } - resultArray.splice(i + 1, 0, node); - return; - } - } else if (node[childNodesCacheKey]) { - return node[childNodesCacheKey]; - } - - var names; - if (isArray.check(node)) { - names = Object.keys(node); - } else if (isObject.check(node)) { - names = types.getFieldNames(node); - } else { - return; - } - - if (!resultArray) { - Object.defineProperty(node, childNodesCacheKey, { - value: resultArray = [], - enumerable: false - }); - } - - for (var i = 0, nameCount = names.length; i < nameCount; ++i) { - getSortedChildNodes(node[names[i]], resultArray); - } - - return resultArray; -} - -// As efficiently as possible, decorate the comment object with -// .precedingNode, .enclosingNode, and/or .followingNode properties, at -// least one of which is guaranteed to be defined. -function decorateComment(node, comment) { - var childNodes = getSortedChildNodes(node); - - // Time to dust off the old binary search robes and wizard hat. - var left = 0, right = childNodes.length; - while (left < right) { - var middle = (left + right) >> 1; - var child = childNodes[middle]; - - if (comparePos(child.loc.start, comment.loc.start) <= 0 && - comparePos(comment.loc.end, child.loc.end) <= 0) { - // The comment is completely contained by this child node. - decorateComment(comment.enclosingNode = child, comment); - return; // Abandon the binary search at this level. - } - - if (comparePos(child.loc.end, comment.loc.start) <= 0) { - // This child node falls completely before the comment. - // Because we will never consider this node or any nodes - // before it again, this node must be the closest preceding - // node we have encountered so far. - var precedingNode = child; - left = middle + 1; - continue; - } - - if (comparePos(comment.loc.end, child.loc.start) <= 0) { - // This child node falls completely after the comment. - // Because we will never consider this node or any nodes after - // it again, this node must be the closest following node we - // have encountered so far. - var followingNode = child; - right = middle; - continue; - } - - throw new Error("Comment location overlaps with node location"); - } - - if (precedingNode) { - comment.precedingNode = precedingNode; - } - - if (followingNode) { - comment.followingNode = followingNode; - } -} - -exports.attach = function(comments, ast, lines) { - if (!isArray.check(comments)) { - return; - } - - var tiesToBreak = []; - - comments.forEach(function(comment) { - comment.loc.lines = lines; - decorateComment(ast, comment); - - var pn = comment.precedingNode; - var en = comment.enclosingNode; - var fn = comment.followingNode; - - if (pn && fn) { - var tieCount = tiesToBreak.length; - if (tieCount > 0) { - var lastTie = tiesToBreak[tieCount - 1]; - - assert.strictEqual( - lastTie.precedingNode === comment.precedingNode, - lastTie.followingNode === comment.followingNode - ); - - if (lastTie.followingNode !== comment.followingNode) { - breakTies(tiesToBreak, lines); - } - } - - tiesToBreak.push(comment); - - } else if (pn) { - // No contest: we have a trailing comment. - breakTies(tiesToBreak, lines); - addTrailingComment(pn, comment); - - } else if (fn) { - // No contest: we have a leading comment. - breakTies(tiesToBreak, lines); - addLeadingComment(fn, comment); - - } else if (en) { - // The enclosing node has no child nodes at all, so what we - // have here is a dangling comment, e.g. [/* crickets */]. - breakTies(tiesToBreak, lines); - addDanglingComment(en, comment); - - } else { - throw new Error("AST contains no nodes at all?"); - } - }); - - breakTies(tiesToBreak, lines); - - comments.forEach(function(comment) { - // These node references were useful for breaking ties, but we - // don't need them anymore, and they create cycles in the AST that - // may lead to infinite recursion if we don't delete them here. - delete comment.precedingNode; - delete comment.enclosingNode; - delete comment.followingNode; - }); -}; - -function breakTies(tiesToBreak, lines) { - var tieCount = tiesToBreak.length; - if (tieCount === 0) { - return; - } - - var pn = tiesToBreak[0].precedingNode; - var fn = tiesToBreak[0].followingNode; - var gapEndPos = fn.loc.start; - - // Iterate backwards through tiesToBreak, examining the gaps - // between the tied comments. In order to qualify as leading, a - // comment must be separated from fn by an unbroken series of - // whitespace-only gaps (or other comments). - for (var indexOfFirstLeadingComment = tieCount; - indexOfFirstLeadingComment > 0; - --indexOfFirstLeadingComment) { - var comment = tiesToBreak[indexOfFirstLeadingComment - 1]; - assert.strictEqual(comment.precedingNode, pn); - assert.strictEqual(comment.followingNode, fn); - - var gap = lines.sliceString(comment.loc.end, gapEndPos); - if (/\S/.test(gap)) { - // The gap string contained something other than whitespace. - break; - } - - gapEndPos = comment.loc.start; - } - - while (indexOfFirstLeadingComment <= tieCount && - (comment = tiesToBreak[indexOfFirstLeadingComment]) && - // If the comment is a //-style comment and indented more - // deeply than the node itself, reconsider it as trailing. - comment.type === "Line" && - comment.loc.start.column > fn.loc.start.column) { - ++indexOfFirstLeadingComment; - } - - tiesToBreak.forEach(function(comment, i) { - if (i < indexOfFirstLeadingComment) { - addTrailingComment(pn, comment); - } else { - addLeadingComment(fn, comment); - } - }); - - tiesToBreak.length = 0; -} - -function addCommentHelper(node, comment) { - var comments = node.comments || (node.comments = []); - comments.push(comment); -} - -function addLeadingComment(node, comment) { - comment.leading = true; - comment.trailing = false; - addCommentHelper(node, comment); -} - -function addDanglingComment(node, comment) { - comment.leading = false; - comment.trailing = false; - addCommentHelper(node, comment); -} - -function addTrailingComment(node, comment) { - comment.leading = false; - comment.trailing = true; - addCommentHelper(node, comment); -} - -function printLeadingComment(commentPath, print) { - var comment = commentPath.getValue(); - n.Comment.assert(comment); - - var loc = comment.loc; - var lines = loc && loc.lines; - var parts = [print(commentPath)]; - - if (comment.trailing) { - // When we print trailing comments as leading comments, we don't - // want to bring any trailing spaces along. - parts.push("\n"); - - } else if (lines instanceof Lines) { - var trailingSpace = lines.slice( - loc.end, - lines.skipSpaces(loc.end) - ); - - if (trailingSpace.length === 1) { - // If the trailing space contains no newlines, then we want to - // preserve it exactly as we found it. - parts.push(trailingSpace); - } else { - // If the trailing space contains newlines, then replace it - // with just that many newlines, with all other spaces removed. - parts.push(new Array(trailingSpace.length).join("\n")); - } - - } else { - parts.push("\n"); - } - - return concat(parts); -} - -function printTrailingComment(commentPath, print) { - var comment = commentPath.getValue(commentPath); - n.Comment.assert(comment); - - var loc = comment.loc; - var lines = loc && loc.lines; - var parts = []; - - if (lines instanceof Lines) { - var fromPos = lines.skipSpaces(loc.start, true) || lines.firstPos(); - var leadingSpace = lines.slice(fromPos, loc.start); - - if (leadingSpace.length === 1) { - // If the leading space contains no newlines, then we want to - // preserve it exactly as we found it. - parts.push(leadingSpace); - } else { - // If the leading space contains newlines, then replace it - // with just that many newlines, sans all other spaces. - parts.push(new Array(leadingSpace.length).join("\n")); - } - } - - parts.push(print(commentPath)); - - return concat(parts); -} - -exports.printComments = function(path, print) { - var value = path.getValue(); - var innerLines = print(path); - var comments = n.Node.check(value) && - types.getFieldValue(value, "comments"); - - if (!comments || comments.length === 0) { - return innerLines; - } - - var leadingParts = []; - var trailingParts = [innerLines]; - - path.each(function(commentPath) { - var comment = commentPath.getValue(); - var leading = types.getFieldValue(comment, "leading"); - var trailing = types.getFieldValue(comment, "trailing"); - - if (leading || (trailing && comment.type !== "Block")) { - leadingParts.push(printLeadingComment(commentPath, print)); - } else if (trailing) { - assert.strictEqual(comment.type, "Block"); - trailingParts.push(printTrailingComment(commentPath, print)); - } - }, "comments"); - - leadingParts.push.apply(leadingParts, trailingParts); - return concat(leadingParts); -}; - -},{"2":2,"536":536,"560":560,"566":566,"567":567}],559:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var types = _dereq_(566); -var n = types.namedTypes; -var Node = n.Node; -var isArray = types.builtInTypes.array; -var isNumber = types.builtInTypes.number; - -function FastPath(value) { - assert.ok(this instanceof FastPath); - this.stack = [value]; -} - -var FPp = FastPath.prototype; -module.exports = FastPath; - -// Static convenience function for coercing a value to a FastPath. -FastPath.from = function(obj) { - if (obj instanceof FastPath) { - // Return a defensive copy of any existing FastPath instances. - return obj.copy(); - } - - if (obj instanceof types.NodePath) { - // For backwards compatibility, unroll NodePath instances into - // lightweight FastPath [..., name, value] stacks. - var copy = Object.create(FastPath.prototype); - var stack = [obj.value]; - for (var pp; (pp = obj.parentPath); obj = pp) - stack.push(obj.name, pp.value); - copy.stack = stack.reverse(); - return copy; - } - - // Otherwise use obj as the value of the new FastPath instance. - return new FastPath(obj); -}; - -FPp.copy = function copy() { - var copy = Object.create(FastPath.prototype); - copy.stack = this.stack.slice(0); - return copy; -}; - -// The name of the current property is always the penultimate element of -// this.stack, and always a String. -FPp.getName = function getName() { - var s = this.stack; - var len = s.length; - if (len > 1) { - return s[len - 2]; - } - // Since the name is always a string, null is a safe sentinel value to - // return if we do not know the name of the (root) value. - return null; -}; - -// The value of the current property is always the final element of -// this.stack. -FPp.getValue = function getValue() { - var s = this.stack; - return s[s.length - 1]; -}; - -function getNodeHelper(path, count) { - var s = path.stack; - - for (var i = s.length - 1; i >= 0; i -= 2) { - var value = s[i]; - if (n.Node.check(value) && --count < 0) { - return value; - } - } - - return null; -} - -FPp.getNode = function getNode(count) { - return getNodeHelper(this, ~~count); -}; - -FPp.getParentNode = function getParentNode(count) { - return getNodeHelper(this, ~~count + 1); -}; - -// The length of the stack can be either even or odd, depending on whether -// or not we have a name for the root value. The difference between the -// index of the root value and the index of the final value is always -// even, though, which allows us to return the root value in constant time -// (i.e. without iterating backwards through the stack). -FPp.getRootValue = function getRootValue() { - var s = this.stack; - if (s.length % 2 === 0) { - return s[1]; - } - return s[0]; -}; - -// Temporarily push properties named by string arguments given after the -// callback function onto this.stack, then call the callback with a -// reference to this (modified) FastPath object. Note that the stack will -// be restored to its original state after the callback is finished, so it -// is probably a mistake to retain a reference to the path. -FPp.call = function call(callback/*, name1, name2, ... */) { - var s = this.stack; - var origLen = s.length; - var value = s[origLen - 1]; - var argc = arguments.length; - for (var i = 1; i < argc; ++i) { - var name = arguments[i]; - value = value[name]; - s.push(name, value); - } - var result = callback(this); - s.length = origLen; - return result; -}; - -// Similar to FastPath.prototype.call, except that the value obtained by -// accessing this.getValue()[name1][name2]... should be array-like. The -// callback will be called with a reference to this path object for each -// element of the array. -FPp.each = function each(callback/*, name1, name2, ... */) { - var s = this.stack; - var origLen = s.length; - var value = s[origLen - 1]; - var argc = arguments.length; - - for (var i = 1; i < argc; ++i) { - var name = arguments[i]; - value = value[name]; - s.push(name, value); - } - - for (var i = 0; i < value.length; ++i) { - if (i in value) { - s.push(i, value[i]); - // If the callback needs to know the value of i, call - // path.getName(), assuming path is the parameter name. - callback(this); - s.length -= 2; - } - } - - s.length = origLen; -}; - -// Similar to FastPath.prototype.each, except that the results of the -// callback function invocations are stored in an array and returned at -// the end of the iteration. -FPp.map = function map(callback/*, name1, name2, ... */) { - var s = this.stack; - var origLen = s.length; - var value = s[origLen - 1]; - var argc = arguments.length; - - for (var i = 1; i < argc; ++i) { - var name = arguments[i]; - value = value[name]; - s.push(name, value); - } - - var result = new Array(value.length); - - for (var i = 0; i < value.length; ++i) { - if (i in value) { - s.push(i, value[i]); - result[i] = callback(this, i); - s.length -= 2; - } - } - - s.length = origLen; - - return result; -}; - -// Inspired by require("ast-types").NodePath.prototype.needsParens, but -// more efficient because we're iterating backwards through a stack. -FPp.needsParens = function(assumeExpressionContext) { - var parent = this.getParentNode(); - if (!parent) { - return false; - } - - var name = this.getName(); - var node = this.getNode(); - - // If the value of this path is some child of a Node and not a Node - // itself, then it doesn't need parentheses. Only Node objects (in - // fact, only Expression nodes) need parentheses. - if (this.getValue() !== node) { - return false; - } - - // Only expressions need parentheses. - if (!n.Expression.check(node)) { - return false; - } - - // Identifiers never need parentheses. - if (node.type === "Identifier") { - return false; - } - - if (parent.type === "ParenthesizedExpression") { - return false; - } - - switch (node.type) { - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - return parent.type === "MemberExpression" - && name === "object" - && parent.object === node; - - case "BinaryExpression": - case "LogicalExpression": - switch (parent.type) { - case "CallExpression": - return name === "callee" - && parent.callee === node; - - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - return true; - - case "MemberExpression": - return name === "object" - && parent.object === node; - - case "BinaryExpression": - case "LogicalExpression": - var po = parent.operator; - var pp = PRECEDENCE[po]; - var no = node.operator; - var np = PRECEDENCE[no]; - - if (pp > np) { - return true; - } - - if (pp === np && name === "right") { - assert.strictEqual(parent.right, node); - return true; - } - - default: - return false; - } - - case "SequenceExpression": - switch (parent.type) { - case "ForStatement": - // Although parentheses wouldn't hurt around sequence - // expressions in the head of for loops, traditional style - // dictates that e.g. i++, j++ should not be wrapped with - // parentheses. - return false; - - case "ExpressionStatement": - return name !== "expression"; - - default: - // Otherwise err on the side of overparenthesization, adding - // explicit exceptions above if this proves overzealous. - return true; - } - - case "YieldExpression": - switch (parent.type) { - case "BinaryExpression": - case "LogicalExpression": - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - case "CallExpression": - case "MemberExpression": - case "NewExpression": - case "ConditionalExpression": - case "YieldExpression": - return true; - - default: - return false; - } - - case "Literal": - return parent.type === "MemberExpression" - && isNumber.check(node.value) - && name === "object" - && parent.object === node; - - case "AssignmentExpression": - case "ConditionalExpression": - switch (parent.type) { - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - case "BinaryExpression": - case "LogicalExpression": - return true; - - case "CallExpression": - return name === "callee" - && parent.callee === node; - - case "ConditionalExpression": - return name === "test" - && parent.test === node; - - case "MemberExpression": - return name === "object" - && parent.object === node; - - default: - return false; - } - - case "ArrowFunctionExpression": - return isBinary(parent); - - case "ObjectExpression": - if (parent.type === "ArrowFunctionExpression" && - name === "body") { - return true; - } - - default: - if (parent.type === "NewExpression" && - name === "callee" && - parent.callee === node) { - return containsCallExpression(node); - } - } - - if (assumeExpressionContext !== true && - !this.canBeFirstInStatement() && - this.firstInStatement()) - return true; - - return false; -}; - -function isBinary(node) { - return n.BinaryExpression.check(node) - || n.LogicalExpression.check(node); -} - -function isUnaryLike(node) { - return n.UnaryExpression.check(node) - // I considered making SpreadElement and SpreadProperty subtypes - // of UnaryExpression, but they're not really Expression nodes. - || (n.SpreadElement && n.SpreadElement.check(node)) - || (n.SpreadProperty && n.SpreadProperty.check(node)); -} - -var PRECEDENCE = {}; -[["||"], - ["&&"], - ["|"], - ["^"], - ["&"], - ["==", "===", "!=", "!=="], - ["<", ">", "<=", ">=", "in", "instanceof"], - [">>", "<<", ">>>"], - ["+", "-"], - ["*", "/", "%"] -].forEach(function(tier, i) { - tier.forEach(function(op) { - PRECEDENCE[op] = i; - }); -}); - -function containsCallExpression(node) { - if (n.CallExpression.check(node)) { - return true; - } - - if (isArray.check(node)) { - return node.some(containsCallExpression); - } - - if (n.Node.check(node)) { - return types.someField(node, function(name, child) { - return containsCallExpression(child); - }); - } - - return false; -} - -FPp.canBeFirstInStatement = function() { - var node = this.getNode(); - return !n.FunctionExpression.check(node) - && !n.ObjectExpression.check(node); -}; - -FPp.firstInStatement = function() { - var s = this.stack; - var parentName, parent; - var childName, child; - - for (var i = s.length - 1; i >= 0; i -= 2) { - if (n.Node.check(s[i])) { - childName = parentName; - child = parent; - parentName = s[i - 1]; - parent = s[i]; - } - - if (!parent || !child) { - continue; - } - - if (n.BlockStatement.check(parent) && - parentName === "body" && - childName === 0) { - assert.strictEqual(parent.body[0], child); - return true; - } - - if (n.ExpressionStatement.check(parent) && - childName === "expression") { - assert.strictEqual(parent.expression, child); - return true; - } - - if (n.SequenceExpression.check(parent) && - parentName === "expressions" && - childName === 0) { - assert.strictEqual(parent.expressions[0], child); - continue; - } - - if (n.CallExpression.check(parent) && - childName === "callee") { - assert.strictEqual(parent.callee, child); - continue; - } - - if (n.MemberExpression.check(parent) && - childName === "object") { - assert.strictEqual(parent.object, child); - continue; - } - - if (n.ConditionalExpression.check(parent) && - childName === "test") { - assert.strictEqual(parent.test, child); - continue; - } - - if (isBinary(parent) && - childName === "left") { - assert.strictEqual(parent.left, child); - continue; - } - - if (n.UnaryExpression.check(parent) && - !parent.prefix && - childName === "argument") { - assert.strictEqual(parent.argument, child); - continue; - } - - return false; - } - - return true; -}; - -},{"2":2,"566":566}],560:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var sourceMap = _dereq_(607); -var normalizeOptions = _dereq_(562).normalize; -var secretKey = _dereq_(536).makeUniqueKey(); -var types = _dereq_(566); -var isString = types.builtInTypes.string; -var comparePos = _dereq_(567).comparePos; -var Mapping = _dereq_(561); - -// Goals: -// 1. Minimize new string creation. -// 2. Keep (de)identation O(lines) time. -// 3. Permit negative indentations. -// 4. Enforce immutability. -// 5. No newline characters. - -function getSecret(lines) { - return lines[secretKey]; -} - -function Lines(infos, sourceFileName) { - assert.ok(this instanceof Lines); - assert.ok(infos.length > 0); - - if (sourceFileName) { - isString.assert(sourceFileName); - } else { - sourceFileName = null; - } - - Object.defineProperty(this, secretKey, { - value: { - infos: infos, - mappings: [], - name: sourceFileName, - cachedSourceMap: null - } - }); - - if (sourceFileName) { - getSecret(this).mappings.push(new Mapping(this, { - start: this.firstPos(), - end: this.lastPos() - })); - } -} - -// Exposed for instanceof checks. The fromString function should be used -// to create new Lines objects. -exports.Lines = Lines; -var Lp = Lines.prototype; - -// These properties used to be assigned to each new object in the Lines -// constructor, but we can more efficiently stuff them into the secret and -// let these lazy accessors compute their values on-the-fly. -Object.defineProperties(Lp, { - length: { - get: function() { - return getSecret(this).infos.length; - } - }, - - name: { - get: function() { - return getSecret(this).name; - } - } -}); - -function copyLineInfo(info) { - return { - line: info.line, - indent: info.indent, - sliceStart: info.sliceStart, - sliceEnd: info.sliceEnd - }; -} - -var fromStringCache = {}; -var hasOwn = fromStringCache.hasOwnProperty; -var maxCacheKeyLen = 10; - -function countSpaces(spaces, tabWidth) { - var count = 0; - var len = spaces.length; - - for (var i = 0; i < len; ++i) { - switch (spaces.charCodeAt(i)) { - case 9: // '\t' - assert.strictEqual(typeof tabWidth, "number"); - assert.ok(tabWidth > 0); - - var next = Math.ceil(count / tabWidth) * tabWidth; - if (next === count) { - count += tabWidth; - } else { - count = next; - } - - break; - - case 11: // '\v' - case 12: // '\f' - case 13: // '\r' - case 0xfeff: // zero-width non-breaking space - // These characters contribute nothing to indentation. - break; - - case 32: // ' ' - default: // Treat all other whitespace like ' '. - count += 1; - break; - } - } - - return count; -} -exports.countSpaces = countSpaces; - -var leadingSpaceExp = /^\s*/; - -// As specified here: http://www.ecma-international.org/ecma-262/6.0/#sec-line-terminators -var lineTerminatorSeqExp = - /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/; - -/** - * @param {Object} options - Options object that configures printing. - */ -function fromString(string, options) { - if (string instanceof Lines) - return string; - - string += ""; - - var tabWidth = options && options.tabWidth; - var tabless = string.indexOf("\t") < 0; - var cacheable = !options && tabless && (string.length <= maxCacheKeyLen); - - assert.ok(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string); - - if (cacheable && hasOwn.call(fromStringCache, string)) - return fromStringCache[string]; - - var lines = new Lines(string.split(lineTerminatorSeqExp).map(function(line) { - var spaces = leadingSpaceExp.exec(line)[0]; - return { - line: line, - indent: countSpaces(spaces, tabWidth), - sliceStart: spaces.length, - sliceEnd: line.length - }; - }), normalizeOptions(options).sourceFileName); - - if (cacheable) - fromStringCache[string] = lines; - - return lines; -} -exports.fromString = fromString; - -function isOnlyWhitespace(string) { - return !/\S/.test(string); -} - -Lp.toString = function(options) { - return this.sliceString(this.firstPos(), this.lastPos(), options); -}; - -Lp.getSourceMap = function(sourceMapName, sourceRoot) { - if (!sourceMapName) { - // Although we could make up a name or generate an anonymous - // source map, instead we assume that any consumer who does not - // provide a name does not actually want a source map. - return null; - } - - var targetLines = this; - - function updateJSON(json) { - json = json || {}; - - isString.assert(sourceMapName); - json.file = sourceMapName; - - if (sourceRoot) { - isString.assert(sourceRoot); - json.sourceRoot = sourceRoot; - } - - return json; - } - - var secret = getSecret(targetLines); - if (secret.cachedSourceMap) { - // Since Lines objects are immutable, we can reuse any source map - // that was previously generated. Nevertheless, we return a new - // JSON object here to protect the cached source map from outside - // modification. - return updateJSON(secret.cachedSourceMap.toJSON()); - } - - var smg = new sourceMap.SourceMapGenerator(updateJSON()); - var sourcesToContents = {}; - - secret.mappings.forEach(function(mapping) { - var sourceCursor = mapping.sourceLines.skipSpaces( - mapping.sourceLoc.start - ) || mapping.sourceLines.lastPos(); - - var targetCursor = targetLines.skipSpaces( - mapping.targetLoc.start - ) || targetLines.lastPos(); - - while (comparePos(sourceCursor, mapping.sourceLoc.end) < 0 && - comparePos(targetCursor, mapping.targetLoc.end) < 0) { - - var sourceChar = mapping.sourceLines.charAt(sourceCursor); - var targetChar = targetLines.charAt(targetCursor); - assert.strictEqual(sourceChar, targetChar); - - var sourceName = mapping.sourceLines.name; - - // Add mappings one character at a time for maximum resolution. - smg.addMapping({ - source: sourceName, - original: { line: sourceCursor.line, - column: sourceCursor.column }, - generated: { line: targetCursor.line, - column: targetCursor.column } - }); - - if (!hasOwn.call(sourcesToContents, sourceName)) { - var sourceContent = mapping.sourceLines.toString(); - smg.setSourceContent(sourceName, sourceContent); - sourcesToContents[sourceName] = sourceContent; - } - - targetLines.nextPos(targetCursor, true); - mapping.sourceLines.nextPos(sourceCursor, true); - } - }); - - secret.cachedSourceMap = smg; - - return smg.toJSON(); -}; - -Lp.bootstrapCharAt = function(pos) { - assert.strictEqual(typeof pos, "object"); - assert.strictEqual(typeof pos.line, "number"); - assert.strictEqual(typeof pos.column, "number"); - - var line = pos.line, - column = pos.column, - strings = this.toString().split(lineTerminatorSeqExp), - string = strings[line - 1]; - - if (typeof string === "undefined") - return ""; - - if (column === string.length && - line < strings.length) - return "\n"; - - if (column >= string.length) - return ""; - - return string.charAt(column); -}; - -Lp.charAt = function(pos) { - assert.strictEqual(typeof pos, "object"); - assert.strictEqual(typeof pos.line, "number"); - assert.strictEqual(typeof pos.column, "number"); - - var line = pos.line, - column = pos.column, - secret = getSecret(this), - infos = secret.infos, - info = infos[line - 1], - c = column; - - if (typeof info === "undefined" || c < 0) - return ""; - - var indent = this.getIndentAt(line); - if (c < indent) - return " "; - - c += info.sliceStart - indent; - - if (c === info.sliceEnd && - line < this.length) - return "\n"; - - if (c >= info.sliceEnd) - return ""; - - return info.line.charAt(c); -}; - -Lp.stripMargin = function(width, skipFirstLine) { - if (width === 0) - return this; - - assert.ok(width > 0, "negative margin: " + width); - - if (skipFirstLine && this.length === 1) - return this; - - var secret = getSecret(this); - - var lines = new Lines(secret.infos.map(function(info, i) { - if (info.line && (i > 0 || !skipFirstLine)) { - info = copyLineInfo(info); - info.indent = Math.max(0, info.indent - width); - } - return info; - })); - - if (secret.mappings.length > 0) { - var newMappings = getSecret(lines).mappings; - assert.strictEqual(newMappings.length, 0); - secret.mappings.forEach(function(mapping) { - newMappings.push(mapping.indent(width, skipFirstLine, true)); - }); - } - - return lines; -}; - -Lp.indent = function(by) { - if (by === 0) - return this; - - var secret = getSecret(this); - - var lines = new Lines(secret.infos.map(function(info) { - if (info.line) { - info = copyLineInfo(info); - info.indent += by; - } - return info - })); - - if (secret.mappings.length > 0) { - var newMappings = getSecret(lines).mappings; - assert.strictEqual(newMappings.length, 0); - secret.mappings.forEach(function(mapping) { - newMappings.push(mapping.indent(by)); - }); - } - - return lines; -}; - -Lp.indentTail = function(by) { - if (by === 0) - return this; - - if (this.length < 2) - return this; - - var secret = getSecret(this); - - var lines = new Lines(secret.infos.map(function(info, i) { - if (i > 0 && info.line) { - info = copyLineInfo(info); - info.indent += by; - } - - return info; - })); - - if (secret.mappings.length > 0) { - var newMappings = getSecret(lines).mappings; - assert.strictEqual(newMappings.length, 0); - secret.mappings.forEach(function(mapping) { - newMappings.push(mapping.indent(by, true)); - }); - } - - return lines; -}; - -Lp.getIndentAt = function(line) { - assert.ok(line >= 1, "no line " + line + " (line numbers start from 1)"); - var secret = getSecret(this), - info = secret.infos[line - 1]; - return Math.max(info.indent, 0); -}; - -Lp.guessTabWidth = function() { - var secret = getSecret(this); - if (hasOwn.call(secret, "cachedTabWidth")) { - return secret.cachedTabWidth; - } - - var counts = []; // Sparse array. - var lastIndent = 0; - - for (var line = 1, last = this.length; line <= last; ++line) { - var info = secret.infos[line - 1]; - var sliced = info.line.slice(info.sliceStart, info.sliceEnd); - - // Whitespace-only lines don't tell us much about the likely tab - // width of this code. - if (isOnlyWhitespace(sliced)) { - continue; - } - - var diff = Math.abs(info.indent - lastIndent); - counts[diff] = ~~counts[diff] + 1; - lastIndent = info.indent; - } - - var maxCount = -1; - var result = 2; - - for (var tabWidth = 1; - tabWidth < counts.length; - tabWidth += 1) { - if (hasOwn.call(counts, tabWidth) && - counts[tabWidth] > maxCount) { - maxCount = counts[tabWidth]; - result = tabWidth; - } - } - - return secret.cachedTabWidth = result; -}; - -Lp.isOnlyWhitespace = function() { - return isOnlyWhitespace(this.toString()); -}; - -Lp.isPrecededOnlyByWhitespace = function(pos) { - var secret = getSecret(this); - var info = secret.infos[pos.line - 1]; - var indent = Math.max(info.indent, 0); - - var diff = pos.column - indent; - if (diff <= 0) { - // If pos.column does not exceed the indentation amount, then - // there must be only whitespace before it. - return true; - } - - var start = info.sliceStart; - var end = Math.min(start + diff, info.sliceEnd); - var prefix = info.line.slice(start, end); - - return isOnlyWhitespace(prefix); -}; - -Lp.getLineLength = function(line) { - var secret = getSecret(this), - info = secret.infos[line - 1]; - return this.getIndentAt(line) + info.sliceEnd - info.sliceStart; -}; - -Lp.nextPos = function(pos, skipSpaces) { - var l = Math.max(pos.line, 0), - c = Math.max(pos.column, 0); - - if (c < this.getLineLength(l)) { - pos.column += 1; - - return skipSpaces - ? !!this.skipSpaces(pos, false, true) - : true; - } - - if (l < this.length) { - pos.line += 1; - pos.column = 0; - - return skipSpaces - ? !!this.skipSpaces(pos, false, true) - : true; - } - - return false; -}; - -Lp.prevPos = function(pos, skipSpaces) { - var l = pos.line, - c = pos.column; - - if (c < 1) { - l -= 1; - - if (l < 1) - return false; - - c = this.getLineLength(l); - - } else { - c = Math.min(c - 1, this.getLineLength(l)); - } - - pos.line = l; - pos.column = c; - - return skipSpaces - ? !!this.skipSpaces(pos, true, true) - : true; -}; - -Lp.firstPos = function() { - // Trivial, but provided for completeness. - return { line: 1, column: 0 }; -}; - -Lp.lastPos = function() { - return { - line: this.length, - column: this.getLineLength(this.length) - }; -}; - -Lp.skipSpaces = function(pos, backward, modifyInPlace) { - if (pos) { - pos = modifyInPlace ? pos : { - line: pos.line, - column: pos.column - }; - } else if (backward) { - pos = this.lastPos(); - } else { - pos = this.firstPos(); - } - - if (backward) { - while (this.prevPos(pos)) { - if (!isOnlyWhitespace(this.charAt(pos)) && - this.nextPos(pos)) { - return pos; - } - } - - return null; - - } else { - while (isOnlyWhitespace(this.charAt(pos))) { - if (!this.nextPos(pos)) { - return null; - } - } - - return pos; - } -}; - -Lp.trimLeft = function() { - var pos = this.skipSpaces(this.firstPos(), false, true); - return pos ? this.slice(pos) : emptyLines; -}; - -Lp.trimRight = function() { - var pos = this.skipSpaces(this.lastPos(), true, true); - return pos ? this.slice(this.firstPos(), pos) : emptyLines; -}; - -Lp.trim = function() { - var start = this.skipSpaces(this.firstPos(), false, true); - if (start === null) - return emptyLines; - - var end = this.skipSpaces(this.lastPos(), true, true); - assert.notStrictEqual(end, null); - - return this.slice(start, end); -}; - -Lp.eachPos = function(callback, startPos, skipSpaces) { - var pos = this.firstPos(); - - if (startPos) { - pos.line = startPos.line, - pos.column = startPos.column - } - - if (skipSpaces && !this.skipSpaces(pos, false, true)) { - return; // Encountered nothing but spaces. - } - - do callback.call(this, pos); - while (this.nextPos(pos, skipSpaces)); -}; - -Lp.bootstrapSlice = function(start, end) { - var strings = this.toString().split( - lineTerminatorSeqExp - ).slice( - start.line - 1, - end.line - ); - - strings.push(strings.pop().slice(0, end.column)); - strings[0] = strings[0].slice(start.column); - - return fromString(strings.join("\n")); -}; - -Lp.slice = function(start, end) { - if (!end) { - if (!start) { - // The client seems to want a copy of this Lines object, but - // Lines objects are immutable, so it's perfectly adequate to - // return the same object. - return this; - } - - // Slice to the end if no end position was provided. - end = this.lastPos(); - } - - var secret = getSecret(this); - var sliced = secret.infos.slice(start.line - 1, end.line); - - if (start.line === end.line) { - sliced[0] = sliceInfo(sliced[0], start.column, end.column); - } else { - assert.ok(start.line < end.line); - sliced[0] = sliceInfo(sliced[0], start.column); - sliced.push(sliceInfo(sliced.pop(), 0, end.column)); - } - - var lines = new Lines(sliced); - - if (secret.mappings.length > 0) { - var newMappings = getSecret(lines).mappings; - assert.strictEqual(newMappings.length, 0); - secret.mappings.forEach(function(mapping) { - var sliced = mapping.slice(this, start, end); - if (sliced) { - newMappings.push(sliced); - } - }, this); - } - - return lines; -}; - -function sliceInfo(info, startCol, endCol) { - var sliceStart = info.sliceStart; - var sliceEnd = info.sliceEnd; - var indent = Math.max(info.indent, 0); - var lineLength = indent + sliceEnd - sliceStart; - - if (typeof endCol === "undefined") { - endCol = lineLength; - } - - startCol = Math.max(startCol, 0); - endCol = Math.min(endCol, lineLength); - endCol = Math.max(endCol, startCol); - - if (endCol < indent) { - indent = endCol; - sliceEnd = sliceStart; - } else { - sliceEnd -= lineLength - endCol; - } - - lineLength = endCol; - lineLength -= startCol; - - if (startCol < indent) { - indent -= startCol; - } else { - startCol -= indent; - indent = 0; - sliceStart += startCol; - } - - assert.ok(indent >= 0); - assert.ok(sliceStart <= sliceEnd); - assert.strictEqual(lineLength, indent + sliceEnd - sliceStart); - - if (info.indent === indent && - info.sliceStart === sliceStart && - info.sliceEnd === sliceEnd) { - return info; - } - - return { - line: info.line, - indent: indent, - sliceStart: sliceStart, - sliceEnd: sliceEnd - }; -} - -Lp.bootstrapSliceString = function(start, end, options) { - return this.slice(start, end).toString(options); -}; - -Lp.sliceString = function(start, end, options) { - if (!end) { - if (!start) { - // The client seems to want a copy of this Lines object, but - // Lines objects are immutable, so it's perfectly adequate to - // return the same object. - return this; - } - - // Slice to the end if no end position was provided. - end = this.lastPos(); - } - - options = normalizeOptions(options); - - var infos = getSecret(this).infos; - var parts = []; - var tabWidth = options.tabWidth; - - for (var line = start.line; line <= end.line; ++line) { - var info = infos[line - 1]; - - if (line === start.line) { - if (line === end.line) { - info = sliceInfo(info, start.column, end.column); - } else { - info = sliceInfo(info, start.column); - } - } else if (line === end.line) { - info = sliceInfo(info, 0, end.column); - } - - var indent = Math.max(info.indent, 0); - - var before = info.line.slice(0, info.sliceStart); - if (options.reuseWhitespace && - isOnlyWhitespace(before) && - countSpaces(before, options.tabWidth) === indent) { - // Reuse original spaces if the indentation is correct. - parts.push(info.line.slice(0, info.sliceEnd)); - continue; - } - - var tabs = 0; - var spaces = indent; - - if (options.useTabs) { - tabs = Math.floor(indent / tabWidth); - spaces -= tabs * tabWidth; - } - - var result = ""; - - if (tabs > 0) { - result += new Array(tabs + 1).join("\t"); - } - - if (spaces > 0) { - result += new Array(spaces + 1).join(" "); - } - - result += info.line.slice(info.sliceStart, info.sliceEnd); - - parts.push(result); - } - - return parts.join(options.lineTerminator); -}; - -Lp.isEmpty = function() { - return this.length < 2 && this.getLineLength(1) < 1; -}; - -Lp.join = function(elements) { - var separator = this; - var separatorSecret = getSecret(separator); - var infos = []; - var mappings = []; - var prevInfo; - - function appendSecret(secret) { - if (secret === null) - return; - - if (prevInfo) { - var info = secret.infos[0]; - var indent = new Array(info.indent + 1).join(" "); - var prevLine = infos.length; - var prevColumn = Math.max(prevInfo.indent, 0) + - prevInfo.sliceEnd - prevInfo.sliceStart; - - prevInfo.line = prevInfo.line.slice( - 0, prevInfo.sliceEnd) + indent + info.line.slice( - info.sliceStart, info.sliceEnd); - - prevInfo.sliceEnd = prevInfo.line.length; - - if (secret.mappings.length > 0) { - secret.mappings.forEach(function(mapping) { - mappings.push(mapping.add(prevLine, prevColumn)); - }); - } - - } else if (secret.mappings.length > 0) { - mappings.push.apply(mappings, secret.mappings); - } - - secret.infos.forEach(function(info, i) { - if (!prevInfo || i > 0) { - prevInfo = copyLineInfo(info); - infos.push(prevInfo); - } - }); - } - - function appendWithSeparator(secret, i) { - if (i > 0) - appendSecret(separatorSecret); - appendSecret(secret); - } - - elements.map(function(elem) { - var lines = fromString(elem); - if (lines.isEmpty()) - return null; - return getSecret(lines); - }).forEach(separator.isEmpty() - ? appendSecret - : appendWithSeparator); - - if (infos.length < 1) - return emptyLines; - - var lines = new Lines(infos); - - getSecret(lines).mappings = mappings; - - return lines; -}; - -exports.concat = function(elements) { - return emptyLines.join(elements); -}; - -Lp.concat = function(other) { - var args = arguments, - list = [this]; - list.push.apply(list, args); - assert.strictEqual(list.length, args.length + 1); - return emptyLines.join(list); -}; - -// The emptyLines object needs to be created all the way down here so that -// Lines.prototype will be fully populated. -var emptyLines = fromString(""); - -},{"2":2,"536":536,"561":561,"562":562,"566":566,"567":567,"607":607}],561:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var types = _dereq_(566); -var isString = types.builtInTypes.string; -var isNumber = types.builtInTypes.number; -var SourceLocation = types.namedTypes.SourceLocation; -var Position = types.namedTypes.Position; -var linesModule = _dereq_(560); -var comparePos = _dereq_(567).comparePos; - -function Mapping(sourceLines, sourceLoc, targetLoc) { - assert.ok(this instanceof Mapping); - assert.ok(sourceLines instanceof linesModule.Lines); - SourceLocation.assert(sourceLoc); - - if (targetLoc) { - // In certain cases it's possible for targetLoc.{start,end}.column - // values to be negative, which technically makes them no longer - // valid SourceLocation nodes, so we need to be more forgiving. - assert.ok( - isNumber.check(targetLoc.start.line) && - isNumber.check(targetLoc.start.column) && - isNumber.check(targetLoc.end.line) && - isNumber.check(targetLoc.end.column) - ); - } else { - // Assume identity mapping if no targetLoc specified. - targetLoc = sourceLoc; - } - - Object.defineProperties(this, { - sourceLines: { value: sourceLines }, - sourceLoc: { value: sourceLoc }, - targetLoc: { value: targetLoc } - }); -} - -var Mp = Mapping.prototype; -module.exports = Mapping; - -Mp.slice = function(lines, start, end) { - assert.ok(lines instanceof linesModule.Lines); - Position.assert(start); - - if (end) { - Position.assert(end); - } else { - end = lines.lastPos(); - } - - var sourceLines = this.sourceLines; - var sourceLoc = this.sourceLoc; - var targetLoc = this.targetLoc; - - function skip(name) { - var sourceFromPos = sourceLoc[name]; - var targetFromPos = targetLoc[name]; - var targetToPos = start; - - if (name === "end") { - targetToPos = end; - } else { - assert.strictEqual(name, "start"); - } - - return skipChars( - sourceLines, sourceFromPos, - lines, targetFromPos, targetToPos - ); - } - - if (comparePos(start, targetLoc.start) <= 0) { - if (comparePos(targetLoc.end, end) <= 0) { - targetLoc = { - start: subtractPos(targetLoc.start, start.line, start.column), - end: subtractPos(targetLoc.end, start.line, start.column) - }; - - // The sourceLoc can stay the same because the contents of the - // targetLoc have not changed. - - } else if (comparePos(end, targetLoc.start) <= 0) { - return null; - - } else { - sourceLoc = { - start: sourceLoc.start, - end: skip("end") - }; - - targetLoc = { - start: subtractPos(targetLoc.start, start.line, start.column), - end: subtractPos(end, start.line, start.column) - }; - } - - } else { - if (comparePos(targetLoc.end, start) <= 0) { - return null; - } - - if (comparePos(targetLoc.end, end) <= 0) { - sourceLoc = { - start: skip("start"), - end: sourceLoc.end - }; - - targetLoc = { - // Same as subtractPos(start, start.line, start.column): - start: { line: 1, column: 0 }, - end: subtractPos(targetLoc.end, start.line, start.column) - }; - - } else { - sourceLoc = { - start: skip("start"), - end: skip("end") - }; - - targetLoc = { - // Same as subtractPos(start, start.line, start.column): - start: { line: 1, column: 0 }, - end: subtractPos(end, start.line, start.column) - }; - } - } - - return new Mapping(this.sourceLines, sourceLoc, targetLoc); -}; - -Mp.add = function(line, column) { - return new Mapping(this.sourceLines, this.sourceLoc, { - start: addPos(this.targetLoc.start, line, column), - end: addPos(this.targetLoc.end, line, column) - }); -}; - -function addPos(toPos, line, column) { - return { - line: toPos.line + line - 1, - column: (toPos.line === 1) - ? toPos.column + column - : toPos.column - }; -} - -Mp.subtract = function(line, column) { - return new Mapping(this.sourceLines, this.sourceLoc, { - start: subtractPos(this.targetLoc.start, line, column), - end: subtractPos(this.targetLoc.end, line, column) - }); -}; - -function subtractPos(fromPos, line, column) { - return { - line: fromPos.line - line + 1, - column: (fromPos.line === line) - ? fromPos.column - column - : fromPos.column - }; -} - -Mp.indent = function(by, skipFirstLine, noNegativeColumns) { - if (by === 0) { - return this; - } - - var targetLoc = this.targetLoc; - var startLine = targetLoc.start.line; - var endLine = targetLoc.end.line; - - if (skipFirstLine && startLine === 1 && endLine === 1) { - return this; - } - - targetLoc = { - start: targetLoc.start, - end: targetLoc.end - }; - - if (!skipFirstLine || startLine > 1) { - var startColumn = targetLoc.start.column + by; - targetLoc.start = { - line: startLine, - column: noNegativeColumns - ? Math.max(0, startColumn) - : startColumn - }; - } - - if (!skipFirstLine || endLine > 1) { - var endColumn = targetLoc.end.column + by; - targetLoc.end = { - line: endLine, - column: noNegativeColumns - ? Math.max(0, endColumn) - : endColumn - }; - } - - return new Mapping(this.sourceLines, this.sourceLoc, targetLoc); -}; - -function skipChars( - sourceLines, sourceFromPos, - targetLines, targetFromPos, targetToPos -) { - assert.ok(sourceLines instanceof linesModule.Lines); - assert.ok(targetLines instanceof linesModule.Lines); - Position.assert(sourceFromPos); - Position.assert(targetFromPos); - Position.assert(targetToPos); - - var targetComparison = comparePos(targetFromPos, targetToPos); - if (targetComparison === 0) { - // Trivial case: no characters to skip. - return sourceFromPos; - } - - if (targetComparison < 0) { - // Skipping forward. - - var sourceCursor = sourceLines.skipSpaces(sourceFromPos); - var targetCursor = targetLines.skipSpaces(targetFromPos); - - var lineDiff = targetToPos.line - targetCursor.line; - sourceCursor.line += lineDiff; - targetCursor.line += lineDiff; - - if (lineDiff > 0) { - // If jumping to later lines, reset columns to the beginnings - // of those lines. - sourceCursor.column = 0; - targetCursor.column = 0; - } else { - assert.strictEqual(lineDiff, 0); - } - - while (comparePos(targetCursor, targetToPos) < 0 && - targetLines.nextPos(targetCursor, true)) { - assert.ok(sourceLines.nextPos(sourceCursor, true)); - assert.strictEqual( - sourceLines.charAt(sourceCursor), - targetLines.charAt(targetCursor) - ); - } - - } else { - // Skipping backward. - - var sourceCursor = sourceLines.skipSpaces(sourceFromPos, true); - var targetCursor = targetLines.skipSpaces(targetFromPos, true); - - var lineDiff = targetToPos.line - targetCursor.line; - sourceCursor.line += lineDiff; - targetCursor.line += lineDiff; - - if (lineDiff < 0) { - // If jumping to earlier lines, reset columns to the ends of - // those lines. - sourceCursor.column = sourceLines.getLineLength(sourceCursor.line); - targetCursor.column = targetLines.getLineLength(targetCursor.line); - } else { - assert.strictEqual(lineDiff, 0); - } - - while (comparePos(targetToPos, targetCursor) < 0 && - targetLines.prevPos(targetCursor, true)) { - assert.ok(sourceLines.prevPos(sourceCursor, true)); - assert.strictEqual( - sourceLines.charAt(sourceCursor), - targetLines.charAt(targetCursor) - ); - } - } - - return sourceCursor; -} - -},{"2":2,"560":560,"566":566,"567":567}],562:[function(_dereq_,module,exports){ -var defaults = { - // If you want to use a different branch of esprima, or any other - // module that supports a .parse function, pass that module object to - // recast.parse as options.esprima. - esprima: _dereq_(1), - - // Number of spaces the pretty-printer should use per tab for - // indentation. If you do not pass this option explicitly, it will be - // (quite reliably!) inferred from the original code. - tabWidth: 4, - - // If you really want the pretty-printer to use tabs instead of - // spaces, make this option true. - useTabs: false, - - // The reprinting code leaves leading whitespace untouched unless it - // has to reindent a line, or you pass false for this option. - reuseWhitespace: true, - - // Override this option to use a different line terminator, e.g. \r\n. - lineTerminator: _dereq_(8).EOL, - - // Some of the pretty-printer code (such as that for printing function - // parameter lists) makes a valiant attempt to prevent really long - // lines. You can adjust the limit by changing this option; however, - // there is no guarantee that line length will fit inside this limit. - wrapColumn: 74, // Aspirational for now. - - // Pass a string as options.sourceFileName to recast.parse to tell the - // reprinter to keep track of reused code so that it can construct a - // source map automatically. - sourceFileName: null, - - // Pass a string as options.sourceMapName to recast.print, and - // (provided you passed options.sourceFileName earlier) the - // PrintResult of recast.print will have a .map property for the - // generated source map. - sourceMapName: null, - - // If provided, this option will be passed along to the source map - // generator as a root directory for relative source file paths. - sourceRoot: null, - - // If you provide a source map that was generated from a previous call - // to recast.print as options.inputSourceMap, the old source map will - // be composed with the new source map. - inputSourceMap: null, - - // If you want esprima to generate .range information (recast only - // uses .loc internally), pass true for this option. - range: false, - - // If you want esprima not to throw exceptions when it encounters - // non-fatal errors, keep this option true. - tolerant: true, - - // If you want to override the quotes used in string literals, specify - // either "single", "double", or "auto" here ("auto" will select the one - // which results in the shorter literal) - // Otherwise, the input marks will be preserved - quote: null, - - // If you want to print trailing commas in object literals, - // array expressions, functions calls and function definitions pass true - // for this option. - trailingComma: false, -}, hasOwn = defaults.hasOwnProperty; - -// Copy options and fill in default values. -exports.normalize = function(options) { - options = options || defaults; - - function get(key) { - return hasOwn.call(options, key) - ? options[key] - : defaults[key]; - } - - return { - tabWidth: +get("tabWidth"), - useTabs: !!get("useTabs"), - reuseWhitespace: !!get("reuseWhitespace"), - lineTerminator: get("lineTerminator"), - wrapColumn: Math.max(get("wrapColumn"), 0), - sourceFileName: get("sourceFileName"), - sourceMapName: get("sourceMapName"), - sourceRoot: get("sourceRoot"), - inputSourceMap: get("inputSourceMap"), - esprima: get("esprima"), - range: get("range"), - tolerant: get("tolerant"), - quote: get("quote"), - trailingComma: get("trailingComma"), - }; -}; - -},{"1":1,"8":8}],563:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var types = _dereq_(566); -var n = types.namedTypes; -var b = types.builders; -var isObject = types.builtInTypes.object; -var isArray = types.builtInTypes.array; -var isFunction = types.builtInTypes.function; -var Patcher = _dereq_(564).Patcher; -var normalizeOptions = _dereq_(562).normalize; -var fromString = _dereq_(560).fromString; -var attachComments = _dereq_(558).attach; -var util = _dereq_(567); - -exports.parse = function parse(source, options) { - options = normalizeOptions(options); - - var lines = fromString(source, options); - - var sourceWithoutTabs = lines.toString({ - tabWidth: options.tabWidth, - reuseWhitespace: false, - useTabs: false - }); - - var comments = []; - var program = options.esprima.parse(sourceWithoutTabs, { - loc: true, - locations: true, - range: options.range, - comment: true, - onComment: comments, - tolerant: options.tolerant, - ecmaVersion: 6, - sourceType: 'module' - }); - - program.loc = program.loc || { - start: lines.firstPos(), - end: lines.lastPos() - }; - - program.loc.lines = lines; - program.loc.indent = 0; - - // Expand the Program node's .loc to include all comments, since - // typically its .loc.start and .loc.end will coincide with those of - // the first and last statements, respectively, excluding any comments - // that fall outside that region. - var trueProgramLoc = util.getTrueLoc(program, lines); - program.loc.start = trueProgramLoc.start; - program.loc.end = trueProgramLoc.end; - - if (program.comments) { - comments = program.comments; - delete program.comments; - } - - // In order to ensure we reprint leading and trailing program - // comments, wrap the original Program node with a File node. - var file = b.file(program); - file.loc = { - lines: lines, - indent: 0, - start: lines.firstPos(), - end: lines.lastPos() - }; - - // Passing file.program here instead of just file means that initial - // comments will be attached to program.body[0] instead of program. - attachComments( - comments, - program.body.length ? file.program : file, - lines - ); - - // Return a copy of the original AST so that any changes made may be - // compared to the original. - return new TreeCopier(lines).copy(file); -}; - -function TreeCopier(lines) { - assert.ok(this instanceof TreeCopier); - this.lines = lines; - this.indent = 0; -} - -var TCp = TreeCopier.prototype; - -TCp.copy = function(node) { - if (isArray.check(node)) { - return node.map(this.copy, this); - } - - if (!isObject.check(node)) { - return node; - } - - util.fixFaultyLocations(node); - - var copy = Object.create(Object.getPrototypeOf(node), { - original: { // Provide a link from the copy to the original. - value: node, - configurable: false, - enumerable: false, - writable: true - } - }); - - var loc = node.loc; - var oldIndent = this.indent; - var newIndent = oldIndent; - - if (loc) { - // When node is a comment, we set node.loc.indent to - // node.loc.start.column so that, when/if we print the comment by - // itself, we can strip that much whitespace from the left margin - // of the comment. This only really matters for multiline Block - // comments, but it doesn't hurt for Line comments. - if (node.type === "Block" || node.type === "Line" || - this.lines.isPrecededOnlyByWhitespace(loc.start)) { - newIndent = this.indent = loc.start.column; - } - - loc.lines = this.lines; - loc.indent = newIndent; - } - - var keys = Object.keys(node); - var keyCount = keys.length; - for (var i = 0; i < keyCount; ++i) { - var key = keys[i]; - if (key === "loc") { - copy[key] = node[key]; - } else { - copy[key] = this.copy(node[key]); - } - } - - this.indent = oldIndent; - - return copy; -}; - -},{"2":2,"558":558,"560":560,"562":562,"564":564,"566":566,"567":567}],564:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var linesModule = _dereq_(560); -var types = _dereq_(566); -var getFieldValue = types.getFieldValue; -var Printable = types.namedTypes.Printable; -var Expression = types.namedTypes.Expression; -var SourceLocation = types.namedTypes.SourceLocation; -var util = _dereq_(567); -var comparePos = util.comparePos; -var FastPath = _dereq_(559); -var isObject = types.builtInTypes.object; -var isArray = types.builtInTypes.array; -var isString = types.builtInTypes.string; -var riskyAdjoiningCharExp = /[0-9a-z_$]/i; - -function Patcher(lines) { - assert.ok(this instanceof Patcher); - assert.ok(lines instanceof linesModule.Lines); - - var self = this, - replacements = []; - - self.replace = function(loc, lines) { - if (isString.check(lines)) - lines = linesModule.fromString(lines); - - replacements.push({ - lines: lines, - start: loc.start, - end: loc.end - }); - }; - - self.get = function(loc) { - // If no location is provided, return the complete Lines object. - loc = loc || { - start: { line: 1, column: 0 }, - end: { line: lines.length, - column: lines.getLineLength(lines.length) } - }; - - var sliceFrom = loc.start, - toConcat = []; - - function pushSlice(from, to) { - assert.ok(comparePos(from, to) <= 0); - toConcat.push(lines.slice(from, to)); - } - - replacements.sort(function(a, b) { - return comparePos(a.start, b.start); - }).forEach(function(rep) { - if (comparePos(sliceFrom, rep.start) > 0) { - // Ignore nested replacement ranges. - } else { - pushSlice(sliceFrom, rep.start); - toConcat.push(rep.lines); - sliceFrom = rep.end; - } - }); - - pushSlice(sliceFrom, loc.end); - - return linesModule.concat(toConcat); - }; -} -exports.Patcher = Patcher; - -var Pp = Patcher.prototype; - -Pp.tryToReprintComments = function(newNode, oldNode, print) { - var patcher = this; - - if (!newNode.comments && - !oldNode.comments) { - // We were (vacuously) able to reprint all the comments! - return true; - } - - var newPath = FastPath.from(newNode); - var oldPath = FastPath.from(oldNode); - - newPath.stack.push("comments", getSurroundingComments(newNode)); - oldPath.stack.push("comments", getSurroundingComments(oldNode)); - - var reprints = []; - var ableToReprintComments = - findArrayReprints(newPath, oldPath, reprints); - - // No need to pop anything from newPath.stack or oldPath.stack, since - // newPath and oldPath are fresh local variables. - - if (ableToReprintComments && reprints.length > 0) { - reprints.forEach(function(reprint) { - var oldComment = reprint.oldPath.getValue(); - assert.ok(oldComment.leading || oldComment.trailing); - patcher.replace( - oldComment.loc, - // Comments can't have .comments, so it doesn't matter - // whether we print with comments or without. - print(reprint.newPath).indentTail(oldComment.loc.indent) - ); - }); - } - - return ableToReprintComments; -}; - -// Get all comments that are either leading or trailing, ignoring any -// comments that occur inside node.loc. Returns an empty array for nodes -// with no leading or trailing comments. -function getSurroundingComments(node) { - var result = []; - if (node.comments && - node.comments.length > 0) { - node.comments.forEach(function(comment) { - if (comment.leading || comment.trailing) { - result.push(comment); - } - }); - } - return result; -} - -Pp.deleteComments = function(node) { - if (!node.comments) { - return; - } - - var patcher = this; - - node.comments.forEach(function(comment) { - if (comment.leading) { - // Delete leading comments along with any trailing whitespace - // they might have. - patcher.replace({ - start: comment.loc.start, - end: node.loc.lines.skipSpaces( - comment.loc.end, false, false) - }, ""); - - } else if (comment.trailing) { - // Delete trailing comments along with any leading whitespace - // they might have. - patcher.replace({ - start: node.loc.lines.skipSpaces( - comment.loc.start, true, false), - end: comment.loc.end - }, ""); - } - }); -}; - -exports.getReprinter = function(path) { - assert.ok(path instanceof FastPath); - - // Make sure that this path refers specifically to a Node, rather than - // some non-Node subproperty of a Node. - var node = path.getValue(); - if (!Printable.check(node)) - return; - - var orig = node.original; - var origLoc = orig && orig.loc; - var lines = origLoc && origLoc.lines; - var reprints = []; - - if (!lines || !findReprints(path, reprints)) - return; - - return function(print) { - var patcher = new Patcher(lines); - - reprints.forEach(function(reprint) { - var newNode = reprint.newPath.getValue(); - var oldNode = reprint.oldPath.getValue(); - - SourceLocation.assert(oldNode.loc, true); - - var needToPrintNewPathWithComments = - !patcher.tryToReprintComments(newNode, oldNode, print) - - if (needToPrintNewPathWithComments) { - // Since we were not able to preserve all leading/trailing - // comments, we delete oldNode's comments, print newPath - // with comments, and then patch the resulting lines where - // oldNode used to be. - patcher.deleteComments(oldNode); - } - - var pos = util.copyPos(oldNode.loc.start); - var needsLeadingSpace = lines.prevPos(pos) && - riskyAdjoiningCharExp.test(lines.charAt(pos)); - - var newLines = print( - reprint.newPath, - needToPrintNewPathWithComments - ).indentTail(oldNode.loc.indent); - - var needsTrailingSpace = - riskyAdjoiningCharExp.test(lines.charAt(oldNode.loc.end)); - - // If we try to replace the argument of a ReturnStatement like - // return"asdf" with e.g. a literal null expression, we run - // the risk of ending up with returnnull, so we need to add an - // extra leading space in situations where that might - // happen. Likewise for "asdf"in obj. See #170. - if (needsLeadingSpace || needsTrailingSpace) { - var newParts = []; - needsLeadingSpace && newParts.push(" "); - newParts.push(newLines); - needsTrailingSpace && newParts.push(" "); - newLines = linesModule.concat(newParts); - } - - patcher.replace(oldNode.loc, newLines); - }); - - // Recall that origLoc is the .loc of an ancestor node that is - // guaranteed to contain all the reprinted nodes and comments. - return patcher.get(origLoc).indentTail(-orig.loc.indent); - }; -}; - -function findReprints(newPath, reprints) { - var newNode = newPath.getValue(); - Printable.assert(newNode); - - var oldNode = newNode.original; - Printable.assert(oldNode); - - assert.deepEqual(reprints, []); - - if (newNode.type !== oldNode.type) { - return false; - } - - var oldPath = new FastPath(oldNode); - var canReprint = findChildReprints(newPath, oldPath, reprints); - - if (!canReprint) { - // Make absolutely sure the calling code does not attempt to reprint - // any nodes. - reprints.length = 0; - } - - return canReprint; -} - -function findAnyReprints(newPath, oldPath, reprints) { - var newNode = newPath.getValue(); - var oldNode = oldPath.getValue(); - - if (newNode === oldNode) - return true; - - if (isArray.check(newNode)) - return findArrayReprints(newPath, oldPath, reprints); - - if (isObject.check(newNode)) - return findObjectReprints(newPath, oldPath, reprints); - - return false; -} - -function findArrayReprints(newPath, oldPath, reprints) { - var newNode = newPath.getValue(); - var oldNode = oldPath.getValue(); - isArray.assert(newNode); - var len = newNode.length; - - if (!(isArray.check(oldNode) && - oldNode.length === len)) - return false; - - for (var i = 0; i < len; ++i) { - newPath.stack.push(i, newNode[i]); - oldPath.stack.push(i, oldNode[i]); - var canReprint = findAnyReprints(newPath, oldPath, reprints); - newPath.stack.length -= 2; - oldPath.stack.length -= 2; - if (!canReprint) { - return false; - } - } - - return true; -} - -function findObjectReprints(newPath, oldPath, reprints) { - var newNode = newPath.getValue(); - isObject.assert(newNode); - - if (newNode.original === null) { - // If newNode.original node was set to null, reprint the node. - return false; - } - - var oldNode = oldPath.getValue(); - if (!isObject.check(oldNode)) - return false; - - if (Printable.check(newNode)) { - if (!Printable.check(oldNode)) { - return false; - } - - // Here we need to decide whether the reprinted code for newNode - // is appropriate for patching into the location of oldNode. - - if (newNode.type === oldNode.type) { - var childReprints = []; - - if (findChildReprints(newPath, oldPath, childReprints)) { - reprints.push.apply(reprints, childReprints); - } else if (oldNode.loc) { - // If we have no .loc information for oldNode, then we - // won't be able to reprint it. - reprints.push({ - oldPath: oldPath.copy(), - newPath: newPath.copy() - }); - } else { - return false; - } - - return true; - } - - if (Expression.check(newNode) && - Expression.check(oldNode) && - // If we have no .loc information for oldNode, then we won't - // be able to reprint it. - oldNode.loc) { - - // If both nodes are subtypes of Expression, then we should be - // able to fill the location occupied by the old node with - // code printed for the new node with no ill consequences. - reprints.push({ - oldPath: oldPath.copy(), - newPath: newPath.copy() - }); - - return true; - } - - // The nodes have different types, and at least one of the types - // is not a subtype of the Expression type, so we cannot safely - // assume the nodes are syntactically interchangeable. - return false; - } - - return findChildReprints(newPath, oldPath, reprints); -} - -// This object is reused in hasOpeningParen and hasClosingParen to avoid -// having to allocate a temporary object. -var reusablePos = { line: 1, column: 0 }; -var nonSpaceExp = /\S/; - -function hasOpeningParen(oldPath) { - var oldNode = oldPath.getValue(); - var loc = oldNode.loc; - var lines = loc && loc.lines; - - if (lines) { - var pos = reusablePos; - pos.line = loc.start.line; - pos.column = loc.start.column; - - while (lines.prevPos(pos)) { - var ch = lines.charAt(pos); - - if (ch === "(") { - // If we found an opening parenthesis but it occurred before - // the start of the original subtree for this reprinting, then - // we must not return true for hasOpeningParen(oldPath). - return comparePos(oldPath.getRootValue().loc.start, pos) <= 0; - } - - if (nonSpaceExp.test(ch)) { - return false; - } - } - } - - return false; -} - -function hasClosingParen(oldPath) { - var oldNode = oldPath.getValue(); - var loc = oldNode.loc; - var lines = loc && loc.lines; - - if (lines) { - var pos = reusablePos; - pos.line = loc.end.line; - pos.column = loc.end.column; - - do { - var ch = lines.charAt(pos); - - if (ch === ")") { - // If we found a closing parenthesis but it occurred after the - // end of the original subtree for this reprinting, then we - // must not return true for hasClosingParen(oldPath). - return comparePos(pos, oldPath.getRootValue().loc.end) <= 0; - } - - if (nonSpaceExp.test(ch)) { - return false; - } - - } while (lines.nextPos(pos)); - } - - return false; -} - -function hasParens(oldPath) { - // This logic can technically be fooled if the node has parentheses - // but there are comments intervening between the parentheses and the - // node. In such cases the node will be harmlessly wrapped in an - // additional layer of parentheses. - return hasOpeningParen(oldPath) && hasClosingParen(oldPath); -} - -function findChildReprints(newPath, oldPath, reprints) { - var newNode = newPath.getValue(); - var oldNode = oldPath.getValue(); - - isObject.assert(newNode); - isObject.assert(oldNode); - - if (newNode.original === null) { - // If newNode.original node was set to null, reprint the node. - return false; - } - - // If this type of node cannot come lexically first in its enclosing - // statement (e.g. a function expression or object literal), and it - // seems to be doing so, then the only way we can ignore this problem - // and save ourselves from falling back to the pretty printer is if an - // opening parenthesis happens to precede the node. For example, - // (function(){ ... }()); does not need to be reprinted, even though - // the FunctionExpression comes lexically first in the enclosing - // ExpressionStatement and fails the hasParens test, because the - // parent CallExpression passes the hasParens test. If we relied on - // the path.needsParens() && !hasParens(oldNode) check below, the - // absence of a closing parenthesis after the FunctionExpression would - // trigger pretty-printing unnecessarily. - if (!newPath.canBeFirstInStatement() && - newPath.firstInStatement() && - !hasOpeningParen(oldPath)) - return false; - - // If this node needs parentheses and will not be wrapped with - // parentheses when reprinted, then return false to skip reprinting - // and let it be printed generically. - if (newPath.needsParens(true) && !hasParens(oldPath)) { - return false; - } - - for (var k in util.getUnionOfKeys(newNode, oldNode)) { - if (k === "loc") - continue; - - newPath.stack.push(k, types.getFieldValue(newNode, k)); - oldPath.stack.push(k, types.getFieldValue(oldNode, k)); - var canReprint = findAnyReprints(newPath, oldPath, reprints); - newPath.stack.length -= 2; - oldPath.stack.length -= 2; - - if (!canReprint) { - return false; - } - } - - return true; -} - -},{"2":2,"559":559,"560":560,"566":566,"567":567}],565:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var sourceMap = _dereq_(607); -var printComments = _dereq_(558).printComments; -var linesModule = _dereq_(560); -var fromString = linesModule.fromString; -var concat = linesModule.concat; -var normalizeOptions = _dereq_(562).normalize; -var getReprinter = _dereq_(564).getReprinter; -var types = _dereq_(566); -var namedTypes = types.namedTypes; -var isString = types.builtInTypes.string; -var isObject = types.builtInTypes.object; -var FastPath = _dereq_(559); -var util = _dereq_(567); - -function PrintResult(code, sourceMap) { - assert.ok(this instanceof PrintResult); - - isString.assert(code); - this.code = code; - - if (sourceMap) { - isObject.assert(sourceMap); - this.map = sourceMap; - } -} - -var PRp = PrintResult.prototype; -var warnedAboutToString = false; - -PRp.toString = function() { - if (!warnedAboutToString) { - console.warn( - "Deprecation warning: recast.print now returns an object with " + - "a .code property. You appear to be treating the object as a " + - "string, which might still work but is strongly discouraged." - ); - - warnedAboutToString = true; - } - - return this.code; -}; - -var emptyPrintResult = new PrintResult(""); - -function Printer(originalOptions) { - assert.ok(this instanceof Printer); - - var explicitTabWidth = originalOptions && originalOptions.tabWidth; - var options = normalizeOptions(originalOptions); - assert.notStrictEqual(options, originalOptions); - - // It's common for client code to pass the same options into both - // recast.parse and recast.print, but the Printer doesn't need (and - // can be confused by) options.sourceFileName, so we null it out. - options.sourceFileName = null; - - function printWithComments(path) { - assert.ok(path instanceof FastPath); - return printComments(path, print); - } - - function print(path, includeComments) { - if (includeComments) - return printWithComments(path); - - assert.ok(path instanceof FastPath); - - if (!explicitTabWidth) { - var oldTabWidth = options.tabWidth; - var loc = path.getNode().loc; - if (loc && loc.lines && loc.lines.guessTabWidth) { - options.tabWidth = loc.lines.guessTabWidth(); - var lines = maybeReprint(path); - options.tabWidth = oldTabWidth; - return lines; - } - } - - return maybeReprint(path); - } - - function maybeReprint(path) { - var reprinter = getReprinter(path); - if (reprinter) - return maybeAddParens(path, reprinter(print)); - return printRootGenerically(path); - } - - // Print the root node generically, but then resume reprinting its - // children non-generically. - function printRootGenerically(path) { - return genericPrint(path, options, printWithComments); - } - - // Print the entire AST generically. - function printGenerically(path) { - return genericPrint(path, options, printGenerically); - } - - this.print = function(ast) { - if (!ast) { - return emptyPrintResult; - } - - var lines = print(FastPath.from(ast), true); - - return new PrintResult( - lines.toString(options), - util.composeSourceMaps( - options.inputSourceMap, - lines.getSourceMap( - options.sourceMapName, - options.sourceRoot - ) - ) - ); - }; - - this.printGenerically = function(ast) { - if (!ast) { - return emptyPrintResult; - } - - var path = FastPath.from(ast); - var oldReuseWhitespace = options.reuseWhitespace; - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - options.reuseWhitespace = false; - - // TODO Allow printing of comments? - var pr = new PrintResult(printGenerically(path).toString(options)); - options.reuseWhitespace = oldReuseWhitespace; - return pr; - }; -} - -exports.Printer = Printer; - -function maybeAddParens(path, lines) { - return path.needsParens() ? concat(["(", lines, ")"]) : lines; -} - -function genericPrint(path, options, printPath) { - assert.ok(path instanceof FastPath); - return maybeAddParens(path, genericPrintNoParens(path, options, printPath)); -} - -function genericPrintNoParens(path, options, print) { - var n = path.getValue(); - - if (!n) { - return fromString(""); - } - - if (typeof n === "string") { - return fromString(n, options); - } - - namedTypes.Printable.assert(n); - - switch (n.type) { - case "File": - return path.call(print, "program"); - - case "Program": - return path.call(function(bodyPath) { - return printStatementSequence(bodyPath, options, print); - }, "body"); - - case "Noop": // Babel extension. - case "EmptyStatement": - return fromString(""); - - case "ExpressionStatement": - return concat([path.call(print, "expression"), ";"]); - - case "ParenthesizedExpression": // Babel extension. - return concat(["(", path.call(print, "expression"), ")"]); - - case "BinaryExpression": - case "LogicalExpression": - case "AssignmentExpression": - return fromString(" ").join([ - path.call(print, "left"), - n.operator, - path.call(print, "right") - ]); - - case "AssignmentPattern": - return concat([ - path.call(print, "left"), - "=", - path.call(print, "right") - ]); - - case "MemberExpression": - var parts = [path.call(print, "object")]; - - var property = path.call(print, "property"); - if (n.computed) { - parts.push("[", property, "]"); - } else { - parts.push(".", property); - } - - return concat(parts); - - case "MetaProperty": - return concat([ - path.call(print, "meta"), - ".", - path.call(print, "property") - ]); - - case "BindExpression": - var parts = []; - - if (n.object) { - parts.push(path.call(print, "object")); - } - - parts.push("::", path.call(print, "callee")); - - return concat(parts); - - case "Path": - return fromString(".").join(n.body); - - case "Identifier": - return concat([ - fromString(n.name, options), - path.call(print, "typeAnnotation") - ]); - - case "SpreadElement": - case "SpreadElementPattern": - case "SpreadProperty": - case "SpreadPropertyPattern": - case "RestElement": - return concat(["...", path.call(print, "argument")]); - - case "FunctionDeclaration": - case "FunctionExpression": - var parts = []; - - if (n.async) - parts.push("async "); - - parts.push("function"); - - if (n.generator) - parts.push("*"); - - if (n.id) { - parts.push( - " ", - path.call(print, "id"), - path.call(print, "typeParameters") - ); - } - - parts.push( - "(", - printFunctionParams(path, options, print), - ")", - path.call(print, "returnType"), - " ", - path.call(print, "body") - ); - - return concat(parts); - - case "ArrowFunctionExpression": - var parts = []; - - if (n.async) - parts.push("async "); - - if ( - n.params.length === 1 && - !n.rest && - n.params[0].type !== 'SpreadElementPattern' && - n.params[0].type !== 'RestElement' - ) { - parts.push(path.call(print, "params", 0)); - } else { - parts.push( - "(", - printFunctionParams(path, options, print), - ")" - ); - } - - parts.push(" => ", path.call(print, "body")); - - return concat(parts); - - case "MethodDefinition": - var parts = []; - - if (n.static) { - parts.push("static "); - } - - parts.push(printMethod(path, options, print)); - - return concat(parts); - - case "YieldExpression": - var parts = ["yield"]; - - if (n.delegate) - parts.push("*"); - - if (n.argument) - parts.push(" ", path.call(print, "argument")); - - return concat(parts); - - case "AwaitExpression": - var parts = ["await"]; - - if (n.all) - parts.push("*"); - - if (n.argument) - parts.push(" ", path.call(print, "argument")); - - return concat(parts); - - case "ModuleDeclaration": - var parts = ["module", path.call(print, "id")]; - - if (n.source) { - assert.ok(!n.body); - parts.push("from", path.call(print, "source")); - } else { - parts.push(path.call(print, "body")); - } - - return fromString(" ").join(parts); - - case "ImportSpecifier": - var parts = []; - - if (n.imported) { - parts.push(path.call(print, "imported")); - if (n.local && - n.local.name !== n.imported.name) { - parts.push(" as ", path.call(print, "local")); - } - } else if (n.id) { - parts.push(path.call(print, "id")); - if (n.name) { - parts.push(" as ", path.call(print, "name")); - } - } - - return concat(parts); - - case "ExportSpecifier": - var parts = []; - - if (n.local) { - parts.push(path.call(print, "local")); - if (n.exported && - n.exported.name !== n.local.name) { - parts.push(" as ", path.call(print, "exported")); - } - } else if (n.id) { - parts.push(path.call(print, "id")); - if (n.name) { - parts.push(" as ", path.call(print, "name")); - } - } - - return concat(parts); - - case "ExportBatchSpecifier": - return fromString("*"); - - case "ImportNamespaceSpecifier": - var parts = ["* as "]; - if (n.local) { - parts.push(path.call(print, "local")); - } else if (n.id) { - parts.push(path.call(print, "id")); - } - return concat(parts); - - case "ImportDefaultSpecifier": - if (n.local) { - return path.call(print, "local"); - } - return path.call(print, "id"); - - case "ExportDeclaration": - var parts = ["export"]; - - if (n["default"]) { - parts.push(" default"); - - } else if (n.specifiers && - n.specifiers.length > 0) { - - if (n.specifiers.length === 1 && - n.specifiers[0].type === "ExportBatchSpecifier") { - parts.push(" *"); - } else { - parts.push( - " { ", - fromString(", ").join(path.map(print, "specifiers")), - " }" - ); - } - - if (n.source) - parts.push(" from ", path.call(print, "source")); - - parts.push(";"); - - return concat(parts); - } - - if (n.declaration) { - var decLines = path.call(print, "declaration"); - parts.push(" ", decLines); - if (lastNonSpaceCharacter(decLines) !== ";") { - parts.push(";"); - } - } - - return concat(parts); - - case "ExportDefaultDeclaration": - return concat([ - "export default ", - path.call(print, "declaration") - ]); - - case "ExportNamedDeclaration": - var parts = ["export "]; - - if (n.declaration) { - parts.push(path.call(print, "declaration")); - } - - if (n.specifiers && - n.specifiers.length > 0) { - parts.push( - n.declaration ? ", {" : "{", - fromString(", ").join(path.map(print, "specifiers")), - "}" - ); - } - - if (n.source) { - parts.push(" from ", path.call(print, "source")); - } - - return concat(parts); - - case "ExportAllDeclaration": - var parts = ["export *"]; - - if (n.exported) { - parts.push(" as ", path.call(print, "exported")); - } - - return concat([ - " from ", - path.call(print, "source") - ]); - - case "ExportNamespaceSpecifier": - return concat(["* as ", path.call(print, "exported")]); - - case "ExportDefaultSpecifier": - return path.call(print, "exported"); - - case "ImportDeclaration": - var parts = ["import "]; - - if (n.importKind && n.importKind !== "value") { - parts.push(n.importKind + " "); - } - - if (n.specifiers && - n.specifiers.length > 0) { - - var foundImportSpecifier = false; - - path.each(function(specifierPath) { - var i = specifierPath.getName(); - if (i > 0) { - parts.push(", "); - } - - var value = specifierPath.getValue(); - - if (namedTypes.ImportDefaultSpecifier.check(value) || - namedTypes.ImportNamespaceSpecifier.check(value)) { - assert.strictEqual(foundImportSpecifier, false); - } else { - namedTypes.ImportSpecifier.assert(value); - if (!foundImportSpecifier) { - foundImportSpecifier = true; - parts.push("{"); - } - } - - parts.push(print(specifierPath)); - }, "specifiers"); - - if (foundImportSpecifier) { - parts.push("}"); - } - - parts.push(" from "); - } - - parts.push(path.call(print, "source"), ";"); - - return concat(parts); - - case "BlockStatement": - var naked = path.call(function(bodyPath) { - return printStatementSequence(bodyPath, options, print); - }, "body"); - - if (naked.isEmpty()) { - return fromString("{}"); - } - - return concat([ - "{\n", - naked.indent(options.tabWidth), - "\n}" - ]); - - case "ReturnStatement": - var parts = ["return"]; - - if (n.argument) { - var argLines = path.call(print, "argument"); - if (argLines.length > 1 && - (namedTypes.XJSElement && - namedTypes.XJSElement.check(n.argument) || - namedTypes.JSXElement && - namedTypes.JSXElement.check(n.argument))) { - parts.push( - " (\n", - argLines.indent(options.tabWidth), - "\n)" - ); - } else { - parts.push(" ", argLines); - } - } - - parts.push(";"); - - return concat(parts); - - case "CallExpression": - return concat([ - path.call(print, "callee"), - printArgumentsList(path, options, print) - ]); - - case "ObjectExpression": - case "ObjectPattern": - case "ObjectTypeAnnotation": - var allowBreak = false; - var isTypeAnnotation = n.type === "ObjectTypeAnnotation"; - var separator = isTypeAnnotation ? ';' : ','; - var fields = []; - - if (isTypeAnnotation) { - fields.push("indexers", "callProperties"); - } - - fields.push("properties"); - - var len = 0; - fields.forEach(function(field) { - len += n[field].length; - }); - - var oneLine = (isTypeAnnotation && len === 1) || len === 0; - var parts = [oneLine ? "{" : "{\n"]; - - var i = 0; - fields.forEach(function(field) { - path.each(function(childPath) { - var lines = print(childPath); - - if (!oneLine) { - lines = lines.indent(options.tabWidth); - } - - var multiLine = !isTypeAnnotation && lines.length > 1; - if (multiLine && allowBreak) { - // Similar to the logic for BlockStatement. - parts.push("\n"); - } - - parts.push(lines); - - if (i < len - 1) { - // Add an extra line break if the previous object property - // had a multi-line value. - parts.push(separator + (multiLine ? "\n\n" : "\n")); - allowBreak = !multiLine; - } else if (len !== 1 && isTypeAnnotation) { - parts.push(separator); - } else if (options.trailingComma) { - parts.push(separator); - } - i++; - }, field); - }); - - parts.push(oneLine ? "}" : "\n}"); - - return concat(parts); - - case "PropertyPattern": - return concat([ - path.call(print, "key"), - ": ", - path.call(print, "pattern") - ]); - - case "Property": // Non-standard AST node type. - if (n.method || n.kind === "get" || n.kind === "set") { - return printMethod(path, options, print); - } - - var parts = []; - - if (n.decorators) { - path.each(function(decoratorPath) { - parts.push(print(decoratorPath), "\n"); - }, "decorators"); - } - - var key = path.call(print, "key"); - if (n.computed) { - parts.push("[", key, "]"); - } else { - parts.push(key); - } - - if (! n.shorthand) { - parts.push(": ", path.call(print, "value")); - } - - return concat(parts); - - case "Decorator": - return concat(["@", path.call(print, "expression")]); - - case "ArrayExpression": - case "ArrayPattern": - var elems = n.elements, - len = elems.length; - - var printed = path.map(print, "elements"); - var joined = fromString(", ").join(printed); - var oneLine = joined.getLineLength(1) <= options.wrapColumn; - var parts = [oneLine ? "[" : "[\n"]; - - path.each(function(elemPath) { - var i = elemPath.getName(); - var elem = elemPath.getValue(); - if (!elem) { - // If the array expression ends with a hole, that hole - // will be ignored by the interpreter, but if it ends with - // two (or more) holes, we need to write out two (or more) - // commas so that the resulting code is interpreted with - // both (all) of the holes. - parts.push(","); - } else { - var lines = printed[i]; - if (oneLine) { - if (i > 0) - parts.push(" "); - } else { - lines = lines.indent(options.tabWidth); - } - parts.push(lines); - if (i < len - 1 || (!oneLine && options.trailingComma)) - parts.push(","); - if (!oneLine) - parts.push("\n"); - } - }, "elements"); - - parts.push("]"); - - return concat(parts); - - case "SequenceExpression": - return fromString(", ").join(path.map(print, "expressions")); - - case "ThisExpression": - return fromString("this"); - - case "Super": - return fromString("super"); - - case "Literal": - if (typeof n.value !== "string") - return fromString(n.value, options); - - return fromString(nodeStr(n.value, options), options); - - case "ModuleSpecifier": - if (n.local) { - throw new Error( - "The ESTree ModuleSpecifier type should be abstract" - ); - } - - // The Esprima ModuleSpecifier type is just a string-valued - // Literal identifying the imported-from module. - return fromString(nodeStr(n.value, options), options); - - case "UnaryExpression": - var parts = [n.operator]; - if (/[a-z]$/.test(n.operator)) - parts.push(" "); - parts.push(path.call(print, "argument")); - return concat(parts); - - case "UpdateExpression": - var parts = [path.call(print, "argument"), n.operator]; - - if (n.prefix) - parts.reverse(); - - return concat(parts); - - case "ConditionalExpression": - return concat([ - "(", path.call(print, "test"), - " ? ", path.call(print, "consequent"), - " : ", path.call(print, "alternate"), ")" - ]); - - case "NewExpression": - var parts = ["new ", path.call(print, "callee")]; - var args = n.arguments; - if (args) { - parts.push(printArgumentsList(path, options, print)); - } - - return concat(parts); - - case "VariableDeclaration": - var parts = [n.kind, " "]; - var maxLen = 0; - var printed = path.map(function(childPath) { - var lines = print(childPath); - maxLen = Math.max(lines.length, maxLen); - return lines; - }, "declarations"); - - if (maxLen === 1) { - parts.push(fromString(", ").join(printed)); - } else if (printed.length > 1 ) { - parts.push( - fromString(",\n").join(printed) - .indentTail(n.kind.length + 1) - ); - } else { - parts.push(printed[0]); - } - - // We generally want to terminate all variable declarations with a - // semicolon, except when they are children of for loops. - var parentNode = path.getParentNode(); - if (!namedTypes.ForStatement.check(parentNode) && - !namedTypes.ForInStatement.check(parentNode) && - !(namedTypes.ForOfStatement && - namedTypes.ForOfStatement.check(parentNode))) { - parts.push(";"); - } - - return concat(parts); - - case "VariableDeclarator": - return n.init ? fromString(" = ").join([ - path.call(print, "id"), - path.call(print, "init") - ]) : path.call(print, "id"); - - case "WithStatement": - return concat([ - "with (", - path.call(print, "object"), - ") ", - path.call(print, "body") - ]); - - case "IfStatement": - var con = adjustClause(path.call(print, "consequent"), options), - parts = ["if (", path.call(print, "test"), ")", con]; - - if (n.alternate) - parts.push( - endsWithBrace(con) ? " else" : "\nelse", - adjustClause(path.call(print, "alternate"), options)); - - return concat(parts); - - case "ForStatement": - // TODO Get the for (;;) case right. - var init = path.call(print, "init"), - sep = init.length > 1 ? ";\n" : "; ", - forParen = "for (", - indented = fromString(sep).join([ - init, - path.call(print, "test"), - path.call(print, "update") - ]).indentTail(forParen.length), - head = concat([forParen, indented, ")"]), - clause = adjustClause(path.call(print, "body"), options), - parts = [head]; - - if (head.length > 1) { - parts.push("\n"); - clause = clause.trimLeft(); - } - - parts.push(clause); - - return concat(parts); - - case "WhileStatement": - return concat([ - "while (", - path.call(print, "test"), - ")", - adjustClause(path.call(print, "body"), options) - ]); - - case "ForInStatement": - // Note: esprima can't actually parse "for each (". - return concat([ - n.each ? "for each (" : "for (", - path.call(print, "left"), - " in ", - path.call(print, "right"), - ")", - adjustClause(path.call(print, "body"), options) - ]); - - case "ForOfStatement": - return concat([ - "for (", - path.call(print, "left"), - " of ", - path.call(print, "right"), - ")", - adjustClause(path.call(print, "body"), options) - ]); - - case "DoWhileStatement": - var doBody = concat([ - "do", - adjustClause(path.call(print, "body"), options) - ]), parts = [doBody]; - - if (endsWithBrace(doBody)) - parts.push(" while"); - else - parts.push("\nwhile"); - - parts.push(" (", path.call(print, "test"), ");"); - - return concat(parts); - - case "DoExpression": - var statements = path.call(function(bodyPath) { - return printStatementSequence(bodyPath, options, print); - }, "body"); - - return concat([ - "do {\n", - statements.indent(options.tabWidth), - "\n}" - ]); - - case "BreakStatement": - var parts = ["break"]; - if (n.label) - parts.push(" ", path.call(print, "label")); - parts.push(";"); - return concat(parts); - - case "ContinueStatement": - var parts = ["continue"]; - if (n.label) - parts.push(" ", path.call(print, "label")); - parts.push(";"); - return concat(parts); - - case "LabeledStatement": - return concat([ - path.call(print, "label"), - ":\n", - path.call(print, "body") - ]); - - case "TryStatement": - var parts = [ - "try ", - path.call(print, "block") - ]; - - if (n.handler) { - parts.push(" ", path.call(print, "handler")); - } else if (n.handlers) { - path.each(function(handlerPath) { - parts.push(" ", print(handlerPath)); - }, "handlers"); - } - - if (n.finalizer) { - parts.push(" finally ", path.call(print, "finalizer")); - } - - return concat(parts); - - case "CatchClause": - var parts = ["catch (", path.call(print, "param")]; - - if (n.guard) - // Note: esprima does not recognize conditional catch clauses. - parts.push(" if ", path.call(print, "guard")); - - parts.push(") ", path.call(print, "body")); - - return concat(parts); - - case "ThrowStatement": - return concat(["throw ", path.call(print, "argument"), ";"]); - - case "SwitchStatement": - return concat([ - "switch (", - path.call(print, "discriminant"), - ") {\n", - fromString("\n").join(path.map(print, "cases")), - "\n}" - ]); - - // Note: ignoring n.lexical because it has no printing consequences. - - case "SwitchCase": - var parts = []; - - if (n.test) - parts.push("case ", path.call(print, "test"), ":"); - else - parts.push("default:"); - - if (n.consequent.length > 0) { - parts.push("\n", path.call(function(consequentPath) { - return printStatementSequence(consequentPath, options, print); - }, "consequent").indent(options.tabWidth)); - } - - return concat(parts); - - case "DebuggerStatement": - return fromString("debugger;"); - - // JSX extensions below. - - case "XJSAttribute": - case "JSXAttribute": - var parts = [path.call(print, "name")]; - if (n.value) - parts.push("=", path.call(print, "value")); - return concat(parts); - - case "XJSIdentifier": - case "JSXIdentifier": - return fromString(n.name, options); - - case "XJSNamespacedName": - case "JSXNamespacedName": - return fromString(":").join([ - path.call(print, "namespace"), - path.call(print, "name") - ]); - - case "XJSMemberExpression": - case "JSXMemberExpression": - return fromString(".").join([ - path.call(print, "object"), - path.call(print, "property") - ]); - - case "XJSSpreadAttribute": - case "JSXSpreadAttribute": - return concat(["{...", path.call(print, "argument"), "}"]); - - case "XJSExpressionContainer": - case "JSXExpressionContainer": - return concat(["{", path.call(print, "expression"), "}"]); - - case "XJSElement": - case "JSXElement": - var openingLines = path.call(print, "openingElement"); - - if (n.openingElement.selfClosing) { - assert.ok(!n.closingElement); - return openingLines; - } - - var childLines = concat( - path.map(function(childPath) { - var child = childPath.getValue(); - - if (namedTypes.Literal.check(child) && - typeof child.value === "string") { - if (/\S/.test(child.value)) { - return child.value.replace(/^\s+|\s+$/g, ""); - } else if (/\n/.test(child.value)) { - return "\n"; - } - } - - return print(childPath); - }, "children") - ).indentTail(options.tabWidth); - - var closingLines = path.call(print, "closingElement"); - - return concat([ - openingLines, - childLines, - closingLines - ]); - - case "XJSOpeningElement": - case "JSXOpeningElement": - var parts = ["<", path.call(print, "name")]; - var attrParts = []; - - path.each(function(attrPath) { - attrParts.push(" ", print(attrPath)); - }, "attributes"); - - var attrLines = concat(attrParts); - - var needLineWrap = ( - attrLines.length > 1 || - attrLines.getLineLength(1) > options.wrapColumn - ); - - if (needLineWrap) { - attrParts.forEach(function(part, i) { - if (part === " ") { - assert.strictEqual(i % 2, 0); - attrParts[i] = "\n"; - } - }); - - attrLines = concat(attrParts).indentTail(options.tabWidth); - } - - parts.push(attrLines, n.selfClosing ? " />" : ">"); - - return concat(parts); - - case "XJSClosingElement": - case "JSXClosingElement": - return concat(["</", path.call(print, "name"), ">"]); - - case "XJSText": - case "JSXText": - return fromString(n.value, options); - - case "XJSEmptyExpression": - case "JSXEmptyExpression": - return fromString(""); - - case "TypeAnnotatedIdentifier": - return concat([ - path.call(print, "annotation"), - " ", - path.call(print, "identifier") - ]); - - case "ClassBody": - if (n.body.length === 0) { - return fromString("{}"); - } - - return concat([ - "{\n", - path.call(function(bodyPath) { - return printStatementSequence(bodyPath, options, print); - }, "body").indent(options.tabWidth), - "\n}" - ]); - - case "ClassPropertyDefinition": - var parts = ["static ", path.call(print, "definition")]; - if (!namedTypes.MethodDefinition.check(n.definition)) - parts.push(";"); - return concat(parts); - - case "ClassProperty": - var parts = []; - if (n.static) - parts.push("static "); - - parts.push(path.call(print, "key")); - if (n.typeAnnotation) - parts.push(path.call(print, "typeAnnotation")); - - if (n.value) - parts.push(" = ", path.call(print, "value")); - - parts.push(";"); - return concat(parts); - - case "ClassDeclaration": - case "ClassExpression": - var parts = ["class"]; - - if (n.id) { - parts.push( - " ", - path.call(print, "id"), - path.call(print, "typeParameters") - ); - } - - if (n.superClass) { - parts.push( - " extends ", - path.call(print, "superClass"), - path.call(print, "superTypeParameters") - ); - } - - if (n["implements"]) { - parts.push( - " implements ", - fromString(", ").join(path.map(print, "implements")) - ); - } - - parts.push(" ", path.call(print, "body")); - - return concat(parts); - - case "TemplateElement": - return fromString(n.value.raw, options); - - case "TemplateLiteral": - var expressions = path.map(print, "expressions"); - var parts = ["`"]; - - path.each(function(childPath) { - var i = childPath.getName(); - parts.push(print(childPath)); - if (i < expressions.length) { - parts.push("${", expressions[i], "}"); - } - }, "quasis"); - - parts.push("`"); - - return concat(parts); - - case "TaggedTemplateExpression": - return concat([ - path.call(print, "tag"), - path.call(print, "quasi") - ]); - - // These types are unprintable because they serve as abstract - // supertypes for other (printable) types. - case "Node": - case "Printable": - case "SourceLocation": - case "Position": - case "Statement": - case "Function": - case "Pattern": - case "Expression": - case "Declaration": - case "Specifier": - case "NamedSpecifier": - case "Comment": // Supertype of Block and Line. - case "MemberTypeAnnotation": // Flow - case "TupleTypeAnnotation": // Flow - case "Type": // Flow - throw new Error("unprintable type: " + JSON.stringify(n.type)); - - case "CommentBlock": // Babel block comment. - case "Block": // Esprima block comment. - return concat(["/*", fromString(n.value, options), "*/"]); - - case "CommentLine": // Babel line comment. - case "Line": // Esprima line comment. - return concat(["//", fromString(n.value, options)]); - - // Type Annotations for Facebook Flow, typically stripped out or - // transformed away before printing. - case "TypeAnnotation": - var parts = []; - - if (n.typeAnnotation) { - if (n.typeAnnotation.type !== "FunctionTypeAnnotation") { - parts.push(": "); - } - parts.push(path.call(print, "typeAnnotation")); - return concat(parts); - } - - return fromString(""); - - case "AnyTypeAnnotation": - return fromString("any", options); - - case "MixedTypeAnnotation": - return fromString("mixed", options); - - case "ArrayTypeAnnotation": - return concat([ - path.call(print, "elementType"), - "[]" - ]); - - case "BooleanTypeAnnotation": - return fromString("boolean", options); - - case "BooleanLiteralTypeAnnotation": - assert.strictEqual(typeof n.value, "boolean"); - return fromString("" + n.value, options); - - case "DeclareClass": - return concat([ - fromString("declare class ", options), - path.call(print, "id"), - " ", - path.call(print, "body"), - ]); - - case "DeclareFunction": - return concat([ - fromString("declare function ", options), - path.call(print, "id"), - ";" - ]); - - case "DeclareModule": - return concat([ - fromString("declare module ", options), - path.call(print, "id"), - " ", - path.call(print, "body"), - ]); - - case "DeclareVariable": - return concat([ - fromString("declare var ", options), - path.call(print, "id"), - ";" - ]); - - case "FunctionTypeAnnotation": - // FunctionTypeAnnotation is ambiguous: - // declare function(a: B): void; OR - // var A: (a: B) => void; - var parts = []; - var parent = path.getParentNode(0); - var isArrowFunctionTypeAnnotation = !( - namedTypes.ObjectTypeCallProperty.check(parent) || - namedTypes.DeclareFunction.check(path.getParentNode(2)) - ); - - var needsColon = - isArrowFunctionTypeAnnotation && - !namedTypes.FunctionTypeParam.check(parent); - - if (needsColon) { - parts.push(": "); - } - - parts.push( - "(", - fromString(", ").join(path.map(print, "params")), - ")" - ); - - // The returnType is not wrapped in a TypeAnnotation, so the colon - // needs to be added separately. - if (n.returnType) { - parts.push( - isArrowFunctionTypeAnnotation ? " => " : ": ", - path.call(print, "returnType") - ); - } - - return concat(parts); - - case "FunctionTypeParam": - return concat([ - path.call(print, "name"), - ": ", - path.call(print, "typeAnnotation"), - ]); - - case "GenericTypeAnnotation": - return concat([ - path.call(print, "id"), - path.call(print, "typeParameters") - ]); - - case "InterfaceDeclaration": - var parts = [ - fromString("interface ", options), - path.call(print, "id"), - path.call(print, "typeParameters"), - " " - ]; - - if (n["extends"]) { - parts.push( - "extends ", - fromString(", ").join(path.map(print, "extends")) - ); - } - - parts.push(" ", path.call(print, "body")); - - return concat(parts); - - case "ClassImplements": - case "InterfaceExtends": - return concat([ - path.call(print, "id"), - path.call(print, "typeParameters") - ]); - - case "IntersectionTypeAnnotation": - return fromString(" & ").join(path.map(print, "types")); - - case "NullableTypeAnnotation": - return concat([ - "?", - path.call(print, "typeAnnotation") - ]); - - case "NumberTypeAnnotation": - return fromString("number", options); - - case "ObjectTypeCallProperty": - return path.call(print, "value"); - - case "ObjectTypeIndexer": - return concat([ - "[", - path.call(print, "id"), - ": ", - path.call(print, "key"), - "]: ", - path.call(print, "value") - ]); - - case "ObjectTypeProperty": - return concat([ - path.call(print, "key"), - ": ", - path.call(print, "value") - ]); - - case "QualifiedTypeIdentifier": - return concat([ - path.call(print, "qualification"), - ".", - path.call(print, "id") - ]); - - case "StringLiteralTypeAnnotation": - return fromString(nodeStr(n.value, options), options); - - case "NumberLiteralTypeAnnotation": - assert.strictEqual(typeof n.value, "number"); - return fromString("" + n.value, options); - - case "StringTypeAnnotation": - return fromString("string", options); - - case "TypeAlias": - return concat([ - "type ", - path.call(print, "id"), - " = ", - path.call(print, "right"), - ";" - ]); - - case "TypeCastExpression": - return concat([ - "(", - path.call(print, "expression"), - path.call(print, "typeAnnotation"), - ")" - ]); - - case "TypeParameterDeclaration": - case "TypeParameterInstantiation": - return concat([ - "<", - fromString(", ").join(path.map(print, "params")), - ">" - ]); - - case "TypeofTypeAnnotation": - return concat([ - fromString("typeof ", options), - path.call(print, "argument") - ]); - - case "UnionTypeAnnotation": - return fromString(" | ").join(path.map(print, "types")); - - case "VoidTypeAnnotation": - return fromString("void", options); - - // Unhandled types below. If encountered, nodes of these types should - // be either left alone or desugared into AST types that are fully - // supported by the pretty-printer. - case "ClassHeritage": // TODO - case "ComprehensionBlock": // TODO - case "ComprehensionExpression": // TODO - case "Glob": // TODO - case "GeneratorExpression": // TODO - case "LetStatement": // TODO - case "LetExpression": // TODO - case "GraphExpression": // TODO - case "GraphIndexExpression": // TODO - - // XML types that nobody cares about or needs to print. - case "XMLDefaultDeclaration": - case "XMLAnyName": - case "XMLQualifiedIdentifier": - case "XMLFunctionQualifiedIdentifier": - case "XMLAttributeSelector": - case "XMLFilterExpression": - case "XML": - case "XMLElement": - case "XMLList": - case "XMLEscape": - case "XMLText": - case "XMLStartTag": - case "XMLEndTag": - case "XMLPointTag": - case "XMLName": - case "XMLAttribute": - case "XMLCdata": - case "XMLComment": - case "XMLProcessingInstruction": - default: - debugger; - throw new Error("unknown type: " + JSON.stringify(n.type)); - } - - return p; -} - -function printStatementSequence(path, options, print) { - var inClassBody = - namedTypes.ClassBody && - namedTypes.ClassBody.check(path.getParentNode()); - - var filtered = []; - var sawComment = false; - var sawStatement = false; - - path.each(function(stmtPath) { - var i = stmtPath.getName(); - var stmt = stmtPath.getValue(); - - // Just in case the AST has been modified to contain falsy - // "statements," it's safer simply to skip them. - if (!stmt) { - return; - } - - // Skip printing EmptyStatement nodes to avoid leaving stray - // semicolons lying around. - if (stmt.type === "EmptyStatement") { - return; - } - - if (namedTypes.Comment.check(stmt)) { - // The pretty printer allows a dangling Comment node to act as - // a Statement when the Comment can't be attached to any other - // non-Comment node in the tree. - sawComment = true; - } else if (!inClassBody) { - namedTypes.Statement.assert(stmt); - sawStatement = true; - } - - // We can't hang onto stmtPath outside of this function, because - // it's just a reference to a mutable FastPath object, so we have - // to go ahead and print it here. - filtered.push({ - node: stmt, - printed: print(stmtPath) - }); - }); - - if (sawComment) { - assert.strictEqual( - sawStatement, false, - "Comments may appear as statements in otherwise empty statement " + - "lists, but may not coexist with non-Comment nodes." - ); - } - - var prevTrailingSpace = null; - var len = filtered.length; - var parts = []; - - filtered.forEach(function(info, i) { - var printed = info.printed; - var stmt = info.node; - var multiLine = printed.length > 1; - var notFirst = i > 0; - var notLast = i < len - 1; - var leadingSpace; - var trailingSpace; - var lines = stmt && stmt.loc && stmt.loc.lines; - var trueLoc = lines && options.reuseWhitespace && - util.getTrueLoc(stmt, lines); - - if (notFirst) { - if (trueLoc) { - var beforeStart = lines.skipSpaces(trueLoc.start, true); - var beforeStartLine = beforeStart ? beforeStart.line : 1; - var leadingGap = trueLoc.start.line - beforeStartLine; - leadingSpace = Array(leadingGap + 1).join("\n"); - } else { - leadingSpace = multiLine ? "\n\n" : "\n"; - } - } else { - leadingSpace = ""; - } - - if (notLast) { - if (trueLoc) { - var afterEnd = lines.skipSpaces(trueLoc.end); - var afterEndLine = afterEnd ? afterEnd.line : lines.length; - var trailingGap = afterEndLine - trueLoc.end.line; - trailingSpace = Array(trailingGap + 1).join("\n"); - } else { - trailingSpace = multiLine ? "\n\n" : "\n"; - } - } else { - trailingSpace = ""; - } - - parts.push( - maxSpace(prevTrailingSpace, leadingSpace), - printed - ); - - if (notLast) { - prevTrailingSpace = trailingSpace; - } else if (trailingSpace) { - parts.push(trailingSpace); - } - }); - - return concat(parts); -} - -function maxSpace(s1, s2) { - if (!s1 && !s2) { - return fromString(""); - } - - if (!s1) { - return fromString(s2); - } - - if (!s2) { - return fromString(s1); - } - - var spaceLines1 = fromString(s1); - var spaceLines2 = fromString(s2); - - if (spaceLines2.length > spaceLines1.length) { - return spaceLines2; - } - - return spaceLines1; -} - -function printMethod(path, options, print) { - var node = path.getNode(); - var kind = node.kind; - var parts = []; - - namedTypes.FunctionExpression.assert(node.value); - - if (node.decorators) { - path.each(function(decoratorPath) { - parts.push(print(decoratorPath), "\n"); - }, "decorators"); - } - - if (node.value.async) { - parts.push("async "); - } - - if (!kind || kind === "init" || kind === "method" || kind === "constructor") { - if (node.value.generator) { - parts.push("*"); - } - } else { - assert.ok(kind === "get" || kind === "set"); - parts.push(kind, " "); - } - - var key = path.call(print, "key"); - if (node.computed) { - key = concat(["[", key, "]"]); - } - - parts.push( - key, - path.call(print, "value", "typeParameters"), - "(", - path.call(function(valuePath) { - return printFunctionParams(valuePath, options, print); - }, "value"), - ")", - path.call(print, "value", "returnType"), - " ", - path.call(print, "value", "body") - ); - - return concat(parts); -} - -function printArgumentsList(path, options, print) { - var printed = path.map(print, "arguments"); - - var joined = fromString(", ").join(printed); - if (joined.getLineLength(1) > options.wrapColumn) { - joined = fromString(",\n").join(printed); - return concat([ - "(\n", - joined.indent(options.tabWidth), - options.trailingComma ? ",\n)" : "\n)" - ]); - } - - return concat(["(", joined, ")"]); -} - -function printFunctionParams(path, options, print) { - var fun = path.getValue(); - namedTypes.Function.assert(fun); - - var printed = path.map(print, "params"); - - if (fun.defaults) { - path.each(function(defExprPath) { - var i = defExprPath.getName(); - var p = printed[i]; - if (p && defExprPath.getValue()) { - printed[i] = concat([p, "=", print(defExprPath)]); - } - }, "defaults"); - } - - if (fun.rest) { - printed.push(concat(["...", path.call(print, "rest")])); - } - - var joined = fromString(", ").join(printed); - if (joined.length > 1 || - joined.getLineLength(1) > options.wrapColumn) { - joined = fromString(",\n").join(printed); - if (options.trailingComma && !fun.rest) { - joined = concat([joined, ",\n"]); - } - return concat(["\n", joined.indent(options.tabWidth)]); - } - - return joined; -} - -function adjustClause(clause, options) { - if (clause.length > 1) - return concat([" ", clause]); - - return concat([ - "\n", - maybeAddSemicolon(clause).indent(options.tabWidth) - ]); -} - -function lastNonSpaceCharacter(lines) { - var pos = lines.lastPos(); - do { - var ch = lines.charAt(pos); - if (/\S/.test(ch)) - return ch; - } while (lines.prevPos(pos)); -} - -function endsWithBrace(lines) { - return lastNonSpaceCharacter(lines) === "}"; -} - -function swapQuotes(str) { - return str.replace(/['"]/g, function(m) { - return m === '"' ? '\'' : '"'; - }); -} - -function nodeStr(str, options) { - isString.assert(str); - switch (options.quote) { - case "auto": - var double = JSON.stringify(str); - var single = swapQuotes(JSON.stringify(swapQuotes(str))); - return double.length > single.length ? single : double; - case "single": - return swapQuotes(JSON.stringify(swapQuotes(str))); - case "double": - default: - return JSON.stringify(str); - } -} - -function maybeAddSemicolon(lines) { - var eoc = lastNonSpaceCharacter(lines); - if (!eoc || "\n};".indexOf(eoc) < 0) - return concat([lines, ";"]); - return lines; -} - -},{"2":2,"558":558,"559":559,"560":560,"562":562,"564":564,"566":566,"567":567,"607":607}],566:[function(_dereq_,module,exports){ -// This module was originally created so that Recast could add its own -// custom types to the AST type system (in particular, the File type), but -// those types are now incorporated into ast-types, so this module doesn't -// have much to do anymore. Still, it might prove useful in the future. -module.exports = _dereq_(584); - -},{"584":584}],567:[function(_dereq_,module,exports){ -var assert = _dereq_(2); -var types = _dereq_(566); -var getFieldValue = types.getFieldValue; -var n = types.namedTypes; -var sourceMap = _dereq_(607); -var SourceMapConsumer = sourceMap.SourceMapConsumer; -var SourceMapGenerator = sourceMap.SourceMapGenerator; -var hasOwn = Object.prototype.hasOwnProperty; - -function getUnionOfKeys() { - var result = {}; - var argc = arguments.length; - for (var i = 0; i < argc; ++i) { - var keys = Object.keys(arguments[i]); - var keyCount = keys.length; - for (var j = 0; j < keyCount; ++j) { - result[keys[j]] = true; - } - } - return result; -} -exports.getUnionOfKeys = getUnionOfKeys; - -function comparePos(pos1, pos2) { - return (pos1.line - pos2.line) || (pos1.column - pos2.column); -} -exports.comparePos = comparePos; - -function copyPos(pos) { - return { - line: pos.line, - column: pos.column - }; -} -exports.copyPos = copyPos; - -exports.composeSourceMaps = function(formerMap, latterMap) { - if (formerMap) { - if (!latterMap) { - return formerMap; - } - } else { - return latterMap || null; - } - - var smcFormer = new SourceMapConsumer(formerMap); - var smcLatter = new SourceMapConsumer(latterMap); - var smg = new SourceMapGenerator({ - file: latterMap.file, - sourceRoot: latterMap.sourceRoot - }); - - var sourcesToContents = {}; - - smcLatter.eachMapping(function(mapping) { - var origPos = smcFormer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - - var sourceName = origPos.source; - if (sourceName === null) { - return; - } - - smg.addMapping({ - source: sourceName, - original: copyPos(origPos), - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - }, - name: mapping.name - }); - - var sourceContent = smcFormer.sourceContentFor(sourceName); - if (sourceContent && !hasOwn.call(sourcesToContents, sourceName)) { - sourcesToContents[sourceName] = sourceContent; - smg.setSourceContent(sourceName, sourceContent); - } - }); - - return smg.toJSON(); -}; - -exports.getTrueLoc = function(node, lines) { - // It's possible that node is newly-created (not parsed by Esprima), - // in which case it probably won't have a .loc property (or an - // .original property for that matter). That's fine; we'll just - // pretty-print it as usual. - if (!node.loc) { - return null; - } - - var start = node.loc.start; - var end = node.loc.end; - - // If the node has any comments, their locations might contribute to - // the true start/end positions of the node. - if (node.comments) { - node.comments.forEach(function(comment) { - if (comment.loc) { - if (comparePos(comment.loc.start, start) < 0) { - start = comment.loc.start; - } - - if (comparePos(end, comment.loc.end) < 0) { - end = comment.loc.end; - } - } - }); - } - - return { - // Finally, trim any leading or trailing whitespace from the true - // location of the node. - start: lines.skipSpaces(start, false, false), - end: lines.skipSpaces(end, true, false) - }; -}; - -exports.fixFaultyLocations = function(node) { - if ((n.MethodDefinition && n.MethodDefinition.check(node)) || - (n.Property.check(node) && (node.method || node.shorthand))) { - // If the node is a MethodDefinition or a .method or .shorthand - // Property, then the location information stored in - // node.value.loc is very likely untrustworthy (just the {body} - // part of a method, or nothing in the case of shorthand - // properties), so we null out that information to prevent - // accidental reuse of bogus source code during reprinting. - node.value.loc = null; - - if (n.FunctionExpression.check(node.value)) { - // FunctionExpression method values should be anonymous, - // because their .id fields are ignored anyway. - node.value.id = null; - } - } - - var loc = node.loc; - if (loc) { - if (loc.start.line < 1) { - loc.start.line = 1; - } - - if (loc.end.line < 1) { - loc.end.line = 1; - } - } -}; - -},{"2":2,"566":566,"607":607}],568:[function(_dereq_,module,exports){ -(function (process){ -var types = _dereq_(566); -var parse = _dereq_(563).parse; -var Printer = _dereq_(565).Printer; - -function print(node, options) { - return new Printer(options).print(node); -} - -function prettyPrint(node, options) { - return new Printer(options).printGenerically(node); -} - -function run(transformer, options) { - return runFile(process.argv[2], transformer, options); -} - -function runFile(path, transformer, options) { - _dereq_(1).readFile(path, "utf-8", function(err, code) { - if (err) { - console.error(err); - return; - } - - runString(code, transformer, options); - }); -} - -function defaultWriteback(output) { - process.stdout.write(output); -} - -function runString(code, transformer, options) { - var writeback = options && options.writeback || defaultWriteback; - transformer(parse(code, options), function(node) { - writeback(print(node, options).code); - }); -} - -Object.defineProperties(exports, { - /** - * Parse a string of code into an augmented syntax tree suitable for - * arbitrary modification and reprinting. - */ - parse: { - enumerable: true, - value: parse - }, - - /** - * Traverse and potentially modify an abstract syntax tree using a - * convenient visitor syntax: - * - * recast.visit(ast, { - * names: [], - * visitIdentifier: function(path) { - * var node = path.value; - * this.visitor.names.push(node.name); - * this.traverse(path); - * } - * }); - */ - visit: { - enumerable: true, - value: types.visit - }, - - /** - * Reprint a modified syntax tree using as much of the original source - * code as possible. - */ - print: { - enumerable: true, - value: print - }, - - /** - * Print without attempting to reuse any original source code. - */ - prettyPrint: { - enumerable: false, - value: prettyPrint - }, - - /** - * Customized version of require("ast-types"). - */ - types: { - enumerable: false, - value: types - }, - - /** - * Convenient command-line interface (see e.g. example/add-braces). - */ - run: { - enumerable: false, - value: run - } -}); - -}).call(this,_dereq_(10)) -},{"1":1,"10":10,"563":563,"565":565,"566":566}],569:[function(_dereq_,module,exports){ -_dereq_(573); - -var types = _dereq_(583); -var defaults = _dereq_(582).defaults; -var def = types.Type.def; -var or = types.Type.or; - -def("Noop") - .bases("Node") - .build(); - -def("DoExpression") - .bases("Expression") - .build("body") - .field("body", [def("Statement")]); - -def("Super") - .bases("Expression") - .build(); - -def("BindExpression") - .bases("Expression") - .build("object", "callee") - .field("object", or(def("Expression"), null)) - .field("callee", def("Expression")); - -def("Decorator") - .bases("Node") - .build("expression") - .field("expression", def("Expression")); - -def("Property") - .field("decorators", - or([def("Decorator")], null), - defaults["null"]); - -def("MethodDefinition") - .field("decorators", - or([def("Decorator")], null), - defaults["null"]); - -def("MetaProperty") - .bases("Expression") - .build("meta", "property") - .field("meta", def("Identifier")) - .field("property", def("Identifier")); - -def("ParenthesizedExpression") - .bases("Expression") - .build("expression") - .field("expression", def("Expression")); - -def("ImportSpecifier") - .bases("ModuleSpecifier") - .build("imported", "local") - .field("imported", def("Identifier")); - -def("ImportDefaultSpecifier") - .bases("ModuleSpecifier") - .build("local"); - -def("ImportNamespaceSpecifier") - .bases("ModuleSpecifier") - .build("local"); - -def("ExportDefaultDeclaration") - .bases("Declaration") - .build("declaration") - .field("declaration", or(def("Declaration"), def("Expression"))); - -def("ExportNamedDeclaration") - .bases("Declaration") - .build("declaration", "specifiers", "source") - .field("declaration", or(def("Declaration"), null)) - .field("specifiers", [def("ExportSpecifier")], defaults.emptyArray) - .field("source", or(def("Literal"), null), defaults["null"]); - -def("ExportSpecifier") - .bases("ModuleSpecifier") - .build("local", "exported") - .field("exported", def("Identifier")); - -def("ExportNamespaceSpecifier") - .bases("Specifier") - .build("exported") - .field("exported", def("Identifier")); - -def("ExportDefaultSpecifier") - .bases("Specifier") - .build("exported") - .field("exported", def("Identifier")); - -def("ExportAllDeclaration") - .bases("Declaration") - .build("exported", "source") - .field("exported", or(def("Identifier"), null)) - .field("source", def("Literal")); - -def("CommentBlock") - .bases("Comment") - .build("value", /*optional:*/ "leading", "trailing"); - -def("CommentLine") - .bases("Comment") - .build("value", /*optional:*/ "leading", "trailing"); - -},{"573":573,"582":582,"583":583}],570:[function(_dereq_,module,exports){ -var types = _dereq_(583); -var Type = types.Type; -var def = Type.def; -var or = Type.or; -var shared = _dereq_(582); -var defaults = shared.defaults; -var geq = shared.geq; - -// Abstract supertype of all syntactic entities that are allowed to have a -// .loc field. -def("Printable") - .field("loc", or( - def("SourceLocation"), - null - ), defaults["null"], true); - -def("Node") - .bases("Printable") - .field("type", String) - .field("comments", or( - [def("Comment")], - null - ), defaults["null"], true); - -def("SourceLocation") - .build("start", "end", "source") - .field("start", def("Position")) - .field("end", def("Position")) - .field("source", or(String, null), defaults["null"]); - -def("Position") - .build("line", "column") - .field("line", geq(1)) - .field("column", geq(0)); - -def("File") - .bases("Node") - .build("program") - .field("program", def("Program")); - -def("Program") - .bases("Node") - .build("body") - .field("body", [def("Statement")]); - -def("Function") - .bases("Node") - .field("id", or(def("Identifier"), null), defaults["null"]) - .field("params", [def("Pattern")]) - .field("body", def("BlockStatement")); - -def("Statement").bases("Node"); - -// The empty .build() here means that an EmptyStatement can be constructed -// (i.e. it's not abstract) but that it needs no arguments. -def("EmptyStatement").bases("Statement").build(); - -def("BlockStatement") - .bases("Statement") - .build("body") - .field("body", [def("Statement")]); - -// TODO Figure out how to silently coerce Expressions to -// ExpressionStatements where a Statement was expected. -def("ExpressionStatement") - .bases("Statement") - .build("expression") - .field("expression", def("Expression")); - -def("IfStatement") - .bases("Statement") - .build("test", "consequent", "alternate") - .field("test", def("Expression")) - .field("consequent", def("Statement")) - .field("alternate", or(def("Statement"), null), defaults["null"]); - -def("LabeledStatement") - .bases("Statement") - .build("label", "body") - .field("label", def("Identifier")) - .field("body", def("Statement")); - -def("BreakStatement") - .bases("Statement") - .build("label") - .field("label", or(def("Identifier"), null), defaults["null"]); - -def("ContinueStatement") - .bases("Statement") - .build("label") - .field("label", or(def("Identifier"), null), defaults["null"]); - -def("WithStatement") - .bases("Statement") - .build("object", "body") - .field("object", def("Expression")) - .field("body", def("Statement")); - -def("SwitchStatement") - .bases("Statement") - .build("discriminant", "cases", "lexical") - .field("discriminant", def("Expression")) - .field("cases", [def("SwitchCase")]) - .field("lexical", Boolean, defaults["false"]); - -def("ReturnStatement") - .bases("Statement") - .build("argument") - .field("argument", or(def("Expression"), null)); - -def("ThrowStatement") - .bases("Statement") - .build("argument") - .field("argument", def("Expression")); - -def("TryStatement") - .bases("Statement") - .build("block", "handler", "finalizer") - .field("block", def("BlockStatement")) - .field("handler", or(def("CatchClause"), null), function() { - return this.handlers && this.handlers[0] || null; - }) - .field("handlers", [def("CatchClause")], function() { - return this.handler ? [this.handler] : []; - }, true) // Indicates this field is hidden from eachField iteration. - .field("guardedHandlers", [def("CatchClause")], defaults.emptyArray) - .field("finalizer", or(def("BlockStatement"), null), defaults["null"]); - -def("CatchClause") - .bases("Node") - .build("param", "guard", "body") - .field("param", def("Pattern")) - .field("guard", or(def("Expression"), null), defaults["null"]) - .field("body", def("BlockStatement")); - -def("WhileStatement") - .bases("Statement") - .build("test", "body") - .field("test", def("Expression")) - .field("body", def("Statement")); - -def("DoWhileStatement") - .bases("Statement") - .build("body", "test") - .field("body", def("Statement")) - .field("test", def("Expression")); - -def("ForStatement") - .bases("Statement") - .build("init", "test", "update", "body") - .field("init", or( - def("VariableDeclaration"), - def("Expression"), - null)) - .field("test", or(def("Expression"), null)) - .field("update", or(def("Expression"), null)) - .field("body", def("Statement")); - -def("ForInStatement") - .bases("Statement") - .build("left", "right", "body") - .field("left", or( - def("VariableDeclaration"), - def("Expression"))) - .field("right", def("Expression")) - .field("body", def("Statement")); - -def("DebuggerStatement").bases("Statement").build(); - -def("Declaration").bases("Statement"); - -def("FunctionDeclaration") - .bases("Function", "Declaration") - .build("id", "params", "body") - .field("id", def("Identifier")); - -def("FunctionExpression") - .bases("Function", "Expression") - .build("id", "params", "body"); - -def("VariableDeclaration") - .bases("Declaration") - .build("kind", "declarations") - .field("kind", or("var", "let", "const")) - .field("declarations", [def("VariableDeclarator")]); - -def("VariableDeclarator") - .bases("Node") - .build("id", "init") - .field("id", def("Pattern")) - .field("init", or(def("Expression"), null)); - -// TODO Are all Expressions really Patterns? -def("Expression").bases("Node", "Pattern"); - -def("ThisExpression").bases("Expression").build(); - -def("ArrayExpression") - .bases("Expression") - .build("elements") - .field("elements", [or(def("Expression"), null)]); - -def("ObjectExpression") - .bases("Expression") - .build("properties") - .field("properties", [def("Property")]); - -// TODO Not in the Mozilla Parser API, but used by Esprima. -def("Property") - .bases("Node") // Want to be able to visit Property Nodes. - .build("kind", "key", "value") - .field("kind", or("init", "get", "set")) - .field("key", or(def("Literal"), def("Identifier"))) - .field("value", def("Expression")); - -def("SequenceExpression") - .bases("Expression") - .build("expressions") - .field("expressions", [def("Expression")]); - -var UnaryOperator = or( - "-", "+", "!", "~", - "typeof", "void", "delete"); - -def("UnaryExpression") - .bases("Expression") - .build("operator", "argument", "prefix") - .field("operator", UnaryOperator) - .field("argument", def("Expression")) - // Esprima doesn't bother with this field, presumably because it's - // always true for unary operators. - .field("prefix", Boolean, defaults["true"]); - -var BinaryOperator = or( - "==", "!=", "===", "!==", - "<", "<=", ">", ">=", - "<<", ">>", ">>>", - "+", "-", "*", "/", "%", - "&", // TODO Missing from the Parser API. - "|", "^", "in", - "instanceof", ".."); - -def("BinaryExpression") - .bases("Expression") - .build("operator", "left", "right") - .field("operator", BinaryOperator) - .field("left", def("Expression")) - .field("right", def("Expression")); - -var AssignmentOperator = or( - "=", "+=", "-=", "*=", "/=", "%=", - "<<=", ">>=", ">>>=", - "|=", "^=", "&="); - -def("AssignmentExpression") - .bases("Expression") - .build("operator", "left", "right") - .field("operator", AssignmentOperator) - .field("left", def("Pattern")) - .field("right", def("Expression")); - -var UpdateOperator = or("++", "--"); - -def("UpdateExpression") - .bases("Expression") - .build("operator", "argument", "prefix") - .field("operator", UpdateOperator) - .field("argument", def("Expression")) - .field("prefix", Boolean); - -var LogicalOperator = or("||", "&&"); - -def("LogicalExpression") - .bases("Expression") - .build("operator", "left", "right") - .field("operator", LogicalOperator) - .field("left", def("Expression")) - .field("right", def("Expression")); - -def("ConditionalExpression") - .bases("Expression") - .build("test", "consequent", "alternate") - .field("test", def("Expression")) - .field("consequent", def("Expression")) - .field("alternate", def("Expression")); - -def("NewExpression") - .bases("Expression") - .build("callee", "arguments") - .field("callee", def("Expression")) - // The Mozilla Parser API gives this type as [or(def("Expression"), - // null)], but null values don't really make sense at the call site. - // TODO Report this nonsense. - .field("arguments", [def("Expression")]); - -def("CallExpression") - .bases("Expression") - .build("callee", "arguments") - .field("callee", def("Expression")) - // See comment for NewExpression above. - .field("arguments", [def("Expression")]); - -def("MemberExpression") - .bases("Expression") - .build("object", "property", "computed") - .field("object", def("Expression")) - .field("property", or(def("Identifier"), def("Expression"))) - .field("computed", Boolean, defaults["false"]); - -def("Pattern").bases("Node"); - -def("SwitchCase") - .bases("Node") - .build("test", "consequent") - .field("test", or(def("Expression"), null)) - .field("consequent", [def("Statement")]); - -def("Identifier") - // But aren't Expressions and Patterns already Nodes? TODO Report this. - .bases("Node", "Expression", "Pattern") - .build("name") - .field("name", String); - -def("Literal") - // But aren't Expressions already Nodes? TODO Report this. - .bases("Node", "Expression") - .build("value") - .field("value", or(String, Boolean, null, Number, RegExp)) - .field("regex", or({ - pattern: String, - flags: String - }, null), function() { - if (this.value instanceof RegExp) { - var flags = ""; - - if (this.value.ignoreCase) flags += "i"; - if (this.value.multiline) flags += "m"; - if (this.value.global) flags += "g"; - - return { - pattern: this.value.source, - flags: flags - }; - } - - return null; - }); - -// Abstract (non-buildable) comment supertype. Not a Node. -def("Comment") - .bases("Printable") - .field("value", String) - // A .leading comment comes before the node, whereas a .trailing - // comment comes after it. These two fields should not both be true, - // but they might both be false when the comment falls inside a node - // and the node has no children for the comment to lead or trail, - // e.g. { /*dangling*/ }. - .field("leading", Boolean, defaults["true"]) - .field("trailing", Boolean, defaults["false"]); - -},{"582":582,"583":583}],571:[function(_dereq_,module,exports){ -_dereq_(570); -var types = _dereq_(583); -var def = types.Type.def; -var or = types.Type.or; - -// Note that none of these types are buildable because the Mozilla Parser -// API doesn't specify any builder functions, and nobody uses E4X anymore. - -def("XMLDefaultDeclaration") - .bases("Declaration") - .field("namespace", def("Expression")); - -def("XMLAnyName").bases("Expression"); - -def("XMLQualifiedIdentifier") - .bases("Expression") - .field("left", or(def("Identifier"), def("XMLAnyName"))) - .field("right", or(def("Identifier"), def("Expression"))) - .field("computed", Boolean); - -def("XMLFunctionQualifiedIdentifier") - .bases("Expression") - .field("right", or(def("Identifier"), def("Expression"))) - .field("computed", Boolean); - -def("XMLAttributeSelector") - .bases("Expression") - .field("attribute", def("Expression")); - -def("XMLFilterExpression") - .bases("Expression") - .field("left", def("Expression")) - .field("right", def("Expression")); - -def("XMLElement") - .bases("XML", "Expression") - .field("contents", [def("XML")]); - -def("XMLList") - .bases("XML", "Expression") - .field("contents", [def("XML")]); - -def("XML").bases("Node"); - -def("XMLEscape") - .bases("XML") - .field("expression", def("Expression")); - -def("XMLText") - .bases("XML") - .field("text", String); - -def("XMLStartTag") - .bases("XML") - .field("contents", [def("XML")]); - -def("XMLEndTag") - .bases("XML") - .field("contents", [def("XML")]); - -def("XMLPointTag") - .bases("XML") - .field("contents", [def("XML")]); - -def("XMLName") - .bases("XML") - .field("contents", or(String, [def("XML")])); - -def("XMLAttribute") - .bases("XML") - .field("value", String); - -def("XMLCdata") - .bases("XML") - .field("contents", String); - -def("XMLComment") - .bases("XML") - .field("contents", String); - -def("XMLProcessingInstruction") - .bases("XML") - .field("target", String) - .field("contents", or(String, null)); - -},{"570":570,"583":583}],572:[function(_dereq_,module,exports){ -_dereq_(570); -var types = _dereq_(583); -var def = types.Type.def; -var or = types.Type.or; -var defaults = _dereq_(582).defaults; - -def("Function") - .field("generator", Boolean, defaults["false"]) - .field("expression", Boolean, defaults["false"]) - .field("defaults", [or(def("Expression"), null)], defaults.emptyArray) - // TODO This could be represented as a RestElement in .params. - .field("rest", or(def("Identifier"), null), defaults["null"]); - -// The ESTree way of representing a ...rest parameter. -def("RestElement") - .bases("Pattern") - .build("argument") - .field("argument", def("Pattern")); - -def("SpreadElementPattern") - .bases("Pattern") - .build("argument") - .field("argument", def("Pattern")); - -def("FunctionDeclaration") - .build("id", "params", "body", "generator", "expression"); - -def("FunctionExpression") - .build("id", "params", "body", "generator", "expression"); - -// The Parser API calls this ArrowExpression, but Esprima and all other -// actual parsers use ArrowFunctionExpression. -def("ArrowFunctionExpression") - .bases("Function", "Expression") - .build("params", "body", "expression") - // The forced null value here is compatible with the overridden - // definition of the "id" field in the Function interface. - .field("id", null, defaults["null"]) - // Arrow function bodies are allowed to be expressions. - .field("body", or(def("BlockStatement"), def("Expression"))) - // The current spec forbids arrow generators, so I have taken the - // liberty of enforcing that. TODO Report this. - .field("generator", false, defaults["false"]); - -def("YieldExpression") - .bases("Expression") - .build("argument", "delegate") - .field("argument", or(def("Expression"), null)) - .field("delegate", Boolean, defaults["false"]); - -def("GeneratorExpression") - .bases("Expression") - .build("body", "blocks", "filter") - .field("body", def("Expression")) - .field("blocks", [def("ComprehensionBlock")]) - .field("filter", or(def("Expression"), null)); - -def("ComprehensionExpression") - .bases("Expression") - .build("body", "blocks", "filter") - .field("body", def("Expression")) - .field("blocks", [def("ComprehensionBlock")]) - .field("filter", or(def("Expression"), null)); - -def("ComprehensionBlock") - .bases("Node") - .build("left", "right", "each") - .field("left", def("Pattern")) - .field("right", def("Expression")) - .field("each", Boolean); - -def("Property") - .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) - .field("value", or(def("Expression"), def("Pattern"))) - .field("method", Boolean, defaults["false"]) - .field("shorthand", Boolean, defaults["false"]) - .field("computed", Boolean, defaults["false"]); - -def("PropertyPattern") - .bases("Pattern") - .build("key", "pattern") - .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) - .field("pattern", def("Pattern")) - .field("computed", Boolean, defaults["false"]); - -def("ObjectPattern") - .bases("Pattern") - .build("properties") - .field("properties", [or(def("PropertyPattern"), def("Property"))]); - -def("ArrayPattern") - .bases("Pattern") - .build("elements") - .field("elements", [or(def("Pattern"), null)]); - -def("MethodDefinition") - .bases("Declaration") - .build("kind", "key", "value", "static") - .field("kind", or("constructor", "method", "get", "set")) - .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) - .field("value", def("Function")) - .field("computed", Boolean, defaults["false"]) - .field("static", Boolean, defaults["false"]); - -def("SpreadElement") - .bases("Node") - .build("argument") - .field("argument", def("Expression")); - -def("ArrayExpression") - .field("elements", [or( - def("Expression"), - def("SpreadElement"), - def("RestElement"), - null - )]); - -def("NewExpression") - .field("arguments", [or(def("Expression"), def("SpreadElement"))]); - -def("CallExpression") - .field("arguments", [or(def("Expression"), def("SpreadElement"))]); - -// Note: this node type is *not* an AssignmentExpression with a Pattern on -// the left-hand side! The existing AssignmentExpression type already -// supports destructuring assignments. AssignmentPattern nodes may appear -// wherever a Pattern is allowed, and the right-hand side represents a -// default value to be destructured against the left-hand side, if no -// value is otherwise provided. For example: default parameter values. -def("AssignmentPattern") - .bases("Pattern") - .build("left", "right") - .field("left", def("Pattern")) - .field("right", def("Expression")); - -var ClassBodyElement = or( - def("MethodDefinition"), - def("VariableDeclarator"), - def("ClassPropertyDefinition"), - def("ClassProperty") -); - -def("ClassProperty") - .bases("Declaration") - .build("key") - .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) - .field("computed", Boolean, defaults["false"]); - -def("ClassPropertyDefinition") // static property - .bases("Declaration") - .build("definition") - // Yes, Virginia, circular definitions are permitted. - .field("definition", ClassBodyElement); - -def("ClassBody") - .bases("Declaration") - .build("body") - .field("body", [ClassBodyElement]); - -def("ClassDeclaration") - .bases("Declaration") - .build("id", "body", "superClass") - .field("id", or(def("Identifier"), null)) - .field("body", def("ClassBody")) - .field("superClass", or(def("Expression"), null), defaults["null"]); - -def("ClassExpression") - .bases("Expression") - .build("id", "body", "superClass") - .field("id", or(def("Identifier"), null), defaults["null"]) - .field("body", def("ClassBody")) - .field("superClass", or(def("Expression"), null), defaults["null"]) - .field("implements", [def("ClassImplements")], defaults.emptyArray); - -def("ClassImplements") - .bases("Node") - .build("id") - .field("id", def("Identifier")) - .field("superClass", or(def("Expression"), null), defaults["null"]); - -// Specifier and ModuleSpecifier are abstract non-standard types -// introduced for definitional convenience. -def("Specifier").bases("Node"); - -// This supertype is shared/abused by both def/babel.js and -// def/esprima.js. In the future, it will be possible to load only one set -// of definitions appropriate for a given parser, but until then we must -// rely on default functions to reconcile the conflicting AST formats. -def("ModuleSpecifier") - .bases("Specifier") - // This local field is used by Babel/Acorn. It should not technically - // be optional in the Babel/Acorn AST format, but it must be optional - // in the Esprima AST format. - .field("local", or(def("Identifier"), null), defaults["null"]) - // The id and name fields are used by Esprima. The id field should not - // technically be optional in the Esprima AST format, but it must be - // optional in the Babel/Acorn AST format. - .field("id", or(def("Identifier"), null), defaults["null"]) - .field("name", or(def("Identifier"), null), defaults["null"]); - -def("TaggedTemplateExpression") - .bases("Expression") - .build("tag", "quasi") - .field("tag", def("Expression")) - .field("quasi", def("TemplateLiteral")); - -def("TemplateLiteral") - .bases("Expression") - .build("quasis", "expressions") - .field("quasis", [def("TemplateElement")]) - .field("expressions", [def("Expression")]); - -def("TemplateElement") - .bases("Node") - .build("value", "tail") - .field("value", {"cooked": String, "raw": String}) - .field("tail", Boolean); - -},{"570":570,"582":582,"583":583}],573:[function(_dereq_,module,exports){ -_dereq_(572); - -var types = _dereq_(583); -var def = types.Type.def; -var or = types.Type.or; -var builtin = types.builtInTypes; -var defaults = _dereq_(582).defaults; - -def("Function") - .field("async", Boolean, defaults["false"]); - -def("SpreadProperty") - .bases("Node") - .build("argument") - .field("argument", def("Expression")); - -def("ObjectExpression") - .field("properties", [or(def("Property"), def("SpreadProperty"))]); - -def("SpreadPropertyPattern") - .bases("Pattern") - .build("argument") - .field("argument", def("Pattern")); - -def("ObjectPattern") - .field("properties", [or( - def("Property"), - def("PropertyPattern"), - def("SpreadPropertyPattern") - )]); - -def("AwaitExpression") - .bases("Expression") - .build("argument", "all") - .field("argument", or(def("Expression"), null)) - .field("all", Boolean, defaults["false"]); - -},{"572":572,"582":582,"583":583}],574:[function(_dereq_,module,exports){ -_dereq_(573); - -var types = _dereq_(583); -var defaults = _dereq_(582).defaults; -var def = types.Type.def; -var or = types.Type.or; - -def("VariableDeclaration") - .field("declarations", [or( - def("VariableDeclarator"), - def("Identifier") // Esprima deviation. - )]); - -def("Property") - .field("value", or( - def("Expression"), - def("Pattern") // Esprima deviation. - )); - -def("ArrayPattern") - .field("elements", [or( - def("Pattern"), - def("SpreadElement"), - null - )]); - -def("ObjectPattern") - .field("properties", [or( - def("Property"), - def("PropertyPattern"), - def("SpreadPropertyPattern"), - def("SpreadProperty") // Used by Esprima. - )]); - -// Like ModuleSpecifier, except type:"ExportSpecifier" and buildable. -// export {<id [as name]>} [from ...]; -def("ExportSpecifier") - .bases("ModuleSpecifier") - .build("id", "name"); - -// export <*> from ...; -def("ExportBatchSpecifier") - .bases("Specifier") - .build(); - -// Like ModuleSpecifier, except type:"ImportSpecifier" and buildable. -// import {<id [as name]>} from ...; -def("ImportSpecifier") - .bases("ModuleSpecifier") - .build("id", "name"); - -// import <* as id> from ...; -def("ImportNamespaceSpecifier") - .bases("ModuleSpecifier") - .build("id"); - -// import <id> from ...; -def("ImportDefaultSpecifier") - .bases("ModuleSpecifier") - .build("id"); - -def("ExportDeclaration") - .bases("Declaration") - .build("default", "declaration", "specifiers", "source") - .field("default", Boolean) - .field("declaration", or( - def("Declaration"), - def("Expression"), // Implies default. - null - )) - .field("specifiers", [or( - def("ExportSpecifier"), - def("ExportBatchSpecifier") - )], defaults.emptyArray) - .field("source", or( - def("Literal"), - null - ), defaults["null"]); - -def("ImportDeclaration") - .bases("Declaration") - .build("specifiers", "source") - .field("specifiers", [or( - def("ImportSpecifier"), - def("ImportNamespaceSpecifier"), - def("ImportDefaultSpecifier") - )], defaults.emptyArray) - .field("source", def("Literal")); - -def("Block") - .bases("Comment") - .build("value", /*optional:*/ "leading", "trailing"); - -def("Line") - .bases("Comment") - .build("value", /*optional:*/ "leading", "trailing"); - -},{"573":573,"582":582,"583":583}],575:[function(_dereq_,module,exports){ -_dereq_(573); - -var types = _dereq_(583); -var def = types.Type.def; -var or = types.Type.or; -var defaults = _dereq_(582).defaults; - -def("JSXAttribute") - .bases("Node") - .build("name", "value") - .field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))) - .field("value", or( - def("Literal"), // attr="value" - def("JSXExpressionContainer"), // attr={value} - null // attr= or just attr - ), defaults["null"]); - -def("JSXIdentifier") - .bases("Identifier") - .build("name") - .field("name", String); - -def("JSXNamespacedName") - .bases("Node") - .build("namespace", "name") - .field("namespace", def("JSXIdentifier")) - .field("name", def("JSXIdentifier")); - -def("JSXMemberExpression") - .bases("MemberExpression") - .build("object", "property") - .field("object", or(def("JSXIdentifier"), def("JSXMemberExpression"))) - .field("property", def("JSXIdentifier")) - .field("computed", Boolean, defaults.false); - -var JSXElementName = or( - def("JSXIdentifier"), - def("JSXNamespacedName"), - def("JSXMemberExpression") -); - -def("JSXSpreadAttribute") - .bases("Node") - .build("argument") - .field("argument", def("Expression")); - -var JSXAttributes = [or( - def("JSXAttribute"), - def("JSXSpreadAttribute") -)]; - -def("JSXExpressionContainer") - .bases("Expression") - .build("expression") - .field("expression", def("Expression")); - -def("JSXElement") - .bases("Expression") - .build("openingElement", "closingElement", "children") - .field("openingElement", def("JSXOpeningElement")) - .field("closingElement", or(def("JSXClosingElement"), null), defaults["null"]) - .field("children", [or( - def("JSXElement"), - def("JSXExpressionContainer"), - def("JSXText"), - def("Literal") // TODO Esprima should return JSXText instead. - )], defaults.emptyArray) - .field("name", JSXElementName, function() { - // Little-known fact: the `this` object inside a default function - // is none other than the partially-built object itself, and any - // fields initialized directly from builder function arguments - // (like openingElement, closingElement, and children) are - // guaranteed to be available. - return this.openingElement.name; - }, true) // hidden from traversal - .field("selfClosing", Boolean, function() { - return this.openingElement.selfClosing; - }, true) // hidden from traversal - .field("attributes", JSXAttributes, function() { - return this.openingElement.attributes; - }, true); // hidden from traversal - -def("JSXOpeningElement") - .bases("Node") // TODO Does this make sense? Can't really be an JSXElement. - .build("name", "attributes", "selfClosing") - .field("name", JSXElementName) - .field("attributes", JSXAttributes, defaults.emptyArray) - .field("selfClosing", Boolean, defaults["false"]); - -def("JSXClosingElement") - .bases("Node") // TODO Same concern. - .build("name") - .field("name", JSXElementName); - -def("JSXText") - .bases("Literal") - .build("value") - .field("value", String); - -def("JSXEmptyExpression").bases("Expression").build(); - -// Type Annotations -def("Type").bases("Node"); - -def("AnyTypeAnnotation") - .bases("Type") - .build(); - -def("MixedTypeAnnotation") - .bases("Type") - .build(); - -def("VoidTypeAnnotation") - .bases("Type") - .build(); - -def("NumberTypeAnnotation") - .bases("Type") - .build(); - -def("NumberLiteralTypeAnnotation") - .bases("Type") - .build("value", "raw") - .field("value", Number) - .field("raw", String); - -def("StringTypeAnnotation") - .bases("Type") - .build(); - -def("StringLiteralTypeAnnotation") - .bases("Type") - .build("value", "raw") - .field("value", String) - .field("raw", String); - -def("BooleanTypeAnnotation") - .bases("Type") - .build(); - -def("BooleanLiteralTypeAnnotation") - .bases("Type") - .build("value", "raw") - .field("value", Boolean) - .field("raw", String); - -def("TypeAnnotation") - .bases("Node") - .build("typeAnnotation") - .field("typeAnnotation", def("Type")); - -def("NullableTypeAnnotation") - .bases("Type") - .build("typeAnnotation") - .field("typeAnnotation", def("Type")); - -def("FunctionTypeAnnotation") - .bases("Type") - .build("params", "returnType", "rest", "typeParameters") - .field("params", [def("FunctionTypeParam")]) - .field("returnType", def("Type")) - .field("rest", or(def("FunctionTypeParam"), null)) - .field("typeParameters", or(def("TypeParameterDeclaration"), null)); - -def("FunctionTypeParam") - .bases("Node") - .build("name", "typeAnnotation", "optional") - .field("name", def("Identifier")) - .field("typeAnnotation", def("Type")) - .field("optional", Boolean); - -def("ArrayTypeAnnotation") - .bases("Type") - .build("elementType") - .field("elementType", def("Type")); - -def("ObjectTypeAnnotation") - .bases("Type") - .build("properties") - .field("properties", [def("ObjectTypeProperty")]) - .field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray) - .field("callProperties", - [def("ObjectTypeCallProperty")], - defaults.emptyArray); - -def("ObjectTypeProperty") - .bases("Node") - .build("key", "value", "optional") - .field("key", or(def("Literal"), def("Identifier"))) - .field("value", def("Type")) - .field("optional", Boolean); - -def("ObjectTypeIndexer") - .bases("Node") - .build("id", "key", "value") - .field("id", def("Identifier")) - .field("key", def("Type")) - .field("value", def("Type")); - -def("ObjectTypeCallProperty") - .bases("Node") - .build("value") - .field("value", def("FunctionTypeAnnotation")) - .field("static", Boolean, false); - -def("QualifiedTypeIdentifier") - .bases("Node") - .build("qualification", "id") - .field("qualification", - or(def("Identifier"), - def("QualifiedTypeIdentifier"))) - .field("id", def("Identifier")); - -def("GenericTypeAnnotation") - .bases("Type") - .build("id", "typeParameters") - .field("id", or(def("Identifier"), def("QualifiedTypeIdentifier"))) - .field("typeParameters", or(def("TypeParameterInstantiation"), null)); - -def("MemberTypeAnnotation") - .bases("Type") - .build("object", "property") - .field("object", def("Identifier")) - .field("property", - or(def("MemberTypeAnnotation"), - def("GenericTypeAnnotation"))); - -def("UnionTypeAnnotation") - .bases("Type") - .build("types") - .field("types", [def("Type")]); - -def("IntersectionTypeAnnotation") - .bases("Type") - .build("types") - .field("types", [def("Type")]); - -def("TypeofTypeAnnotation") - .bases("Type") - .build("argument") - .field("argument", def("Type")); - -def("Identifier") - .field("typeAnnotation", or(def("TypeAnnotation"), null), defaults["null"]); - -def("TypeParameterDeclaration") - .bases("Node") - .build("params") - .field("params", [def("Identifier")]); - -def("TypeParameterInstantiation") - .bases("Node") - .build("params") - .field("params", [def("Type")]); - -def("Function") - .field("returnType", - or(def("TypeAnnotation"), null), - defaults["null"]) - .field("typeParameters", - or(def("TypeParameterDeclaration"), null), - defaults["null"]); - -def("ClassProperty") - .build("key", "value", "typeAnnotation", "static") - .field("value", or(def("Expression"), null)) - .field("typeAnnotation", or(def("TypeAnnotation"), null)) - .field("static", Boolean, defaults["false"]); - -def("ClassImplements") - .field("typeParameters", - or(def("TypeParameterInstantiation"), null), - defaults["null"]); - -def("InterfaceDeclaration") - .bases("Statement") - .build("id", "body", "extends") - .field("id", def("Identifier")) - .field("typeParameters", - or(def("TypeParameterDeclaration"), null), - defaults["null"]) - .field("body", def("ObjectTypeAnnotation")) - .field("extends", [def("InterfaceExtends")]); - -def("InterfaceExtends") - .bases("Node") - .build("id") - .field("id", def("Identifier")) - .field("typeParameters", or(def("TypeParameterInstantiation"), null)); - -def("TypeAlias") - .bases("Statement") - .build("id", "typeParameters", "right") - .field("id", def("Identifier")) - .field("typeParameters", or(def("TypeParameterDeclaration"), null)) - .field("right", def("Type")); - -def("TypeCastExpression") - .bases("Expression") - .build("expression", "typeAnnotation") - .field("expression", def("Expression")) - .field("typeAnnotation", def("TypeAnnotation")); - -def("TupleTypeAnnotation") - .bases("Type") - .build("types") - .field("types", [def("Type")]); - -def("DeclareVariable") - .bases("Statement") - .build("id") - .field("id", def("Identifier")); - -def("DeclareFunction") - .bases("Statement") - .build("id") - .field("id", def("Identifier")); - -def("DeclareClass") - .bases("InterfaceDeclaration") - .build("id"); - -def("DeclareModule") - .bases("Statement") - .build("id", "body") - .field("id", or(def("Identifier"), def("Literal"))) - .field("body", def("BlockStatement")); - -},{"573":573,"582":582,"583":583}],576:[function(_dereq_,module,exports){ -_dereq_(570); -var types = _dereq_(583); -var def = types.Type.def; -var or = types.Type.or; -var shared = _dereq_(582); -var geq = shared.geq; -var defaults = shared.defaults; - -def("Function") - // SpiderMonkey allows expression closures: function(x) x+1 - .field("body", or(def("BlockStatement"), def("Expression"))); - -def("ForInStatement") - .build("left", "right", "body", "each") - .field("each", Boolean, defaults["false"]); - -def("ForOfStatement") - .bases("Statement") - .build("left", "right", "body") - .field("left", or( - def("VariableDeclaration"), - def("Expression"))) - .field("right", def("Expression")) - .field("body", def("Statement")); - -def("LetStatement") - .bases("Statement") - .build("head", "body") - // TODO Deviating from the spec by reusing VariableDeclarator here. - .field("head", [def("VariableDeclarator")]) - .field("body", def("Statement")); - -def("LetExpression") - .bases("Expression") - .build("head", "body") - // TODO Deviating from the spec by reusing VariableDeclarator here. - .field("head", [def("VariableDeclarator")]) - .field("body", def("Expression")); - -def("GraphExpression") - .bases("Expression") - .build("index", "expression") - .field("index", geq(0)) - .field("expression", def("Literal")); - -def("GraphIndexExpression") - .bases("Expression") - .build("index") - .field("index", geq(0)); - -},{"570":570,"582":582,"583":583}],577:[function(_dereq_,module,exports){ -var types = _dereq_(584); -var getFieldNames = types.getFieldNames; -var getFieldValue = types.getFieldValue; -var isArray = types.builtInTypes.array; -var isObject = types.builtInTypes.object; -var isDate = types.builtInTypes.Date; -var isRegExp = types.builtInTypes.RegExp; -var hasOwn = Object.prototype.hasOwnProperty; - -function astNodesAreEquivalent(a, b, problemPath) { - if (isArray.check(problemPath)) { - problemPath.length = 0; - } else { - problemPath = null; - } - - return areEquivalent(a, b, problemPath); -} - -astNodesAreEquivalent.assert = function(a, b) { - var problemPath = []; - if (!astNodesAreEquivalent(a, b, problemPath)) { - if (problemPath.length === 0) { - if (a !== b) { - throw new Error("Nodes must be equal"); - } - } else { - throw new Error( - "Nodes differ in the following path: " + - problemPath.map(subscriptForProperty).join("") - ); - } - } -}; - -function subscriptForProperty(property) { - if (/[_$a-z][_$a-z0-9]*/i.test(property)) { - return "." + property; - } - return "[" + JSON.stringify(property) + "]"; -} - -function areEquivalent(a, b, problemPath) { - if (a === b) { - return true; - } - - if (isArray.check(a)) { - return arraysAreEquivalent(a, b, problemPath); - } - - if (isObject.check(a)) { - return objectsAreEquivalent(a, b, problemPath); - } - - if (isDate.check(a)) { - return isDate.check(b) && (+a === +b); - } - - if (isRegExp.check(a)) { - return isRegExp.check(b) && ( - a.source === b.source && - a.global === b.global && - a.multiline === b.multiline && - a.ignoreCase === b.ignoreCase - ); - } - - return a == b; -} - -function arraysAreEquivalent(a, b, problemPath) { - isArray.assert(a); - var aLength = a.length; - - if (!isArray.check(b) || b.length !== aLength) { - if (problemPath) { - problemPath.push("length"); - } - return false; - } - - for (var i = 0; i < aLength; ++i) { - if (problemPath) { - problemPath.push(i); - } - - if (i in a !== i in b) { - return false; - } - - if (!areEquivalent(a[i], b[i], problemPath)) { - return false; - } - - if (problemPath) { - var problemPathTail = problemPath.pop(); - if (problemPathTail !== i) { - throw new Error("" + problemPathTail); - } - } - } - - return true; -} - -function objectsAreEquivalent(a, b, problemPath) { - isObject.assert(a); - if (!isObject.check(b)) { - return false; - } - - // Fast path for a common property of AST nodes. - if (a.type !== b.type) { - if (problemPath) { - problemPath.push("type"); - } - return false; - } - - var aNames = getFieldNames(a); - var aNameCount = aNames.length; - - var bNames = getFieldNames(b); - var bNameCount = bNames.length; - - if (aNameCount === bNameCount) { - for (var i = 0; i < aNameCount; ++i) { - var name = aNames[i]; - var aChild = getFieldValue(a, name); - var bChild = getFieldValue(b, name); - - if (problemPath) { - problemPath.push(name); - } - - if (!areEquivalent(aChild, bChild, problemPath)) { - return false; - } - - if (problemPath) { - var problemPathTail = problemPath.pop(); - if (problemPathTail !== name) { - throw new Error("" + problemPathTail); - } - } - } - - return true; - } - - if (!problemPath) { - return false; - } - - // Since aNameCount !== bNameCount, we need to find some name that's - // missing in aNames but present in bNames, or vice-versa. - - var seenNames = Object.create(null); - - for (i = 0; i < aNameCount; ++i) { - seenNames[aNames[i]] = true; - } - - for (i = 0; i < bNameCount; ++i) { - name = bNames[i]; - - if (!hasOwn.call(seenNames, name)) { - problemPath.push(name); - return false; - } - - delete seenNames[name]; - } - - for (name in seenNames) { - problemPath.push(name); - break; - } - - return false; -} - -module.exports = astNodesAreEquivalent; - -},{"584":584}],578:[function(_dereq_,module,exports){ -var types = _dereq_(583); -var n = types.namedTypes; -var b = types.builders; -var isNumber = types.builtInTypes.number; -var isArray = types.builtInTypes.array; -var Path = _dereq_(580); -var Scope = _dereq_(581); - -function NodePath(value, parentPath, name) { - if (!(this instanceof NodePath)) { - throw new Error("NodePath constructor cannot be invoked without 'new'"); - } - Path.call(this, value, parentPath, name); -} - -var NPp = NodePath.prototype = Object.create(Path.prototype, { - constructor: { - value: NodePath, - enumerable: false, - writable: true, - configurable: true - } -}); - -Object.defineProperties(NPp, { - node: { - get: function() { - Object.defineProperty(this, "node", { - configurable: true, // Enable deletion. - value: this._computeNode() - }); - - return this.node; - } - }, - - parent: { - get: function() { - Object.defineProperty(this, "parent", { - configurable: true, // Enable deletion. - value: this._computeParent() - }); - - return this.parent; - } - }, - - scope: { - get: function() { - Object.defineProperty(this, "scope", { - configurable: true, // Enable deletion. - value: this._computeScope() - }); - - return this.scope; - } - } -}); - -NPp.replace = function() { - delete this.node; - delete this.parent; - delete this.scope; - return Path.prototype.replace.apply(this, arguments); -}; - -NPp.prune = function() { - var remainingNodePath = this.parent; - - this.replace(); - - return cleanUpNodesAfterPrune(remainingNodePath); -}; - -// The value of the first ancestor Path whose value is a Node. -NPp._computeNode = function() { - var value = this.value; - if (n.Node.check(value)) { - return value; - } - - var pp = this.parentPath; - return pp && pp.node || null; -}; - -// The first ancestor Path whose value is a Node distinct from this.node. -NPp._computeParent = function() { - var value = this.value; - var pp = this.parentPath; - - if (!n.Node.check(value)) { - while (pp && !n.Node.check(pp.value)) { - pp = pp.parentPath; - } - - if (pp) { - pp = pp.parentPath; - } - } - - while (pp && !n.Node.check(pp.value)) { - pp = pp.parentPath; - } - - return pp || null; -}; - -// The closest enclosing scope that governs this node. -NPp._computeScope = function() { - var value = this.value; - var pp = this.parentPath; - var scope = pp && pp.scope; - - if (n.Node.check(value) && - Scope.isEstablishedBy(value)) { - scope = new Scope(this, scope); - } - - return scope || null; -}; - -NPp.getValueProperty = function(name) { - return types.getFieldValue(this.value, name); -}; - -/** - * Determine whether this.node needs to be wrapped in parentheses in order - * for a parser to reproduce the same local AST structure. - * - * For instance, in the expression `(1 + 2) * 3`, the BinaryExpression - * whose operator is "+" needs parentheses, because `1 + 2 * 3` would - * parse differently. - * - * If assumeExpressionContext === true, we don't worry about edge cases - * like an anonymous FunctionExpression appearing lexically first in its - * enclosing statement and thus needing parentheses to avoid being parsed - * as a FunctionDeclaration with a missing name. - */ -NPp.needsParens = function(assumeExpressionContext) { - var pp = this.parentPath; - if (!pp) { - return false; - } - - var node = this.value; - - // Only expressions need parentheses. - if (!n.Expression.check(node)) { - return false; - } - - // Identifiers never need parentheses. - if (node.type === "Identifier") { - return false; - } - - while (!n.Node.check(pp.value)) { - pp = pp.parentPath; - if (!pp) { - return false; - } - } - - var parent = pp.value; - - switch (node.type) { - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - return parent.type === "MemberExpression" - && this.name === "object" - && parent.object === node; - - case "BinaryExpression": - case "LogicalExpression": - switch (parent.type) { - case "CallExpression": - return this.name === "callee" - && parent.callee === node; - - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - return true; - - case "MemberExpression": - return this.name === "object" - && parent.object === node; - - case "BinaryExpression": - case "LogicalExpression": - var po = parent.operator; - var pp = PRECEDENCE[po]; - var no = node.operator; - var np = PRECEDENCE[no]; - - if (pp > np) { - return true; - } - - if (pp === np && this.name === "right") { - if (parent.right !== node) { - throw new Error("Nodes must be equal"); - } - return true; - } - - default: - return false; - } - - case "SequenceExpression": - switch (parent.type) { - case "ForStatement": - // Although parentheses wouldn't hurt around sequence - // expressions in the head of for loops, traditional style - // dictates that e.g. i++, j++ should not be wrapped with - // parentheses. - return false; - - case "ExpressionStatement": - return this.name !== "expression"; - - default: - // Otherwise err on the side of overparenthesization, adding - // explicit exceptions above if this proves overzealous. - return true; - } - - case "YieldExpression": - switch (parent.type) { - case "BinaryExpression": - case "LogicalExpression": - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - case "CallExpression": - case "MemberExpression": - case "NewExpression": - case "ConditionalExpression": - case "YieldExpression": - return true; - - default: - return false; - } - - case "Literal": - return parent.type === "MemberExpression" - && isNumber.check(node.value) - && this.name === "object" - && parent.object === node; - - case "AssignmentExpression": - case "ConditionalExpression": - switch (parent.type) { - case "UnaryExpression": - case "SpreadElement": - case "SpreadProperty": - case "BinaryExpression": - case "LogicalExpression": - return true; - - case "CallExpression": - return this.name === "callee" - && parent.callee === node; - - case "ConditionalExpression": - return this.name === "test" - && parent.test === node; - - case "MemberExpression": - return this.name === "object" - && parent.object === node; - - default: - return false; - } - - default: - if (parent.type === "NewExpression" && - this.name === "callee" && - parent.callee === node) { - return containsCallExpression(node); - } - } - - if (assumeExpressionContext !== true && - !this.canBeFirstInStatement() && - this.firstInStatement()) - return true; - - return false; -}; - -function isBinary(node) { - return n.BinaryExpression.check(node) - || n.LogicalExpression.check(node); -} - -function isUnaryLike(node) { - return n.UnaryExpression.check(node) - // I considered making SpreadElement and SpreadProperty subtypes - // of UnaryExpression, but they're not really Expression nodes. - || (n.SpreadElement && n.SpreadElement.check(node)) - || (n.SpreadProperty && n.SpreadProperty.check(node)); -} - -var PRECEDENCE = {}; -[["||"], - ["&&"], - ["|"], - ["^"], - ["&"], - ["==", "===", "!=", "!=="], - ["<", ">", "<=", ">=", "in", "instanceof"], - [">>", "<<", ">>>"], - ["+", "-"], - ["*", "/", "%"] -].forEach(function(tier, i) { - tier.forEach(function(op) { - PRECEDENCE[op] = i; - }); -}); - -function containsCallExpression(node) { - if (n.CallExpression.check(node)) { - return true; - } - - if (isArray.check(node)) { - return node.some(containsCallExpression); - } - - if (n.Node.check(node)) { - return types.someField(node, function(name, child) { - return containsCallExpression(child); - }); - } - - return false; -} - -NPp.canBeFirstInStatement = function() { - var node = this.node; - return !n.FunctionExpression.check(node) - && !n.ObjectExpression.check(node); -}; - -NPp.firstInStatement = function() { - return firstInStatement(this); -}; - -function firstInStatement(path) { - for (var node, parent; path.parent; path = path.parent) { - node = path.node; - parent = path.parent.node; - - if (n.BlockStatement.check(parent) && - path.parent.name === "body" && - path.name === 0) { - if (parent.body[0] !== node) { - throw new Error("Nodes must be equal"); - } - return true; - } - - if (n.ExpressionStatement.check(parent) && - path.name === "expression") { - if (parent.expression !== node) { - throw new Error("Nodes must be equal"); - } - return true; - } - - if (n.SequenceExpression.check(parent) && - path.parent.name === "expressions" && - path.name === 0) { - if (parent.expressions[0] !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - if (n.CallExpression.check(parent) && - path.name === "callee") { - if (parent.callee !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - if (n.MemberExpression.check(parent) && - path.name === "object") { - if (parent.object !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - if (n.ConditionalExpression.check(parent) && - path.name === "test") { - if (parent.test !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - if (isBinary(parent) && - path.name === "left") { - if (parent.left !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - if (n.UnaryExpression.check(parent) && - !parent.prefix && - path.name === "argument") { - if (parent.argument !== node) { - throw new Error("Nodes must be equal"); - } - continue; - } - - return false; - } - - return true; -} - -/** - * Pruning certain nodes will result in empty or incomplete nodes, here we clean those nodes up. - */ -function cleanUpNodesAfterPrune(remainingNodePath) { - if (n.VariableDeclaration.check(remainingNodePath.node)) { - var declarations = remainingNodePath.get('declarations').value; - if (!declarations || declarations.length === 0) { - return remainingNodePath.prune(); - } - } else if (n.ExpressionStatement.check(remainingNodePath.node)) { - if (!remainingNodePath.get('expression').value) { - return remainingNodePath.prune(); - } - } else if (n.IfStatement.check(remainingNodePath.node)) { - cleanUpIfStatementAfterPrune(remainingNodePath); - } - - return remainingNodePath; -} - -function cleanUpIfStatementAfterPrune(ifStatement) { - var testExpression = ifStatement.get('test').value; - var alternate = ifStatement.get('alternate').value; - var consequent = ifStatement.get('consequent').value; - - if (!consequent && !alternate) { - var testExpressionStatement = b.expressionStatement(testExpression); - - ifStatement.replace(testExpressionStatement); - } else if (!consequent && alternate) { - var negatedTestExpression = b.unaryExpression('!', testExpression, true); - - if (n.UnaryExpression.check(testExpression) && testExpression.operator === '!') { - negatedTestExpression = testExpression.argument; - } - - ifStatement.get("test").replace(negatedTestExpression); - ifStatement.get("consequent").replace(alternate); - ifStatement.get("alternate").replace(); - } -} - -module.exports = NodePath; - -},{"580":580,"581":581,"583":583}],579:[function(_dereq_,module,exports){ -var types = _dereq_(583); -var NodePath = _dereq_(578); -var Printable = types.namedTypes.Printable; -var isArray = types.builtInTypes.array; -var isObject = types.builtInTypes.object; -var isFunction = types.builtInTypes.function; -var hasOwn = Object.prototype.hasOwnProperty; -var undefined; - -function PathVisitor() { - if (!(this instanceof PathVisitor)) { - throw new Error( - "PathVisitor constructor cannot be invoked without 'new'" - ); - } - - // Permanent state. - this._reusableContextStack = []; - - this._methodNameTable = computeMethodNameTable(this); - this._shouldVisitComments = - hasOwn.call(this._methodNameTable, "Block") || - hasOwn.call(this._methodNameTable, "Line"); - - this.Context = makeContextConstructor(this); - - // State reset every time PathVisitor.prototype.visit is called. - this._visiting = false; - this._changeReported = false; -} - -function computeMethodNameTable(visitor) { - var typeNames = Object.create(null); - - for (var methodName in visitor) { - if (/^visit[A-Z]/.test(methodName)) { - typeNames[methodName.slice("visit".length)] = true; - } - } - - var supertypeTable = types.computeSupertypeLookupTable(typeNames); - var methodNameTable = Object.create(null); - - var typeNames = Object.keys(supertypeTable); - var typeNameCount = typeNames.length; - for (var i = 0; i < typeNameCount; ++i) { - var typeName = typeNames[i]; - methodName = "visit" + supertypeTable[typeName]; - if (isFunction.check(visitor[methodName])) { - methodNameTable[typeName] = methodName; - } - } - - return methodNameTable; -} - -PathVisitor.fromMethodsObject = function fromMethodsObject(methods) { - if (methods instanceof PathVisitor) { - return methods; - } - - if (!isObject.check(methods)) { - // An empty visitor? - return new PathVisitor; - } - - function Visitor() { - if (!(this instanceof Visitor)) { - throw new Error( - "Visitor constructor cannot be invoked without 'new'" - ); - } - PathVisitor.call(this); - } - - var Vp = Visitor.prototype = Object.create(PVp); - Vp.constructor = Visitor; - - extend(Vp, methods); - extend(Visitor, PathVisitor); - - isFunction.assert(Visitor.fromMethodsObject); - isFunction.assert(Visitor.visit); - - return new Visitor; -}; - -function extend(target, source) { - for (var property in source) { - if (hasOwn.call(source, property)) { - target[property] = source[property]; - } - } - - return target; -} - -PathVisitor.visit = function visit(node, methods) { - return PathVisitor.fromMethodsObject(methods).visit(node); -}; - -var PVp = PathVisitor.prototype; - -PVp.visit = function() { - if (this._visiting) { - throw new Error( - "Recursively calling visitor.visit(path) resets visitor state. " + - "Try this.visit(path) or this.traverse(path) instead." - ); - } - - // Private state that needs to be reset before every traversal. - this._visiting = true; - this._changeReported = false; - this._abortRequested = false; - - var argc = arguments.length; - var args = new Array(argc) - for (var i = 0; i < argc; ++i) { - args[i] = arguments[i]; - } - - if (!(args[0] instanceof NodePath)) { - args[0] = new NodePath({ root: args[0] }).get("root"); - } - - // Called with the same arguments as .visit. - this.reset.apply(this, args); - - try { - var root = this.visitWithoutReset(args[0]); - var didNotThrow = true; - } finally { - this._visiting = false; - - if (!didNotThrow && this._abortRequested) { - // If this.visitWithoutReset threw an exception and - // this._abortRequested was set to true, return the root of - // the AST instead of letting the exception propagate, so that - // client code does not have to provide a try-catch block to - // intercept the AbortRequest exception. Other kinds of - // exceptions will propagate without being intercepted and - // rethrown by a catch block, so their stacks will accurately - // reflect the original throwing context. - return args[0].value; - } - } - - return root; -}; - -PVp.AbortRequest = function AbortRequest() {}; -PVp.abort = function() { - var visitor = this; - visitor._abortRequested = true; - var request = new visitor.AbortRequest(); - - // If you decide to catch this exception and stop it from propagating, - // make sure to call its cancel method to avoid silencing other - // exceptions that might be thrown later in the traversal. - request.cancel = function() { - visitor._abortRequested = false; - }; - - throw request; -}; - -PVp.reset = function(path/*, additional arguments */) { - // Empty stub; may be reassigned or overridden by subclasses. -}; - -PVp.visitWithoutReset = function(path) { - if (this instanceof this.Context) { - // Since this.Context.prototype === this, there's a chance we - // might accidentally call context.visitWithoutReset. If that - // happens, re-invoke the method against context.visitor. - return this.visitor.visitWithoutReset(path); - } - - if (!(path instanceof NodePath)) { - throw new Error(""); - } - - var value = path.value; - - var methodName = value && - typeof value === "object" && - typeof value.type === "string" && - this._methodNameTable[value.type]; - - if (methodName) { - var context = this.acquireContext(path); - try { - return context.invokeVisitorMethod(methodName); - } finally { - this.releaseContext(context); - } - - } else { - // If there was no visitor method to call, visit the children of - // this node generically. - return visitChildren(path, this); - } -}; - -function visitChildren(path, visitor) { - if (!(path instanceof NodePath)) { - throw new Error(""); - } - if (!(visitor instanceof PathVisitor)) { - throw new Error(""); - } - - var value = path.value; - - if (isArray.check(value)) { - path.each(visitor.visitWithoutReset, visitor); - } else if (!isObject.check(value)) { - // No children to visit. - } else { - var childNames = types.getFieldNames(value); - - // The .comments field of the Node type is hidden, so we only - // visit it if the visitor defines visitBlock or visitLine, and - // value.comments is defined. - if (visitor._shouldVisitComments && - value.comments && - childNames.indexOf("comments") < 0) { - childNames.push("comments"); - } - - var childCount = childNames.length; - var childPaths = []; - - for (var i = 0; i < childCount; ++i) { - var childName = childNames[i]; - if (!hasOwn.call(value, childName)) { - value[childName] = types.getFieldValue(value, childName); - } - childPaths.push(path.get(childName)); - } - - for (var i = 0; i < childCount; ++i) { - visitor.visitWithoutReset(childPaths[i]); - } - } - - return path.value; -} - -PVp.acquireContext = function(path) { - if (this._reusableContextStack.length === 0) { - return new this.Context(path); - } - return this._reusableContextStack.pop().reset(path); -}; - -PVp.releaseContext = function(context) { - if (!(context instanceof this.Context)) { - throw new Error(""); - } - this._reusableContextStack.push(context); - context.currentPath = null; -}; - -PVp.reportChanged = function() { - this._changeReported = true; -}; - -PVp.wasChangeReported = function() { - return this._changeReported; -}; - -function makeContextConstructor(visitor) { - function Context(path) { - if (!(this instanceof Context)) { - throw new Error(""); - } - if (!(this instanceof PathVisitor)) { - throw new Error(""); - } - if (!(path instanceof NodePath)) { - throw new Error(""); - } - - Object.defineProperty(this, "visitor", { - value: visitor, - writable: false, - enumerable: true, - configurable: false - }); - - this.currentPath = path; - this.needToCallTraverse = true; - - Object.seal(this); - } - - if (!(visitor instanceof PathVisitor)) { - throw new Error(""); - } - - // Note that the visitor object is the prototype of Context.prototype, - // so all visitor methods are inherited by context objects. - var Cp = Context.prototype = Object.create(visitor); - - Cp.constructor = Context; - extend(Cp, sharedContextProtoMethods); - - return Context; -} - -// Every PathVisitor has a different this.Context constructor and -// this.Context.prototype object, but those prototypes can all use the -// same reset, invokeVisitorMethod, and traverse function objects. -var sharedContextProtoMethods = Object.create(null); - -sharedContextProtoMethods.reset = -function reset(path) { - if (!(this instanceof this.Context)) { - throw new Error(""); - } - if (!(path instanceof NodePath)) { - throw new Error(""); - } - - this.currentPath = path; - this.needToCallTraverse = true; - - return this; -}; - -sharedContextProtoMethods.invokeVisitorMethod = -function invokeVisitorMethod(methodName) { - if (!(this instanceof this.Context)) { - throw new Error(""); - } - if (!(this.currentPath instanceof NodePath)) { - throw new Error(""); - } - - var result = this.visitor[methodName].call(this, this.currentPath); - - if (result === false) { - // Visitor methods return false to indicate that they have handled - // their own traversal needs, and we should not complain if - // this.needToCallTraverse is still true. - this.needToCallTraverse = false; - - } else if (result !== undefined) { - // Any other non-undefined value returned from the visitor method - // is interpreted as a replacement value. - this.currentPath = this.currentPath.replace(result)[0]; - - if (this.needToCallTraverse) { - // If this.traverse still hasn't been called, visit the - // children of the replacement node. - this.traverse(this.currentPath); - } - } - - if (this.needToCallTraverse !== false) { - throw new Error( - "Must either call this.traverse or return false in " + methodName - ); - } - - var path = this.currentPath; - return path && path.value; -}; - -sharedContextProtoMethods.traverse = -function traverse(path, newVisitor) { - if (!(this instanceof this.Context)) { - throw new Error(""); - } - if (!(path instanceof NodePath)) { - throw new Error(""); - } - if (!(this.currentPath instanceof NodePath)) { - throw new Error(""); - } - - this.needToCallTraverse = false; - - return visitChildren(path, PathVisitor.fromMethodsObject( - newVisitor || this.visitor - )); -}; - -sharedContextProtoMethods.visit = -function visit(path, newVisitor) { - if (!(this instanceof this.Context)) { - throw new Error(""); - } - if (!(path instanceof NodePath)) { - throw new Error(""); - } - if (!(this.currentPath instanceof NodePath)) { - throw new Error(""); - } - - this.needToCallTraverse = false; - - return PathVisitor.fromMethodsObject( - newVisitor || this.visitor - ).visitWithoutReset(path); -}; - -sharedContextProtoMethods.reportChanged = function reportChanged() { - this.visitor.reportChanged(); -}; - -sharedContextProtoMethods.abort = function abort() { - this.needToCallTraverse = false; - this.visitor.abort(); -}; - -module.exports = PathVisitor; - -},{"578":578,"583":583}],580:[function(_dereq_,module,exports){ -var Op = Object.prototype; -var hasOwn = Op.hasOwnProperty; -var types = _dereq_(583); -var isArray = types.builtInTypes.array; -var isNumber = types.builtInTypes.number; -var Ap = Array.prototype; -var slice = Ap.slice; -var map = Ap.map; - -function Path(value, parentPath, name) { - if (!(this instanceof Path)) { - throw new Error("Path constructor cannot be invoked without 'new'"); - } - - if (parentPath) { - if (!(parentPath instanceof Path)) { - throw new Error(""); - } - } else { - parentPath = null; - name = null; - } - - // The value encapsulated by this Path, generally equal to - // parentPath.value[name] if we have a parentPath. - this.value = value; - - // The immediate parent Path of this Path. - this.parentPath = parentPath; - - // The name of the property of parentPath.value through which this - // Path's value was reached. - this.name = name; - - // Calling path.get("child") multiple times always returns the same - // child Path object, for both performance and consistency reasons. - this.__childCache = null; -} - -var Pp = Path.prototype; - -function getChildCache(path) { - // Lazily create the child cache. This also cheapens cache - // invalidation, since you can just reset path.__childCache to null. - return path.__childCache || (path.__childCache = Object.create(null)); -} - -function getChildPath(path, name) { - var cache = getChildCache(path); - var actualChildValue = path.getValueProperty(name); - var childPath = cache[name]; - if (!hasOwn.call(cache, name) || - // Ensure consistency between cache and reality. - childPath.value !== actualChildValue) { - childPath = cache[name] = new path.constructor( - actualChildValue, path, name - ); - } - return childPath; -} - -// This method is designed to be overridden by subclasses that need to -// handle missing properties, etc. -Pp.getValueProperty = function getValueProperty(name) { - return this.value[name]; -}; - -Pp.get = function get(name) { - var path = this; - var names = arguments; - var count = names.length; - - for (var i = 0; i < count; ++i) { - path = getChildPath(path, names[i]); - } - - return path; -}; - -Pp.each = function each(callback, context) { - var childPaths = []; - var len = this.value.length; - var i = 0; - - // Collect all the original child paths before invoking the callback. - for (var i = 0; i < len; ++i) { - if (hasOwn.call(this.value, i)) { - childPaths[i] = this.get(i); - } - } - - // Invoke the callback on just the original child paths, regardless of - // any modifications made to the array by the callback. I chose these - // semantics over cleverly invoking the callback on new elements because - // this way is much easier to reason about. - context = context || this; - for (i = 0; i < len; ++i) { - if (hasOwn.call(childPaths, i)) { - callback.call(context, childPaths[i]); - } - } -}; - -Pp.map = function map(callback, context) { - var result = []; - - this.each(function(childPath) { - result.push(callback.call(this, childPath)); - }, context); - - return result; -}; - -Pp.filter = function filter(callback, context) { - var result = []; - - this.each(function(childPath) { - if (callback.call(this, childPath)) { - result.push(childPath); - } - }, context); - - return result; -}; - -function emptyMoves() {} -function getMoves(path, offset, start, end) { - isArray.assert(path.value); - - if (offset === 0) { - return emptyMoves; - } - - var length = path.value.length; - if (length < 1) { - return emptyMoves; - } - - var argc = arguments.length; - if (argc === 2) { - start = 0; - end = length; - } else if (argc === 3) { - start = Math.max(start, 0); - end = length; - } else { - start = Math.max(start, 0); - end = Math.min(end, length); - } - - isNumber.assert(start); - isNumber.assert(end); - - var moves = Object.create(null); - var cache = getChildCache(path); - - for (var i = start; i < end; ++i) { - if (hasOwn.call(path.value, i)) { - var childPath = path.get(i); - if (childPath.name !== i) { - throw new Error(""); - } - var newIndex = i + offset; - childPath.name = newIndex; - moves[newIndex] = childPath; - delete cache[i]; - } - } - - delete cache.length; - - return function() { - for (var newIndex in moves) { - var childPath = moves[newIndex]; - if (childPath.name !== +newIndex) { - throw new Error(""); - } - cache[newIndex] = childPath; - path.value[newIndex] = childPath.value; - } - }; -} - -Pp.shift = function shift() { - var move = getMoves(this, -1); - var result = this.value.shift(); - move(); - return result; -}; - -Pp.unshift = function unshift(node) { - var move = getMoves(this, arguments.length); - var result = this.value.unshift.apply(this.value, arguments); - move(); - return result; -}; - -Pp.push = function push(node) { - isArray.assert(this.value); - delete getChildCache(this).length - return this.value.push.apply(this.value, arguments); -}; - -Pp.pop = function pop() { - isArray.assert(this.value); - var cache = getChildCache(this); - delete cache[this.value.length - 1]; - delete cache.length; - return this.value.pop(); -}; - -Pp.insertAt = function insertAt(index, node) { - var argc = arguments.length; - var move = getMoves(this, argc - 1, index); - if (move === emptyMoves) { - return this; - } - - index = Math.max(index, 0); - - for (var i = 1; i < argc; ++i) { - this.value[index + i - 1] = arguments[i]; - } - - move(); - - return this; -}; - -Pp.insertBefore = function insertBefore(node) { - var pp = this.parentPath; - var argc = arguments.length; - var insertAtArgs = [this.name]; - for (var i = 0; i < argc; ++i) { - insertAtArgs.push(arguments[i]); - } - return pp.insertAt.apply(pp, insertAtArgs); -}; - -Pp.insertAfter = function insertAfter(node) { - var pp = this.parentPath; - var argc = arguments.length; - var insertAtArgs = [this.name + 1]; - for (var i = 0; i < argc; ++i) { - insertAtArgs.push(arguments[i]); - } - return pp.insertAt.apply(pp, insertAtArgs); -}; - -function repairRelationshipWithParent(path) { - if (!(path instanceof Path)) { - throw new Error(""); - } - - var pp = path.parentPath; - if (!pp) { - // Orphan paths have no relationship to repair. - return path; - } - - var parentValue = pp.value; - var parentCache = getChildCache(pp); - - // Make sure parentCache[path.name] is populated. - if (parentValue[path.name] === path.value) { - parentCache[path.name] = path; - } else if (isArray.check(parentValue)) { - // Something caused path.name to become out of date, so attempt to - // recover by searching for path.value in parentValue. - var i = parentValue.indexOf(path.value); - if (i >= 0) { - parentCache[path.name = i] = path; - } - } else { - // If path.value disagrees with parentValue[path.name], and - // path.name is not an array index, let path.value become the new - // parentValue[path.name] and update parentCache accordingly. - parentValue[path.name] = path.value; - parentCache[path.name] = path; - } - - if (parentValue[path.name] !== path.value) { - throw new Error(""); - } - if (path.parentPath.get(path.name) !== path) { - throw new Error(""); - } - - return path; -} - -Pp.replace = function replace(replacement) { - var results = []; - var parentValue = this.parentPath.value; - var parentCache = getChildCache(this.parentPath); - var count = arguments.length; - - repairRelationshipWithParent(this); - - if (isArray.check(parentValue)) { - var originalLength = parentValue.length; - var move = getMoves(this.parentPath, count - 1, this.name + 1); - - var spliceArgs = [this.name, 1]; - for (var i = 0; i < count; ++i) { - spliceArgs.push(arguments[i]); - } - - var splicedOut = parentValue.splice.apply(parentValue, spliceArgs); - - if (splicedOut[0] !== this.value) { - throw new Error(""); - } - if (parentValue.length !== (originalLength - 1 + count)) { - throw new Error(""); - } - - move(); - - if (count === 0) { - delete this.value; - delete parentCache[this.name]; - this.__childCache = null; - - } else { - if (parentValue[this.name] !== replacement) { - throw new Error(""); - } - - if (this.value !== replacement) { - this.value = replacement; - this.__childCache = null; - } - - for (i = 0; i < count; ++i) { - results.push(this.parentPath.get(this.name + i)); - } - - if (results[0] !== this) { - throw new Error(""); - } - } - - } else if (count === 1) { - if (this.value !== replacement) { - this.__childCache = null; - } - this.value = parentValue[this.name] = replacement; - results.push(this); - - } else if (count === 0) { - delete parentValue[this.name]; - delete this.value; - this.__childCache = null; - - // Leave this path cached as parentCache[this.name], even though - // it no longer has a value defined. - - } else { - throw new Error("Could not replace path"); - } - - return results; -}; - -module.exports = Path; - -},{"583":583}],581:[function(_dereq_,module,exports){ -var types = _dereq_(583); -var Type = types.Type; -var namedTypes = types.namedTypes; -var Node = namedTypes.Node; -var Expression = namedTypes.Expression; -var isArray = types.builtInTypes.array; -var hasOwn = Object.prototype.hasOwnProperty; -var b = types.builders; - -function Scope(path, parentScope) { - if (!(this instanceof Scope)) { - throw new Error("Scope constructor cannot be invoked without 'new'"); - } - if (!(path instanceof _dereq_(578))) { - throw new Error(""); - } - ScopeType.assert(path.value); - - var depth; - - if (parentScope) { - if (!(parentScope instanceof Scope)) { - throw new Error(""); - } - depth = parentScope.depth + 1; - } else { - parentScope = null; - depth = 0; - } - - Object.defineProperties(this, { - path: { value: path }, - node: { value: path.value }, - isGlobal: { value: !parentScope, enumerable: true }, - depth: { value: depth }, - parent: { value: parentScope }, - bindings: { value: {} } - }); -} - -var scopeTypes = [ - // Program nodes introduce global scopes. - namedTypes.Program, - - // Function is the supertype of FunctionExpression, - // FunctionDeclaration, ArrowExpression, etc. - namedTypes.Function, - - // In case you didn't know, the caught parameter shadows any variable - // of the same name in an outer scope. - namedTypes.CatchClause -]; - -var ScopeType = Type.or.apply(Type, scopeTypes); - -Scope.isEstablishedBy = function(node) { - return ScopeType.check(node); -}; - -var Sp = Scope.prototype; - -// Will be overridden after an instance lazily calls scanScope. -Sp.didScan = false; - -Sp.declares = function(name) { - this.scan(); - return hasOwn.call(this.bindings, name); -}; - -Sp.declareTemporary = function(prefix) { - if (prefix) { - if (!/^[a-z$_]/i.test(prefix)) { - throw new Error(""); - } - } else { - prefix = "t$"; - } - - // Include this.depth in the name to make sure the name does not - // collide with any variables in nested/enclosing scopes. - prefix += this.depth.toString(36) + "$"; - - this.scan(); - - var index = 0; - while (this.declares(prefix + index)) { - ++index; - } - - var name = prefix + index; - return this.bindings[name] = types.builders.identifier(name); -}; - -Sp.injectTemporary = function(identifier, init) { - identifier || (identifier = this.declareTemporary()); - - var bodyPath = this.path.get("body"); - if (namedTypes.BlockStatement.check(bodyPath.value)) { - bodyPath = bodyPath.get("body"); - } - - bodyPath.unshift( - b.variableDeclaration( - "var", - [b.variableDeclarator(identifier, init || null)] - ) - ); - - return identifier; -}; - -Sp.scan = function(force) { - if (force || !this.didScan) { - for (var name in this.bindings) { - // Empty out this.bindings, just in cases. - delete this.bindings[name]; - } - scanScope(this.path, this.bindings); - this.didScan = true; - } -}; - -Sp.getBindings = function () { - this.scan(); - return this.bindings; -}; - -function scanScope(path, bindings) { - var node = path.value; - ScopeType.assert(node); - - if (namedTypes.CatchClause.check(node)) { - // A catch clause establishes a new scope but the only variable - // bound in that scope is the catch parameter. Any other - // declarations create bindings in the outer scope. - addPattern(path.get("param"), bindings); - - } else { - recursiveScanScope(path, bindings); - } -} - -function recursiveScanScope(path, bindings) { - var node = path.value; - - if (path.parent && - namedTypes.FunctionExpression.check(path.parent.node) && - path.parent.node.id) { - addPattern(path.parent.get("id"), bindings); - } - - if (!node) { - // None of the remaining cases matter if node is falsy. - - } else if (isArray.check(node)) { - path.each(function(childPath) { - recursiveScanChild(childPath, bindings); - }); - - } else if (namedTypes.Function.check(node)) { - path.get("params").each(function(paramPath) { - addPattern(paramPath, bindings); - }); - - recursiveScanChild(path.get("body"), bindings); - - } else if (namedTypes.VariableDeclarator.check(node)) { - addPattern(path.get("id"), bindings); - recursiveScanChild(path.get("init"), bindings); - - } else if (node.type === "ImportSpecifier" || - node.type === "ImportNamespaceSpecifier" || - node.type === "ImportDefaultSpecifier") { - addPattern( - // Esprima used to use the .name field to refer to the local - // binding identifier for ImportSpecifier nodes, but .id for - // ImportNamespaceSpecifier and ImportDefaultSpecifier nodes. - // ESTree/Acorn/ESpree use .local for all three node types. - path.get(node.local ? "local" : - node.name ? "name" : "id"), - bindings - ); - - } else if (Node.check(node) && !Expression.check(node)) { - types.eachField(node, function(name, child) { - var childPath = path.get(name); - if (childPath.value !== child) { - throw new Error(""); - } - recursiveScanChild(childPath, bindings); - }); - } -} - -function recursiveScanChild(path, bindings) { - var node = path.value; - - if (!node || Expression.check(node)) { - // Ignore falsy values and Expressions. - - } else if (namedTypes.FunctionDeclaration.check(node)) { - addPattern(path.get("id"), bindings); - - } else if (namedTypes.ClassDeclaration && - namedTypes.ClassDeclaration.check(node)) { - addPattern(path.get("id"), bindings); - - } else if (ScopeType.check(node)) { - if (namedTypes.CatchClause.check(node)) { - var catchParamName = node.param.name; - var hadBinding = hasOwn.call(bindings, catchParamName); - - // Any declarations that occur inside the catch body that do - // not have the same name as the catch parameter should count - // as bindings in the outer scope. - recursiveScanScope(path.get("body"), bindings); - - // If a new binding matching the catch parameter name was - // created while scanning the catch body, ignore it because it - // actually refers to the catch parameter and not the outer - // scope that we're currently scanning. - if (!hadBinding) { - delete bindings[catchParamName]; - } - } - - } else { - recursiveScanScope(path, bindings); - } -} - -function addPattern(patternPath, bindings) { - var pattern = patternPath.value; - namedTypes.Pattern.assert(pattern); - - if (namedTypes.Identifier.check(pattern)) { - if (hasOwn.call(bindings, pattern.name)) { - bindings[pattern.name].push(patternPath); - } else { - bindings[pattern.name] = [patternPath]; - } - - } else if (namedTypes.ObjectPattern && - namedTypes.ObjectPattern.check(pattern)) { - patternPath.get('properties').each(function(propertyPath) { - var property = propertyPath.value; - if (namedTypes.Pattern.check(property)) { - addPattern(propertyPath, bindings); - } else if (namedTypes.Property.check(property)) { - addPattern(propertyPath.get('value'), bindings); - } else if (namedTypes.SpreadProperty && - namedTypes.SpreadProperty.check(property)) { - addPattern(propertyPath.get('argument'), bindings); - } - }); - - } else if (namedTypes.ArrayPattern && - namedTypes.ArrayPattern.check(pattern)) { - patternPath.get('elements').each(function(elementPath) { - var element = elementPath.value; - if (namedTypes.Pattern.check(element)) { - addPattern(elementPath, bindings); - } else if (namedTypes.SpreadElement && - namedTypes.SpreadElement.check(element)) { - addPattern(elementPath.get("argument"), bindings); - } - }); - - } else if (namedTypes.PropertyPattern && - namedTypes.PropertyPattern.check(pattern)) { - addPattern(patternPath.get('pattern'), bindings); - - } else if ((namedTypes.SpreadElementPattern && - namedTypes.SpreadElementPattern.check(pattern)) || - (namedTypes.SpreadPropertyPattern && - namedTypes.SpreadPropertyPattern.check(pattern))) { - addPattern(patternPath.get('argument'), bindings); - } -} - -Sp.lookup = function(name) { - for (var scope = this; scope; scope = scope.parent) - if (scope.declares(name)) - break; - return scope; -}; - -Sp.getGlobalScope = function() { - var scope = this; - while (!scope.isGlobal) - scope = scope.parent; - return scope; -}; - -module.exports = Scope; - -},{"578":578,"583":583}],582:[function(_dereq_,module,exports){ -var types = _dereq_(583); -var Type = types.Type; -var builtin = types.builtInTypes; -var isNumber = builtin.number; - -// An example of constructing a new type with arbitrary constraints from -// an existing type. -exports.geq = function(than) { - return new Type(function(value) { - return isNumber.check(value) && value >= than; - }, isNumber + " >= " + than); -}; - -// Default value-returning functions that may optionally be passed as a -// third argument to Def.prototype.field. -exports.defaults = { - // Functions were used because (among other reasons) that's the most - // elegant way to allow for the emptyArray one always to give a new - // array instance. - "null": function() { return null }, - "emptyArray": function() { return [] }, - "false": function() { return false }, - "true": function() { return true }, - "undefined": function() {} -}; - -var naiveIsPrimitive = Type.or( - builtin.string, - builtin.number, - builtin.boolean, - builtin.null, - builtin.undefined -); - -exports.isPrimitive = new Type(function(value) { - if (value === null) - return true; - var type = typeof value; - return !(type === "object" || - type === "function"); -}, naiveIsPrimitive.toString()); - -},{"583":583}],583:[function(_dereq_,module,exports){ -var Ap = Array.prototype; -var slice = Ap.slice; -var map = Ap.map; -var each = Ap.forEach; -var Op = Object.prototype; -var objToStr = Op.toString; -var funObjStr = objToStr.call(function(){}); -var strObjStr = objToStr.call(""); -var hasOwn = Op.hasOwnProperty; - -// A type is an object with a .check method that takes a value and returns -// true or false according to whether the value matches the type. - -function Type(check, name) { - var self = this; - if (!(self instanceof Type)) { - throw new Error("Type constructor cannot be invoked without 'new'"); - } - - // Unfortunately we can't elegantly reuse isFunction and isString, - // here, because this code is executed while defining those types. - if (objToStr.call(check) !== funObjStr) { - throw new Error(check + " is not a function"); - } - - // The `name` parameter can be either a function or a string. - var nameObjStr = objToStr.call(name); - if (!(nameObjStr === funObjStr || - nameObjStr === strObjStr)) { - throw new Error(name + " is neither a function nor a string"); - } - - Object.defineProperties(self, { - name: { value: name }, - check: { - value: function(value, deep) { - var result = check.call(self, value, deep); - if (!result && deep && objToStr.call(deep) === funObjStr) - deep(self, value); - return result; - } - } - }); -} - -var Tp = Type.prototype; - -// Throughout this file we use Object.defineProperty to prevent -// redefinition of exported properties. -exports.Type = Type; - -// Like .check, except that failure triggers an AssertionError. -Tp.assert = function(value, deep) { - if (!this.check(value, deep)) { - var str = shallowStringify(value); - throw new Error(str + " does not match type " + this); - } - return true; -}; - -function shallowStringify(value) { - if (isObject.check(value)) - return "{" + Object.keys(value).map(function(key) { - return key + ": " + value[key]; - }).join(", ") + "}"; - - if (isArray.check(value)) - return "[" + value.map(shallowStringify).join(", ") + "]"; - - return JSON.stringify(value); -} - -Tp.toString = function() { - var name = this.name; - - if (isString.check(name)) - return name; - - if (isFunction.check(name)) - return name.call(this) + ""; - - return name + " type"; -}; - -var builtInCtorFns = []; -var builtInCtorTypes = []; -var builtInTypes = {}; -exports.builtInTypes = builtInTypes; - -function defBuiltInType(example, name) { - var objStr = objToStr.call(example); - - var type = new Type(function(value) { - return objToStr.call(value) === objStr; - }, name); - - builtInTypes[name] = type; - - if (example && typeof example.constructor === "function") { - builtInCtorFns.push(example.constructor); - builtInCtorTypes.push(type); - } - - return type; -} - -// These types check the underlying [[Class]] attribute of the given -// value, rather than using the problematic typeof operator. Note however -// that no subtyping is considered; so, for instance, isObject.check -// returns false for [], /./, new Date, and null. -var isString = defBuiltInType("truthy", "string"); -var isFunction = defBuiltInType(function(){}, "function"); -var isArray = defBuiltInType([], "array"); -var isObject = defBuiltInType({}, "object"); -var isRegExp = defBuiltInType(/./, "RegExp"); -var isDate = defBuiltInType(new Date, "Date"); -var isNumber = defBuiltInType(3, "number"); -var isBoolean = defBuiltInType(true, "boolean"); -var isNull = defBuiltInType(null, "null"); -var isUndefined = defBuiltInType(void 0, "undefined"); - -// There are a number of idiomatic ways of expressing types, so this -// function serves to coerce them all to actual Type objects. Note that -// providing the name argument is not necessary in most cases. -function toType(from, name) { - // The toType function should of course be idempotent. - if (from instanceof Type) - return from; - - // The Def type is used as a helper for constructing compound - // interface types for AST nodes. - if (from instanceof Def) - return from.type; - - // Support [ElemType] syntax. - if (isArray.check(from)) - return Type.fromArray(from); - - // Support { someField: FieldType, ... } syntax. - if (isObject.check(from)) - return Type.fromObject(from); - - if (isFunction.check(from)) { - var bicfIndex = builtInCtorFns.indexOf(from); - if (bicfIndex >= 0) { - return builtInCtorTypes[bicfIndex]; - } - - // If isFunction.check(from), and from is not a built-in - // constructor, assume from is a binary predicate function we can - // use to define the type. - return new Type(from, name); - } - - // As a last resort, toType returns a type that matches any value that - // is === from. This is primarily useful for literal values like - // toType(null), but it has the additional advantage of allowing - // toType to be a total function. - return new Type(function(value) { - return value === from; - }, isUndefined.check(name) ? function() { - return from + ""; - } : name); -} - -// Returns a type that matches the given value iff any of type1, type2, -// etc. match the value. -Type.or = function(/* type1, type2, ... */) { - var types = []; - var len = arguments.length; - for (var i = 0; i < len; ++i) - types.push(toType(arguments[i])); - - return new Type(function(value, deep) { - for (var i = 0; i < len; ++i) - if (types[i].check(value, deep)) - return true; - return false; - }, function() { - return types.join(" | "); - }); -}; - -Type.fromArray = function(arr) { - if (!isArray.check(arr)) { - throw new Error(""); - } - if (arr.length !== 1) { - throw new Error("only one element type is permitted for typed arrays"); - } - return toType(arr[0]).arrayOf(); -}; - -Tp.arrayOf = function() { - var elemType = this; - return new Type(function(value, deep) { - return isArray.check(value) && value.every(function(elem) { - return elemType.check(elem, deep); - }); - }, function() { - return "[" + elemType + "]"; - }); -}; - -Type.fromObject = function(obj) { - var fields = Object.keys(obj).map(function(name) { - return new Field(name, obj[name]); - }); - - return new Type(function(value, deep) { - return isObject.check(value) && fields.every(function(field) { - return field.type.check(value[field.name], deep); - }); - }, function() { - return "{ " + fields.join(", ") + " }"; - }); -}; - -function Field(name, type, defaultFn, hidden) { - var self = this; - - if (!(self instanceof Field)) { - throw new Error("Field constructor cannot be invoked without 'new'"); - } - isString.assert(name); - - type = toType(type); - - var properties = { - name: { value: name }, - type: { value: type }, - hidden: { value: !!hidden } - }; - - if (isFunction.check(defaultFn)) { - properties.defaultFn = { value: defaultFn }; - } - - Object.defineProperties(self, properties); -} - -var Fp = Field.prototype; - -Fp.toString = function() { - return JSON.stringify(this.name) + ": " + this.type; -}; - -Fp.getValue = function(obj) { - var value = obj[this.name]; - - if (!isUndefined.check(value)) - return value; - - if (this.defaultFn) - value = this.defaultFn.call(obj); - - return value; -}; - -// Define a type whose name is registered in a namespace (the defCache) so -// that future definitions will return the same type given the same name. -// In particular, this system allows for circular and forward definitions. -// The Def object d returned from Type.def may be used to configure the -// type d.type by calling methods such as d.bases, d.build, and d.field. -Type.def = function(typeName) { - isString.assert(typeName); - return hasOwn.call(defCache, typeName) - ? defCache[typeName] - : defCache[typeName] = new Def(typeName); -}; - -// In order to return the same Def instance every time Type.def is called -// with a particular name, those instances need to be stored in a cache. -var defCache = Object.create(null); - -function Def(typeName) { - var self = this; - if (!(self instanceof Def)) { - throw new Error("Def constructor cannot be invoked without 'new'"); - } - - Object.defineProperties(self, { - typeName: { value: typeName }, - baseNames: { value: [] }, - ownFields: { value: Object.create(null) }, - - // These two are populated during finalization. - allSupertypes: { value: Object.create(null) }, // Includes own typeName. - supertypeList: { value: [] }, // Linear inheritance hierarchy. - allFields: { value: Object.create(null) }, // Includes inherited fields. - fieldNames: { value: [] }, // Non-hidden keys of allFields. - - type: { - value: new Type(function(value, deep) { - return self.check(value, deep); - }, typeName) - } - }); -} - -Def.fromValue = function(value) { - if (value && typeof value === "object") { - var type = value.type; - if (typeof type === "string" && - hasOwn.call(defCache, type)) { - var d = defCache[type]; - if (d.finalized) { - return d; - } - } - } - - return null; -}; - -var Dp = Def.prototype; - -Dp.isSupertypeOf = function(that) { - if (that instanceof Def) { - if (this.finalized !== true || - that.finalized !== true) { - throw new Error(""); - } - return hasOwn.call(that.allSupertypes, this.typeName); - } else { - throw new Error(that + " is not a Def"); - } -}; - -// Note that the list returned by this function is a copy of the internal -// supertypeList, *without* the typeName itself as the first element. -exports.getSupertypeNames = function(typeName) { - if (!hasOwn.call(defCache, typeName)) { - throw new Error(""); - } - var d = defCache[typeName]; - if (d.finalized !== true) { - throw new Error(""); - } - return d.supertypeList.slice(1); -}; - -// Returns an object mapping from every known type in the defCache to the -// most specific supertype whose name is an own property of the candidates -// object. -exports.computeSupertypeLookupTable = function(candidates) { - var table = {}; - var typeNames = Object.keys(defCache); - var typeNameCount = typeNames.length; - - for (var i = 0; i < typeNameCount; ++i) { - var typeName = typeNames[i]; - var d = defCache[typeName]; - if (d.finalized !== true) { - throw new Error("" + typeName); - } - for (var j = 0; j < d.supertypeList.length; ++j) { - var superTypeName = d.supertypeList[j]; - if (hasOwn.call(candidates, superTypeName)) { - table[typeName] = superTypeName; - break; - } - } - } - - return table; -}; - -Dp.checkAllFields = function(value, deep) { - var allFields = this.allFields; - if (this.finalized !== true) { - throw new Error("" + this.typeName); - } - - function checkFieldByName(name) { - var field = allFields[name]; - var type = field.type; - var child = field.getValue(value); - return type.check(child, deep); - } - - return isObject.check(value) - && Object.keys(allFields).every(checkFieldByName); -}; - -Dp.check = function(value, deep) { - if (this.finalized !== true) { - throw new Error( - "prematurely checking unfinalized type " + this.typeName - ); - } - - // A Def type can only match an object value. - if (!isObject.check(value)) - return false; - - var vDef = Def.fromValue(value); - if (!vDef) { - // If we couldn't infer the Def associated with the given value, - // and we expected it to be a SourceLocation or a Position, it was - // probably just missing a "type" field (because Esprima does not - // assign a type property to such nodes). Be optimistic and let - // this.checkAllFields make the final decision. - if (this.typeName === "SourceLocation" || - this.typeName === "Position") { - return this.checkAllFields(value, deep); - } - - // Calling this.checkAllFields for any other type of node is both - // bad for performance and way too forgiving. - return false; - } - - // If checking deeply and vDef === this, then we only need to call - // checkAllFields once. Calling checkAllFields is too strict when deep - // is false, because then we only care about this.isSupertypeOf(vDef). - if (deep && vDef === this) - return this.checkAllFields(value, deep); - - // In most cases we rely exclusively on isSupertypeOf to make O(1) - // subtyping determinations. This suffices in most situations outside - // of unit tests, since interface conformance is checked whenever new - // instances are created using builder functions. - if (!this.isSupertypeOf(vDef)) - return false; - - // The exception is when deep is true; then, we recursively check all - // fields. - if (!deep) - return true; - - // Use the more specific Def (vDef) to perform the deep check, but - // shallow-check fields defined by the less specific Def (this). - return vDef.checkAllFields(value, deep) - && this.checkAllFields(value, false); -}; - -Dp.bases = function() { - var args = slice.call(arguments); - var bases = this.baseNames; - - if (this.finalized) { - if (args.length !== bases.length) { - throw new Error(""); - } - for (var i = 0; i < args.length; i++) { - if (args[i] !== bases[i]) { - throw new Error(""); - } - } - return this; - } - - args.forEach(function(baseName) { - isString.assert(baseName); - - // This indexOf lookup may be O(n), but the typical number of base - // names is very small, and indexOf is a native Array method. - if (bases.indexOf(baseName) < 0) - bases.push(baseName); - }); - - return this; // For chaining. -}; - -// False by default until .build(...) is called on an instance. -Object.defineProperty(Dp, "buildable", { value: false }); - -var builders = {}; -exports.builders = builders; - -// This object is used as prototype for any node created by a builder. -var nodePrototype = {}; - -// Call this function to define a new method to be shared by all AST -// nodes. The replaced method (if any) is returned for easy wrapping. -exports.defineMethod = function(name, func) { - var old = nodePrototype[name]; - - // Pass undefined as func to delete nodePrototype[name]. - if (isUndefined.check(func)) { - delete nodePrototype[name]; - - } else { - isFunction.assert(func); - - Object.defineProperty(nodePrototype, name, { - enumerable: true, // For discoverability. - configurable: true, // For delete proto[name]. - value: func - }); - } - - return old; -}; - -var isArrayOfString = isString.arrayOf(); - -// Calling the .build method of a Def simultaneously marks the type as -// buildable (by defining builders[getBuilderName(typeName)]) and -// specifies the order of arguments that should be passed to the builder -// function to create an instance of the type. -Dp.build = function(/* param1, param2, ... */) { - var self = this; - - var newBuildParams = slice.call(arguments); - isArrayOfString.assert(newBuildParams); - - // Calling Def.prototype.build multiple times has the effect of merely - // redefining this property. - Object.defineProperty(self, "buildParams", { - value: newBuildParams, - writable: false, - enumerable: false, - configurable: true - }); - - if (self.buildable) { - // If this Def is already buildable, update self.buildParams and - // continue using the old builder function. - return self; - } - - // Every buildable type will have its "type" field filled in - // automatically. This includes types that are not subtypes of Node, - // like SourceLocation, but that seems harmless (TODO?). - self.field("type", String, function() { return self.typeName }); - - // Override Dp.buildable for this Def instance. - Object.defineProperty(self, "buildable", { value: true }); - - Object.defineProperty(builders, getBuilderName(self.typeName), { - enumerable: true, - - value: function() { - var args = arguments; - var argc = args.length; - var built = Object.create(nodePrototype); - - if (!self.finalized) { - throw new Error( - "attempting to instantiate unfinalized type " + - self.typeName - ); - } - - function add(param, i) { - if (hasOwn.call(built, param)) - return; - - var all = self.allFields; - if (!hasOwn.call(all, param)) { - throw new Error("" + param); - } - - var field = all[param]; - var type = field.type; - var value; - - if (isNumber.check(i) && i < argc) { - value = args[i]; - } else if (field.defaultFn) { - // Expose the partially-built object to the default - // function as its `this` object. - value = field.defaultFn.call(built); - } else { - var message = "no value or default function given for field " + - JSON.stringify(param) + " of " + self.typeName + "(" + - self.buildParams.map(function(name) { - return all[name]; - }).join(", ") + ")"; - throw new Error(message); - } - - if (!type.check(value)) { - throw new Error( - shallowStringify(value) + - " does not match field " + field + - " of type " + self.typeName - ); - } - - // TODO Could attach getters and setters here to enforce - // dynamic type safety. - built[param] = value; - } - - self.buildParams.forEach(function(param, i) { - add(param, i); - }); - - Object.keys(self.allFields).forEach(function(param) { - add(param); // Use the default value. - }); - - // Make sure that the "type" field was filled automatically. - if (built.type !== self.typeName) { - throw new Error(""); - } - - return built; - } - }); - - return self; // For chaining. -}; - -function getBuilderName(typeName) { - return typeName.replace(/^[A-Z]+/, function(upperCasePrefix) { - var len = upperCasePrefix.length; - switch (len) { - case 0: return ""; - // If there's only one initial capital letter, just lower-case it. - case 1: return upperCasePrefix.toLowerCase(); - default: - // If there's more than one initial capital letter, lower-case - // all but the last one, so that XMLDefaultDeclaration (for - // example) becomes xmlDefaultDeclaration. - return upperCasePrefix.slice( - 0, len - 1).toLowerCase() + - upperCasePrefix.charAt(len - 1); - } - }); -} -exports.getBuilderName = getBuilderName; - -function getStatementBuilderName(typeName) { - typeName = getBuilderName(typeName); - return typeName.replace(/(Expression)?$/, "Statement"); -} -exports.getStatementBuilderName = getStatementBuilderName; - -// The reason fields are specified using .field(...) instead of an object -// literal syntax is somewhat subtle: the object literal syntax would -// support only one key and one value, but with .field(...) we can pass -// any number of arguments to specify the field. -Dp.field = function(name, type, defaultFn, hidden) { - if (this.finalized) { - console.error("Ignoring attempt to redefine field " + - JSON.stringify(name) + " of finalized type " + - JSON.stringify(this.typeName)); - return this; - } - this.ownFields[name] = new Field(name, type, defaultFn, hidden); - return this; // For chaining. -}; - -var namedTypes = {}; -exports.namedTypes = namedTypes; - -// Like Object.keys, but aware of what fields each AST type should have. -function getFieldNames(object) { - var d = Def.fromValue(object); - if (d) { - return d.fieldNames.slice(0); - } - - if ("type" in object) { - throw new Error( - "did not recognize object of type " + - JSON.stringify(object.type) - ); - } - - return Object.keys(object); -} -exports.getFieldNames = getFieldNames; - -// Get the value of an object property, taking object.type and default -// functions into account. -function getFieldValue(object, fieldName) { - var d = Def.fromValue(object); - if (d) { - var field = d.allFields[fieldName]; - if (field) { - return field.getValue(object); - } - } - - return object[fieldName]; -} -exports.getFieldValue = getFieldValue; - -// Iterate over all defined fields of an object, including those missing -// or undefined, passing each field name and effective value (as returned -// by getFieldValue) to the callback. If the object has no corresponding -// Def, the callback will never be called. -exports.eachField = function(object, callback, context) { - getFieldNames(object).forEach(function(name) { - callback.call(this, name, getFieldValue(object, name)); - }, context); -}; - -// Similar to eachField, except that iteration stops as soon as the -// callback returns a truthy value. Like Array.prototype.some, the final -// result is either true or false to indicates whether the callback -// returned true for any element or not. -exports.someField = function(object, callback, context) { - return getFieldNames(object).some(function(name) { - return callback.call(this, name, getFieldValue(object, name)); - }, context); -}; - -// This property will be overridden as true by individual Def instances -// when they are finalized. -Object.defineProperty(Dp, "finalized", { value: false }); - -Dp.finalize = function() { - var self = this; - - // It's not an error to finalize a type more than once, but only the - // first call to .finalize does anything. - if (!self.finalized) { - var allFields = self.allFields; - var allSupertypes = self.allSupertypes; - - self.baseNames.forEach(function(name) { - var def = defCache[name]; - if (def instanceof Def) { - def.finalize(); - extend(allFields, def.allFields); - extend(allSupertypes, def.allSupertypes); - } else { - var message = "unknown supertype name " + - JSON.stringify(name) + - " for subtype " + - JSON.stringify(self.typeName); - throw new Error(message); - } - }); - - // TODO Warn if fields are overridden with incompatible types. - extend(allFields, self.ownFields); - allSupertypes[self.typeName] = self; - - self.fieldNames.length = 0; - for (var fieldName in allFields) { - if (hasOwn.call(allFields, fieldName) && - !allFields[fieldName].hidden) { - self.fieldNames.push(fieldName); - } - } - - // Types are exported only once they have been finalized. - Object.defineProperty(namedTypes, self.typeName, { - enumerable: true, - value: self.type - }); - - Object.defineProperty(self, "finalized", { value: true }); - - // A linearization of the inheritance hierarchy. - populateSupertypeList(self.typeName, self.supertypeList); - - if (self.buildable && self.supertypeList.lastIndexOf("Expression") >= 0) { - wrapExpressionBuilderWithStatement(self.typeName); - } - } -}; - -// Adds an additional builder for Expression subtypes -// that wraps the built Expression in an ExpressionStatements. -function wrapExpressionBuilderWithStatement(typeName) { - var wrapperName = getStatementBuilderName(typeName); - - // skip if the builder already exists - if (builders[wrapperName]) return; - - // the builder function to wrap with builders.ExpressionStatement - var wrapped = builders[getBuilderName(typeName)]; - - // skip if there is nothing to wrap - if (!wrapped) return; - - builders[wrapperName] = function() { - return builders.expressionStatement(wrapped.apply(builders, arguments)); - }; -} - -function populateSupertypeList(typeName, list) { - list.length = 0; - list.push(typeName); - - var lastSeen = Object.create(null); - - for (var pos = 0; pos < list.length; ++pos) { - typeName = list[pos]; - var d = defCache[typeName]; - if (d.finalized !== true) { - throw new Error(""); - } - - // If we saw typeName earlier in the breadth-first traversal, - // delete the last-seen occurrence. - if (hasOwn.call(lastSeen, typeName)) { - delete list[lastSeen[typeName]]; - } - - // Record the new index of the last-seen occurrence of typeName. - lastSeen[typeName] = pos; - - // Enqueue the base names of this type. - list.push.apply(list, d.baseNames); - } - - // Compaction loop to remove array holes. - for (var to = 0, from = to, len = list.length; from < len; ++from) { - if (hasOwn.call(list, from)) { - list[to++] = list[from]; - } - } - - list.length = to; -} - -function extend(into, from) { - Object.keys(from).forEach(function(name) { - into[name] = from[name]; - }); - - return into; -}; - -exports.finalize = function() { - Object.keys(defCache).forEach(function(name) { - defCache[name].finalize(); - }); -}; - -},{}],584:[function(_dereq_,module,exports){ -var types = _dereq_(583); - -// This core module of AST types captures ES5 as it is parsed today by -// git://github.com/ariya/esprima.git#master. -_dereq_(570); - -// Feel free to add to or remove from this list of extension modules to -// configure the precise type hierarchy that you need. -_dereq_(572); -_dereq_(573); -_dereq_(576); -_dereq_(571); -_dereq_(575); -_dereq_(574); -_dereq_(569); - -types.finalize(); - -exports.Type = types.Type; -exports.builtInTypes = types.builtInTypes; -exports.namedTypes = types.namedTypes; -exports.builders = types.builders; -exports.defineMethod = types.defineMethod; -exports.getFieldNames = types.getFieldNames; -exports.getFieldValue = types.getFieldValue; -exports.eachField = types.eachField; -exports.someField = types.someField; -exports.getSupertypeNames = types.getSupertypeNames; -exports.astNodesAreEquivalent = _dereq_(577); -exports.finalize = types.finalize; -exports.NodePath = _dereq_(578); -exports.PathVisitor = _dereq_(579); -exports.visit = exports.PathVisitor.visit; - -},{"569":569,"570":570,"571":571,"572":572,"573":573,"574":574,"575":575,"576":576,"577":577,"578":578,"579":579,"583":583}],585:[function(_dereq_,module,exports){ -(function (process,global){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * https://raw.github.com/facebook/regenerator/master/LICENSE file. An - * additional grant of patent rights can be found in the PATENTS file in - * the same directory. - */ - -!(function(global) { - "use strict"; - - var hasOwn = Object.prototype.hasOwnProperty; - var undefined; // More compressible than void 0. - var iteratorSymbol = - typeof Symbol === "function" && Symbol.iterator || "@@iterator"; - - var inModule = typeof module === "object"; - var runtime = global.regeneratorRuntime; - if (runtime) { - if (inModule) { - // If regeneratorRuntime is defined globally and we're in a module, - // make the exports object identical to regeneratorRuntime. - module.exports = runtime; - } - // Don't bother evaluating the rest of this file if the runtime was - // already defined globally. - return; - } - - // Define the runtime globally (as expected by generated code) as either - // module.exports (if we're in a module) or a new, empty object. - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided, then outerFn.prototype instanceof Generator. - var generator = Object.create((outerFn || Generator).prototype); - var context = new Context(tryLocsList || []); - - // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - generator._invoke = makeInvokeMethod(innerFn, self, context); - - return generator; - } - runtime.wrap = wrap; - - // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - - // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - var ContinueSentinel = {}; - - // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype; - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunction.displayName = "GeneratorFunction"; - - // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - prototype[method] = function(arg) { - return this._invoke(method, arg); - }; - }); - } - - runtime.isGeneratorFunction = function(genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor - ? ctor === GeneratorFunction || - // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" - : false; - }; - - runtime.mark = function(genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - - // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `value instanceof AwaitArgument` to determine if the yielded value is - // meant to be awaited. Some may consider the name of this method too - // cutesy, but they are curmudgeons. - runtime.awrap = function(arg) { - return new AwaitArgument(arg); - }; - - function AwaitArgument(arg) { - this.arg = arg; - } - - function AsyncIterator(generator) { - // This invoke function is written in a style that assumes some - // calling function (or Promise) will handle exceptions. - function invoke(method, arg) { - var result = generator[method](arg); - var value = result.value; - return value instanceof AwaitArgument - ? Promise.resolve(value.arg).then(invokeNext, invokeThrow) - : Promise.resolve(value).then(function(unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. If the Promise is rejected, however, the - // result for this iteration will be rejected with the same - // reason. Note that rejections of yielded Promises are not - // thrown back into the generator function, as is the case - // when an awaited Promise is rejected. This difference in - // behavior between yield and await is important, because it - // allows the consumer to decide what to do with the yielded - // rejection (swallow it and continue, manually .throw it back - // into the generator, abandon iteration, whatever). With - // await, by contrast, there is no opportunity to examine the - // rejection reason outside the generator function, so the - // only option is to throw it from the await expression, and - // let the generator function handle the exception. - result.value = unwrapped; - return result; - }); - } - - if (typeof process === "object" && process.domain) { - invoke = process.domain.bind(invoke); - } - - var invokeNext = invoke.bind(generator, "next"); - var invokeThrow = invoke.bind(generator, "throw"); - var invokeReturn = invoke.bind(generator, "return"); - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return invoke(method, arg); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : new Promise(function (resolve) { - resolve(callInvokeWithMethodAndArg()); - }); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - runtime.async = function(innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList) - ); - - return runtime.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - while (true) { - var delegate = context.delegate; - if (delegate) { - if (method === "return" || - (method === "throw" && delegate.iterator[method] === undefined)) { - // A return or throw (when the delegate iterator has no throw - // method) always terminates the yield* loop. - context.delegate = null; - - // If the delegate iterator has a return method, give it a - // chance to clean up. - var returnMethod = delegate.iterator["return"]; - if (returnMethod) { - var record = tryCatch(returnMethod, delegate.iterator, arg); - if (record.type === "throw") { - // If the return method threw an exception, let that - // exception prevail over the original return or throw. - method = "throw"; - arg = record.arg; - continue; - } - } - - if (method === "return") { - // Continue with the outer return, now that the delegate - // iterator has been terminated. - continue; - } - } - - var record = tryCatch( - delegate.iterator[method], - delegate.iterator, - arg - ); - - if (record.type === "throw") { - context.delegate = null; - - // Like returning generator.throw(uncaught), but without the - // overhead of an extra function call. - method = "throw"; - arg = record.arg; - continue; - } - - // Delegate generator ran and handled its own exceptions so - // regardless of what the method was, we continue as if it is - // "next" with an undefined arg. - method = "next"; - arg = undefined; - - var info = record.arg; - if (info.done) { - context[delegate.resultName] = info.value; - context.next = delegate.nextLoc; - } else { - state = GenStateSuspendedYield; - return info; - } - - context.delegate = null; - } - - if (method === "next") { - if (state === GenStateSuspendedYield) { - context.sent = arg; - } else { - context.sent = undefined; - } - - } else if (method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw arg; - } - - if (context.dispatchException(arg)) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - method = "next"; - arg = undefined; - } - - } else if (method === "return") { - context.abrupt("return", arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - var info = { - value: record.arg, - done: context.done - }; - - if (record.arg === ContinueSentinel) { - if (context.delegate && method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - arg = undefined; - } - } else { - return info; - } - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(arg) call above. - method = "throw"; - arg = record.arg; - } - } - }; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - runtime.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - runtime.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - this.sent = undefined; - this.done = false; - this.delegate = null; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - return !!caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.next = finallyEntry.finallyLoc; - } else { - this.complete(record); - } - - return ContinueSentinel; - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = record.arg; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - return ContinueSentinel; - } - }; -})( - // Among the various tricks for obtaining a reference to the global - // object, this seems to be the most reliable technique that does not - // use indirect eval (which violates Content Security Policy). - typeof global === "object" ? global : - typeof window === "object" ? window : - typeof self === "object" ? self : this -); - -}).call(this,_dereq_(10),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"10":10}],586:[function(_dereq_,module,exports){ -// Generated by `/scripts/character-class-escape-sets.js`. Do not edit. -var regenerate = _dereq_(588); - -exports.REGULAR = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0xFFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0xFFFF), - 'w': regenerate(0x5F) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0xFFFF) -}; - -exports.UNICODE = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x10FFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0x10FFFF), - 'w': regenerate(0x5F) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0x10FFFF) -}; - -exports.UNICODE_IGNORE_CASE = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x10FFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0x10FFFF), - 'w': regenerate(0x5F, 0x17F, 0x212A) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x4B, 0x53, 0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0x10FFFF) -}; - -},{"588":588}],587:[function(_dereq_,module,exports){ -module.exports={ - "75": 8490, - "83": 383, - "107": 8490, - "115": 383, - "181": 924, - "197": 8491, - "383": 83, - "452": 453, - "453": 452, - "455": 456, - "456": 455, - "458": 459, - "459": 458, - "497": 498, - "498": 497, - "837": 8126, - "914": 976, - "917": 1013, - "920": 1012, - "921": 8126, - "922": 1008, - "924": 181, - "928": 982, - "929": 1009, - "931": 962, - "934": 981, - "937": 8486, - "962": 931, - "976": 914, - "977": 1012, - "981": 934, - "982": 928, - "1008": 922, - "1009": 929, - "1012": [ - 920, - 977 - ], - "1013": 917, - "7776": 7835, - "7835": 7776, - "8126": [ - 837, - 921 - ], - "8486": 937, - "8490": 75, - "8491": 197, - "66560": 66600, - "66561": 66601, - "66562": 66602, - "66563": 66603, - "66564": 66604, - "66565": 66605, - "66566": 66606, - "66567": 66607, - "66568": 66608, - "66569": 66609, - "66570": 66610, - "66571": 66611, - "66572": 66612, - "66573": 66613, - "66574": 66614, - "66575": 66615, - "66576": 66616, - "66577": 66617, - "66578": 66618, - "66579": 66619, - "66580": 66620, - "66581": 66621, - "66582": 66622, - "66583": 66623, - "66584": 66624, - "66585": 66625, - "66586": 66626, - "66587": 66627, - "66588": 66628, - "66589": 66629, - "66590": 66630, - "66591": 66631, - "66592": 66632, - "66593": 66633, - "66594": 66634, - "66595": 66635, - "66596": 66636, - "66597": 66637, - "66598": 66638, - "66599": 66639, - "66600": 66560, - "66601": 66561, - "66602": 66562, - "66603": 66563, - "66604": 66564, - "66605": 66565, - "66606": 66566, - "66607": 66567, - "66608": 66568, - "66609": 66569, - "66610": 66570, - "66611": 66571, - "66612": 66572, - "66613": 66573, - "66614": 66574, - "66615": 66575, - "66616": 66576, - "66617": 66577, - "66618": 66578, - "66619": 66579, - "66620": 66580, - "66621": 66581, - "66622": 66582, - "66623": 66583, - "66624": 66584, - "66625": 66585, - "66626": 66586, - "66627": 66587, - "66628": 66588, - "66629": 66589, - "66630": 66590, - "66631": 66591, - "66632": 66592, - "66633": 66593, - "66634": 66594, - "66635": 66595, - "66636": 66596, - "66637": 66597, - "66638": 66598, - "66639": 66599, - "68736": 68800, - "68737": 68801, - "68738": 68802, - "68739": 68803, - "68740": 68804, - "68741": 68805, - "68742": 68806, - "68743": 68807, - "68744": 68808, - "68745": 68809, - "68746": 68810, - "68747": 68811, - "68748": 68812, - "68749": 68813, - "68750": 68814, - "68751": 68815, - "68752": 68816, - "68753": 68817, - "68754": 68818, - "68755": 68819, - "68756": 68820, - "68757": 68821, - "68758": 68822, - "68759": 68823, - "68760": 68824, - "68761": 68825, - "68762": 68826, - "68763": 68827, - "68764": 68828, - "68765": 68829, - "68766": 68830, - "68767": 68831, - "68768": 68832, - "68769": 68833, - "68770": 68834, - "68771": 68835, - "68772": 68836, - "68773": 68837, - "68774": 68838, - "68775": 68839, - "68776": 68840, - "68777": 68841, - "68778": 68842, - "68779": 68843, - "68780": 68844, - "68781": 68845, - "68782": 68846, - "68783": 68847, - "68784": 68848, - "68785": 68849, - "68786": 68850, - "68800": 68736, - "68801": 68737, - "68802": 68738, - "68803": 68739, - "68804": 68740, - "68805": 68741, - "68806": 68742, - "68807": 68743, - "68808": 68744, - "68809": 68745, - "68810": 68746, - "68811": 68747, - "68812": 68748, - "68813": 68749, - "68814": 68750, - "68815": 68751, - "68816": 68752, - "68817": 68753, - "68818": 68754, - "68819": 68755, - "68820": 68756, - "68821": 68757, - "68822": 68758, - "68823": 68759, - "68824": 68760, - "68825": 68761, - "68826": 68762, - "68827": 68763, - "68828": 68764, - "68829": 68765, - "68830": 68766, - "68831": 68767, - "68832": 68768, - "68833": 68769, - "68834": 68770, - "68835": 68771, - "68836": 68772, - "68837": 68773, - "68838": 68774, - "68839": 68775, - "68840": 68776, - "68841": 68777, - "68842": 68778, - "68843": 68779, - "68844": 68780, - "68845": 68781, - "68846": 68782, - "68847": 68783, - "68848": 68784, - "68849": 68785, - "68850": 68786, - "71840": 71872, - "71841": 71873, - "71842": 71874, - "71843": 71875, - "71844": 71876, - "71845": 71877, - "71846": 71878, - "71847": 71879, - "71848": 71880, - "71849": 71881, - "71850": 71882, - "71851": 71883, - "71852": 71884, - "71853": 71885, - "71854": 71886, - "71855": 71887, - "71856": 71888, - "71857": 71889, - "71858": 71890, - "71859": 71891, - "71860": 71892, - "71861": 71893, - "71862": 71894, - "71863": 71895, - "71864": 71896, - "71865": 71897, - "71866": 71898, - "71867": 71899, - "71868": 71900, - "71869": 71901, - "71870": 71902, - "71871": 71903, - "71872": 71840, - "71873": 71841, - "71874": 71842, - "71875": 71843, - "71876": 71844, - "71877": 71845, - "71878": 71846, - "71879": 71847, - "71880": 71848, - "71881": 71849, - "71882": 71850, - "71883": 71851, - "71884": 71852, - "71885": 71853, - "71886": 71854, - "71887": 71855, - "71888": 71856, - "71889": 71857, - "71890": 71858, - "71891": 71859, - "71892": 71860, - "71893": 71861, - "71894": 71862, - "71895": 71863, - "71896": 71864, - "71897": 71865, - "71898": 71866, - "71899": 71867, - "71900": 71868, - "71901": 71869, - "71902": 71870, - "71903": 71871 -} - -},{}],588:[function(_dereq_,module,exports){ -(function (global){ -/*! https://mths.be/regenerate v1.2.0 by @mathias | MIT license */ -;(function(root) { - - // Detect free variables `exports`. - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module`. - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root`. - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - var ERRORS = { - 'rangeOrder': 'A range\u2019s `stop` value must be greater than or equal ' + - 'to the `start` value.', - 'codePointRange': 'Invalid code point value. Code points range from ' + - 'U+000000 to U+10FFFF.' + var setMeta = function setMeta(it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); + }; + var fastKey = function fastKey(it, create) { + // return primitive with prefix + if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + }return it[META].i; + }; + var getWeak = function getWeak(it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + }return it[META].w; + }; + // add metadata on freeze-family methods calling + var onFreeze = function onFreeze(it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; + }; + var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze }; - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs - var HIGH_SURROGATE_MIN = 0xD800; - var HIGH_SURROGATE_MAX = 0xDBFF; - var LOW_SURROGATE_MIN = 0xDC00; - var LOW_SURROGATE_MAX = 0xDFFF; +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { - // In Regenerate output, `\0` will never be preceded by `\` because we sort - // by code point value, so let’s keep this regular expression simple. - var regexNull = /\\x00([^0123456789]|$)/g; + 'use strict'; - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - var extend = function(destination, source) { - var key; - for (key in source) { - if (hasOwnProperty.call(source, key)) { - destination[key] = source[key]; + __webpack_require__(437); + var global = __webpack_require__(14), + hide = __webpack_require__(28), + Iterators = __webpack_require__(55), + TO_STRING_TAG = __webpack_require__(12)('toStringTag'); + + for (var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++) { + var NAME = collections[i], + Collection = global[NAME], + proto = Collection && Collection.prototype; + if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; + } + +/***/ }), +/* 58 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + module.exports = arrayMap; + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var baseMatches = __webpack_require__(493), + baseMatchesProperty = __webpack_require__(494), + identity = __webpack_require__(110), + isArray = __webpack_require__(6), + property = __webpack_require__(583); + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object') { + return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); + } + return property(value); + } + + module.exports = baseIteratee; + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var baseGetTag = __webpack_require__(29), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var symbolTag = '[object Symbol]'; + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag; + } + + module.exports = isSymbol; + +/***/ }), +/* 61 */ +/***/ (function(module, exports) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + /** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ + function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } + } + exports.getArg = getArg; + + var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; + var dataUrlRegexp = /^data:.+\,.+$/; + + function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; + } + exports.urlParse = urlParse; + + function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port; + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; + } + exports.urlGenerate = urlGenerate; + + /** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '<dir>/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ + function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; + } + exports.normalize = normalize; + + /** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ + function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; + } + exports.join = join; + + exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); + }; + + /** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ + function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + } + exports.relative = relative; + + var supportsNullProto = function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }(); + + function identity(s) { + return s; + } + + /** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || s.charCodeAt(length - 2) !== 95 /* '_' */ || s.charCodeAt(length - 3) !== 111 /* 'o' */ || s.charCodeAt(length - 4) !== 116 /* 't' */ || s.charCodeAt(length - 5) !== 111 /* 'o' */ || s.charCodeAt(length - 6) !== 114 /* 'r' */ || s.charCodeAt(length - 7) !== 112 /* 'p' */ || s.charCodeAt(length - 8) !== 95 /* '_' */ || s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ + function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByOriginalPositions = compareByOriginalPositions; + + /** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ + function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + + function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; + } + + /** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ + function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js + // original notice: + + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> + * @license MIT + */ + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + function compare(a, b) { + if (a === b) { + return 0; + } + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + if (y < x) { + return 1; + } + return 0; + } + function isBuffer(b) { + if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { + return global.Buffer.isBuffer(b); + } + return !!(b != null && b._isBuffer); + } + + // based on node assert, original notice: + + // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 + // + // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! + // + // Originally from narwhal.js (http://narwhaljs.org) + // Copyright (c) 2009 Thomas Robinson <280north.com> + // + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the 'Software'), to + // deal in the Software without restriction, including without limitation the + // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + // sell copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in + // all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + var util = __webpack_require__(116); + var hasOwn = Object.prototype.hasOwnProperty; + var pSlice = Array.prototype.slice; + var functionsHaveNames = function () { + return function foo() {}.name === 'foo'; + }(); + function pToString(obj) { + return Object.prototype.toString.call(obj); + } + function isView(arrbuf) { + if (isBuffer(arrbuf)) { + return false; + } + if (typeof global.ArrayBuffer !== 'function') { + return false; + } + if (typeof ArrayBuffer.isView === 'function') { + return ArrayBuffer.isView(arrbuf); + } + if (!arrbuf) { + return false; + } + if (arrbuf instanceof DataView) { + return true; + } + if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { + return true; + } + return false; + } + // 1. The assert module provides functions that throw + // AssertionError's when particular conditions are not met. The + // assert module must conform to the following interface. + + var assert = module.exports = ok; + + // 2. The AssertionError is defined in assert. + // new assert.AssertionError({ message: message, + // actual: actual, + // expected: expected }) + + var regex = /\s*function\s+([^\(\s]*)\s*/; + // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js + function getName(func) { + if (!util.isFunction(func)) { + return; + } + if (functionsHaveNames) { + return func.name; + } + var str = func.toString(); + var match = str.match(regex); + return match && match[1]; + } + assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = getName(stackStartFunction); + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } + }; + + // assert.AssertionError instanceof Error + util.inherits(assert.AssertionError, Error); + + function truncate(s, n) { + if (typeof s === 'string') { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } + } + function inspect(something) { + if (functionsHaveNames || !util.isFunction(something)) { + return util.inspect(something); + } + var rawname = getName(something); + var name = rawname ? ': ' + rawname : ''; + return '[Function' + name + ']'; + } + function getMessage(self) { + return truncate(inspect(self.actual), 128) + ' ' + self.operator + ' ' + truncate(inspect(self.expected), 128); + } + + // At present only the three keys mentioned above are used and + // understood by the spec. Implementations or sub modules can pass + // other keys to the AssertionError's constructor - they will be + // ignored. + + // 3. All of the following functions must throw an AssertionError + // when a corresponding condition is not met, with a message that + // may be undefined if not provided. All assertion methods provide + // both the actual and expected values to the assertion error for + // display purposes. + + function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); + } + + // EXTENSION! allows for well behaved errors defined elsewhere. + assert.fail = fail; + + // 4. Pure assertion tests whether a value is truthy, as determined + // by !!guard. + // assert.ok(guard, message_opt); + // This statement is equivalent to assert.equal(true, !!guard, + // message_opt);. To test strictly for the value true, use + // assert.strictEqual(true, guard, message_opt);. + + function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); + } + assert.ok = ok; + + // 5. The equality assertion tests shallow, coercive equality with + // ==. + // assert.equal(actual, expected, message_opt); + + assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); + }; + + // 6. The non-equality assertion tests for whether two objects are not equal + // with != assert.notEqual(actual, expected, message_opt); + + assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } + }; + + // 7. The equivalence assertion tests a deep equality relation. + // assert.deepEqual(actual, expected, message_opt); + + assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } + }; + + assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + } + }; + + function _deepEqual(actual, expected, strict, memos) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if (isBuffer(actual) && isBuffer(expected)) { + return compare(actual, expected) === 0; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if ((actual === null || (typeof actual === 'undefined' ? 'undefined' : _typeof(actual)) !== 'object') && (expected === null || (typeof expected === 'undefined' ? 'undefined' : _typeof(expected)) !== 'object')) { + return strict ? actual === expected : actual == expected; + + // If both values are instances of typed arrays, wrap their underlying + // ArrayBuffers in a Buffer each to increase performance + // This optimization requires the arrays to have the same type as checked by + // Object.prototype.toString (aka pToString). Never perform binary + // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their + // bit patterns are not identical. + } else if (isView(actual) && isView(expected) && pToString(actual) === pToString(expected) && !(actual instanceof Float32Array || actual instanceof Float64Array)) { + return compare(new Uint8Array(actual.buffer), new Uint8Array(expected.buffer)) === 0; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else if (isBuffer(actual) !== isBuffer(expected)) { + return false; + } else { + memos = memos || { actual: [], expected: [] }; + + var actualIndex = memos.actual.indexOf(actual); + if (actualIndex !== -1) { + if (actualIndex === memos.expected.indexOf(expected)) { + return true; + } + } + + memos.actual.push(actual); + memos.expected.push(expected); + + return objEquiv(actual, expected, strict, memos); + } + } + + function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + } + + function objEquiv(a, b, strict, actualVisitedObjects) { + if (a === null || a === undefined || b === null || b === undefined) return false; + // if one is a primitive, the other must be same + if (util.isPrimitive(a) || util.isPrimitive(b)) return a === b; + if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false; + var aIsArgs = isArguments(a); + var bIsArgs = isArguments(b); + if (aIsArgs && !bIsArgs || !aIsArgs && bIsArgs) return false; + if (aIsArgs) { + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b, strict); + } + var ka = objectKeys(a); + var kb = objectKeys(b); + var key, i; + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length !== kb.length) return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] !== kb[i]) return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) return false; + } + return true; + } + + // 8. The non-equivalence assertion tests for any deep inequality. + // assert.notDeepEqual(actual, expected, message_opt); + + assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } + }; + + assert.notDeepStrictEqual = notDeepStrictEqual; + function notDeepStrictEqual(actual, expected, message) { + if (_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + } + } + + // 9. The strict equality assertion tests strict equality, as determined by ===. + // assert.strictEqual(actual, expected, message_opt); + + assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } + }; + + // 10. The strict non-equality assertion tests for strict inequality, as + // determined by !==. assert.notStrictEqual(actual, expected, message_opt); + + assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } + }; + + function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } + + try { + if (actual instanceof expected) { + return true; + } + } catch (e) { + // Ignore. The instanceof check doesn't work for arrow functions. + } + + if (Error.isPrototypeOf(expected)) { + return false; + } + + return expected.call({}, actual) === true; + } + + function _tryBlock(block) { + var error; + try { + block(); + } catch (e) { + error = e; + } + return error; + } + + function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof block !== 'function') { + throw new TypeError('"block" argument must be a function'); + } + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + actual = _tryBlock(block); + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + var userProvidedMessage = typeof message === 'string'; + var isUnwantedException = !shouldThrow && util.isError(actual); + var isUnexpectedException = !shouldThrow && actual && !expected; + + if (isUnwantedException && userProvidedMessage && expectedException(actual, expected) || isUnexpectedException) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if (shouldThrow && actual && expected && !expectedException(actual, expected) || !shouldThrow && actual) { + throw actual; + } + } + + // 11. Expected to throw an error: + // assert.throws(block, Error_opt, message_opt); + + assert.throws = function (block, /*optional*/error, /*optional*/message) { + _throws(true, block, error, message); + }; + + // EXTENSION! This is annoying to write outside this module. + assert.doesNotThrow = function (block, /*optional*/error, /*optional*/message) { + _throws(false, block, error, message); + }; + + assert.ifError = function (err) { + if (err) throw err; + }; + + var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; + }; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _optionManager = __webpack_require__(33); + + var _optionManager2 = _interopRequireDefault(_optionManager); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _store = __webpack_require__(118); + + var _store2 = _interopRequireDefault(_store); + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + var _assign = __webpack_require__(170); + + var _assign2 = _interopRequireDefault(_assign); + + var _clone = __webpack_require__(109); + + var _clone2 = _interopRequireDefault(_clone); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var GLOBAL_VISITOR_PROPS = ["enter", "exit"]; + + var Plugin = function (_Store) { + (0, _inherits3.default)(Plugin, _Store); + + function Plugin(plugin, key) { + (0, _classCallCheck3.default)(this, Plugin); + + var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this)); + + _this.initialized = false; + _this.raw = (0, _assign2.default)({}, plugin); + _this.key = _this.take("name") || key; + + _this.manipulateOptions = _this.take("manipulateOptions"); + _this.post = _this.take("post"); + _this.pre = _this.take("pre"); + _this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {}); + return _this; + } + + Plugin.prototype.take = function take(key) { + var val = this.raw[key]; + delete this.raw[key]; + return val; + }; + + Plugin.prototype.chain = function chain(target, key) { + if (!target[key]) return this[key]; + if (!this[key]) return target[key]; + + var fns = [target[key], this[key]]; + + return function () { + var val = void 0; + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var fn = _ref; + + if (fn) { + var ret = fn.apply(this, args); + if (ret != null) val = ret; + } + } + return val; + }; + }; + + Plugin.prototype.maybeInherit = function maybeInherit(loc) { + var inherits = this.take("inherits"); + if (!inherits) return; + + inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits"); + + this.manipulateOptions = this.chain(inherits, "manipulateOptions"); + this.post = this.chain(inherits, "post"); + this.pre = this.chain(inherits, "pre"); + this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]); + }; + + Plugin.prototype.init = function init(loc, i) { + if (this.initialized) return; + this.initialized = true; + + this.maybeInherit(loc); + + for (var key in this.raw) { + throw new Error(messages.get("pluginInvalidProperty", loc, i, key)); + } + }; + + Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) { + for (var _iterator2 = GLOBAL_VISITOR_PROPS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var key = _ref2; + + if (visitor[key]) { + throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes."); + } + } + + _babelTraverse2.default.explode(visitor); + return visitor; + }; + + return Plugin; + }(_store2.default); + + exports.default = Plugin; + module.exports = exports["default"]; + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var messages = _ref.messages; + + return { + visitor: { + Scope: function Scope(_ref2) { + var scope = _ref2.scope; + + for (var name in scope.bindings) { + var binding = scope.bindings[name]; + if (binding.kind !== "const" && binding.kind !== "module") continue; + + for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var violation = _ref3; + + throw violation.buildCodeFrameError(messages.get("readOnly", name)); + } + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 65 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("asyncFunctions"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 66 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + ArrowFunctionExpression: function ArrowFunctionExpression(path, state) { + if (state.opts.spec) { + var node = path.node; + + if (node.shadow) return; + + node.shadow = { this: false }; + node.type = "FunctionExpression"; + + var boundThis = t.thisExpression(); + boundThis._forceShadow = path; + + path.ensureBlock(); + path.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(state.addHelper("newArrowCheck"), [t.thisExpression(), boundThis]))); + + path.replaceWith(t.callExpression(t.memberExpression(node, t.identifier("bind")), [t.thisExpression()])); + } else { + path.arrowFunctionToShadowed(); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function statementList(key, path) { + var paths = path.get(key); + + for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var _path = _ref2; + + var func = _path.node; + if (!_path.isFunctionDeclaration()) continue; + + var declar = t.variableDeclaration("let", [t.variableDeclarator(func.id, t.toExpression(func))]); + + declar._blockHoist = 2; + + func.id = null; + + _path.replaceWith(declar); + } + } + + return { + visitor: { + BlockStatement: function BlockStatement(path) { + var node = path.node, + parent = path.parent; + + if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) { + return; + } + + statementList("body", path); + }, + SwitchCase: function SwitchCase(path) { + statementList("consequent", path); + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + exports.default = function () { + return { + visitor: { + VariableDeclaration: function VariableDeclaration(path, file) { + var node = path.node, + parent = path.parent, + scope = path.scope; + + if (!isBlockScoped(node)) return; + convertBlockScopedToVar(path, null, parent, scope, true); + + if (node._tdzThis) { + var nodes = [node]; + + for (var i = 0; i < node.declarations.length; i++) { + var decl = node.declarations[i]; + if (decl.init) { + var assign = t.assignmentExpression("=", decl.id, decl.init); + assign._ignoreBlockScopingTDZ = true; + nodes.push(t.expressionStatement(assign)); + } + decl.init = file.addHelper("temporalUndefined"); + } + + node._blockHoist = 2; + + if (path.isCompletionRecord()) { + nodes.push(t.expressionStatement(scope.buildUndefinedNode())); + } + + path.replaceWithMultiple(nodes); + } + }, + Loop: function Loop(path, file) { + var node = path.node, + parent = path.parent, + scope = path.scope; + + t.ensureBlock(node); + var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file); + var replace = blockScoping.run(); + if (replace) path.replaceWith(replace); + }, + CatchClause: function CatchClause(path, file) { + var parent = path.parent, + scope = path.scope; + + var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file); + blockScoping.run(); + }, + "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) { + if (!ignoreBlock(path)) { + var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file); + blockScoping.run(); + } + } + } + }; + }; + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + var _tdz = __webpack_require__(326); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _values = __webpack_require__(275); + + var _values2 = _interopRequireDefault(_values); + + var _extend = __webpack_require__(569); + + var _extend2 = _interopRequireDefault(_extend); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function ignoreBlock(path) { + return t.isLoop(path.parent) || t.isCatchClause(path.parent); + } + + var buildRetCheck = (0, _babelTemplate2.default)("\n if (typeof RETURN === \"object\") return RETURN.v;\n"); + + function isBlockScoped(node) { + if (!t.isVariableDeclaration(node)) return false; + if (node[t.BLOCK_SCOPED_SYMBOL]) return true; + if (node.kind !== "let" && node.kind !== "const") return false; + return true; + } + + function convertBlockScopedToVar(path, node, parent, scope) { + var moveBindingsToParent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + if (!node) { + node = path.node; + } + + if (!t.isFor(parent)) { + for (var i = 0; i < node.declarations.length; i++) { + var declar = node.declarations[i]; + declar.init = declar.init || scope.buildUndefinedNode(); + } + } + + node[t.BLOCK_SCOPED_SYMBOL] = true; + node.kind = "var"; + + if (moveBindingsToParent) { + var parentScope = scope.getFunctionParent(); + var ids = path.getBindingIdentifiers(); + for (var name in ids) { + var binding = scope.getOwnBinding(name); + if (binding) binding.kind = "var"; + scope.moveBindingTo(name, parentScope); + } + } + } + + function isVar(node) { + return t.isVariableDeclaration(node, { kind: "var" }) && !isBlockScoped(node); + } + + var letReferenceBlockVisitor = _babelTraverse2.default.visitors.merge([{ + Loop: { + enter: function enter(path, state) { + state.loopDepth++; + }, + exit: function exit(path, state) { + state.loopDepth--; + } + }, + Function: function Function(path, state) { + if (state.loopDepth > 0) { + path.traverse(letReferenceFunctionVisitor, state); + } + return path.skip(); + } + }, _tdz.visitor]); + + var letReferenceFunctionVisitor = _babelTraverse2.default.visitors.merge([{ + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + var ref = state.letReferences[path.node.name]; + + if (!ref) return; + + var localBinding = path.scope.getBindingIdentifier(path.node.name); + if (localBinding && localBinding !== ref) return; + + state.closurify = true; + } + }, _tdz.visitor]); + + var hoistVarDeclarationsVisitor = { + enter: function enter(path, self) { + var node = path.node, + parent = path.parent; + + if (path.isForStatement()) { + if (isVar(node.init, node)) { + var nodes = self.pushDeclar(node.init); + if (nodes.length === 1) { + node.init = nodes[0]; + } else { + node.init = t.sequenceExpression(nodes); + } + } + } else if (path.isFor()) { + if (isVar(node.left, node)) { + self.pushDeclar(node.left); + node.left = node.left.declarations[0].id; + } + } else if (isVar(node, parent)) { + path.replaceWithMultiple(self.pushDeclar(node).map(function (expr) { + return t.expressionStatement(expr); + })); + } else if (path.isFunction()) { + return path.skip(); + } + } + }; + + var loopLabelVisitor = { + LabeledStatement: function LabeledStatement(_ref, state) { + var node = _ref.node; + + state.innerLabels.push(node.label.name); + } + }; + + var continuationVisitor = { + enter: function enter(path, state) { + if (path.isAssignmentExpression() || path.isUpdateExpression()) { + var bindings = path.getBindingIdentifiers(); + for (var name in bindings) { + if (state.outsideReferences[name] !== path.scope.getBindingIdentifier(name)) continue; + state.reassignments[name] = true; + } + } + } + }; + + function loopNodeTo(node) { + if (t.isBreakStatement(node)) { + return "break"; + } else if (t.isContinueStatement(node)) { + return "continue"; + } + } + + var loopVisitor = { + Loop: function Loop(path, state) { + var oldIgnoreLabeless = state.ignoreLabeless; + state.ignoreLabeless = true; + path.traverse(loopVisitor, state); + state.ignoreLabeless = oldIgnoreLabeless; + path.skip(); + }, + Function: function Function(path) { + path.skip(); + }, + SwitchCase: function SwitchCase(path, state) { + var oldInSwitchCase = state.inSwitchCase; + state.inSwitchCase = true; + path.traverse(loopVisitor, state); + state.inSwitchCase = oldInSwitchCase; + path.skip(); + }, + "BreakStatement|ContinueStatement|ReturnStatement": function BreakStatementContinueStatementReturnStatement(path, state) { + var node = path.node, + parent = path.parent, + scope = path.scope; + + if (node[this.LOOP_IGNORE]) return; + + var replace = void 0; + var loopText = loopNodeTo(node); + + if (loopText) { + if (node.label) { + if (state.innerLabels.indexOf(node.label.name) >= 0) { + return; + } + + loopText = loopText + "|" + node.label.name; + } else { + if (state.ignoreLabeless) return; + + if (state.inSwitchCase) return; + + if (t.isBreakStatement(node) && t.isSwitchCase(parent)) return; + } + + state.hasBreakContinue = true; + state.map[loopText] = node; + replace = t.stringLiteral(loopText); + } + + if (path.isReturnStatement()) { + state.hasReturn = true; + replace = t.objectExpression([t.objectProperty(t.identifier("v"), node.argument || scope.buildUndefinedNode())]); + } + + if (replace) { + replace = t.returnStatement(replace); + replace[this.LOOP_IGNORE] = true; + path.skip(); + path.replaceWith(t.inherits(replace, node)); + } + } + }; + + var BlockScoping = function () { + function BlockScoping(loopPath, blockPath, parent, scope, file) { + (0, _classCallCheck3.default)(this, BlockScoping); + + this.parent = parent; + this.scope = scope; + this.file = file; + + this.blockPath = blockPath; + this.block = blockPath.node; + + this.outsideLetReferences = (0, _create2.default)(null); + this.hasLetReferences = false; + this.letReferences = (0, _create2.default)(null); + this.body = []; + + if (loopPath) { + this.loopParent = loopPath.parent; + this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label; + this.loopPath = loopPath; + this.loop = loopPath.node; + } + } + + BlockScoping.prototype.run = function run() { + var block = this.block; + if (block._letDone) return; + block._letDone = true; + + var needsClosure = this.getLetReferences(); + + if (t.isFunction(this.parent) || t.isProgram(this.block)) { + this.updateScopeInfo(); + return; + } + + if (!this.hasLetReferences) return; + + if (needsClosure) { + this.wrapClosure(); + } else { + this.remap(); + } + + this.updateScopeInfo(needsClosure); + + if (this.loopLabel && !t.isLabeledStatement(this.loopParent)) { + return t.labeledStatement(this.loopLabel, this.loop); + } + }; + + BlockScoping.prototype.updateScopeInfo = function updateScopeInfo(wrappedInClosure) { + var scope = this.scope; + var parentScope = scope.getFunctionParent(); + var letRefs = this.letReferences; + + for (var key in letRefs) { + var ref = letRefs[key]; + var binding = scope.getBinding(ref.name); + if (!binding) continue; + if (binding.kind === "let" || binding.kind === "const") { + binding.kind = "var"; + + if (wrappedInClosure) { + scope.removeBinding(ref.name); + } else { + scope.moveBindingTo(ref.name, parentScope); + } + } + } + }; + + BlockScoping.prototype.remap = function remap() { + var letRefs = this.letReferences; + var scope = this.scope; + + for (var key in letRefs) { + var ref = letRefs[key]; + + if (scope.parentHasBinding(key) || scope.hasGlobal(key)) { + if (scope.hasOwnBinding(key)) scope.rename(ref.name); + + if (this.blockPath.scope.hasOwnBinding(key)) this.blockPath.scope.rename(ref.name); + } + } + }; + + BlockScoping.prototype.wrapClosure = function wrapClosure() { + if (this.file.opts.throwIfClosureRequired) { + throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure " + "(throwIfClosureRequired)."); + } + var block = this.block; + + var outsideRefs = this.outsideLetReferences; + + if (this.loop) { + for (var name in outsideRefs) { + var id = outsideRefs[name]; + + if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) { + delete outsideRefs[id.name]; + delete this.letReferences[id.name]; + + this.scope.rename(id.name); + + this.letReferences[id.name] = id; + outsideRefs[id.name] = id; + } + } + } + + this.has = this.checkLoop(); + + this.hoistVarDeclarations(); + + var params = (0, _values2.default)(outsideRefs); + var args = (0, _values2.default)(outsideRefs); + + var isSwitch = this.blockPath.isSwitchStatement(); + + var fn = t.functionExpression(null, params, t.blockStatement(isSwitch ? [block] : block.body)); + fn.shadow = true; + + this.addContinuations(fn); + + var ref = fn; + + if (this.loop) { + ref = this.scope.generateUidIdentifier("loop"); + this.loopPath.insertBefore(t.variableDeclaration("var", [t.variableDeclarator(ref, fn)])); + } + + var call = t.callExpression(ref, args); + var ret = this.scope.generateUidIdentifier("ret"); + + var hasYield = _babelTraverse2.default.hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES); + if (hasYield) { + fn.generator = true; + call = t.yieldExpression(call, true); + } + + var hasAsync = _babelTraverse2.default.hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES); + if (hasAsync) { + fn.async = true; + call = t.awaitExpression(call); + } + + this.buildClosure(ret, call); + + if (isSwitch) this.blockPath.replaceWithMultiple(this.body);else block.body = this.body; + }; + + BlockScoping.prototype.buildClosure = function buildClosure(ret, call) { + var has = this.has; + if (has.hasReturn || has.hasBreakContinue) { + this.buildHas(ret, call); + } else { + this.body.push(t.expressionStatement(call)); + } + }; + + BlockScoping.prototype.addContinuations = function addContinuations(fn) { + var state = { + reassignments: {}, + outsideReferences: this.outsideLetReferences + }; + + this.scope.traverse(fn, continuationVisitor, state); + + for (var i = 0; i < fn.params.length; i++) { + var param = fn.params[i]; + if (!state.reassignments[param.name]) continue; + + var newParam = this.scope.generateUidIdentifier(param.name); + fn.params[i] = newParam; + + this.scope.rename(param.name, newParam.name, fn); + + fn.body.body.push(t.expressionStatement(t.assignmentExpression("=", param, newParam))); + } + }; + + BlockScoping.prototype.getLetReferences = function getLetReferences() { + var _this = this; + + var block = this.block; + + var declarators = []; + + if (this.loop) { + var init = this.loop.left || this.loop.init; + if (isBlockScoped(init)) { + declarators.push(init); + (0, _extend2.default)(this.outsideLetReferences, t.getBindingIdentifiers(init)); + } + } + + var addDeclarationsFromChild = function addDeclarationsFromChild(path, node) { + node = node || path.node; + if (t.isClassDeclaration(node) || t.isFunctionDeclaration(node) || isBlockScoped(node)) { + if (isBlockScoped(node)) { + convertBlockScopedToVar(path, node, block, _this.scope); + } + declarators = declarators.concat(node.declarations || node); + } + if (t.isLabeledStatement(node)) { + addDeclarationsFromChild(path.get("body"), node.body); + } + }; + + if (block.body) { + for (var i = 0; i < block.body.length; i++) { + var declarPath = this.blockPath.get("body")[i]; + addDeclarationsFromChild(declarPath); + } + } + + if (block.cases) { + for (var _i = 0; _i < block.cases.length; _i++) { + var consequents = block.cases[_i].consequent; + + for (var j = 0; j < consequents.length; j++) { + var _declarPath = this.blockPath.get("cases")[_i]; + var declar = consequents[j]; + addDeclarationsFromChild(_declarPath, declar); + } + } + } + + for (var _i2 = 0; _i2 < declarators.length; _i2++) { + var _declar = declarators[_i2]; + + var keys = t.getBindingIdentifiers(_declar, false, true); + (0, _extend2.default)(this.letReferences, keys); + this.hasLetReferences = true; + } + + if (!this.hasLetReferences) return; + + var state = { + letReferences: this.letReferences, + closurify: false, + file: this.file, + loopDepth: 0 + }; + + var loopOrFunctionParent = this.blockPath.find(function (path) { + return path.isLoop() || path.isFunction(); + }); + if (loopOrFunctionParent && loopOrFunctionParent.isLoop()) { + state.loopDepth++; + } + + this.blockPath.traverse(letReferenceBlockVisitor, state); + + return state.closurify; + }; + + BlockScoping.prototype.checkLoop = function checkLoop() { + var state = { + hasBreakContinue: false, + ignoreLabeless: false, + inSwitchCase: false, + innerLabels: [], + hasReturn: false, + isLoop: !!this.loop, + map: {}, + LOOP_IGNORE: (0, _symbol2.default)() + }; + + this.blockPath.traverse(loopLabelVisitor, state); + this.blockPath.traverse(loopVisitor, state); + + return state; + }; + + BlockScoping.prototype.hoistVarDeclarations = function hoistVarDeclarations() { + this.blockPath.traverse(hoistVarDeclarationsVisitor, this); + }; + + BlockScoping.prototype.pushDeclar = function pushDeclar(node) { + var declars = []; + var names = t.getBindingIdentifiers(node); + for (var name in names) { + declars.push(t.variableDeclarator(names[name])); + } + + this.body.push(t.variableDeclaration(node.kind, declars)); + + var replace = []; + + for (var i = 0; i < node.declarations.length; i++) { + var declar = node.declarations[i]; + if (!declar.init) continue; + + var expr = t.assignmentExpression("=", declar.id, declar.init); + replace.push(t.inherits(expr, declar)); + } + + return replace; + }; + + BlockScoping.prototype.buildHas = function buildHas(ret, call) { + var body = this.body; + + body.push(t.variableDeclaration("var", [t.variableDeclarator(ret, call)])); + + var retCheck = void 0; + var has = this.has; + var cases = []; + + if (has.hasReturn) { + retCheck = buildRetCheck({ + RETURN: ret + }); + } + + if (has.hasBreakContinue) { + for (var key in has.map) { + cases.push(t.switchCase(t.stringLiteral(key), [has.map[key]])); + } + + if (has.hasReturn) { + cases.push(t.switchCase(null, [retCheck])); + } + + if (cases.length === 1) { + var single = cases[0]; + body.push(t.ifStatement(t.binaryExpression("===", ret, single.test), single.consequent[0])); + } else { + if (this.loop) { + for (var i = 0; i < cases.length; i++) { + var caseConsequent = cases[i].consequent[0]; + if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) { + caseConsequent.label = this.loopLabel = this.loopLabel || this.scope.generateUidIdentifier("loop"); + } + } + } + + body.push(t.switchStatement(ret, cases)); + } + } else { + if (has.hasReturn) { + body.push(retCheck); + } + } + }; + + return BlockScoping; + }(); + + module.exports = exports["default"]; + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (_ref) { + var t = _ref.types; + + var VISITED = (0, _symbol2.default)(); + + return { + visitor: { + ExportDefaultDeclaration: function ExportDefaultDeclaration(path) { + if (!path.get("declaration").isClassDeclaration()) return; + + var node = path.node; + + var ref = node.declaration.id || path.scope.generateUidIdentifier("class"); + node.declaration.id = ref; + + path.replaceWith(node.declaration); + path.insertAfter(t.exportDefaultDeclaration(ref)); + }, + ClassDeclaration: function ClassDeclaration(path) { + var node = path.node; + + var ref = node.id || path.scope.generateUidIdentifier("class"); + + path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(ref, t.toExpression(node))])); + }, + ClassExpression: function ClassExpression(path, state) { + var node = path.node; + + if (node[VISITED]) return; + + var inferred = (0, _babelHelperFunctionName2.default)(path); + if (inferred && inferred !== node) return path.replaceWith(inferred); + + node[VISITED] = true; + + var Constructor = _vanilla2.default; + if (state.opts.loose) Constructor = _loose2.default; + + path.replaceWith(new Constructor(path, state.file).run()); + } + } + }; + }; + + var _loose = __webpack_require__(327); + + var _loose2 = _interopRequireDefault(_loose); + + var _vanilla = __webpack_require__(203); + + var _vanilla2 = _interopRequireDefault(_vanilla); + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types, + template = _ref.template; + + var buildMutatorMapAssign = template("\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n "); + + function getValue(prop) { + if (t.isObjectProperty(prop)) { + return prop.value; + } else if (t.isObjectMethod(prop)) { + return t.functionExpression(null, prop.params, prop.body, prop.generator, prop.async); + } + } + + function pushAssign(objId, prop, body) { + if (prop.kind === "get" && prop.kind === "set") { + pushMutatorDefine(objId, prop, body); + } else { + body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(objId, prop.key, prop.computed || t.isLiteral(prop.key)), getValue(prop)))); + } + } + + function pushMutatorDefine(_ref2, prop) { + var objId = _ref2.objId, + body = _ref2.body, + getMutatorId = _ref2.getMutatorId, + scope = _ref2.scope; + + var key = !prop.computed && t.isIdentifier(prop.key) ? t.stringLiteral(prop.key.name) : prop.key; + + var maybeMemoise = scope.maybeGenerateMemoised(key); + if (maybeMemoise) { + body.push(t.expressionStatement(t.assignmentExpression("=", maybeMemoise, key))); + key = maybeMemoise; + } + + body.push.apply(body, buildMutatorMapAssign({ + MUTATOR_MAP_REF: getMutatorId(), + KEY: key, + VALUE: getValue(prop), + KIND: t.identifier(prop.kind) + })); + } + + function loose(info) { + for (var _iterator = info.computedProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var prop = _ref3; + + if (prop.kind === "get" || prop.kind === "set") { + pushMutatorDefine(info, prop); + } else { + pushAssign(info.objId, prop, info.body); + } + } + } + + function spec(info) { + var objId = info.objId, + body = info.body, + computedProps = info.computedProps, + state = info.state; + + for (var _iterator2 = computedProps, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref4; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref4 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref4 = _i2.value; + } + + var prop = _ref4; + + var key = t.toComputedKey(prop); + + if (prop.kind === "get" || prop.kind === "set") { + pushMutatorDefine(info, prop); + } else if (t.isStringLiteral(key, { value: "__proto__" })) { + pushAssign(objId, prop, body); + } else { + if (computedProps.length === 1) { + return t.callExpression(state.addHelper("defineProperty"), [info.initPropExpression, key, getValue(prop)]); + } else { + body.push(t.expressionStatement(t.callExpression(state.addHelper("defineProperty"), [objId, key, getValue(prop)]))); + } + } + } + } + + return { + visitor: { + ObjectExpression: { + exit: function exit(path, state) { + var node = path.node, + parent = path.parent, + scope = path.scope; + + var hasComputed = false; + for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref5; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref5 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref5 = _i3.value; + } + + var prop = _ref5; + + hasComputed = prop.computed === true; + if (hasComputed) break; + } + if (!hasComputed) return; + + var initProps = []; + var computedProps = []; + var foundComputed = false; + + for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref6; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref6 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref6 = _i4.value; + } + + var _prop = _ref6; + + if (_prop.computed) { + foundComputed = true; + } + + if (foundComputed) { + computedProps.push(_prop); + } else { + initProps.push(_prop); + } + } + + var objId = scope.generateUidIdentifierBasedOnNode(parent); + var initPropExpression = t.objectExpression(initProps); + var body = []; + + body.push(t.variableDeclaration("var", [t.variableDeclarator(objId, initPropExpression)])); + + var callback = spec; + if (state.opts.loose) callback = loose; + + var mutatorRef = void 0; + + var getMutatorId = function getMutatorId() { + if (!mutatorRef) { + mutatorRef = scope.generateUidIdentifier("mutatorMap"); + + body.push(t.variableDeclaration("var", [t.variableDeclarator(mutatorRef, t.objectExpression([]))])); + } + + return mutatorRef; + }; + + var single = callback({ + scope: scope, + objId: objId, + body: body, + computedProps: computedProps, + initPropExpression: initPropExpression, + getMutatorId: getMutatorId, + state: state + }); + + if (mutatorRef) { + body.push(t.expressionStatement(t.callExpression(state.addHelper("defineEnumerableProperties"), [objId, mutatorRef]))); + } + + if (single) { + path.replaceWith(single); + } else { + body.push(t.expressionStatement(objId)); + path.replaceWithMultiple(body); + } + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function variableDeclarationHasPattern(node) { + for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var declar = _ref2; + + if (t.isPattern(declar.id)) { + return true; + } + } + return false; + } + + function hasRest(pattern) { + for (var _iterator2 = pattern.elements, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var elem = _ref3; + + if (t.isRestElement(elem)) { + return true; + } + } + return false; + } + + var arrayUnpackVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + if (state.bindings[path.node.name]) { + state.deopt = true; + path.stop(); + } + } + }; + + var DestructuringTransformer = function () { + function DestructuringTransformer(opts) { + (0, _classCallCheck3.default)(this, DestructuringTransformer); + + this.blockHoist = opts.blockHoist; + this.operator = opts.operator; + this.arrays = {}; + this.nodes = opts.nodes || []; + this.scope = opts.scope; + this.file = opts.file; + this.kind = opts.kind; + } + + DestructuringTransformer.prototype.buildVariableAssignment = function buildVariableAssignment(id, init) { + var op = this.operator; + if (t.isMemberExpression(id)) op = "="; + + var node = void 0; + + if (op) { + node = t.expressionStatement(t.assignmentExpression(op, id, init)); + } else { + node = t.variableDeclaration(this.kind, [t.variableDeclarator(id, init)]); + } + + node._blockHoist = this.blockHoist; + + return node; + }; + + DestructuringTransformer.prototype.buildVariableDeclaration = function buildVariableDeclaration(id, init) { + var declar = t.variableDeclaration("var", [t.variableDeclarator(id, init)]); + declar._blockHoist = this.blockHoist; + return declar; + }; + + DestructuringTransformer.prototype.push = function push(id, init) { + if (t.isObjectPattern(id)) { + this.pushObjectPattern(id, init); + } else if (t.isArrayPattern(id)) { + this.pushArrayPattern(id, init); + } else if (t.isAssignmentPattern(id)) { + this.pushAssignmentPattern(id, init); + } else { + this.nodes.push(this.buildVariableAssignment(id, init)); + } + }; + + DestructuringTransformer.prototype.toArray = function toArray(node, count) { + if (this.file.opts.loose || t.isIdentifier(node) && this.arrays[node.name]) { + return node; + } else { + return this.scope.toArray(node, count); + } + }; + + DestructuringTransformer.prototype.pushAssignmentPattern = function pushAssignmentPattern(pattern, valueRef) { + + var tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef); + + var declar = t.variableDeclaration("var", [t.variableDeclarator(tempValueRef, valueRef)]); + declar._blockHoist = this.blockHoist; + this.nodes.push(declar); + + var tempConditional = t.conditionalExpression(t.binaryExpression("===", tempValueRef, t.identifier("undefined")), pattern.right, tempValueRef); + + var left = pattern.left; + if (t.isPattern(left)) { + var tempValueDefault = t.expressionStatement(t.assignmentExpression("=", tempValueRef, tempConditional)); + tempValueDefault._blockHoist = this.blockHoist; + + this.nodes.push(tempValueDefault); + this.push(left, tempValueRef); + } else { + this.nodes.push(this.buildVariableAssignment(left, tempConditional)); + } + }; + + DestructuringTransformer.prototype.pushObjectRest = function pushObjectRest(pattern, objRef, spreadProp, spreadPropIndex) { + + var keys = []; + + for (var i = 0; i < pattern.properties.length; i++) { + var prop = pattern.properties[i]; + + if (i >= spreadPropIndex) break; + + if (t.isRestProperty(prop)) continue; + + var key = prop.key; + if (t.isIdentifier(key) && !prop.computed) key = t.stringLiteral(prop.key.name); + keys.push(key); + } + + keys = t.arrayExpression(keys); + + var value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]); + this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value)); + }; + + DestructuringTransformer.prototype.pushObjectProperty = function pushObjectProperty(prop, propRef) { + if (t.isLiteral(prop.key)) prop.computed = true; + + var pattern = prop.value; + var objRef = t.memberExpression(propRef, prop.key, prop.computed); + + if (t.isPattern(pattern)) { + this.push(pattern, objRef); + } else { + this.nodes.push(this.buildVariableAssignment(pattern, objRef)); + } + }; + + DestructuringTransformer.prototype.pushObjectPattern = function pushObjectPattern(pattern, objRef) { + + if (!pattern.properties.length) { + this.nodes.push(t.expressionStatement(t.callExpression(this.file.addHelper("objectDestructuringEmpty"), [objRef]))); + } + + if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) { + var temp = this.scope.generateUidIdentifierBasedOnNode(objRef); + this.nodes.push(this.buildVariableDeclaration(temp, objRef)); + objRef = temp; + } + + for (var i = 0; i < pattern.properties.length; i++) { + var prop = pattern.properties[i]; + if (t.isRestProperty(prop)) { + this.pushObjectRest(pattern, objRef, prop, i); + } else { + this.pushObjectProperty(prop, objRef); + } + } + }; + + DestructuringTransformer.prototype.canUnpackArrayPattern = function canUnpackArrayPattern(pattern, arr) { + if (!t.isArrayExpression(arr)) return false; + + if (pattern.elements.length > arr.elements.length) return; + if (pattern.elements.length < arr.elements.length && !hasRest(pattern)) return false; + + for (var _iterator3 = pattern.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + var elem = _ref4; + + if (!elem) return false; + + if (t.isMemberExpression(elem)) return false; + } + + for (var _iterator4 = arr.elements, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref5; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref5 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref5 = _i4.value; + } + + var _elem = _ref5; + + if (t.isSpreadElement(_elem)) return false; + + if (t.isCallExpression(_elem)) return false; + + if (t.isMemberExpression(_elem)) return false; + } + + var bindings = t.getBindingIdentifiers(pattern); + var state = { deopt: false, bindings: bindings }; + this.scope.traverse(arr, arrayUnpackVisitor, state); + return !state.deopt; + }; + + DestructuringTransformer.prototype.pushUnpackedArrayPattern = function pushUnpackedArrayPattern(pattern, arr) { + for (var i = 0; i < pattern.elements.length; i++) { + var elem = pattern.elements[i]; + if (t.isRestElement(elem)) { + this.push(elem.argument, t.arrayExpression(arr.elements.slice(i))); + } else { + this.push(elem, arr.elements[i]); + } + } + }; + + DestructuringTransformer.prototype.pushArrayPattern = function pushArrayPattern(pattern, arrayRef) { + if (!pattern.elements) return; + + if (this.canUnpackArrayPattern(pattern, arrayRef)) { + return this.pushUnpackedArrayPattern(pattern, arrayRef); + } + + var count = !hasRest(pattern) && pattern.elements.length; + + var toArray = this.toArray(arrayRef, count); + + if (t.isIdentifier(toArray)) { + arrayRef = toArray; + } else { + arrayRef = this.scope.generateUidIdentifierBasedOnNode(arrayRef); + this.arrays[arrayRef.name] = true; + this.nodes.push(this.buildVariableDeclaration(arrayRef, toArray)); + } + + for (var i = 0; i < pattern.elements.length; i++) { + var elem = pattern.elements[i]; + + if (!elem) continue; + + var elemRef = void 0; + + if (t.isRestElement(elem)) { + elemRef = this.toArray(arrayRef); + elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]); + + elem = elem.argument; + } else { + elemRef = t.memberExpression(arrayRef, t.numericLiteral(i), true); + } + + this.push(elem, elemRef); + } + }; + + DestructuringTransformer.prototype.init = function init(pattern, ref) { + + if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) { + var memo = this.scope.maybeGenerateMemoised(ref, true); + if (memo) { + this.nodes.push(this.buildVariableDeclaration(memo, ref)); + ref = memo; + } + } + + this.push(pattern, ref); + + return this.nodes; + }; + + return DestructuringTransformer; + }(); + + return { + visitor: { + ExportNamedDeclaration: function ExportNamedDeclaration(path) { + var declaration = path.get("declaration"); + if (!declaration.isVariableDeclaration()) return; + if (!variableDeclarationHasPattern(declaration.node)) return; + + var specifiers = []; + + for (var name in path.getOuterBindingIdentifiers(path)) { + var id = t.identifier(name); + specifiers.push(t.exportSpecifier(id, id)); + } + + path.replaceWith(declaration.node); + path.insertAfter(t.exportNamedDeclaration(null, specifiers)); + }, + ForXStatement: function ForXStatement(path, file) { + var node = path.node, + scope = path.scope; + + var left = node.left; + + if (t.isPattern(left)) { + + var temp = scope.generateUidIdentifier("ref"); + + node.left = t.variableDeclaration("var", [t.variableDeclarator(temp)]); + + path.ensureBlock(); + + node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(left, temp)])); + + return; + } + + if (!t.isVariableDeclaration(left)) return; + + var pattern = left.declarations[0].id; + if (!t.isPattern(pattern)) return; + + var key = scope.generateUidIdentifier("ref"); + node.left = t.variableDeclaration(left.kind, [t.variableDeclarator(key, null)]); + + var nodes = []; + + var destructuring = new DestructuringTransformer({ + kind: left.kind, + file: file, + scope: scope, + nodes: nodes + }); + + destructuring.init(pattern, key); + + path.ensureBlock(); + + var block = node.body; + block.body = nodes.concat(block.body); + }, + CatchClause: function CatchClause(_ref6, file) { + var node = _ref6.node, + scope = _ref6.scope; + + var pattern = node.param; + if (!t.isPattern(pattern)) return; + + var ref = scope.generateUidIdentifier("ref"); + node.param = ref; + + var nodes = []; + + var destructuring = new DestructuringTransformer({ + kind: "let", + file: file, + scope: scope, + nodes: nodes + }); + destructuring.init(pattern, ref); + + node.body.body = nodes.concat(node.body.body); + }, + AssignmentExpression: function AssignmentExpression(path, file) { + var node = path.node, + scope = path.scope; + + if (!t.isPattern(node.left)) return; + + var nodes = []; + + var destructuring = new DestructuringTransformer({ + operator: node.operator, + file: file, + scope: scope, + nodes: nodes + }); + + var ref = void 0; + if (path.isCompletionRecord() || !path.parentPath.isExpressionStatement()) { + ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref"); + + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(ref, node.right)])); + + if (t.isArrayExpression(node.right)) { + destructuring.arrays[ref.name] = true; + } + } + + destructuring.init(node.left, ref || node.right); + + if (ref) { + nodes.push(t.expressionStatement(ref)); + } + + path.replaceWithMultiple(nodes); + }, + VariableDeclaration: function VariableDeclaration(path, file) { + var node = path.node, + scope = path.scope, + parent = path.parent; + + if (t.isForXStatement(parent)) return; + if (!parent || !path.container) return; + if (!variableDeclarationHasPattern(node)) return; + + var nodes = []; + var declar = void 0; + + for (var i = 0; i < node.declarations.length; i++) { + declar = node.declarations[i]; + + var patternId = declar.init; + var pattern = declar.id; + + var destructuring = new DestructuringTransformer({ + blockHoist: node._blockHoist, + nodes: nodes, + scope: scope, + kind: node.kind, + file: file + }); + + if (t.isPattern(pattern)) { + destructuring.init(pattern, patternId); + + if (+i !== node.declarations.length - 1) { + t.inherits(nodes[nodes.length - 1], declar); + } + } else { + nodes.push(t.inherits(destructuring.buildVariableAssignment(declar.id, declar.init), declar)); + } + } + + var nodesOut = []; + for (var _iterator5 = nodes, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref7; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref7 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref7 = _i5.value; + } + + var _node = _ref7; + + var tail = nodesOut[nodesOut.length - 1]; + if (tail && t.isVariableDeclaration(tail) && t.isVariableDeclaration(_node) && tail.kind === _node.kind) { + var _tail$declarations; + + (_tail$declarations = tail.declarations).push.apply(_tail$declarations, _node.declarations); + } else { + nodesOut.push(_node); + } + } + + for (var _iterator6 = nodesOut, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref8; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref8 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref8 = _i6.value; + } + + var nodeOut = _ref8; + + if (!nodeOut.declarations) continue; + for (var _iterator7 = nodeOut.declarations, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref9; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref9 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref9 = _i7.value; + } + + var declaration = _ref9; + var name = declaration.id.name; + + if (scope.bindings[name]) { + scope.bindings[name].kind = nodeOut.kind; + } + } + } + + if (nodesOut.length === 1) { + path.replaceWith(nodesOut[0]); + } else { + path.replaceWithMultiple(nodesOut); + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 72 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var messages = _ref.messages, + template = _ref.template, + t = _ref.types; + + var buildForOfArray = template("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n "); + + var buildForOfLoose = template("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n "); + + var buildForOf = template("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n "); + + function _ForOfStatementArray(path) { + var node = path.node, + scope = path.scope; + + var nodes = []; + var right = node.right; + + if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) { + var uid = scope.generateUidIdentifier("arr"); + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, right)])); + right = uid; + } + + var iterationKey = scope.generateUidIdentifier("i"); + + var loop = buildForOfArray({ + BODY: node.body, + KEY: iterationKey, + ARR: right + }); + + t.inherits(loop, node); + t.ensureBlock(loop); + + var iterationValue = t.memberExpression(right, iterationKey, true); + + var left = node.left; + if (t.isVariableDeclaration(left)) { + left.declarations[0].init = iterationValue; + loop.body.body.unshift(left); + } else { + loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue))); + } + + if (path.parentPath.isLabeledStatement()) { + loop = t.labeledStatement(path.parentPath.node.label, loop); + } + + nodes.push(loop); + + return nodes; + } + + return { + visitor: { + ForOfStatement: function ForOfStatement(path, state) { + if (path.get("right").isArrayExpression()) { + if (path.parentPath.isLabeledStatement()) { + return path.parentPath.replaceWithMultiple(_ForOfStatementArray(path)); + } else { + return path.replaceWithMultiple(_ForOfStatementArray(path)); + } + } + + var callback = spec; + if (state.opts.loose) callback = loose; + + var node = path.node; + + var build = callback(path, state); + var declar = build.declar; + var loop = build.loop; + var block = loop.body; + + path.ensureBlock(); + + if (declar) { + block.body.push(declar); + } + + block.body = block.body.concat(node.body.body); + + t.inherits(loop, node); + t.inherits(loop.body, node.body); + + if (build.replaceParent) { + path.parentPath.replaceWithMultiple(build.node); + path.remove(); + } else { + path.replaceWithMultiple(build.node); + } + } + } + }; + + function loose(path, file) { + var node = path.node, + scope = path.scope, + parent = path.parent; + var left = node.left; + + var declar = void 0, + id = void 0; + + if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { + id = left; + } else if (t.isVariableDeclaration(left)) { + id = scope.generateUidIdentifier("ref"); + declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, id)]); + } else { + throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); + } + + var iteratorKey = scope.generateUidIdentifier("iterator"); + var isArrayKey = scope.generateUidIdentifier("isArray"); + + var loop = buildForOfLoose({ + LOOP_OBJECT: iteratorKey, + IS_ARRAY: isArrayKey, + OBJECT: node.right, + INDEX: scope.generateUidIdentifier("i"), + ID: id + }); + + if (!declar) { + loop.body.body.shift(); + } + + var isLabeledParent = t.isLabeledStatement(parent); + var labeled = void 0; + + if (isLabeledParent) { + labeled = t.labeledStatement(parent.label, loop); + } + + return { + replaceParent: isLabeledParent, + declar: declar, + node: labeled || loop, + loop: loop + }; + } + + function spec(path, file) { + var node = path.node, + scope = path.scope, + parent = path.parent; + + var left = node.left; + var declar = void 0; + + var stepKey = scope.generateUidIdentifier("step"); + var stepValue = t.memberExpression(stepKey, t.identifier("value")); + + if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { + declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue)); + } else if (t.isVariableDeclaration(left)) { + declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]); + } else { + throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); + } + + var iteratorKey = scope.generateUidIdentifier("iterator"); + + var template = buildForOf({ + ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), + ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), + ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), + ITERATOR_KEY: iteratorKey, + STEP_KEY: stepKey, + OBJECT: node.right, + BODY: null + }); + + var isLabeledParent = t.isLabeledStatement(parent); + + var tryBody = template[3].block.body; + var loop = tryBody[0]; + + if (isLabeledParent) { + tryBody[0] = t.labeledStatement(parent.label, loop); + } + + return { + replaceParent: isLabeledParent, + declar: declar, + loop: loop, + node: template + }; + } + }; + + module.exports = exports["default"]; + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + FunctionExpression: { + exit: function exit(path) { + if (path.key !== "value" && !path.parentPath.isObjectProperty()) { + var replacement = (0, _babelHelperFunctionName2.default)(path); + if (replacement) path.replaceWith(replacement); + } + } + }, + + ObjectProperty: function ObjectProperty(path) { + var value = path.get("value"); + if (value.isFunction()) { + var newNode = (0, _babelHelperFunctionName2.default)(value); + if (newNode) value.replaceWith(newNode); + } + } + } + }; + }; + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 74 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + NumericLiteral: function NumericLiteral(_ref) { + var node = _ref.node; + + if (node.extra && /^0[ob]/i.test(node.extra.raw)) { + node.extra = undefined; + } + }, + StringLiteral: function StringLiteral(_ref2) { + var node = _ref2.node; + + if (node.extra && /\\[u]/gi.test(node.extra.raw)) { + node.extra = undefined; + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function () { + var REASSIGN_REMAP_SKIP = (0, _symbol2.default)(); + + var reassignmentVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(path) { + var name = path.node.name; + var remap = this.remaps[name]; + if (!remap) return; + + if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; + + if (path.parentPath.isCallExpression({ callee: path.node })) { + path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap])); + } else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) { + var object = remap.object, + property = remap.property; + + path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name))); + } else { + path.replaceWith(remap); + } + this.requeueInParent(path); + }, + AssignmentExpression: function AssignmentExpression(path) { + var node = path.node; + if (node[REASSIGN_REMAP_SKIP]) return; + + var left = path.get("left"); + if (!left.isIdentifier()) return; + + var name = left.node.name; + var exports = this.exports[name]; + if (!exports) return; + + if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; + + node[REASSIGN_REMAP_SKIP] = true; + + for (var _iterator = exports, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var reid = _ref; + + node = buildExportsAssignment(reid, node).expression; + } + + path.replaceWith(node); + this.requeueInParent(path); + }, + UpdateExpression: function UpdateExpression(path) { + var arg = path.get("argument"); + if (!arg.isIdentifier()) return; + + var name = arg.node.name; + var exports = this.exports[name]; + if (!exports) return; + + if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; + + var node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1)); + + if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord() || path.node.prefix) { + path.replaceWith(node); + this.requeueInParent(path); + return; + } + + var nodes = []; + nodes.push(node); + + var operator = void 0; + if (path.node.operator === "--") { + operator = "+"; + } else { + operator = "-"; + } + nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1))); + + path.replaceWithMultiple(t.sequenceExpression(nodes)); + } + }; + + return { + inherits: __webpack_require__(212), + + visitor: { + ThisExpression: function ThisExpression(path, state) { + if (this.ranCommonJS) return; + + if (state.opts.allowTopLevelThis !== true && !path.findParent(function (path) { + return !path.is("shadow") && THIS_BREAK_KEYS.indexOf(path.type) >= 0; + })) { + path.replaceWith(t.identifier("undefined")); + } + }, + + Program: { + exit: function exit(path) { + this.ranCommonJS = true; + + var strict = !!this.opts.strict; + var noInterop = !!this.opts.noInterop; + + var scope = path.scope; + + scope.rename("module"); + scope.rename("exports"); + scope.rename("require"); + + var hasExports = false; + var hasImports = false; + + var body = path.get("body"); + var imports = (0, _create2.default)(null); + var exports = (0, _create2.default)(null); + + var nonHoistedExportNames = (0, _create2.default)(null); + + var topNodes = []; + var remaps = (0, _create2.default)(null); + + var requires = (0, _create2.default)(null); + + function addRequire(source, blockHoist) { + var cached = requires[source]; + if (cached) return cached; + + var ref = path.scope.generateUidIdentifier((0, _path2.basename)(source, (0, _path2.extname)(source))); + + var varDecl = t.variableDeclaration("var", [t.variableDeclarator(ref, buildRequire(t.stringLiteral(source)).expression)]); + + if (imports[source]) { + varDecl.loc = imports[source].loc; + } + + if (typeof blockHoist === "number" && blockHoist > 0) { + varDecl._blockHoist = blockHoist; + } + + topNodes.push(varDecl); + + return requires[source] = ref; + } + + function addTo(obj, key, arr) { + var existing = obj[key] || []; + obj[key] = existing.concat(arr); + } + + for (var _iterator2 = body, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _path = _ref2; + + if (_path.isExportDeclaration()) { + hasExports = true; + + var specifiers = [].concat(_path.get("declaration"), _path.get("specifiers")); + for (var _iterator4 = specifiers, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var _specifier2 = _ref4; + + var ids = _specifier2.getBindingIdentifiers(); + if (ids.__esModule) { + throw _specifier2.buildCodeFrameError("Illegal export \"__esModule\""); + } + } + } + + if (_path.isImportDeclaration()) { + var _importsEntry$specifi; + + hasImports = true; + + var key = _path.node.source.value; + var importsEntry = imports[key] || { + specifiers: [], + maxBlockHoist: 0, + loc: _path.node.loc + }; + + (_importsEntry$specifi = importsEntry.specifiers).push.apply(_importsEntry$specifi, _path.node.specifiers); + + if (typeof _path.node._blockHoist === "number") { + importsEntry.maxBlockHoist = Math.max(_path.node._blockHoist, importsEntry.maxBlockHoist); + } + + imports[key] = importsEntry; + + _path.remove(); + } else if (_path.isExportDefaultDeclaration()) { + var declaration = _path.get("declaration"); + if (declaration.isFunctionDeclaration()) { + var id = declaration.node.id; + var defNode = t.identifier("default"); + if (id) { + addTo(exports, id.name, defNode); + topNodes.push(buildExportsAssignment(defNode, id)); + _path.replaceWith(declaration.node); + } else { + topNodes.push(buildExportsAssignment(defNode, t.toExpression(declaration.node))); + _path.remove(); + } + } else if (declaration.isClassDeclaration()) { + var _id = declaration.node.id; + var _defNode = t.identifier("default"); + if (_id) { + addTo(exports, _id.name, _defNode); + _path.replaceWithMultiple([declaration.node, buildExportsAssignment(_defNode, _id)]); + } else { + _path.replaceWith(buildExportsAssignment(_defNode, t.toExpression(declaration.node))); + + _path.parentPath.requeue(_path.get("expression.left")); + } + } else { + _path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node)); + + _path.parentPath.requeue(_path.get("expression.left")); + } + } else if (_path.isExportNamedDeclaration()) { + var _declaration = _path.get("declaration"); + if (_declaration.node) { + if (_declaration.isFunctionDeclaration()) { + var _id2 = _declaration.node.id; + addTo(exports, _id2.name, _id2); + topNodes.push(buildExportsAssignment(_id2, _id2)); + _path.replaceWith(_declaration.node); + } else if (_declaration.isClassDeclaration()) { + var _id3 = _declaration.node.id; + addTo(exports, _id3.name, _id3); + _path.replaceWithMultiple([_declaration.node, buildExportsAssignment(_id3, _id3)]); + nonHoistedExportNames[_id3.name] = true; + } else if (_declaration.isVariableDeclaration()) { + var declarators = _declaration.get("declarations"); + for (var _iterator5 = declarators, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var decl = _ref5; + + var _id4 = decl.get("id"); + + var init = decl.get("init"); + if (!init.node) init.replaceWith(t.identifier("undefined")); + + if (_id4.isIdentifier()) { + addTo(exports, _id4.node.name, _id4.node); + init.replaceWith(buildExportsAssignment(_id4.node, init.node).expression); + nonHoistedExportNames[_id4.node.name] = true; + } else {} + } + _path.replaceWith(_declaration.node); + } + continue; + } + + var _specifiers = _path.get("specifiers"); + var nodes = []; + var _source = _path.node.source; + if (_source) { + var ref = addRequire(_source.value, _path.node._blockHoist); + + for (var _iterator6 = _specifiers, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref6; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref6 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref6 = _i6.value; + } + + var _specifier3 = _ref6; + + if (_specifier3.isExportNamespaceSpecifier()) {} else if (_specifier3.isExportDefaultSpecifier()) {} else if (_specifier3.isExportSpecifier()) { + if (!noInterop && _specifier3.node.local.name === "default") { + topNodes.push(buildExportsFrom(t.stringLiteral(_specifier3.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), _specifier3.node.local))); + } else { + topNodes.push(buildExportsFrom(t.stringLiteral(_specifier3.node.exported.name), t.memberExpression(ref, _specifier3.node.local))); + } + nonHoistedExportNames[_specifier3.node.exported.name] = true; + } + } + } else { + for (var _iterator7 = _specifiers, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref7; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref7 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref7 = _i7.value; + } + + var _specifier4 = _ref7; + + if (_specifier4.isExportSpecifier()) { + addTo(exports, _specifier4.node.local.name, _specifier4.node.exported); + nonHoistedExportNames[_specifier4.node.exported.name] = true; + nodes.push(buildExportsAssignment(_specifier4.node.exported, _specifier4.node.local)); + } + } + } + _path.replaceWithMultiple(nodes); + } else if (_path.isExportAllDeclaration()) { + var exportNode = buildExportAll({ + OBJECT: addRequire(_path.node.source.value, _path.node._blockHoist) + }); + exportNode.loc = _path.node.loc; + topNodes.push(exportNode); + _path.remove(); + } + } + + for (var source in imports) { + var _imports$source = imports[source], + specifiers = _imports$source.specifiers, + maxBlockHoist = _imports$source.maxBlockHoist; + + if (specifiers.length) { + var uid = addRequire(source, maxBlockHoist); + + var wildcard = void 0; + + for (var i = 0; i < specifiers.length; i++) { + var specifier = specifiers[i]; + if (t.isImportNamespaceSpecifier(specifier)) { + if (strict || noInterop) { + remaps[specifier.local.name] = uid; + } else { + var varDecl = t.variableDeclaration("var", [t.variableDeclarator(specifier.local, t.callExpression(this.addHelper("interopRequireWildcard"), [uid]))]); + + if (maxBlockHoist > 0) { + varDecl._blockHoist = maxBlockHoist; + } + + topNodes.push(varDecl); + } + wildcard = specifier.local; + } else if (t.isImportDefaultSpecifier(specifier)) { + specifiers[i] = t.importSpecifier(specifier.local, t.identifier("default")); + } + } + + for (var _iterator3 = specifiers, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var _specifier = _ref3; + + if (t.isImportSpecifier(_specifier)) { + var target = uid; + if (_specifier.imported.name === "default") { + if (wildcard) { + target = wildcard; + } else if (!noInterop) { + target = wildcard = path.scope.generateUidIdentifier(uid.name); + var _varDecl = t.variableDeclaration("var", [t.variableDeclarator(target, t.callExpression(this.addHelper("interopRequireDefault"), [uid]))]); + + if (maxBlockHoist > 0) { + _varDecl._blockHoist = maxBlockHoist; + } + + topNodes.push(_varDecl); + } + } + remaps[_specifier.local.name] = t.memberExpression(target, t.cloneWithoutLoc(_specifier.imported)); + } + } + } else { + var requireNode = buildRequire(t.stringLiteral(source)); + requireNode.loc = imports[source].loc; + topNodes.push(requireNode); + } + } + + if (hasImports && (0, _keys2.default)(nonHoistedExportNames).length) { + var maxHoistedExportsNodeAssignmentLength = 100; + var nonHoistedExportNamesArr = (0, _keys2.default)(nonHoistedExportNames); + + var _loop = function _loop(currentExportsNodeAssignmentLength) { + var nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice(currentExportsNodeAssignmentLength, currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength); + + var hoistedExportsNode = t.identifier("undefined"); + + nonHoistedExportNamesChunk.forEach(function (name) { + hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; + }); + + var node = t.expressionStatement(hoistedExportsNode); + node._blockHoist = 3; + + topNodes.unshift(node); + }; + + for (var currentExportsNodeAssignmentLength = 0; currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength) { + _loop(currentExportsNodeAssignmentLength); + } + } + + if (hasExports && !strict) { + var buildTemplate = buildExportsModuleDeclaration; + if (this.opts.loose) buildTemplate = buildLooseExportsModuleDeclaration; + + var declar = buildTemplate(); + declar._blockHoist = 3; + + topNodes.unshift(declar); + } + + path.unshiftContainer("body", topNodes); + path.traverse(reassignmentVisitor, { + remaps: remaps, + scope: scope, + exports: exports, + requeueInParent: function requeueInParent(newPath) { + return path.requeue(newPath); + } + }); + } + } + } + }; + }; + + var _path2 = __webpack_require__(17); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildRequire = (0, _babelTemplate2.default)("\n require($0);\n"); + + var buildExportsModuleDeclaration = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n"); + + var buildExportsFrom = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, $0, {\n enumerable: true,\n get: function () {\n return $1;\n }\n });\n"); + + var buildLooseExportsModuleDeclaration = (0, _babelTemplate2.default)("\n exports.__esModule = true;\n"); + + var buildExportsAssignment = (0, _babelTemplate2.default)("\n exports.$0 = $1;\n"); + + var buildExportAll = (0, _babelTemplate2.default)("\n Object.keys(OBJECT).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function () {\n return OBJECT[key];\n }\n });\n });\n"); + + var THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"]; + + module.exports = exports["default"]; + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (_ref) { + var t = _ref.types; + + function Property(path, node, scope, getObjectRef, file) { + var replaceSupers = new _babelHelperReplaceSupers2.default({ + getObjectRef: getObjectRef, + methodNode: node, + methodPath: path, + isStatic: true, + scope: scope, + file: file + }); + + replaceSupers.replace(); + } + + var CONTAINS_SUPER = (0, _symbol2.default)(); + + return { + visitor: { + Super: function Super(path) { + var parentObj = path.findParent(function (path) { + return path.isObjectExpression(); + }); + if (parentObj) parentObj.node[CONTAINS_SUPER] = true; + }, + + ObjectExpression: { + exit: function exit(path, file) { + if (!path.node[CONTAINS_SUPER]) return; + + var objectRef = void 0; + var getObjectRef = function getObjectRef() { + return objectRef = objectRef || path.scope.generateUidIdentifier("obj"); + }; + + var propPaths = path.get("properties"); + for (var _iterator = propPaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var propPath = _ref2; + + if (propPath.isObjectProperty()) propPath = propPath.get("value"); + Property(propPath, propPath.node, path.scope, getObjectRef, file); + } + + if (objectRef) { + path.scope.push({ id: objectRef }); + path.replaceWith(t.assignmentExpression("=", objectRef, path.node)); + } + } + } + } + }; + }; + + var _babelHelperReplaceSupers = __webpack_require__(189); + + var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function () { + return { + visitor: _babelTraverse.visitors.merge([{ + ArrowFunctionExpression: function ArrowFunctionExpression(path) { + var params = path.get("params"); + for (var _iterator = params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var param = _ref; + + if (param.isRestElement() || param.isAssignmentPattern()) { + path.arrowFunctionToShadowed(); + break; + } + } + } + }, destructuring.visitor, rest.visitor, def.visitor]) + }; + }; + + var _babelTraverse = __webpack_require__(7); + + var _destructuring = __webpack_require__(330); + + var destructuring = _interopRequireWildcard(_destructuring); + + var _default = __webpack_require__(329); + + var def = _interopRequireWildcard(_default); + + var _rest = __webpack_require__(331); + + var rest = _interopRequireWildcard(_rest); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + ObjectMethod: function ObjectMethod(path) { + var node = path.node; + + if (node.kind === "method") { + var func = t.functionExpression(null, node.params, node.body, node.generator, node.async); + func.returnType = node.returnType; + + path.replaceWith(t.objectProperty(node.key, func, node.computed)); + } + }, + ObjectProperty: function ObjectProperty(_ref) { + var node = _ref.node; + + if (node.shorthand) { + node.shorthand = false; + } + } + } + }; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function getSpreadLiteral(spread, scope, state) { + if (state.opts.loose && !t.isIdentifier(spread.argument, { name: "arguments" })) { + return spread.argument; + } else { + return scope.toArray(spread.argument, true); + } + } + + function hasSpread(nodes) { + for (var i = 0; i < nodes.length; i++) { + if (t.isSpreadElement(nodes[i])) { + return true; + } + } + return false; + } + + function build(props, scope, state) { + var nodes = []; + + var _props = []; + + function push() { + if (!_props.length) return; + nodes.push(t.arrayExpression(_props)); + _props = []; + } + + for (var _iterator = props, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var prop = _ref2; + + if (t.isSpreadElement(prop)) { + push(); + nodes.push(getSpreadLiteral(prop, scope, state)); + } else { + _props.push(prop); + } + } + + push(); + + return nodes; + } + + return { + visitor: { + ArrayExpression: function ArrayExpression(path, state) { + var node = path.node, + scope = path.scope; + + var elements = node.elements; + if (!hasSpread(elements)) return; + + var nodes = build(elements, scope, state); + var first = nodes.shift(); + + if (!t.isArrayExpression(first)) { + nodes.unshift(first); + first = t.arrayExpression([]); + } + + path.replaceWith(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes)); + }, + CallExpression: function CallExpression(path, state) { + var node = path.node, + scope = path.scope; + + var args = node.arguments; + if (!hasSpread(args)) return; + + var calleePath = path.get("callee"); + if (calleePath.isSuper()) return; + + var contextLiteral = t.identifier("undefined"); + + node.arguments = []; + + var nodes = void 0; + if (args.length === 1 && args[0].argument.name === "arguments") { + nodes = [args[0].argument]; + } else { + nodes = build(args, scope, state); + } + + var first = nodes.shift(); + if (nodes.length) { + node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes)); + } else { + node.arguments.push(first); + } + + var callee = node.callee; + + if (calleePath.isMemberExpression()) { + var temp = scope.maybeGenerateMemoised(callee.object); + if (temp) { + callee.object = t.assignmentExpression("=", temp, callee.object); + contextLiteral = temp; + } else { + contextLiteral = callee.object; + } + t.appendToMemberExpression(callee, t.identifier("apply")); + } else { + node.callee = t.memberExpression(node.callee, t.identifier("apply")); + } + + if (t.isSuper(contextLiteral)) { + contextLiteral = t.thisExpression(); + } + + node.arguments.unshift(contextLiteral); + }, + NewExpression: function NewExpression(path, state) { + var node = path.node, + scope = path.scope; + + var args = node.arguments; + if (!hasSpread(args)) return; + + var nodes = build(args, scope, state); + + var context = t.arrayExpression([t.nullLiteral()]); + + args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes); + + path.replaceWith(t.newExpression(t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Function"), t.identifier("prototype")), t.identifier("bind")), t.identifier("apply")), [node.callee, args]), [])); + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + RegExpLiteral: function RegExpLiteral(path) { + var node = path.node; + + if (!regex.is(node, "y")) return; + + path.replaceWith(t.newExpression(t.identifier("RegExp"), [t.stringLiteral(node.pattern), t.stringLiteral(node.flags)])); + } + } + }; + }; + + var _babelHelperRegex = __webpack_require__(188); + + var regex = _interopRequireWildcard(_babelHelperRegex); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function isString(node) { + return t.isLiteral(node) && typeof node.value === "string"; + } + + function buildBinaryExpression(left, right) { + return t.binaryExpression("+", left, right); + } + + return { + visitor: { + TaggedTemplateExpression: function TaggedTemplateExpression(path, state) { + var node = path.node; + + var quasi = node.quasi; + var args = []; + + var strings = []; + var raw = []; + + for (var _iterator = quasi.quasis, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var elem = _ref2; + + strings.push(t.stringLiteral(elem.value.cooked)); + raw.push(t.stringLiteral(elem.value.raw)); + } + + strings = t.arrayExpression(strings); + raw = t.arrayExpression(raw); + + var templateName = "taggedTemplateLiteral"; + if (state.opts.loose) templateName += "Loose"; + + var templateObject = state.file.addTemplateObject(templateName, strings, raw); + args.push(templateObject); + + args = args.concat(quasi.expressions); + + path.replaceWith(t.callExpression(node.tag, args)); + }, + TemplateLiteral: function TemplateLiteral(path, state) { + var nodes = []; + + var expressions = path.get("expressions"); + + for (var _iterator2 = path.node.quasis, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var elem = _ref3; + + nodes.push(t.stringLiteral(elem.value.cooked)); + + var expr = expressions.shift(); + if (expr) { + if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) { + nodes.push(t.callExpression(t.identifier("String"), [expr.node])); + } else { + nodes.push(expr.node); + } + } + } + + nodes = nodes.filter(function (n) { + return !t.isLiteral(n, { value: "" }); + }); + + if (!isString(nodes[0]) && !isString(nodes[1])) { + nodes.unshift(t.stringLiteral("")); + } + + if (nodes.length > 1) { + var root = buildBinaryExpression(nodes.shift(), nodes.shift()); + + for (var _iterator3 = nodes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + var node = _ref4; + + root = buildBinaryExpression(root, node); + } + + path.replaceWith(root); + } else { + path.replaceWith(nodes[0]); + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (_ref) { + var t = _ref.types; + + var IGNORE = (0, _symbol2.default)(); + + return { + visitor: { + Scope: function Scope(_ref2) { + var scope = _ref2.scope; + + if (!scope.getBinding("Symbol")) { + return; + } + + scope.rename("Symbol"); + }, + UnaryExpression: function UnaryExpression(path) { + var node = path.node, + parent = path.parent; + + if (node[IGNORE]) return; + if (path.find(function (path) { + return path.node && !!path.node._generated; + })) return; + + if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) { + var opposite = path.getOpposite(); + if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") { + return; + } + } + + if (node.operator === "typeof") { + var call = t.callExpression(this.addHelper("typeof"), [node.argument]); + if (path.get("argument").isIdentifier()) { + var undefLiteral = t.stringLiteral("undefined"); + var unary = t.unaryExpression("typeof", node.argument); + unary[IGNORE] = true; + path.replaceWith(t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call)); + } else { + path.replaceWith(call); + } + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + RegExpLiteral: function RegExpLiteral(_ref) { + var node = _ref.node; + + if (!regex.is(node, "u")) return; + node.pattern = (0, _regexpuCore2.default)(node.pattern, node.flags); + regex.pullFlag(node, "u"); + } + } + }; + }; + + var _regexpuCore = __webpack_require__(603); + + var _regexpuCore2 = _interopRequireDefault(_regexpuCore); + + var _babelHelperRegex = __webpack_require__(188); + + var regex = _interopRequireWildcard(_babelHelperRegex); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = __webpack_require__(597); + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(404), __esModule: true }; + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.scope = exports.path = undefined; + + var _weakMap = __webpack_require__(360); + + var _weakMap2 = _interopRequireDefault(_weakMap); + + exports.clear = clear; + exports.clearPath = clearPath; + exports.clearScope = clearScope; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var path = exports.path = new _weakMap2.default(); + var scope = exports.scope = new _weakMap2.default(); + + function clear() { + clearPath(); + clearScope(); + } + + function clearPath() { + exports.path = path = new _weakMap2.default(); + } + + function clearScope() { + exports.scope = scope = new _weakMap2.default(); + } + +/***/ }), +/* 87 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + Object.defineProperty(exports, '__esModule', { value: true }); + + /* eslint max-len: 0 */ + + // This is a trick taken from Esprima. It turns out that, on + // non-Chrome browsers, to check whether a string is in a set, a + // predicate containing a big ugly `switch` statement is faster than + // a regular expression, and on Chrome the two are about on par. + // This function uses `eval` (non-lexical) to produce such a + // predicate from a space-separated string of words. + // + // It starts by sorting the words by length. + + function makePredicate(words) { + words = words.split(" "); + return function (str) { + return words.indexOf(str) >= 0; + }; + } + + // Reserved word lists for various dialects of the language + + var reservedWords = { + 6: makePredicate("enum await"), + strict: makePredicate("implements interface let package private protected public static yield"), + strictBind: makePredicate("eval arguments") + }; + + // And the keywords + + var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); + + // ## Character categories + + // Big ugly regular expressions that match characters in the + // whitespace, identifier, and identifier-start categories. These + // are only applied when a character is found to actually have a + // code point above 128. + // Generated by `bin/generate-identifier-regex.js`. + + var nonASCIIidentifierStartChars = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC'; + var nonASCIIidentifierChars = '\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F'; + + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + + nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; + + // These are a run-length and offset encoded representation of the + // >0xffff code points that are a valid part of identifiers. The + // offset starts at 0x10000, and each pair of numbers represents an + // offset to the next range, and then a size of the range. They were + // generated by `bin/generate-identifier-regex.js`. + // eslint-disable-next-line comma-spacing + var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541]; + // eslint-disable-next-line comma-spacing + var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; + + // This has a complexity linear to the value of the code. The + // assumption is that looking up astral identifier characters is + // rare. + function isInAstralSet(code, set) { + var pos = 0x10000; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code) return false; + + pos += set[i + 1]; + if (pos >= code) return true; + } + } + + // Test whether a given character code starts an identifier. + + function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes); + } + + // Test whether a given character is part of an identifier. + + function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); + } + + // A second optional argument can be given to further configure + var defaultOptions = { + // Source type ("script" or "module") for different semantics + sourceType: "script", + // Source filename. + sourceFilename: undefined, + // Line from which to start counting source. Useful for + // integration with other tools. + startLine: 1, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program. + allowImportExportEverywhere: false, + // TODO + allowSuperOutsideMethod: false, + // An array of plugins to enable + plugins: [], + // TODO + strictMode: null + }; + + // Interpret and default an options object + + function getOptions(opts) { + var options = {}; + for (var key in defaultOptions) { + options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; + } + return options; + } + + var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { + return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); + }; + + var classCallCheck = function classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var inherits = function inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof2(superClass))); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + }; + + var possibleConstructorReturn = function possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && ((typeof call === 'undefined' ? 'undefined' : _typeof2(call)) === "object" || typeof call === "function") ? call : self; + }; + + // ## Token types + + // The assignment of fine-grained, information-carrying type objects + // allows the tokenizer to store the information it has about a + // token in a way that is very cheap for the parser to look up. + + // All token type variables start with an underscore, to make them + // easy to recognize. + + // The `beforeExpr` property is used to disambiguate between regular + // expressions and divisions. It is set on all token types that can + // be followed by an expression (thus, a slash after them would be a + // regular expression). + // + // `isLoop` marks a keyword as starting a loop, which is important + // to know when parsing a label, in order to allow or disallow + // continue jumps to that label. + + var beforeExpr = true; + var startsExpr = true; + var isLoop = true; + var isAssign = true; + var prefix = true; + var postfix = true; + + var TokenType = function TokenType(label) { + var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, TokenType); + + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.rightAssociative = !!conf.rightAssociative; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; + }; + + var KeywordTokenType = function (_TokenType) { + inherits(KeywordTokenType, _TokenType); + + function KeywordTokenType(name) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, KeywordTokenType); + + options.keyword = name; + + return possibleConstructorReturn(this, _TokenType.call(this, name, options)); + } + + return KeywordTokenType; + }(TokenType); + + var BinopTokenType = function (_TokenType2) { + inherits(BinopTokenType, _TokenType2); + + function BinopTokenType(name, prec) { + classCallCheck(this, BinopTokenType); + return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec })); + } + + return BinopTokenType; + }(TokenType); + + var types = { + num: new TokenType("num", { startsExpr: startsExpr }), + regexp: new TokenType("regexp", { startsExpr: startsExpr }), + string: new TokenType("string", { startsExpr: startsExpr }), + name: new TokenType("name", { startsExpr: startsExpr }), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + bracketR: new TokenType("]"), + braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceR: new TokenType("}"), + braceBarR: new TokenType("|}"), + parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + parenR: new TokenType(")"), + comma: new TokenType(",", { beforeExpr: beforeExpr }), + semi: new TokenType(";", { beforeExpr: beforeExpr }), + colon: new TokenType(":", { beforeExpr: beforeExpr }), + doubleColon: new TokenType("::", { beforeExpr: beforeExpr }), + dot: new TokenType("."), + question: new TokenType("?", { beforeExpr: beforeExpr }), + arrow: new TokenType("=>", { beforeExpr: beforeExpr }), + template: new TokenType("template"), + ellipsis: new TokenType("...", { beforeExpr: beforeExpr }), + backQuote: new TokenType("`", { startsExpr: startsExpr }), + dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + at: new TokenType("@"), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }), + assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }), + incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }), + prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + logicalOR: new BinopTokenType("||", 1), + logicalAND: new BinopTokenType("&&", 2), + bitwiseOR: new BinopTokenType("|", 3), + bitwiseXOR: new BinopTokenType("^", 4), + bitwiseAND: new BinopTokenType("&", 5), + equality: new BinopTokenType("==/!=", 6), + relational: new BinopTokenType("</>", 7), + bitShift: new BinopTokenType("<</>>", 8), + plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }), + modulo: new BinopTokenType("%", 10), + star: new BinopTokenType("*", 10), + slash: new BinopTokenType("/", 10), + exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true }) + }; + + var keywords = { + "break": new KeywordTokenType("break"), + "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }), + "catch": new KeywordTokenType("catch"), + "continue": new KeywordTokenType("continue"), + "debugger": new KeywordTokenType("debugger"), + "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }), + "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }), + "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }), + "finally": new KeywordTokenType("finally"), + "for": new KeywordTokenType("for", { isLoop: isLoop }), + "function": new KeywordTokenType("function", { startsExpr: startsExpr }), + "if": new KeywordTokenType("if"), + "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }), + "switch": new KeywordTokenType("switch"), + "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }), + "try": new KeywordTokenType("try"), + "var": new KeywordTokenType("var"), + "let": new KeywordTokenType("let"), + "const": new KeywordTokenType("const"), + "while": new KeywordTokenType("while", { isLoop: isLoop }), + "with": new KeywordTokenType("with"), + "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "this": new KeywordTokenType("this", { startsExpr: startsExpr }), + "super": new KeywordTokenType("super", { startsExpr: startsExpr }), + "class": new KeywordTokenType("class"), + "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }), + "export": new KeywordTokenType("export"), + "import": new KeywordTokenType("import", { startsExpr: startsExpr }), + "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "null": new KeywordTokenType("null", { startsExpr: startsExpr }), + "true": new KeywordTokenType("true", { startsExpr: startsExpr }), + "false": new KeywordTokenType("false", { startsExpr: startsExpr }), + "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }), + "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }), + "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }) + }; + + // Map keyword names to token types. + Object.keys(keywords).forEach(function (name) { + types["_" + name] = keywords[name]; + }); + + // Matches a whole line break (where CRLF is considered a single + // line break). Used to count lines. + + var lineBreak = /\r\n?|\n|\u2028|\u2029/; + var lineBreakG = new RegExp(lineBreak.source, "g"); + + function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; + } + + var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + + // The algorithm used to determine whether a regexp can appear at a + // given point in the program is loosely based on sweet.js' approach. + // See https://github.com/mozilla/sweet.js/wiki/design + + var TokContext = function TokContext(token, isExpr, preserveSpace, override) { + classCallCheck(this, TokContext); + + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + }; + + var types$1 = { + braceStatement: new TokContext("{", false), + braceExpression: new TokContext("{", true), + templateQuasi: new TokContext("${", true), + parenStatement: new TokContext("(", false), + parenExpression: new TokContext("(", true), + template: new TokContext("`", true, true, function (p) { + return p.readTmplToken(); + }), + functionExpression: new TokContext("function", true) + }; + + // Token-specific context update code + + types.parenR.updateContext = types.braceR.updateContext = function () { + if (this.state.context.length === 1) { + this.state.exprAllowed = true; + return; + } + + var out = this.state.context.pop(); + if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { + this.state.context.pop(); + this.state.exprAllowed = false; + } else if (out === types$1.templateQuasi) { + this.state.exprAllowed = true; + } else { + this.state.exprAllowed = !out.isExpr; + } + }; + + types.name.updateContext = function (prevType) { + this.state.exprAllowed = false; + + if (prevType === types._let || prevType === types._const || prevType === types._var) { + if (lineBreak.test(this.input.slice(this.state.end))) { + this.state.exprAllowed = true; + } + } + }; + + types.braceL.updateContext = function (prevType) { + this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); + this.state.exprAllowed = true; + }; + + types.dollarBraceL.updateContext = function () { + this.state.context.push(types$1.templateQuasi); + this.state.exprAllowed = true; + }; + + types.parenL.updateContext = function (prevType) { + var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; + this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); + this.state.exprAllowed = true; + }; + + types.incDec.updateContext = function () { + // tokExprAllowed stays unchanged + }; + + types._function.updateContext = function () { + if (this.curContext() !== types$1.braceStatement) { + this.state.context.push(types$1.functionExpression); + } + + this.state.exprAllowed = false; + }; + + types.backQuote.updateContext = function () { + if (this.curContext() === types$1.template) { + this.state.context.pop(); + } else { + this.state.context.push(types$1.template); + } + this.state.exprAllowed = false; + }; + + // These are used when `options.locations` is on, for the + // `startLoc` and `endLoc` properties. + + var Position = function Position(line, col) { + classCallCheck(this, Position); + + this.line = line; + this.column = col; + }; + + var SourceLocation = function SourceLocation(start, end) { + classCallCheck(this, SourceLocation); + + this.start = start; + this.end = end; + }; + + // The `getLineInfo` function is mostly useful when the + // `locations` option is off (for performance reasons) and you + // want to find the line/column position for a given character + // offset. `input` should be the code string that the offset refers + // into. + + function getLineInfo(input, offset) { + for (var line = 1, cur = 0;;) { + lineBreakG.lastIndex = cur; + var match = lineBreakG.exec(input); + if (match && match.index < offset) { + ++line; + cur = match.index + match[0].length; + } else { + return new Position(line, offset - cur); + } + } + } + + var State = function () { + function State() { + classCallCheck(this, State); + } + + State.prototype.init = function init(options, input) { + this.strict = options.strictMode === false ? false : options.sourceType === "module"; + + this.input = input; + + this.potentialArrowAt = -1; + + this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = false; + + this.labels = []; + + this.decorators = []; + + this.tokens = []; + + this.comments = []; + + this.trailingComments = []; + this.leadingComments = []; + this.commentStack = []; + + this.pos = this.lineStart = 0; + this.curLine = options.startLine; + + this.type = types.eof; + this.value = null; + this.start = this.end = this.pos; + this.startLoc = this.endLoc = this.curPosition(); + + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + + this.context = [types$1.braceStatement]; + this.exprAllowed = true; + + this.containsEsc = this.containsOctal = false; + this.octalPosition = null; + + this.invalidTemplateEscapePosition = null; + + this.exportedIdentifiers = []; + + return this; + }; + + // TODO + + + // TODO + + + // Used to signify the start of a potential arrow function + + + // Flags to track whether we are in a function, a generator. + + + // Labels in scope. + + + // Leading decorators. + + + // Token store. + + + // Comment store. + + + // Comment attachment store + + + // The current position of the tokenizer in the input. + + + // Properties of the current token: + // Its type + + + // For tokens that include more information than their type, the value + + + // Its start and end offset + + + // And, if locations are used, the {line, column} object + // corresponding to those offsets + + + // Position information for the previous token + + + // The context stack is used to superficially track syntactic + // context to predict whether a regular expression is allowed in a + // given position. + + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + + + // TODO + + + // Names of exports store. `default` is stored as a name for both + // `export default foo;` and `export { foo as default };`. + + + State.prototype.curPosition = function curPosition() { + return new Position(this.curLine, this.pos - this.lineStart); + }; + + State.prototype.clone = function clone(skipArrays) { + var state = new State(); + for (var key in this) { + var val = this[key]; + + if ((!skipArrays || key === "context") && Array.isArray(val)) { + val = val.slice(); + } + + state[key] = val; + } + return state; + }; + + return State; + }(); + + // Object type used to represent tokens. Note that normally, tokens + // simply exist as properties on the parser object. This is only + // used for the onToken callback and the external tokenizer. + + var Token = function Token(state) { + classCallCheck(this, Token); + + this.type = state.type; + this.value = state.value; + this.start = state.start; + this.end = state.end; + this.loc = new SourceLocation(state.startLoc, state.endLoc); + }; + + // ## Tokenizer + + function codePointToString(code) { + // UTF-16 Decoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } else { + return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); + } + } + + var Tokenizer = function () { + function Tokenizer(options, input) { + classCallCheck(this, Tokenizer); + + this.state = new State(); + this.state.init(options, input); + } + + // Move to the next token + + Tokenizer.prototype.next = function next() { + if (!this.isLookahead) { + this.state.tokens.push(new Token(this.state)); + } + + this.state.lastTokEnd = this.state.end; + this.state.lastTokStart = this.state.start; + this.state.lastTokEndLoc = this.state.endLoc; + this.state.lastTokStartLoc = this.state.startLoc; + this.nextToken(); + }; + + // TODO + + Tokenizer.prototype.eat = function eat(type) { + if (this.match(type)) { + this.next(); + return true; + } else { + return false; + } + }; + + // TODO + + Tokenizer.prototype.match = function match(type) { + return this.state.type === type; + }; + + // TODO + + Tokenizer.prototype.isKeyword = function isKeyword$$1(word) { + return isKeyword(word); + }; + + // TODO + + Tokenizer.prototype.lookahead = function lookahead() { + var old = this.state; + this.state = old.clone(true); + + this.isLookahead = true; + this.next(); + this.isLookahead = false; + + var curr = this.state.clone(true); + this.state = old; + return curr; + }; + + // Toggle strict mode. Re-reads the next number or string to please + // pedantic tests (`"use strict"; 010;` should fail). + + Tokenizer.prototype.setStrict = function setStrict(strict) { + this.state.strict = strict; + if (!this.match(types.num) && !this.match(types.string)) return; + this.state.pos = this.state.start; + while (this.state.pos < this.state.lineStart) { + this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; + --this.state.curLine; + } + this.nextToken(); + }; + + Tokenizer.prototype.curContext = function curContext() { + return this.state.context[this.state.context.length - 1]; + }; + + // Read a single token, updating the parser object's token-related + // properties. + + Tokenizer.prototype.nextToken = function nextToken() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) this.skipSpace(); + + this.state.containsOctal = false; + this.state.octalPosition = null; + this.state.start = this.state.pos; + this.state.startLoc = this.state.curPosition(); + if (this.state.pos >= this.input.length) return this.finishToken(types.eof); + + if (curContext.override) { + return curContext.override(this); + } else { + return this.readToken(this.fullCharCodeAtPos()); + } + }; + + Tokenizer.prototype.readToken = function readToken(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if (isIdentifierStart(code) || code === 92 /* '\' */) { + return this.readWord(); + } else { + return this.getTokenFromCode(code); + } + }; + + Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { + var code = this.input.charCodeAt(this.state.pos); + if (code <= 0xd7ff || code >= 0xe000) return code; + + var next = this.input.charCodeAt(this.state.pos + 1); + return (code << 10) + next - 0x35fdc00; + }; + + Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "CommentBlock" : "CommentLine", + value: text, + start: start, + end: end, + loc: new SourceLocation(startLoc, endLoc) + }; + + if (!this.isLookahead) { + this.state.tokens.push(comment); + this.state.comments.push(comment); + this.addComment(comment); + } + }; + + Tokenizer.prototype.skipBlockComment = function skipBlockComment() { + var startLoc = this.state.curPosition(); + var start = this.state.pos; + var end = this.input.indexOf("*/", this.state.pos += 2); + if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + + this.state.pos = end + 2; + lineBreakG.lastIndex = start; + var match = void 0; + while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { + ++this.state.curLine; + this.state.lineStart = match.index + match[0].length; + } + + this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { + var start = this.state.pos; + var startLoc = this.state.curPosition(); + var ch = this.input.charCodeAt(this.state.pos += startSkip); + while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { + ++this.state.pos; + ch = this.input.charCodeAt(this.state.pos); + } + + this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + // Called at the start of the parse and after every token. Skips + // whitespace and comments, and. + + Tokenizer.prototype.skipSpace = function skipSpace() { + loop: while (this.state.pos < this.input.length) { + var ch = this.input.charCodeAt(this.state.pos); + switch (ch) { + case 32:case 160: + // ' ' + ++this.state.pos; + break; + + case 13: + if (this.input.charCodeAt(this.state.pos + 1) === 10) { + ++this.state.pos; + } + + case 10:case 8232:case 8233: + ++this.state.pos; + ++this.state.curLine; + this.state.lineStart = this.state.pos; + break; + + case 47: + // '/' + switch (this.input.charCodeAt(this.state.pos + 1)) { + case 42: + // '*' + this.skipBlockComment(); + break; + + case 47: + this.skipLineComment(2); + break; + + default: + break loop; + } + break; + + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.state.pos; + } else { + break loop; + } + } + } + }; + + // Called at the end of every token. Sets `end`, `val`, and + // maintains `context` and `exprAllowed`, and skips the space after + // the token, so that the next one's `start` will point at the + // right position. + + Tokenizer.prototype.finishToken = function finishToken(type, val) { + this.state.end = this.state.pos; + this.state.endLoc = this.state.curPosition(); + var prevType = this.state.type; + this.state.type = type; + this.state.value = val; + + this.updateContext(prevType); + }; + + // ### Token reading + + // This is the function that is called to fetch the next token. It + // is somewhat obscure, because it works in character codes rather + // than characters, and because operator parsing has been inlined + // into it. + // + // All in the name of speed. + // + + + Tokenizer.prototype.readToken_dot = function readToken_dot() { + var next = this.input.charCodeAt(this.state.pos + 1); + if (next >= 48 && next <= 57) { + return this.readNumber(true); + } + + var next2 = this.input.charCodeAt(this.state.pos + 2); + if (next === 46 && next2 === 46) { + // 46 = dot '.' + this.state.pos += 3; + return this.finishToken(types.ellipsis); + } else { + ++this.state.pos; + return this.finishToken(types.dot); + } + }; + + Tokenizer.prototype.readToken_slash = function readToken_slash() { + // '/' + if (this.state.exprAllowed) { + ++this.state.pos; + return this.readRegexp(); + } + + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.slash, 1); + } + }; + + Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { + // '%*' + var type = code === 42 ? types.star : types.modulo; + var width = 1; + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === 42) { + // '*' + width++; + next = this.input.charCodeAt(this.state.pos + 2); + type = types.exponent; + } + + if (next === 61) { + width++; + type = types.assign; + } + + return this.finishOp(type, width); + }; + + Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { + // '|&' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); + if (next === 61) return this.finishOp(types.assign, 2); + if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); + return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); + }; + + Tokenizer.prototype.readToken_caret = function readToken_caret() { + // '^' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.bitwiseXOR, 1); + } + }; + + Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { + // '+-' + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === code) { + if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { + // A `-->` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken(); + } + return this.finishOp(types.incDec, 2); + } + + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.plusMin, 1); + } + }; + + Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { + // '<>' + var next = this.input.charCodeAt(this.state.pos + 1); + var size = 1; + + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); + return this.finishOp(types.bitShift, size); + } + + if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { + if (this.inModule) this.unexpected(); + // `<!--`, an XML-style comment that should be interpreted as a line comment + this.skipLineComment(4); + this.skipSpace(); + return this.nextToken(); + } + + if (next === 61) { + // <= | >= + size = 2; + } + + return this.finishOp(types.relational, size); + }; + + Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) { + // '=!' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) return this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2); + if (code === 61 && next === 62) { + // '=>' + this.state.pos += 2; + return this.finishToken(types.arrow); + } + return this.finishOp(code === 61 ? types.eq : types.prefix, 1); + }; + + Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) { + switch (code) { + // The interpretation of a dot depends on whether it is followed + // by a digit or another two dots. + case 46: + // '.' + return this.readToken_dot(); + + // Punctuation tokens. + case 40: + ++this.state.pos;return this.finishToken(types.parenL); + case 41: + ++this.state.pos;return this.finishToken(types.parenR); + case 59: + ++this.state.pos;return this.finishToken(types.semi); + case 44: + ++this.state.pos;return this.finishToken(types.comma); + case 91: + ++this.state.pos;return this.finishToken(types.bracketL); + case 93: + ++this.state.pos;return this.finishToken(types.bracketR); + + case 123: + if (this.hasPlugin("flow") && this.input.charCodeAt(this.state.pos + 1) === 124) { + return this.finishOp(types.braceBarL, 2); + } else { + ++this.state.pos; + return this.finishToken(types.braceL); + } + + case 125: + ++this.state.pos;return this.finishToken(types.braceR); + + case 58: + if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) { + return this.finishOp(types.doubleColon, 2); + } else { + ++this.state.pos; + return this.finishToken(types.colon); + } + + case 63: + ++this.state.pos;return this.finishToken(types.question); + case 64: + ++this.state.pos;return this.finishToken(types.at); + + case 96: + // '`' + ++this.state.pos; + return this.finishToken(types.backQuote); + + case 48: + // '0' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number + if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number + if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number + // Anything else beginning with a digit is an integer, octal + // number, or float. + case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + // 1-9 + return this.readNumber(false); + + // Quotes produce strings. + case 34:case 39: + // '"', "'" + return this.readString(code); + + // Operators are parsed inline in tiny state machines. '=' (61) is + // often referred to. `finishOp` simply skips the amount of + // characters it is given as second argument, and returns a token + // of the type given by its first argument. + + case 47: + // '/' + return this.readToken_slash(); + + case 37:case 42: + // '%*' + return this.readToken_mult_modulo(code); + + case 124:case 38: + // '|&' + return this.readToken_pipe_amp(code); + + case 94: + // '^' + return this.readToken_caret(); + + case 43:case 45: + // '+-' + return this.readToken_plus_min(code); + + case 60:case 62: + // '<>' + return this.readToken_lt_gt(code); + + case 61:case 33: + // '=!' + return this.readToken_eq_excl(code); + + case 126: + // '~' + return this.finishOp(types.prefix, 1); + } + + this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'"); + }; + + Tokenizer.prototype.finishOp = function finishOp(type, size) { + var str = this.input.slice(this.state.pos, this.state.pos + size); + this.state.pos += size; + return this.finishToken(type, str); + }; + + Tokenizer.prototype.readRegexp = function readRegexp() { + var start = this.state.pos; + var escaped = void 0, + inClass = void 0; + for (;;) { + if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression"); + var ch = this.input.charAt(this.state.pos); + if (lineBreak.test(ch)) { + this.raise(start, "Unterminated regular expression"); + } + if (escaped) { + escaped = false; + } else { + if (ch === "[") { + inClass = true; + } else if (ch === "]" && inClass) { + inClass = false; + } else if (ch === "/" && !inClass) { + break; + } + escaped = ch === "\\"; + } + ++this.state.pos; + } + var content = this.input.slice(start, this.state.pos); + ++this.state.pos; + // Need to use `readWord1` because '\uXXXX' sequences are allowed + // here (don't ask). + var mods = this.readWord1(); + if (mods) { + var validFlags = /^[gmsiyu]*$/; + if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag"); + } + return this.finishToken(types.regexp, { + pattern: content, + flags: mods + }); + }; + + // Read an integer in the given radix. Return null if zero digits + // were read, the integer value otherwise. When `len` is given, this + // will return `null` unless the integer has exactly `len` digits. + + Tokenizer.prototype.readInt = function readInt(radix, len) { + var start = this.state.pos; + var total = 0; + + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { + var code = this.input.charCodeAt(this.state.pos); + var val = void 0; + if (code >= 97) { + val = code - 97 + 10; // a + } else if (code >= 65) { + val = code - 65 + 10; // A + } else if (code >= 48 && code <= 57) { + val = code - 48; // 0-9 + } else { + val = Infinity; + } + if (val >= radix) break; + ++this.state.pos; + total = total * radix + val; + } + if (this.state.pos === start || len != null && this.state.pos - start !== len) return null; + + return total; + }; + + Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) { + this.state.pos += 2; // 0x + var val = this.readInt(radix); + if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix); + if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); + return this.finishToken(types.num, val); + }; + + // Read an integer, octal integer, or floating-point number. + + Tokenizer.prototype.readNumber = function readNumber(startsWithDot) { + var start = this.state.pos; + var octal = this.input.charCodeAt(start) === 48; // '0' + var isFloat = false; + + if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number"); + if (octal && this.state.pos == start + 1) octal = false; // number === 0 + + var next = this.input.charCodeAt(this.state.pos); + if (next === 46 && !octal) { + // '.' + ++this.state.pos; + this.readInt(10); + isFloat = true; + next = this.input.charCodeAt(this.state.pos); + } + + if ((next === 69 || next === 101) && !octal) { + // 'eE' + next = this.input.charCodeAt(++this.state.pos); + if (next === 43 || next === 45) ++this.state.pos; // '+-' + if (this.readInt(10) === null) this.raise(start, "Invalid number"); + isFloat = true; + } + + if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); + + var str = this.input.slice(start, this.state.pos); + var val = void 0; + if (isFloat) { + val = parseFloat(str); + } else if (!octal || str.length === 1) { + val = parseInt(str, 10); + } else if (this.state.strict) { + this.raise(start, "Invalid number"); + } else if (/[89]/.test(str)) { + val = parseInt(str, 10); + } else { + val = parseInt(str, 8); + } + return this.finishToken(types.num, val); + }; + + // Read a string value, interpreting backslash-escapes. + + Tokenizer.prototype.readCodePoint = function readCodePoint(throwOnInvalid) { + var ch = this.input.charCodeAt(this.state.pos); + var code = void 0; + + if (ch === 123) { + // '{' + var codePos = ++this.state.pos; + code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, throwOnInvalid); + ++this.state.pos; + if (code === null) { + --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u' + } else if (code > 0x10FFFF) { + if (throwOnInvalid) { + this.raise(codePos, "Code point out of bounds"); + } else { + this.state.invalidTemplateEscapePosition = codePos - 2; + return null; + } + } + } else { + code = this.readHexChar(4, throwOnInvalid); + } + return code; + }; + + Tokenizer.prototype.readString = function readString(quote) { + var out = "", + chunkStart = ++this.state.pos; + for (;;) { + if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant"); + var ch = this.input.charCodeAt(this.state.pos); + if (ch === quote) break; + if (ch === 92) { + // '\' + out += this.input.slice(chunkStart, this.state.pos); + out += this.readEscapedChar(false); + chunkStart = this.state.pos; + } else { + if (isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant"); + ++this.state.pos; + } + } + out += this.input.slice(chunkStart, this.state.pos++); + return this.finishToken(types.string, out); + }; + + // Reads template string tokens. + + Tokenizer.prototype.readTmplToken = function readTmplToken() { + var out = "", + chunkStart = this.state.pos, + containsInvalid = false; + for (;;) { + if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template"); + var ch = this.input.charCodeAt(this.state.pos); + if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) { + // '`', '${' + if (this.state.pos === this.state.start && this.match(types.template)) { + if (ch === 36) { + this.state.pos += 2; + return this.finishToken(types.dollarBraceL); + } else { + ++this.state.pos; + return this.finishToken(types.backQuote); + } + } + out += this.input.slice(chunkStart, this.state.pos); + return this.finishToken(types.template, containsInvalid ? null : out); + } + if (ch === 92) { + // '\' + out += this.input.slice(chunkStart, this.state.pos); + var escaped = this.readEscapedChar(true); + if (escaped === null) { + containsInvalid = true; + } else { + out += escaped; + } + chunkStart = this.state.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + ++this.state.pos; + switch (ch) { + case 13: + if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; + case 10: + out += "\n"; + break; + default: + out += String.fromCharCode(ch); + break; + } + ++this.state.curLine; + this.state.lineStart = this.state.pos; + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + }; + + // Used to read escaped characters + + Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) { + var throwOnInvalid = !inTemplate; + var ch = this.input.charCodeAt(++this.state.pos); + ++this.state.pos; + switch (ch) { + case 110: + return "\n"; // 'n' -> '\n' + case 114: + return "\r"; // 'r' -> '\r' + case 120: + { + // 'x' + var code = this.readHexChar(2, throwOnInvalid); + return code === null ? null : String.fromCharCode(code); + } + case 117: + { + // 'u' + var _code = this.readCodePoint(throwOnInvalid); + return _code === null ? null : codePointToString(_code); + } + case 116: + return "\t"; // 't' -> '\t' + case 98: + return "\b"; // 'b' -> '\b' + case 118: + return "\x0B"; // 'v' -> '\u000b' + case 102: + return "\f"; // 'f' -> '\f' + case 13: + if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n' + case 10: + // ' \n' + this.state.lineStart = this.state.pos; + ++this.state.curLine; + return ""; + default: + if (ch >= 48 && ch <= 55) { + var codePos = this.state.pos - 1; + var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0]; + var octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + if (octal > 0) { + if (inTemplate) { + this.state.invalidTemplateEscapePosition = codePos; + return null; + } else if (this.state.strict) { + this.raise(codePos, "Octal literal in strict mode"); + } else if (!this.state.containsOctal) { + // These properties are only used to throw an error for an octal which occurs + // in a directive which occurs prior to a "use strict" directive. + this.state.containsOctal = true; + this.state.octalPosition = codePos; + } + } + this.state.pos += octalStr.length - 1; + return String.fromCharCode(octal); + } + return String.fromCharCode(ch); + } + }; + + // Used to read character escape sequences ('\x', '\u'). + + Tokenizer.prototype.readHexChar = function readHexChar(len, throwOnInvalid) { + var codePos = this.state.pos; + var n = this.readInt(16, len); + if (n === null) { + if (throwOnInvalid) { + this.raise(codePos, "Bad character escape sequence"); + } else { + this.state.pos = codePos - 1; + this.state.invalidTemplateEscapePosition = codePos - 1; + } + } + return n; + }; + + // Read an identifier, and return it as a string. Sets `this.state.containsEsc` + // to whether the word contained a '\u' escape. + // + // Incrementally adds only escaped chars, adding other chunks as-is + // as a micro-optimization. + + Tokenizer.prototype.readWord1 = function readWord1() { + this.state.containsEsc = false; + var word = "", + first = true, + chunkStart = this.state.pos; + while (this.state.pos < this.input.length) { + var ch = this.fullCharCodeAtPos(); + if (isIdentifierChar(ch)) { + this.state.pos += ch <= 0xffff ? 1 : 2; + } else if (ch === 92) { + // "\" + this.state.containsEsc = true; + + word += this.input.slice(chunkStart, this.state.pos); + var escStart = this.state.pos; + + if (this.input.charCodeAt(++this.state.pos) !== 117) { + // "u" + this.raise(this.state.pos, 'Expecting Unicode escape sequence \\uXXXX'); + } + + ++this.state.pos; + var esc = this.readCodePoint(true); + if (!(first ? isIdentifierStart : isIdentifierChar)(esc, true)) { + this.raise(escStart, "Invalid Unicode escape"); + } + + word += codePointToString(esc); + chunkStart = this.state.pos; + } else { + break; + } + first = false; + } + return word + this.input.slice(chunkStart, this.state.pos); + }; + + // Read an identifier or keyword token. Will check for reserved + // words when necessary. + + Tokenizer.prototype.readWord = function readWord() { + var word = this.readWord1(); + var type = types.name; + if (!this.state.containsEsc && this.isKeyword(word)) { + type = keywords[word]; + } + return this.finishToken(type, word); + }; + + Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) { + if (prevType === types.colon) { + var parent = this.curContext(); + if (parent === types$1.braceStatement || parent === types$1.braceExpression) { + return !parent.isExpr; + } + } + + if (prevType === types._return) { + return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); + } + + if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR) { + return true; + } + + if (prevType === types.braceL) { + return this.curContext() === types$1.braceStatement; + } + + return !this.state.exprAllowed; + }; + + Tokenizer.prototype.updateContext = function updateContext(prevType) { + var type = this.state.type; + var update = void 0; + + if (type.keyword && prevType === types.dot) { + this.state.exprAllowed = false; + } else if (update = type.updateContext) { + update.call(this, prevType); + } else { + this.state.exprAllowed = type.beforeExpr; + } + }; + + return Tokenizer; + }(); + + var plugins = {}; + var frozenDeprecatedWildcardPluginList = ["jsx", "doExpressions", "objectRestSpread", "decorators", "classProperties", "exportExtensions", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "flow"]; + + var Parser = function (_Tokenizer) { + inherits(Parser, _Tokenizer); + + function Parser(options, input) { + classCallCheck(this, Parser); + + options = getOptions(options); + + var _this = possibleConstructorReturn(this, _Tokenizer.call(this, options, input)); + + _this.options = options; + _this.inModule = _this.options.sourceType === "module"; + _this.input = input; + _this.plugins = _this.loadPlugins(_this.options.plugins); + _this.filename = options.sourceFilename; + + // If enabled, skip leading hashbang line. + if (_this.state.pos === 0 && _this.input[0] === "#" && _this.input[1] === "!") { + _this.skipLineComment(2); + } + return _this; + } + + Parser.prototype.isReservedWord = function isReservedWord(word) { + if (word === "await") { + return this.inModule; + } else { + return reservedWords[6](word); + } + }; + + Parser.prototype.hasPlugin = function hasPlugin(name) { + if (this.plugins["*"] && frozenDeprecatedWildcardPluginList.indexOf(name) > -1) { + return true; + } + + return !!this.plugins[name]; + }; + + Parser.prototype.extend = function extend(name, f) { + this[name] = f(this[name]); + }; + + Parser.prototype.loadAllPlugins = function loadAllPlugins() { + var _this2 = this; + + // ensure flow plugin loads last, also ensure estree is not loaded with * + var pluginNames = Object.keys(plugins).filter(function (name) { + return name !== "flow" && name !== "estree"; + }); + pluginNames.push("flow"); + + pluginNames.forEach(function (name) { + var plugin = plugins[name]; + if (plugin) plugin(_this2); + }); + }; + + Parser.prototype.loadPlugins = function loadPlugins(pluginList) { + // TODO: Deprecate "*" option in next major version of Babylon + if (pluginList.indexOf("*") >= 0) { + this.loadAllPlugins(); + + return { "*": true }; + } + + var pluginMap = {}; + + if (pluginList.indexOf("flow") >= 0) { + // ensure flow plugin loads last + pluginList = pluginList.filter(function (plugin) { + return plugin !== "flow"; + }); + pluginList.push("flow"); + } + + if (pluginList.indexOf("estree") >= 0) { + // ensure estree plugin loads first + pluginList = pluginList.filter(function (plugin) { + return plugin !== "estree"; + }); + pluginList.unshift("estree"); + } + + for (var _iterator = pluginList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var name = _ref; + + if (!pluginMap[name]) { + pluginMap[name] = true; + + var plugin = plugins[name]; + if (plugin) plugin(this); + } + } + + return pluginMap; + }; + + Parser.prototype.parse = function parse() { + var file = this.startNode(); + var program = this.startNode(); + this.nextToken(); + return this.parseTopLevel(file, program); + }; + + return Parser; + }(Tokenizer); + + var pp = Parser.prototype; + + // ## Parser utilities + + // TODO + + pp.addExtra = function (node, key, val) { + if (!node) return; + + var extra = node.extra = node.extra || {}; + extra[key] = val; + }; + + // TODO + + pp.isRelational = function (op) { + return this.match(types.relational) && this.state.value === op; + }; + + // TODO + + pp.expectRelational = function (op) { + if (this.isRelational(op)) { + this.next(); + } else { + this.unexpected(null, types.relational); + } + }; + + // Tests whether parsed token is a contextual keyword. + + pp.isContextual = function (name) { + return this.match(types.name) && this.state.value === name; + }; + + // Consumes contextual keyword if possible. + + pp.eatContextual = function (name) { + return this.state.value === name && this.eat(types.name); + }; + + // Asserts that following token is given contextual keyword. + + pp.expectContextual = function (name, message) { + if (!this.eatContextual(name)) this.unexpected(null, message); + }; + + // Test whether a semicolon can be inserted at the current position. + + pp.canInsertSemicolon = function () { + return this.match(types.eof) || this.match(types.braceR) || lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); + }; + + // TODO + + pp.isLineTerminator = function () { + return this.eat(types.semi) || this.canInsertSemicolon(); + }; + + // Consume a semicolon, or, failing that, see if we are allowed to + // pretend that there is a semicolon at this position. + + pp.semicolon = function () { + if (!this.isLineTerminator()) this.unexpected(null, types.semi); + }; + + // Expect a token of a given type. If found, consume it, otherwise, + // raise an unexpected token error at given pos. + + pp.expect = function (type, pos) { + return this.eat(type) || this.unexpected(pos, type); + }; + + // Raise an unexpected token error. Can take the expected token type + // instead of a message string. + + pp.unexpected = function (pos) { + var messageOrType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected token"; + + if (messageOrType && (typeof messageOrType === "undefined" ? "undefined" : _typeof(messageOrType)) === "object" && messageOrType.label) { + messageOrType = "Unexpected token, expected " + messageOrType.label; + } + this.raise(pos != null ? pos : this.state.start, messageOrType); + }; + + /* eslint max-len: 0 */ + + var pp$1 = Parser.prototype; + + // ### Statement parsing + + // Parse a program. Initializes the parser, reads any number of + // statements, and wraps them in a Program node. Optionally takes a + // `program` argument. If present, the statements will be appended + // to its body instead of creating a new node. + + pp$1.parseTopLevel = function (file, program) { + program.sourceType = this.options.sourceType; + + this.parseBlockBody(program, true, true, types.eof); + + file.program = this.finishNode(program, "Program"); + file.comments = this.state.comments; + file.tokens = this.state.tokens; + + return this.finishNode(file, "File"); + }; + + var loopLabel = { kind: "loop" }; + var switchLabel = { kind: "switch" }; + + // TODO + + pp$1.stmtToDirective = function (stmt) { + var expr = stmt.expression; + + var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start); + var directive = this.startNodeAt(stmt.start, stmt.loc.start); + + var raw = this.input.slice(expr.start, expr.end); + var val = directiveLiteral.value = raw.slice(1, -1); // remove quotes + + this.addExtra(directiveLiteral, "raw", raw); + this.addExtra(directiveLiteral, "rawValue", val); + + directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end); + + return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end); + }; + + // Parse a single statement. + // + // If expecting a statement and finding a slash operator, parse a + // regular expression literal. This is to handle cases like + // `if (foo) /blah/.exec(foo)`, where looking at the previous token + // does not help. + + pp$1.parseStatement = function (declaration, topLevel) { + if (this.match(types.at)) { + this.parseDecorators(true); + } + + var starttype = this.state.type; + var node = this.startNode(); + + // Most types of statements are recognized by the keyword they + // start with. Many are trivial to parse, some require a bit of + // complexity. + + switch (starttype) { + case types._break:case types._continue: + return this.parseBreakContinueStatement(node, starttype.keyword); + case types._debugger: + return this.parseDebuggerStatement(node); + case types._do: + return this.parseDoStatement(node); + case types._for: + return this.parseForStatement(node); + case types._function: + if (!declaration) this.unexpected(); + return this.parseFunctionStatement(node); + + case types._class: + if (!declaration) this.unexpected(); + return this.parseClass(node, true); + + case types._if: + return this.parseIfStatement(node); + case types._return: + return this.parseReturnStatement(node); + case types._switch: + return this.parseSwitchStatement(node); + case types._throw: + return this.parseThrowStatement(node); + case types._try: + return this.parseTryStatement(node); + + case types._let: + case types._const: + if (!declaration) this.unexpected(); // NOTE: falls through to _var + + case types._var: + return this.parseVarStatement(node, starttype); + + case types._while: + return this.parseWhileStatement(node); + case types._with: + return this.parseWithStatement(node); + case types.braceL: + return this.parseBlock(); + case types.semi: + return this.parseEmptyStatement(node); + case types._export: + case types._import: + if (this.hasPlugin("dynamicImport") && this.lookahead().type === types.parenL) break; + + if (!this.options.allowImportExportEverywhere) { + if (!topLevel) { + this.raise(this.state.start, "'import' and 'export' may only appear at the top level"); + } + + if (!this.inModule) { + this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: module'"); + } + } + return starttype === types._import ? this.parseImport(node) : this.parseExport(node); + + case types.name: + if (this.state.value === "async") { + // peek ahead and see if next token is a function + var state = this.state.clone(); + this.next(); + if (this.match(types._function) && !this.canInsertSemicolon()) { + this.expect(types._function); + return this.parseFunction(node, true, false, true); + } else { + this.state = state; + } + } + } + + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + var maybeName = this.state.value; + var expr = this.parseExpression(); + + if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) { + return this.parseLabeledStatement(node, maybeName, expr); + } else { + return this.parseExpressionStatement(node, expr); + } + }; + + pp$1.takeDecorators = function (node) { + if (this.state.decorators.length) { + node.decorators = this.state.decorators; + this.state.decorators = []; + } + }; + + pp$1.parseDecorators = function (allowExport) { + while (this.match(types.at)) { + var decorator = this.parseDecorator(); + this.state.decorators.push(decorator); + } + + if (allowExport && this.match(types._export)) { + return; + } + + if (!this.match(types._class)) { + this.raise(this.state.start, "Leading decorators must be attached to a class declaration"); + } + }; + + pp$1.parseDecorator = function () { + if (!this.hasPlugin("decorators")) { + this.unexpected(); + } + var node = this.startNode(); + this.next(); + node.expression = this.parseMaybeAssign(); + return this.finishNode(node, "Decorator"); + }; + + pp$1.parseBreakContinueStatement = function (node, keyword) { + var isBreak = keyword === "break"; + this.next(); + + if (this.isLineTerminator()) { + node.label = null; + } else if (!this.match(types.name)) { + this.unexpected(); + } else { + node.label = this.parseIdentifier(); + this.semicolon(); + } + + // Verify that there is an actual destination to break or + // continue to. + var i = void 0; + for (i = 0; i < this.state.labels.length; ++i) { + var lab = this.state.labels[i]; + if (node.label == null || lab.name === node.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) break; + if (node.label && isBreak) break; + } + } + if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword); + return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); + }; + + pp$1.parseDebuggerStatement = function (node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement"); + }; + + pp$1.parseDoStatement = function (node) { + this.next(); + this.state.labels.push(loopLabel); + node.body = this.parseStatement(false); + this.state.labels.pop(); + this.expect(types._while); + node.test = this.parseParenExpression(); + this.eat(types.semi); + return this.finishNode(node, "DoWhileStatement"); + }; + + // Disambiguating between a `for` and a `for`/`in` or `for`/`of` + // loop is non-trivial. Basically, we have to parse the init `var` + // statement or expression, disallowing the `in` operator (see + // the second parameter to `parseExpression`), and then check + // whether the next token is `in` or `of`. When there is no init + // part (semicolon immediately after the opening parenthesis), it + // is a regular `for` loop. + + pp$1.parseForStatement = function (node) { + this.next(); + this.state.labels.push(loopLabel); + + var forAwait = false; + if (this.hasPlugin("asyncGenerators") && this.state.inAsync && this.isContextual("await")) { + forAwait = true; + this.next(); + } + this.expect(types.parenL); + + if (this.match(types.semi)) { + if (forAwait) { + this.unexpected(); + } + return this.parseFor(node, null); + } + + if (this.match(types._var) || this.match(types._let) || this.match(types._const)) { + var _init = this.startNode(); + var varKind = this.state.type; + this.next(); + this.parseVar(_init, true, varKind); + this.finishNode(_init, "VariableDeclaration"); + + if (this.match(types._in) || this.isContextual("of")) { + if (_init.declarations.length === 1 && !_init.declarations[0].init) { + return this.parseForIn(node, _init, forAwait); + } + } + if (forAwait) { + this.unexpected(); + } + return this.parseFor(node, _init); + } + + var refShorthandDefaultPos = { start: 0 }; + var init = this.parseExpression(true, refShorthandDefaultPos); + if (this.match(types._in) || this.isContextual("of")) { + var description = this.isContextual("of") ? "for-of statement" : "for-in statement"; + this.toAssignable(init, undefined, description); + this.checkLVal(init, undefined, undefined, description); + return this.parseForIn(node, init, forAwait); + } else if (refShorthandDefaultPos.start) { + this.unexpected(refShorthandDefaultPos.start); + } + if (forAwait) { + this.unexpected(); + } + return this.parseFor(node, init); + }; + + pp$1.parseFunctionStatement = function (node) { + this.next(); + return this.parseFunction(node, true); + }; + + pp$1.parseIfStatement = function (node) { + this.next(); + node.test = this.parseParenExpression(); + node.consequent = this.parseStatement(false); + node.alternate = this.eat(types._else) ? this.parseStatement(false) : null; + return this.finishNode(node, "IfStatement"); + }; + + pp$1.parseReturnStatement = function (node) { + if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) { + this.raise(this.state.start, "'return' outside of function"); + } + + this.next(); + + // In `return` (and `break`/`continue`), the keywords with + // optional arguments, we eagerly look for a semicolon or the + // possibility to insert one. + + if (this.isLineTerminator()) { + node.argument = null; + } else { + node.argument = this.parseExpression(); + this.semicolon(); + } + + return this.finishNode(node, "ReturnStatement"); + }; + + pp$1.parseSwitchStatement = function (node) { + this.next(); + node.discriminant = this.parseParenExpression(); + node.cases = []; + this.expect(types.braceL); + this.state.labels.push(switchLabel); + + // Statements under must be grouped (by label) in SwitchCase + // nodes. `cur` is used to keep the node that we are currently + // adding statements to. + + var cur = void 0; + for (var sawDefault; !this.match(types.braceR);) { + if (this.match(types._case) || this.match(types._default)) { + var isCase = this.match(types._case); + if (cur) this.finishNode(cur, "SwitchCase"); + node.cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses"); + sawDefault = true; + cur.test = null; + } + this.expect(types.colon); + } else { + if (cur) { + cur.consequent.push(this.parseStatement(true)); + } else { + this.unexpected(); + } + } + } + if (cur) this.finishNode(cur, "SwitchCase"); + this.next(); // Closing brace + this.state.labels.pop(); + return this.finishNode(node, "SwitchStatement"); + }; + + pp$1.parseThrowStatement = function (node) { + this.next(); + if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw"); + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement"); + }; + + // Reused empty array added for node fields that are always empty. + + var empty = []; + + pp$1.parseTryStatement = function (node) { + this.next(); + + node.block = this.parseBlock(); + node.handler = null; + + if (this.match(types._catch)) { + var clause = this.startNode(); + this.next(); + + this.expect(types.parenL); + clause.param = this.parseBindingAtom(); + this.checkLVal(clause.param, true, Object.create(null), "catch clause"); + this.expect(types.parenR); + + clause.body = this.parseBlock(); + node.handler = this.finishNode(clause, "CatchClause"); + } + + node.guardedHandlers = empty; + node.finalizer = this.eat(types._finally) ? this.parseBlock() : null; + + if (!node.handler && !node.finalizer) { + this.raise(node.start, "Missing catch or finally clause"); + } + + return this.finishNode(node, "TryStatement"); + }; + + pp$1.parseVarStatement = function (node, kind) { + this.next(); + this.parseVar(node, false, kind); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration"); + }; + + pp$1.parseWhileStatement = function (node) { + this.next(); + node.test = this.parseParenExpression(); + this.state.labels.push(loopLabel); + node.body = this.parseStatement(false); + this.state.labels.pop(); + return this.finishNode(node, "WhileStatement"); + }; + + pp$1.parseWithStatement = function (node) { + if (this.state.strict) this.raise(this.state.start, "'with' in strict mode"); + this.next(); + node.object = this.parseParenExpression(); + node.body = this.parseStatement(false); + return this.finishNode(node, "WithStatement"); + }; + + pp$1.parseEmptyStatement = function (node) { + this.next(); + return this.finishNode(node, "EmptyStatement"); + }; + + pp$1.parseLabeledStatement = function (node, maybeName, expr) { + for (var _iterator = this.state.labels, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var _label = _ref; + + if (_label.name === maybeName) { + this.raise(expr.start, "Label '" + maybeName + "' is already declared"); + } + } + + var kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null; + for (var i = this.state.labels.length - 1; i >= 0; i--) { + var label = this.state.labels[i]; + if (label.statementStart === node.start) { + label.statementStart = this.state.start; + label.kind = kind; + } else { + break; + } + } + + this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start }); + node.body = this.parseStatement(true); + this.state.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement"); + }; + + pp$1.parseExpressionStatement = function (node, expr) { + node.expression = expr; + this.semicolon(); + return this.finishNode(node, "ExpressionStatement"); + }; + + // Parse a semicolon-enclosed block of statements, handling `"use + // strict"` declarations when `allowStrict` is true (used for + // function bodies). + + pp$1.parseBlock = function (allowDirectives) { + var node = this.startNode(); + this.expect(types.braceL); + this.parseBlockBody(node, allowDirectives, false, types.braceR); + return this.finishNode(node, "BlockStatement"); + }; + + pp$1.isValidDirective = function (stmt) { + return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized; + }; + + pp$1.parseBlockBody = function (node, allowDirectives, topLevel, end) { + node.body = []; + node.directives = []; + + var parsedNonDirective = false; + var oldStrict = void 0; + var octalPosition = void 0; + + while (!this.eat(end)) { + if (!parsedNonDirective && this.state.containsOctal && !octalPosition) { + octalPosition = this.state.octalPosition; + } + + var stmt = this.parseStatement(true, topLevel); + + if (allowDirectives && !parsedNonDirective && this.isValidDirective(stmt)) { + var directive = this.stmtToDirective(stmt); + node.directives.push(directive); + + if (oldStrict === undefined && directive.value.value === "use strict") { + oldStrict = this.state.strict; + this.setStrict(true); + + if (octalPosition) { + this.raise(octalPosition, "Octal literal in strict mode"); + } + } + + continue; + } + + parsedNonDirective = true; + node.body.push(stmt); + } + + if (oldStrict === false) { + this.setStrict(false); + } + }; + + // Parse a regular `for` loop. The disambiguation code in + // `parseStatement` will already have parsed the init statement or + // expression. + + pp$1.parseFor = function (node, init) { + node.init = init; + this.expect(types.semi); + node.test = this.match(types.semi) ? null : this.parseExpression(); + this.expect(types.semi); + node.update = this.match(types.parenR) ? null : this.parseExpression(); + this.expect(types.parenR); + node.body = this.parseStatement(false); + this.state.labels.pop(); + return this.finishNode(node, "ForStatement"); + }; + + // Parse a `for`/`in` and `for`/`of` loop, which are almost + // same from parser's perspective. + + pp$1.parseForIn = function (node, init, forAwait) { + var type = void 0; + if (forAwait) { + this.eatContextual("of"); + type = "ForAwaitStatement"; + } else { + type = this.match(types._in) ? "ForInStatement" : "ForOfStatement"; + this.next(); + } + node.left = init; + node.right = this.parseExpression(); + this.expect(types.parenR); + node.body = this.parseStatement(false); + this.state.labels.pop(); + return this.finishNode(node, type); + }; + + // Parse a list of variable declarations. + + pp$1.parseVar = function (node, isFor, kind) { + node.declarations = []; + node.kind = kind.keyword; + for (;;) { + var decl = this.startNode(); + this.parseVarHead(decl); + if (this.eat(types.eq)) { + decl.init = this.parseMaybeAssign(isFor); + } else if (kind === types._const && !(this.match(types._in) || this.isContextual("of"))) { + this.unexpected(); + } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) { + this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value"); + } else { + decl.init = null; + } + node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(types.comma)) break; + } + return node; + }; + + pp$1.parseVarHead = function (decl) { + decl.id = this.parseBindingAtom(); + this.checkLVal(decl.id, true, undefined, "variable declaration"); + }; + + // Parse a function declaration or literal (depending on the + // `isStatement` parameter). + + pp$1.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, optionalId) { + var oldInMethod = this.state.inMethod; + this.state.inMethod = false; + + this.initFunction(node, isAsync); + + if (this.match(types.star)) { + if (node.async && !this.hasPlugin("asyncGenerators")) { + this.unexpected(); + } else { + node.generator = true; + this.next(); + } + } + + if (isStatement && !optionalId && !this.match(types.name) && !this.match(types._yield)) { + this.unexpected(); + } + + if (this.match(types.name) || this.match(types._yield)) { + node.id = this.parseBindingIdentifier(); + } + + this.parseFunctionParams(node); + this.parseFunctionBody(node, allowExpressionBody); + + this.state.inMethod = oldInMethod; + + return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); + }; + + pp$1.parseFunctionParams = function (node) { + this.expect(types.parenL); + node.params = this.parseBindingList(types.parenR); + }; + + // Parse a class declaration or literal (depending on the + // `isStatement` parameter). + + pp$1.parseClass = function (node, isStatement, optionalId) { + this.next(); + this.takeDecorators(node); + this.parseClassId(node, isStatement, optionalId); + this.parseClassSuper(node); + this.parseClassBody(node); + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); + }; + + pp$1.isClassProperty = function () { + return this.match(types.eq) || this.match(types.semi) || this.match(types.braceR); + }; + + pp$1.isClassMethod = function () { + return this.match(types.parenL); + }; + + pp$1.isNonstaticConstructor = function (method) { + return !method.computed && !method.static && (method.key.name === "constructor" || // Identifier + method.key.value === "constructor" // Literal + ); + }; + + pp$1.parseClassBody = function (node) { + // class bodies are implicitly strict + var oldStrict = this.state.strict; + this.state.strict = true; + + var hadConstructorCall = false; + var hadConstructor = false; + var decorators = []; + var classBody = this.startNode(); + + classBody.body = []; + + this.expect(types.braceL); + + while (!this.eat(types.braceR)) { + if (this.eat(types.semi)) { + if (decorators.length > 0) { + this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon"); + } + continue; + } + + if (this.match(types.at)) { + decorators.push(this.parseDecorator()); + continue; + } + + var method = this.startNode(); + + // steal the decorators if there are any + if (decorators.length) { + method.decorators = decorators; + decorators = []; + } + + method.static = false; + if (this.match(types.name) && this.state.value === "static") { + var key = this.parseIdentifier(true); // eats 'static' + if (this.isClassMethod()) { + // a method named 'static' + method.kind = "method"; + method.computed = false; + method.key = key; + this.parseClassMethod(classBody, method, false, false); + continue; + } else if (this.isClassProperty()) { + // a property named 'static' + method.computed = false; + method.key = key; + classBody.body.push(this.parseClassProperty(method)); + continue; + } + // otherwise something static + method.static = true; + } + + if (this.eat(types.star)) { + // a generator + method.kind = "method"; + this.parsePropertyName(method); + if (this.isNonstaticConstructor(method)) { + this.raise(method.key.start, "Constructor can't be a generator"); + } + if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) { + this.raise(method.key.start, "Classes may not have static property named prototype"); + } + this.parseClassMethod(classBody, method, true, false); + } else { + var isSimple = this.match(types.name); + var _key = this.parsePropertyName(method); + if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) { + this.raise(method.key.start, "Classes may not have static property named prototype"); + } + if (this.isClassMethod()) { + // a normal method + if (this.isNonstaticConstructor(method)) { + if (hadConstructor) { + this.raise(_key.start, "Duplicate constructor in the same class"); + } else if (method.decorators) { + this.raise(method.start, "You can't attach decorators to a class constructor"); + } + hadConstructor = true; + method.kind = "constructor"; + } else { + method.kind = "method"; + } + this.parseClassMethod(classBody, method, false, false); + } else if (this.isClassProperty()) { + // a normal property + if (this.isNonstaticConstructor(method)) { + this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'"); + } + classBody.body.push(this.parseClassProperty(method)); + } else if (isSimple && _key.name === "async" && !this.isLineTerminator()) { + // an async method + var isGenerator = this.hasPlugin("asyncGenerators") && this.eat(types.star); + method.kind = "method"; + this.parsePropertyName(method); + if (this.isNonstaticConstructor(method)) { + this.raise(method.key.start, "Constructor can't be an async function"); + } + this.parseClassMethod(classBody, method, isGenerator, true); + } else if (isSimple && (_key.name === "get" || _key.name === "set") && !(this.isLineTerminator() && this.match(types.star))) { + // `get\n*` is an uninitialized property named 'get' followed by a generator. + // a getter or setter + method.kind = _key.name; + this.parsePropertyName(method); + if (this.isNonstaticConstructor(method)) { + this.raise(method.key.start, "Constructor can't have get/set modifier"); + } + this.parseClassMethod(classBody, method, false, false); + this.checkGetterSetterParamCount(method); + } else if (this.hasPlugin("classConstructorCall") && isSimple && _key.name === "call" && this.match(types.name) && this.state.value === "constructor") { + // a (deprecated) call constructor + if (hadConstructorCall) { + this.raise(method.start, "Duplicate constructor call in the same class"); + } else if (method.decorators) { + this.raise(method.start, "You can't attach decorators to a class constructor"); + } + hadConstructorCall = true; + method.kind = "constructorCall"; + this.parsePropertyName(method); // consume "constructor" and make it the method's name + this.parseClassMethod(classBody, method, false, false); + } else if (this.isLineTerminator()) { + // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) + if (this.isNonstaticConstructor(method)) { + this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'"); + } + classBody.body.push(this.parseClassProperty(method)); + } else { + this.unexpected(); + } + } + } + + if (decorators.length) { + this.raise(this.state.start, "You have trailing decorators with no method"); + } + + node.body = this.finishNode(classBody, "ClassBody"); + + this.state.strict = oldStrict; + }; + + pp$1.parseClassProperty = function (node) { + this.state.inClassProperty = true; + if (this.match(types.eq)) { + if (!this.hasPlugin("classProperties")) this.unexpected(); + this.next(); + node.value = this.parseMaybeAssign(); + } else { + node.value = null; + } + this.semicolon(); + this.state.inClassProperty = false; + return this.finishNode(node, "ClassProperty"); + }; + + pp$1.parseClassMethod = function (classBody, method, isGenerator, isAsync) { + this.parseMethod(method, isGenerator, isAsync); + classBody.body.push(this.finishNode(method, "ClassMethod")); + }; + + pp$1.parseClassId = function (node, isStatement, optionalId) { + if (this.match(types.name)) { + node.id = this.parseIdentifier(); + } else { + if (optionalId || !isStatement) { + node.id = null; + } else { + this.unexpected(); + } + } + }; + + pp$1.parseClassSuper = function (node) { + node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null; + }; + + // Parses module export declaration. + + pp$1.parseExport = function (node) { + this.next(); + // export * from '...' + if (this.match(types.star)) { + var specifier = this.startNode(); + this.next(); + if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) { + specifier.exported = this.parseIdentifier(); + node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]; + this.parseExportSpecifiersMaybe(node); + this.parseExportFrom(node, true); + } else { + this.parseExportFrom(node, true); + return this.finishNode(node, "ExportAllDeclaration"); + } + } else if (this.hasPlugin("exportExtensions") && this.isExportDefaultSpecifier()) { + var _specifier = this.startNode(); + _specifier.exported = this.parseIdentifier(true); + node.specifiers = [this.finishNode(_specifier, "ExportDefaultSpecifier")]; + if (this.match(types.comma) && this.lookahead().type === types.star) { + this.expect(types.comma); + var _specifier2 = this.startNode(); + this.expect(types.star); + this.expectContextual("as"); + _specifier2.exported = this.parseIdentifier(); + node.specifiers.push(this.finishNode(_specifier2, "ExportNamespaceSpecifier")); + } else { + this.parseExportSpecifiersMaybe(node); + } + this.parseExportFrom(node, true); + } else if (this.eat(types._default)) { + // export default ... + var expr = this.startNode(); + var needsSemi = false; + if (this.eat(types._function)) { + expr = this.parseFunction(expr, true, false, false, true); + } else if (this.match(types._class)) { + expr = this.parseClass(expr, true, true); + } else { + needsSemi = true; + expr = this.parseMaybeAssign(); + } + node.declaration = expr; + if (needsSemi) this.semicolon(); + this.checkExport(node, true, true); + return this.finishNode(node, "ExportDefaultDeclaration"); + } else if (this.shouldParseExportDeclaration()) { + node.specifiers = []; + node.source = null; + node.declaration = this.parseExportDeclaration(node); + } else { + // export { x, y as z } [from '...'] + node.declaration = null; + node.specifiers = this.parseExportSpecifiers(); + this.parseExportFrom(node); + } + this.checkExport(node, true); + return this.finishNode(node, "ExportNamedDeclaration"); + }; + + pp$1.parseExportDeclaration = function () { + return this.parseStatement(true); + }; + + pp$1.isExportDefaultSpecifier = function () { + if (this.match(types.name)) { + return this.state.value !== "async"; + } + + if (!this.match(types._default)) { + return false; + } + + var lookahead = this.lookahead(); + return lookahead.type === types.comma || lookahead.type === types.name && lookahead.value === "from"; + }; + + pp$1.parseExportSpecifiersMaybe = function (node) { + if (this.eat(types.comma)) { + node.specifiers = node.specifiers.concat(this.parseExportSpecifiers()); + } + }; + + pp$1.parseExportFrom = function (node, expect) { + if (this.eatContextual("from")) { + node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected(); + this.checkExport(node); + } else { + if (expect) { + this.unexpected(); + } else { + node.source = null; + } + } + + this.semicolon(); + }; + + pp$1.shouldParseExportDeclaration = function () { + return this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "let" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isContextual("async"); + }; + + pp$1.checkExport = function (node, checkNames, isDefault) { + if (checkNames) { + // Check for duplicate exports + if (isDefault) { + // Default exports + this.checkDuplicateExports(node, "default"); + } else if (node.specifiers && node.specifiers.length) { + // Named exports + for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var specifier = _ref2; + + this.checkDuplicateExports(specifier, specifier.exported.name); + } + } else if (node.declaration) { + // Exported declarations + if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") { + this.checkDuplicateExports(node, node.declaration.id.name); + } else if (node.declaration.type === "VariableDeclaration") { + for (var _iterator3 = node.declaration.declarations, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var declaration = _ref3; + + this.checkDeclaration(declaration.id); + } + } + } + } + + if (this.state.decorators.length) { + var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression"); + if (!node.declaration || !isClass) { + this.raise(node.start, "You can only use decorators on an export when exporting a class"); + } + this.takeDecorators(node.declaration); + } + }; + + pp$1.checkDeclaration = function (node) { + if (node.type === "ObjectPattern") { + for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var prop = _ref4; + + this.checkDeclaration(prop); + } + } else if (node.type === "ArrayPattern") { + for (var _iterator5 = node.elements, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var elem = _ref5; + + if (elem) { + this.checkDeclaration(elem); + } + } + } else if (node.type === "ObjectProperty") { + this.checkDeclaration(node.value); + } else if (node.type === "RestElement" || node.type === "RestProperty") { + this.checkDeclaration(node.argument); + } else if (node.type === "Identifier") { + this.checkDuplicateExports(node, node.name); + } + }; + + pp$1.checkDuplicateExports = function (node, name) { + if (this.state.exportedIdentifiers.indexOf(name) > -1) { + this.raiseDuplicateExportError(node, name); + } + this.state.exportedIdentifiers.push(name); + }; + + pp$1.raiseDuplicateExportError = function (node, name) { + this.raise(node.start, name === "default" ? "Only one default export allowed per module." : "`" + name + "` has already been exported. Exported identifiers must be unique."); + }; + + // Parses a comma-separated list of module exports. + + pp$1.parseExportSpecifiers = function () { + var nodes = []; + var first = true; + var needsFrom = void 0; + + // export { x, y as z } [from '...'] + this.expect(types.braceL); + + while (!this.eat(types.braceR)) { + if (first) { + first = false; + } else { + this.expect(types.comma); + if (this.eat(types.braceR)) break; + } + + var isDefault = this.match(types._default); + if (isDefault && !needsFrom) needsFrom = true; + + var node = this.startNode(); + node.local = this.parseIdentifier(isDefault); + node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone(); + nodes.push(this.finishNode(node, "ExportSpecifier")); + } + + // https://github.com/ember-cli/ember-cli/pull/3739 + if (needsFrom && !this.isContextual("from")) { + this.unexpected(); + } + + return nodes; + }; + + // Parses import declaration. + + pp$1.parseImport = function (node) { + this.eat(types._import); + + // import '...' + if (this.match(types.string)) { + node.specifiers = []; + node.source = this.parseExprAtom(); + } else { + node.specifiers = []; + this.parseImportSpecifiers(node); + this.expectContextual("from"); + node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected(); + } + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + }; + + // Parses a comma-separated list of module imports. + + pp$1.parseImportSpecifiers = function (node) { + var first = true; + if (this.match(types.name)) { + // import defaultObj, { x, y as z } from '...' + var startPos = this.state.start; + var startLoc = this.state.startLoc; + node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(), startPos, startLoc)); + if (!this.eat(types.comma)) return; + } + + if (this.match(types.star)) { + var specifier = this.startNode(); + this.next(); + this.expectContextual("as"); + specifier.local = this.parseIdentifier(); + this.checkLVal(specifier.local, true, undefined, "import namespace specifier"); + node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier")); + return; + } + + this.expect(types.braceL); + while (!this.eat(types.braceR)) { + if (first) { + first = false; + } else { + // Detect an attempt to deep destructure + if (this.eat(types.colon)) { + this.unexpected(null, "ES2015 named imports do not destructure. Use another statement for destructuring after the import."); + } + + this.expect(types.comma); + if (this.eat(types.braceR)) break; + } + + this.parseImportSpecifier(node); + } + }; + + pp$1.parseImportSpecifier = function (node) { + var specifier = this.startNode(); + specifier.imported = this.parseIdentifier(true); + if (this.eatContextual("as")) { + specifier.local = this.parseIdentifier(); + } else { + this.checkReservedWord(specifier.imported.name, specifier.start, true, true); + specifier.local = specifier.imported.__clone(); + } + this.checkLVal(specifier.local, true, undefined, "import specifier"); + node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); + }; + + pp$1.parseImportSpecifierDefault = function (id, startPos, startLoc) { + var node = this.startNodeAt(startPos, startLoc); + node.local = id; + this.checkLVal(node.local, true, undefined, "default import specifier"); + return this.finishNode(node, "ImportDefaultSpecifier"); + }; + + var pp$2 = Parser.prototype; + + // Convert existing expression atom to assignable pattern + // if possible. + + pp$2.toAssignable = function (node, isBinding, contextDescription) { + if (node) { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + break; + + case "ObjectExpression": + node.type = "ObjectPattern"; + for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var prop = _ref; + + if (prop.type === "ObjectMethod") { + if (prop.kind === "get" || prop.kind === "set") { + this.raise(prop.key.start, "Object pattern can't contain getter or setter"); + } else { + this.raise(prop.key.start, "Object pattern can't contain methods"); + } + } else { + this.toAssignable(prop, isBinding, "object destructuring pattern"); + } + } + break; + + case "ObjectProperty": + this.toAssignable(node.value, isBinding, contextDescription); + break; + + case "SpreadProperty": + node.type = "RestProperty"; + var arg = node.argument; + this.toAssignable(arg, isBinding, contextDescription); + break; + + case "ArrayExpression": + node.type = "ArrayPattern"; + this.toAssignableList(node.elements, isBinding, contextDescription); + break; + + case "AssignmentExpression": + if (node.operator === "=") { + node.type = "AssignmentPattern"; + delete node.operator; + } else { + this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); + } + break; + + case "MemberExpression": + if (!isBinding) break; + + default: + { + var message = "Invalid left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression"); + this.raise(node.start, message); + } + } + } + return node; + }; + + // Convert list of expression atoms to binding list. + + pp$2.toAssignableList = function (exprList, isBinding, contextDescription) { + var end = exprList.length; + if (end) { + var last = exprList[end - 1]; + if (last && last.type === "RestElement") { + --end; + } else if (last && last.type === "SpreadElement") { + last.type = "RestElement"; + var arg = last.argument; + this.toAssignable(arg, isBinding, contextDescription); + if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") { + this.unexpected(arg.start); + } + --end; + } + } + for (var i = 0; i < end; i++) { + var elt = exprList[i]; + if (elt) this.toAssignable(elt, isBinding, contextDescription); + } + return exprList; + }; + + // Convert list of expression atoms to a list of + + pp$2.toReferencedList = function (exprList) { + return exprList; + }; + + // Parses spread element. + + pp$2.parseSpread = function (refShorthandDefaultPos) { + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssign(false, refShorthandDefaultPos); + return this.finishNode(node, "SpreadElement"); + }; + + pp$2.parseRest = function () { + var node = this.startNode(); + this.next(); + node.argument = this.parseBindingIdentifier(); + return this.finishNode(node, "RestElement"); + }; + + pp$2.shouldAllowYieldIdentifier = function () { + return this.match(types._yield) && !this.state.strict && !this.state.inGenerator; + }; + + pp$2.parseBindingIdentifier = function () { + return this.parseIdentifier(this.shouldAllowYieldIdentifier()); + }; + + // Parses lvalue (assignable) atom. + + pp$2.parseBindingAtom = function () { + switch (this.state.type) { + case types._yield: + if (this.state.strict || this.state.inGenerator) this.unexpected(); + // fall-through + case types.name: + return this.parseIdentifier(true); + + case types.bracketL: + var node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(types.bracketR, true); + return this.finishNode(node, "ArrayPattern"); + + case types.braceL: + return this.parseObj(true); + + default: + this.unexpected(); + } + }; + + pp$2.parseBindingList = function (close, allowEmpty) { + var elts = []; + var first = true; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(types.comma); + } + if (allowEmpty && this.match(types.comma)) { + elts.push(null); + } else if (this.eat(close)) { + break; + } else if (this.match(types.ellipsis)) { + elts.push(this.parseAssignableListItemTypes(this.parseRest())); + this.expect(close); + break; + } else { + var decorators = []; + while (this.match(types.at)) { + decorators.push(this.parseDecorator()); + } + var left = this.parseMaybeDefault(); + if (decorators.length) { + left.decorators = decorators; + } + this.parseAssignableListItemTypes(left); + elts.push(this.parseMaybeDefault(left.start, left.loc.start, left)); + } + } + return elts; + }; + + pp$2.parseAssignableListItemTypes = function (param) { + return param; + }; + + // Parses assignment pattern around given atom if possible. + + pp$2.parseMaybeDefault = function (startPos, startLoc, left) { + startLoc = startLoc || this.state.startLoc; + startPos = startPos || this.state.start; + left = left || this.parseBindingAtom(); + if (!this.eat(types.eq)) return left; + + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.right = this.parseMaybeAssign(); + return this.finishNode(node, "AssignmentPattern"); + }; + + // Verify that a node is an lval — something that can be assigned + // to. + + pp$2.checkLVal = function (expr, isBinding, checkClashes, contextDescription) { + switch (expr.type) { + case "Identifier": + this.checkReservedWord(expr.name, expr.start, false, true); + + if (checkClashes) { + // we need to prefix this with an underscore for the cases where we have a key of + // `__proto__`. there's a bug in old V8 where the following wouldn't work: + // + // > var obj = Object.create(null); + // undefined + // > obj.__proto__ + // null + // > obj.__proto__ = true; + // true + // > obj.__proto__ + // null + var key = "_" + expr.name; + + if (checkClashes[key]) { + this.raise(expr.start, "Argument name clash in strict mode"); + } else { + checkClashes[key] = true; + } + } + break; + + case "MemberExpression": + if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression"); + break; + + case "ObjectPattern": + for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var prop = _ref2; + + if (prop.type === "ObjectProperty") prop = prop.value; + this.checkLVal(prop, isBinding, checkClashes, "object destructuring pattern"); + } + break; + + case "ArrayPattern": + for (var _iterator3 = expr.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var elem = _ref3; + + if (elem) this.checkLVal(elem, isBinding, checkClashes, "array destructuring pattern"); + } + break; + + case "AssignmentPattern": + this.checkLVal(expr.left, isBinding, checkClashes, "assignment pattern"); + break; + + case "RestProperty": + this.checkLVal(expr.argument, isBinding, checkClashes, "rest property"); + break; + + case "RestElement": + this.checkLVal(expr.argument, isBinding, checkClashes, "rest element"); + break; + + default: + { + var message = (isBinding ? /* istanbul ignore next */"Binding invalid" : "Invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression"); + this.raise(expr.start, message); + } + } + }; + + /* eslint max-len: 0 */ + + // A recursive descent parser operates by defining functions for all + // syntactic elements, and recursively calling those, each function + // advancing the input stream and returning an AST node. Precedence + // of constructs (for example, the fact that `!x[1]` means `!(x[1])` + // instead of `(!x)[1]` is handled by the fact that the parser + // function that parses unary prefix operators is called first, and + // in turn calls the function that parses `[]` subscripts — that + // way, it'll receive the node for `x[1]` already parsed, and wraps + // *that* in the unary operator node. + // + // Acorn uses an [operator precedence parser][opp] to handle binary + // operator precedence, because it is much more compact than using + // the technique outlined above, which uses different, nesting + // functions to specify precedence, for all of the ten binary + // precedence levels that JavaScript defines. + // + // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser + + var pp$3 = Parser.prototype; + + // Check if property name clashes with already added. + // Object/class getters and setters are not allowed to clash — + // either with each other or with an init property — and in + // strict mode, init properties are also not allowed to be repeated. + + pp$3.checkPropClash = function (prop, propHash) { + if (prop.computed || prop.kind) return; + + var key = prop.key; + // It is either an Identifier or a String/NumericLiteral + var name = key.type === "Identifier" ? key.name : String(key.value); + + if (name === "__proto__") { + if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); + propHash.proto = true; + } + }; + + // Convenience method to parse an Expression only + pp$3.getExpression = function () { + this.nextToken(); + var expr = this.parseExpression(); + if (!this.match(types.eof)) { + this.unexpected(); + } + return expr; + }; + + // ### Expression parsing + + // These nest, from the most general expression type at the top to + // 'atomic', nondivisible expression types at the bottom. Most of + // the functions will simply let the function (s) below them parse, + // and, *if* the syntactic construct they handle is present, wrap + // the AST node that the inner parser gave them in another node. + + // Parse a full expression. The optional arguments are used to + // forbid the `in` operator (in for loops initialization expressions) + // and provide reference for storing '=' operator inside shorthand + // property assignment in contexts where both object expression + // and object pattern might appear (so it's possible to raise + // delayed syntax error at correct position). + + pp$3.parseExpression = function (noIn, refShorthandDefaultPos) { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); + if (this.match(types.comma)) { + var node = this.startNodeAt(startPos, startLoc); + node.expressions = [expr]; + while (this.eat(types.comma)) { + node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos)); + } + this.toReferencedList(node.expressions); + return this.finishNode(node, "SequenceExpression"); + } + return expr; + }; + + // Parse an assignment expression. This includes applications of + // operators like `+=`. + + pp$3.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + + if (this.match(types._yield) && this.state.inGenerator) { + var _left = this.parseYield(); + if (afterLeftParse) _left = afterLeftParse.call(this, _left, startPos, startLoc); + return _left; + } + + var failOnShorthandAssign = void 0; + if (refShorthandDefaultPos) { + failOnShorthandAssign = false; + } else { + refShorthandDefaultPos = { start: 0 }; + failOnShorthandAssign = true; + } + + if (this.match(types.parenL) || this.match(types.name)) { + this.state.potentialArrowAt = this.state.start; + } + + var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos); + if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); + if (this.state.type.isAssign) { + var node = this.startNodeAt(startPos, startLoc); + node.operator = this.state.value; + node.left = this.match(types.eq) ? this.toAssignable(left, undefined, "assignment expression") : left; + refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly + + this.checkLVal(left, undefined, undefined, "assignment expression"); + + if (left.extra && left.extra.parenthesized) { + var errorMsg = void 0; + if (left.type === "ObjectPattern") { + errorMsg = "`({a}) = 0` use `({a} = 0)`"; + } else if (left.type === "ArrayPattern") { + errorMsg = "`([a]) = 0` use `([a] = 0)`"; + } + if (errorMsg) { + this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg); + } + } + + this.next(); + node.right = this.parseMaybeAssign(noIn); + return this.finishNode(node, "AssignmentExpression"); + } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { + this.unexpected(refShorthandDefaultPos.start); + } + + return left; + }; + + // Parse a ternary conditional (`?:`) operator. + + pp$3.parseMaybeConditional = function (noIn, refShorthandDefaultPos, refNeedsArrowPos) { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var expr = this.parseExprOps(noIn, refShorthandDefaultPos); + if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + + return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos); + }; + + pp$3.parseConditional = function (expr, noIn, startPos, startLoc) { + if (this.eat(types.question)) { + var node = this.startNodeAt(startPos, startLoc); + node.test = expr; + node.consequent = this.parseMaybeAssign(); + this.expect(types.colon); + node.alternate = this.parseMaybeAssign(noIn); + return this.finishNode(node, "ConditionalExpression"); + } + return expr; + }; + + // Start the precedence parser. + + pp$3.parseExprOps = function (noIn, refShorthandDefaultPos) { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var expr = this.parseMaybeUnary(refShorthandDefaultPos); + if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + return expr; + } else { + return this.parseExprOp(expr, startPos, startLoc, -1, noIn); + } + }; + + // Parse binary operators with the operator precedence parsing + // algorithm. `left` is the left-hand side of the operator. + // `minPrec` provides context that allows the function to stop and + // defer further parser to one of its callers when it encounters an + // operator that has a lower precedence than the set it is parsing. + + pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { + var prec = this.state.type.binop; + if (prec != null && (!noIn || !this.match(types._in))) { + if (prec > minPrec) { + var node = this.startNodeAt(leftStartPos, leftStartLoc); + node.left = left; + node.operator = this.state.value; + + if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument && !left.extra.parenthesized) { + this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses."); + } + + var op = this.state.type; + this.next(); + + var startPos = this.state.start; + var startLoc = this.state.startLoc; + node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn); + + this.finishNode(node, op === types.logicalOR || op === types.logicalAND ? "LogicalExpression" : "BinaryExpression"); + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); + } + } + return left; + }; + + // Parse unary operators, both prefix and postfix. + + pp$3.parseMaybeUnary = function (refShorthandDefaultPos) { + if (this.state.type.prefix) { + var node = this.startNode(); + var update = this.match(types.incDec); + node.operator = this.state.value; + node.prefix = true; + this.next(); + + var argType = this.state.type; + node.argument = this.parseMaybeUnary(); + + this.addExtra(node, "parenthesizedArgument", argType === types.parenL && (!node.argument.extra || !node.argument.extra.parenthesized)); + + if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + this.unexpected(refShorthandDefaultPos.start); + } + + if (update) { + this.checkLVal(node.argument, undefined, undefined, "prefix operation"); + } else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") { + this.raise(node.start, "Deleting local variable in strict mode"); + } + + return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + } + + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var expr = this.parseExprSubscripts(refShorthandDefaultPos); + if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + while (this.state.type.postfix && !this.canInsertSemicolon()) { + var _node = this.startNodeAt(startPos, startLoc); + _node.operator = this.state.value; + _node.prefix = false; + _node.argument = expr; + this.checkLVal(expr, undefined, undefined, "postfix operation"); + this.next(); + expr = this.finishNode(_node, "UpdateExpression"); + } + return expr; + }; + + // Parse call, dot, and `[]`-subscript expressions. + + pp$3.parseExprSubscripts = function (refShorthandDefaultPos) { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var potentialArrowAt = this.state.potentialArrowAt; + var expr = this.parseExprAtom(refShorthandDefaultPos); + + if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) { + return expr; + } + + if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + return expr; + } + + return this.parseSubscripts(expr, startPos, startLoc); + }; + + pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) { + for (;;) { + if (!noCalls && this.eat(types.doubleColon)) { + var node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.callee = this.parseNoCallExpr(); + return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls); + } else if (this.eat(types.dot)) { + var _node2 = this.startNodeAt(startPos, startLoc); + _node2.object = base; + _node2.property = this.parseIdentifier(true); + _node2.computed = false; + base = this.finishNode(_node2, "MemberExpression"); + } else if (this.eat(types.bracketL)) { + var _node3 = this.startNodeAt(startPos, startLoc); + _node3.object = base; + _node3.property = this.parseExpression(); + _node3.computed = true; + this.expect(types.bracketR); + base = this.finishNode(_node3, "MemberExpression"); + } else if (!noCalls && this.match(types.parenL)) { + var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon(); + this.next(); + + var _node4 = this.startNodeAt(startPos, startLoc); + _node4.callee = base; + _node4.arguments = this.parseCallExpressionArguments(types.parenR, possibleAsync); + if (_node4.callee.type === "Import" && _node4.arguments.length !== 1) { + this.raise(_node4.start, "import() requires exactly one argument"); + } + base = this.finishNode(_node4, "CallExpression"); + + if (possibleAsync && this.shouldParseAsyncArrow()) { + return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), _node4); + } else { + this.toReferencedList(_node4.arguments); + } + } else if (this.match(types.backQuote)) { + var _node5 = this.startNodeAt(startPos, startLoc); + _node5.tag = base; + _node5.quasi = this.parseTemplate(true); + base = this.finishNode(_node5, "TaggedTemplateExpression"); + } else { + return base; + } + } + }; + + pp$3.parseCallExpressionArguments = function (close, possibleAsyncArrow) { + var elts = []; + var innerParenStart = void 0; + var first = true; + + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(types.comma); + if (this.eat(close)) break; + } + + // we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params + if (this.match(types.parenL) && !innerParenStart) { + innerParenStart = this.state.start; + } + + elts.push(this.parseExprListItem(false, possibleAsyncArrow ? { start: 0 } : undefined, possibleAsyncArrow ? { start: 0 } : undefined)); + } + + // we found an async arrow function so let's not allow any inner parens + if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) { + this.unexpected(); + } + + return elts; + }; + + pp$3.shouldParseAsyncArrow = function () { + return this.match(types.arrow); + }; + + pp$3.parseAsyncArrowFromCallExpression = function (node, call) { + this.expect(types.arrow); + return this.parseArrowExpression(node, call.arguments, true); + }; + + // Parse a no-call expression (like argument of `new` or `::` operators). + + pp$3.parseNoCallExpr = function () { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); + }; + + // Parse an atomic expression — either a single token that is an + // expression, an expression started by a keyword like `function` or + // `new`, or an expression wrapped in punctuation like `()`, `[]`, + // or `{}`. + + pp$3.parseExprAtom = function (refShorthandDefaultPos) { + var canBeArrow = this.state.potentialArrowAt === this.state.start; + var node = void 0; + + switch (this.state.type) { + case types._super: + if (!this.state.inMethod && !this.state.inClassProperty && !this.options.allowSuperOutsideMethod) { + this.raise(this.state.start, "'super' outside of function or class"); + } + + node = this.startNode(); + this.next(); + if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) { + this.unexpected(); + } + if (this.match(types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) { + this.raise(node.start, "super() outside of class constructor"); + } + return this.finishNode(node, "Super"); + + case types._import: + if (!this.hasPlugin("dynamicImport")) this.unexpected(); + + node = this.startNode(); + this.next(); + if (!this.match(types.parenL)) { + this.unexpected(null, types.parenL); + } + return this.finishNode(node, "Import"); + + case types._this: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression"); + + case types._yield: + if (this.state.inGenerator) this.unexpected(); + + case types.name: + node = this.startNode(); + var allowAwait = this.state.value === "await" && this.state.inAsync; + var allowYield = this.shouldAllowYieldIdentifier(); + var id = this.parseIdentifier(allowAwait || allowYield); + + if (id.name === "await") { + if (this.state.inAsync || this.inModule) { + return this.parseAwait(node); + } + } else if (id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) { + this.next(); + return this.parseFunction(node, false, false, true); + } else if (canBeArrow && id.name === "async" && this.match(types.name)) { + var params = [this.parseIdentifier()]; + this.expect(types.arrow); + // let foo = bar => {}; + return this.parseArrowExpression(node, params, true); + } + + if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { + return this.parseArrowExpression(node, [id]); + } + + return id; + + case types._do: + if (this.hasPlugin("doExpressions")) { + var _node6 = this.startNode(); + this.next(); + var oldInFunction = this.state.inFunction; + var oldLabels = this.state.labels; + this.state.labels = []; + this.state.inFunction = false; + _node6.body = this.parseBlock(false, true); + this.state.inFunction = oldInFunction; + this.state.labels = oldLabels; + return this.finishNode(_node6, "DoExpression"); + } + + case types.regexp: + var value = this.state.value; + node = this.parseLiteral(value.value, "RegExpLiteral"); + node.pattern = value.pattern; + node.flags = value.flags; + return node; + + case types.num: + return this.parseLiteral(this.state.value, "NumericLiteral"); + + case types.string: + return this.parseLiteral(this.state.value, "StringLiteral"); + + case types._null: + node = this.startNode(); + this.next(); + return this.finishNode(node, "NullLiteral"); + + case types._true:case types._false: + node = this.startNode(); + node.value = this.match(types._true); + this.next(); + return this.finishNode(node, "BooleanLiteral"); + + case types.parenL: + return this.parseParenAndDistinguishExpression(null, null, canBeArrow); + + case types.bracketL: + node = this.startNode(); + this.next(); + node.elements = this.parseExprList(types.bracketR, true, refShorthandDefaultPos); + this.toReferencedList(node.elements); + return this.finishNode(node, "ArrayExpression"); + + case types.braceL: + return this.parseObj(false, refShorthandDefaultPos); + + case types._function: + return this.parseFunctionExpression(); + + case types.at: + this.parseDecorators(); + + case types._class: + node = this.startNode(); + this.takeDecorators(node); + return this.parseClass(node, false); + + case types._new: + return this.parseNew(); + + case types.backQuote: + return this.parseTemplate(false); + + case types.doubleColon: + node = this.startNode(); + this.next(); + node.object = null; + var callee = node.callee = this.parseNoCallExpr(); + if (callee.type === "MemberExpression") { + return this.finishNode(node, "BindExpression"); + } else { + this.raise(callee.start, "Binding should be performed on object property."); + } + + default: + this.unexpected(); + } + }; + + pp$3.parseFunctionExpression = function () { + var node = this.startNode(); + var meta = this.parseIdentifier(true); + if (this.state.inGenerator && this.eat(types.dot) && this.hasPlugin("functionSent")) { + return this.parseMetaProperty(node, meta, "sent"); + } else { + return this.parseFunction(node, false); + } + }; + + pp$3.parseMetaProperty = function (node, meta, propertyName) { + node.meta = meta; + node.property = this.parseIdentifier(true); + + if (node.property.name !== propertyName) { + this.raise(node.property.start, "The only valid meta property for new is " + meta.name + "." + propertyName); + } + + return this.finishNode(node, "MetaProperty"); + }; + + pp$3.parseLiteral = function (value, type, startPos, startLoc) { + startPos = startPos || this.state.start; + startLoc = startLoc || this.state.startLoc; + + var node = this.startNodeAt(startPos, startLoc); + this.addExtra(node, "rawValue", value); + this.addExtra(node, "raw", this.input.slice(startPos, this.state.end)); + node.value = value; + this.next(); + return this.finishNode(node, type); + }; + + pp$3.parseParenExpression = function () { + this.expect(types.parenL); + var val = this.parseExpression(); + this.expect(types.parenR); + return val; + }; + + pp$3.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow) { + startPos = startPos || this.state.start; + startLoc = startLoc || this.state.startLoc; + + var val = void 0; + this.expect(types.parenL); + + var innerStartPos = this.state.start; + var innerStartLoc = this.state.startLoc; + var exprList = []; + var refShorthandDefaultPos = { start: 0 }; + var refNeedsArrowPos = { start: 0 }; + var first = true; + var spreadStart = void 0; + var optionalCommaStart = void 0; + + while (!this.match(types.parenR)) { + if (first) { + first = false; + } else { + this.expect(types.comma, refNeedsArrowPos.start || null); + if (this.match(types.parenR)) { + optionalCommaStart = this.state.start; + break; + } + } + + if (this.match(types.ellipsis)) { + var spreadNodeStartPos = this.state.start; + var spreadNodeStartLoc = this.state.startLoc; + spreadStart = this.state.start; + exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartPos, spreadNodeStartLoc)); + break; + } else { + exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos)); + } + } + + var innerEndPos = this.state.start; + var innerEndLoc = this.state.startLoc; + this.expect(types.parenR); + + var arrowNode = this.startNodeAt(startPos, startLoc); + if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) { + for (var _iterator = exprList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var param = _ref; + + if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart); + } + + return this.parseArrowExpression(arrowNode, exprList); + } + + if (!exprList.length) { + this.unexpected(this.state.lastTokStart); + } + if (optionalCommaStart) this.unexpected(optionalCommaStart); + if (spreadStart) this.unexpected(spreadStart); + if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); + if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); + + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.toReferencedList(val.expressions); + this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + + this.addExtra(val, "parenthesized", true); + this.addExtra(val, "parenStart", startPos); + + return val; + }; + + pp$3.shouldParseArrow = function () { + return !this.canInsertSemicolon(); + }; + + pp$3.parseArrow = function (node) { + if (this.eat(types.arrow)) { + return node; + } + }; + + pp$3.parseParenItem = function (node) { + return node; + }; + + // New's precedence is slightly tricky. It must allow its argument + // to be a `[]` or dot subscript expression, but not a call — at + // least, not without wrapping it in parentheses. Thus, it uses the + + pp$3.parseNew = function () { + var node = this.startNode(); + var meta = this.parseIdentifier(true); + + if (this.eat(types.dot)) { + var metaProp = this.parseMetaProperty(node, meta, "target"); + + if (!this.state.inFunction) { + this.raise(metaProp.property.start, "new.target can only be used in functions"); + } + + return metaProp; + } + + node.callee = this.parseNoCallExpr(); + + if (this.eat(types.parenL)) { + node.arguments = this.parseExprList(types.parenR); + this.toReferencedList(node.arguments); + } else { + node.arguments = []; + } + + return this.finishNode(node, "NewExpression"); + }; + + // Parse template expression. + + pp$3.parseTemplateElement = function (isTagged) { + var elem = this.startNode(); + if (this.state.value === null) { + if (!isTagged || !this.hasPlugin("templateInvalidEscapes")) { + this.raise(this.state.invalidTemplateEscapePosition, "Invalid escape sequence in template"); + } else { + this.state.invalidTemplateEscapePosition = null; + } + } + elem.value = { + raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"), + cooked: this.state.value + }; + this.next(); + elem.tail = this.match(types.backQuote); + return this.finishNode(elem, "TemplateElement"); + }; + + pp$3.parseTemplate = function (isTagged) { + var node = this.startNode(); + this.next(); + node.expressions = []; + var curElt = this.parseTemplateElement(isTagged); + node.quasis = [curElt]; + while (!curElt.tail) { + this.expect(types.dollarBraceL); + node.expressions.push(this.parseExpression()); + this.expect(types.braceR); + node.quasis.push(curElt = this.parseTemplateElement(isTagged)); + } + this.next(); + return this.finishNode(node, "TemplateLiteral"); + }; + + // Parse an object literal or binding pattern. + + pp$3.parseObj = function (isPattern, refShorthandDefaultPos) { + var decorators = []; + var propHash = Object.create(null); + var first = true; + var node = this.startNode(); + + node.properties = []; + this.next(); + + var firstRestLocation = null; + + while (!this.eat(types.braceR)) { + if (first) { + first = false; + } else { + this.expect(types.comma); + if (this.eat(types.braceR)) break; + } + + while (this.match(types.at)) { + decorators.push(this.parseDecorator()); + } + + var prop = this.startNode(), + isGenerator = false, + isAsync = false, + startPos = void 0, + startLoc = void 0; + if (decorators.length) { + prop.decorators = decorators; + decorators = []; + } + + if (this.hasPlugin("objectRestSpread") && this.match(types.ellipsis)) { + prop = this.parseSpread(isPattern ? { start: 0 } : undefined); + prop.type = isPattern ? "RestProperty" : "SpreadProperty"; + if (isPattern) this.toAssignable(prop.argument, true, "object pattern"); + node.properties.push(prop); + if (isPattern) { + var position = this.state.start; + if (firstRestLocation !== null) { + this.unexpected(firstRestLocation, "Cannot have multiple rest elements when destructuring"); + } else if (this.eat(types.braceR)) { + break; + } else if (this.match(types.comma) && this.lookahead().type === types.braceR) { + // TODO: temporary rollback + // this.unexpected(position, "A trailing comma is not permitted after the rest element"); + continue; + } else { + firstRestLocation = position; + continue; + } + } else { + continue; + } + } + + prop.method = false; + prop.shorthand = false; + + if (isPattern || refShorthandDefaultPos) { + startPos = this.state.start; + startLoc = this.state.startLoc; + } + + if (!isPattern) { + isGenerator = this.eat(types.star); + } + + if (!isPattern && this.isContextual("async")) { + if (isGenerator) this.unexpected(); + + var asyncId = this.parseIdentifier(); + if (this.match(types.colon) || this.match(types.parenL) || this.match(types.braceR) || this.match(types.eq) || this.match(types.comma)) { + prop.key = asyncId; + prop.computed = false; + } else { + isAsync = true; + if (this.hasPlugin("asyncGenerators")) isGenerator = this.eat(types.star); + this.parsePropertyName(prop); + } + } else { + this.parsePropertyName(prop); + } + + this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos); + this.checkPropClash(prop, propHash); + + if (prop.shorthand) { + this.addExtra(prop, "shorthand", true); + } + + node.properties.push(prop); + } + + if (firstRestLocation !== null) { + this.unexpected(firstRestLocation, "The rest element has to be the last element when destructuring"); + } + + if (decorators.length) { + this.raise(this.state.start, "You have trailing decorators with no property"); + } + + return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); + }; + + pp$3.isGetterOrSetterMethod = function (prop, isPattern) { + return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.match(types.string) || // get "string"() {} + this.match(types.num) || // get 1() {} + this.match(types.bracketL) || // get ["string"]() {} + this.match(types.name) || // get foo() {} + this.state.type.keyword // get debugger() {} + ); + }; + + // get methods aren't allowed to have any parameters + // set methods must have exactly 1 parameter + pp$3.checkGetterSetterParamCount = function (method) { + var paramCount = method.kind === "get" ? 0 : 1; + if (method.params.length !== paramCount) { + var start = method.start; + if (method.kind === "get") { + this.raise(start, "getter should have no params"); + } else { + this.raise(start, "setter should have exactly one param"); + } + } + }; + + pp$3.parseObjectMethod = function (prop, isGenerator, isAsync, isPattern) { + if (isAsync || isGenerator || this.match(types.parenL)) { + if (isPattern) this.unexpected(); + prop.kind = "method"; + prop.method = true; + this.parseMethod(prop, isGenerator, isAsync); + + return this.finishNode(prop, "ObjectMethod"); + } + + if (this.isGetterOrSetterMethod(prop, isPattern)) { + if (isGenerator || isAsync) this.unexpected(); + prop.kind = prop.key.name; + this.parsePropertyName(prop); + this.parseMethod(prop); + this.checkGetterSetterParamCount(prop); + + return this.finishNode(prop, "ObjectMethod"); + } + }; + + pp$3.parseObjectProperty = function (prop, startPos, startLoc, isPattern, refShorthandDefaultPos) { + if (this.eat(types.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos); + + return this.finishNode(prop, "ObjectProperty"); + } + + if (!prop.computed && prop.key.type === "Identifier") { + this.checkReservedWord(prop.key.name, prop.key.start, true, true); + + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); + } else if (this.match(types.eq) && refShorthandDefaultPos) { + if (!refShorthandDefaultPos.start) { + refShorthandDefaultPos.start = this.state.start; + } + prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); + } else { + prop.value = prop.key.__clone(); + } + prop.shorthand = true; + + return this.finishNode(prop, "ObjectProperty"); + } + }; + + pp$3.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) { + var node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos); + + if (!node) this.unexpected(); + + return node; + }; + + pp$3.parsePropertyName = function (prop) { + if (this.eat(types.bracketL)) { + prop.computed = true; + prop.key = this.parseMaybeAssign(); + this.expect(types.bracketR); + } else { + prop.computed = false; + var oldInPropertyName = this.state.inPropertyName; + this.state.inPropertyName = true; + prop.key = this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true); + this.state.inPropertyName = oldInPropertyName; + } + return prop.key; + }; + + // Initialize empty function node. + + pp$3.initFunction = function (node, isAsync) { + node.id = null; + node.generator = false; + node.expression = false; + node.async = !!isAsync; + }; + + // Parse object or class method. + + pp$3.parseMethod = function (node, isGenerator, isAsync) { + var oldInMethod = this.state.inMethod; + this.state.inMethod = node.kind || true; + this.initFunction(node, isAsync); + this.expect(types.parenL); + node.params = this.parseBindingList(types.parenR); + node.generator = !!isGenerator; + this.parseFunctionBody(node); + this.state.inMethod = oldInMethod; + return node; + }; + + // Parse arrow function expression with given parameters. + + pp$3.parseArrowExpression = function (node, params, isAsync) { + this.initFunction(node, isAsync); + node.params = this.toAssignableList(params, true, "arrow function parameters"); + this.parseFunctionBody(node, true); + return this.finishNode(node, "ArrowFunctionExpression"); + }; + + pp$3.isStrictBody = function (node, isExpression) { + if (!isExpression && node.body.directives.length) { + for (var _iterator2 = node.body.directives, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var directive = _ref2; + + if (directive.value.value === "use strict") { + return true; + } + } + } + + return false; + }; + + // Parse function body and check parameters. + pp$3.parseFunctionBody = function (node, allowExpression) { + var isExpression = allowExpression && !this.match(types.braceL); + + var oldInAsync = this.state.inAsync; + this.state.inAsync = node.async; + if (isExpression) { + node.body = this.parseMaybeAssign(); + node.expression = true; + } else { + // Start a new scope with regard to labels and the `inFunction` + // flag (restore them to their old value afterwards). + var oldInFunc = this.state.inFunction; + var oldInGen = this.state.inGenerator; + var oldLabels = this.state.labels; + this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = []; + node.body = this.parseBlock(true); + node.expression = false; + this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels; + } + this.state.inAsync = oldInAsync; + + // If this is a strict mode function, verify that argument names + // are not repeated, and it does not try to bind the words `eval` + // or `arguments`. + var isStrict = this.isStrictBody(node, isExpression); + // Also check when allowExpression === true for arrow functions + var checkLVal = this.state.strict || allowExpression || isStrict; + + if (isStrict && node.id && node.id.type === "Identifier" && node.id.name === "yield") { + this.raise(node.id.start, "Binding yield in strict mode"); + } + + if (checkLVal) { + var nameHash = Object.create(null); + var oldStrict = this.state.strict; + if (isStrict) this.state.strict = true; + if (node.id) { + this.checkLVal(node.id, true, undefined, "function name"); + } + for (var _iterator3 = node.params, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var param = _ref3; + + if (isStrict && param.type !== "Identifier") { + this.raise(param.start, "Non-simple parameter in strict mode"); + } + this.checkLVal(param, true, nameHash, "function parameter list"); + } + this.state.strict = oldStrict; + } + }; + + // Parses a comma-separated list of expressions, and returns them as + // an array. `close` is the token type that ends the list, and + // `allowEmpty` can be turned on to allow subsequent commas with + // nothing in between them to be parsed as `null` (which is needed + // for array literals). + + pp$3.parseExprList = function (close, allowEmpty, refShorthandDefaultPos) { + var elts = []; + var first = true; + + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(types.comma); + if (this.eat(close)) break; + } + + elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos)); + } + return elts; + }; + + pp$3.parseExprListItem = function (allowEmpty, refShorthandDefaultPos, refNeedsArrowPos) { + var elt = void 0; + if (allowEmpty && this.match(types.comma)) { + elt = null; + } else if (this.match(types.ellipsis)) { + elt = this.parseSpread(refShorthandDefaultPos); + } else { + elt = this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos); + } + return elt; + }; + + // Parse the next token as an identifier. If `liberal` is true (used + // when parsing properties), it will also convert keywords into + // identifiers. + + pp$3.parseIdentifier = function (liberal) { + var node = this.startNode(); + if (!liberal) { + this.checkReservedWord(this.state.value, this.state.start, !!this.state.type.keyword, false); + } + + if (this.match(types.name)) { + node.name = this.state.value; + } else if (this.state.type.keyword) { + node.name = this.state.type.keyword; + } else { + this.unexpected(); + } + + if (!liberal && node.name === "await" && this.state.inAsync) { + this.raise(node.start, "invalid use of await inside of an async function"); + } + + node.loc.identifierName = node.name; + + this.next(); + return this.finishNode(node, "Identifier"); + }; + + pp$3.checkReservedWord = function (word, startLoc, checkKeywords, isBinding) { + if (this.isReservedWord(word) || checkKeywords && this.isKeyword(word)) { + this.raise(startLoc, word + " is a reserved word"); + } + + if (this.state.strict && (reservedWords.strict(word) || isBinding && reservedWords.strictBind(word))) { + this.raise(startLoc, word + " is a reserved word in strict mode"); + } + }; + + // Parses await expression inside async function. + + pp$3.parseAwait = function (node) { + // istanbul ignore next: this condition is checked at the call site so won't be hit here + if (!this.state.inAsync) { + this.unexpected(); + } + if (this.match(types.star)) { + this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead."); + } + node.argument = this.parseMaybeUnary(); + return this.finishNode(node, "AwaitExpression"); + }; + + // Parses yield expression inside generator. + + pp$3.parseYield = function () { + var node = this.startNode(); + this.next(); + if (this.match(types.semi) || this.canInsertSemicolon() || !this.match(types.star) && !this.state.type.startsExpr) { + node.delegate = false; + node.argument = null; + } else { + node.delegate = this.eat(types.star); + node.argument = this.parseMaybeAssign(); + } + return this.finishNode(node, "YieldExpression"); + }; + + // Start an AST node, attaching a start offset. + + var pp$4 = Parser.prototype; + var commentKeys = ["leadingComments", "trailingComments", "innerComments"]; + + var Node = function () { + function Node(pos, loc, filename) { + classCallCheck(this, Node); + + this.type = ""; + this.start = pos; + this.end = 0; + this.loc = new SourceLocation(loc); + if (filename) this.loc.filename = filename; + } + + Node.prototype.__clone = function __clone() { + var node2 = new Node(); + for (var key in this) { + // Do not clone comments that are already attached to the node + if (commentKeys.indexOf(key) < 0) { + node2[key] = this[key]; + } + } + + return node2; + }; + + return Node; + }(); + + pp$4.startNode = function () { + return new Node(this.state.start, this.state.startLoc, this.filename); + }; + + pp$4.startNodeAt = function (pos, loc) { + return new Node(pos, loc, this.filename); + }; + + function finishNodeAt(node, type, pos, loc) { + node.type = type; + node.end = pos; + node.loc.end = loc; + this.processComment(node); + return node; + } + + // Finish an AST node, adding `type` and `end` properties. + + pp$4.finishNode = function (node, type) { + return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc); + }; + + // Finish node at given position + + pp$4.finishNodeAt = function (node, type, pos, loc) { + return finishNodeAt.call(this, node, type, pos, loc); + }; + + var pp$5 = Parser.prototype; + + // This function is used to raise exceptions on parse errors. It + // takes an offset integer (into the current `input`) to indicate + // the location of the error, attaches the position to the end + // of the error message, and then raises a `SyntaxError` with that + // message. + + pp$5.raise = function (pos, message) { + var loc = getLineInfo(this.input, pos); + message += " (" + loc.line + ":" + loc.column + ")"; + var err = new SyntaxError(message); + err.pos = pos; + err.loc = loc; + throw err; + }; + + /* eslint max-len: 0 */ + + /** + * Based on the comment attachment algorithm used in espree and estraverse. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + function last(stack) { + return stack[stack.length - 1]; + } + + var pp$6 = Parser.prototype; + + pp$6.addComment = function (comment) { + if (this.filename) comment.loc.filename = this.filename; + this.state.trailingComments.push(comment); + this.state.leadingComments.push(comment); + }; + + pp$6.processComment = function (node) { + if (node.type === "Program" && node.body.length > 0) return; + + var stack = this.state.commentStack; + + var firstChild = void 0, + lastChild = void 0, + trailingComments = void 0, + i = void 0, + j = void 0; + + if (this.state.trailingComments.length > 0) { + // If the first comment in trailingComments comes after the + // current node, then we're good - all comments in the array will + // come after the node and so it's safe to add them as official + // trailingComments. + if (this.state.trailingComments[0].start >= node.end) { + trailingComments = this.state.trailingComments; + this.state.trailingComments = []; + } else { + // Otherwise, if the first comment doesn't come after the + // current node, that means we have a mix of leading and trailing + // comments in the array and that leadingComments contains the + // same items as trailingComments. Reset trailingComments to + // zero items and we'll handle this by evaluating leadingComments + // later. + this.state.trailingComments.length = 0; + } + } else { + var lastInStack = last(stack); + if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) { + trailingComments = lastInStack.trailingComments; + lastInStack.trailingComments = null; + } + } + + // Eating the stack. + if (stack.length > 0 && last(stack).start >= node.start) { + firstChild = stack.pop(); + } + + while (stack.length > 0 && last(stack).start >= node.start) { + lastChild = stack.pop(); + } + + if (!lastChild && firstChild) lastChild = firstChild; + + // Attach comments that follow a trailing comma on the last + // property in an object literal or a trailing comma in function arguments + // as trailing comments + if (firstChild && (firstChild.type === "ObjectProperty" || node.type === "CallExpression") && this.state.leadingComments.length > 0) { + var lastComment = last(this.state.leadingComments); + if (lastComment.start >= node.start) { + if (this.state.commentPreviousNode) { + for (j = 0; j < this.state.leadingComments.length; j++) { + if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { + this.state.leadingComments.splice(j, 1); + j--; + } + } + + if (this.state.leadingComments.length > 0) { + firstChild.trailingComments = this.state.leadingComments; + this.state.leadingComments = []; + } + } + } + } + + if (lastChild) { + if (lastChild.leadingComments) { + if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) { + node.leadingComments = lastChild.leadingComments; + lastChild.leadingComments = null; + } else { + // A leading comment for an anonymous class had been stolen by its first ClassMethod, + // so this takes back the leading comment. + // See also: https://github.com/eslint/espree/issues/158 + for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { + if (lastChild.leadingComments[i].end <= node.start) { + node.leadingComments = lastChild.leadingComments.splice(0, i + 1); + break; + } + } + } + } + } else if (this.state.leadingComments.length > 0) { + if (last(this.state.leadingComments).end <= node.start) { + if (this.state.commentPreviousNode) { + for (j = 0; j < this.state.leadingComments.length; j++) { + if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { + this.state.leadingComments.splice(j, 1); + j--; + } + } + } + if (this.state.leadingComments.length > 0) { + node.leadingComments = this.state.leadingComments; + this.state.leadingComments = []; + } + } else { + // https://github.com/eslint/espree/issues/2 + // + // In special cases, such as return (without a value) and + // debugger, all comments will end up as leadingComments and + // will otherwise be eliminated. This step runs when the + // commentStack is empty and there are comments left + // in leadingComments. + // + // This loop figures out the stopping point between the actual + // leading and trailing comments by finding the location of the + // first comment that comes after the given node. + for (i = 0; i < this.state.leadingComments.length; i++) { + if (this.state.leadingComments[i].end > node.start) { + break; + } + } + + // Split the array based on the location of the first comment + // that comes after the node. Keep in mind that this could + // result in an empty array, and if so, the array must be + // deleted. + node.leadingComments = this.state.leadingComments.slice(0, i); + if (node.leadingComments.length === 0) { + node.leadingComments = null; + } + + // Similarly, trailing comments are attached later. The variable + // must be reset to null if there are no trailing comments. + trailingComments = this.state.leadingComments.slice(i); + if (trailingComments.length === 0) { + trailingComments = null; + } + } + } + + this.state.commentPreviousNode = node; + + if (trailingComments) { + if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) { + node.innerComments = trailingComments; + } else { + node.trailingComments = trailingComments; + } + } + + stack.push(node); + }; + + var pp$7 = Parser.prototype; + + pp$7.estreeParseRegExpLiteral = function (_ref) { + var pattern = _ref.pattern, + flags = _ref.flags; + + var regex = null; + try { + regex = new RegExp(pattern, flags); + } catch (e) { + // In environments that don't support these flags value will + // be null as the regex can't be represented natively. + } + var node = this.estreeParseLiteral(regex); + node.regex = { pattern: pattern, flags: flags }; + + return node; + }; + + pp$7.estreeParseLiteral = function (value) { + return this.parseLiteral(value, "Literal"); + }; + + pp$7.directiveToStmt = function (directive) { + var directiveLiteral = directive.value; + + var stmt = this.startNodeAt(directive.start, directive.loc.start); + var expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start); + + expression.value = directiveLiteral.value; + expression.raw = directiveLiteral.extra.raw; + + stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end); + stmt.directive = directiveLiteral.extra.raw.slice(1, -1); + + return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end); + }; + + function isSimpleProperty(node) { + return node && node.type === "Property" && node.kind === "init" && node.method === false; + } + + var estreePlugin = function estreePlugin(instance) { + instance.extend("checkDeclaration", function (inner) { + return function (node) { + if (isSimpleProperty(node)) { + this.checkDeclaration(node.value); + } else { + inner.call(this, node); + } + }; + }); + + instance.extend("checkGetterSetterParamCount", function () { + return function (prop) { + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start = prop.start; + if (prop.kind === "get") { + this.raise(start, "getter should have no params"); + } else { + this.raise(start, "setter should have exactly one param"); + } + } + }; + }); + + instance.extend("checkLVal", function (inner) { + return function (expr, isBinding, checkClashes) { + var _this = this; + + switch (expr.type) { + case "ObjectPattern": + expr.properties.forEach(function (prop) { + _this.checkLVal(prop.type === "Property" ? prop.value : prop, isBinding, checkClashes, "object destructuring pattern"); + }); + break; + default: + for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + args[_key - 3] = arguments[_key]; + } + + inner.call.apply(inner, [this, expr, isBinding, checkClashes].concat(args)); + } + }; + }); + + instance.extend("checkPropClash", function () { + return function (prop, propHash) { + if (prop.computed || !isSimpleProperty(prop)) return; + + var key = prop.key; + // It is either an Identifier or a String/NumericLiteral + var name = key.type === "Identifier" ? key.name : String(key.value); + + if (name === "__proto__") { + if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); + propHash.proto = true; + } + }; + }); + + instance.extend("isStrictBody", function () { + return function (node, isExpression) { + if (!isExpression && node.body.body.length > 0) { + for (var _iterator = node.body.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var directive = _ref2; + + if (directive.type === "ExpressionStatement" && directive.expression.type === "Literal") { + if (directive.expression.value === "use strict") return true; + } else { + // Break for the first non literal expression + break; + } + } + } + + return false; + }; + }); + + instance.extend("isValidDirective", function () { + return function (stmt) { + return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized); + }; + }); + + instance.extend("parseBlockBody", function (inner) { + return function (node) { + var _this2 = this; + + for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + inner.call.apply(inner, [this, node].concat(args)); + + node.directives.reverse().forEach(function (directive) { + node.body.unshift(_this2.directiveToStmt(directive)); + }); + delete node.directives; + }; + }); + + instance.extend("parseClassMethod", function (inner) { + return function (classBody) { + for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + args[_key3 - 1] = arguments[_key3]; + } + + inner.call.apply(inner, [this, classBody].concat(args)); + + var body = classBody.body; + body[body.length - 1].type = "MethodDefinition"; + }; + }); + + instance.extend("parseExprAtom", function (inner) { + return function () { + switch (this.state.type) { + case types.regexp: + return this.estreeParseRegExpLiteral(this.state.value); + + case types.num: + case types.string: + return this.estreeParseLiteral(this.state.value); + + case types._null: + return this.estreeParseLiteral(null); + + case types._true: + return this.estreeParseLiteral(true); + + case types._false: + return this.estreeParseLiteral(false); + + default: + for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + return inner.call.apply(inner, [this].concat(args)); + } + }; + }); + + instance.extend("parseLiteral", function (inner) { + return function () { + for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + var node = inner.call.apply(inner, [this].concat(args)); + node.raw = node.extra.raw; + delete node.extra; + + return node; + }; + }); + + instance.extend("parseMethod", function (inner) { + return function (node) { + var funcNode = this.startNode(); + funcNode.kind = node.kind; // provide kind, so inner method correctly sets state + + for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + args[_key6 - 1] = arguments[_key6]; + } + + funcNode = inner.call.apply(inner, [this, funcNode].concat(args)); + delete funcNode.kind; + node.value = this.finishNode(funcNode, "FunctionExpression"); + + return node; + }; + }); + + instance.extend("parseObjectMethod", function (inner) { + return function () { + for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + args[_key7] = arguments[_key7]; + } + + var node = inner.call.apply(inner, [this].concat(args)); + + if (node) { + if (node.kind === "method") node.kind = "init"; + node.type = "Property"; + } + + return node; + }; + }); + + instance.extend("parseObjectProperty", function (inner) { + return function () { + for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + args[_key8] = arguments[_key8]; + } + + var node = inner.call.apply(inner, [this].concat(args)); + + if (node) { + node.kind = "init"; + node.type = "Property"; + } + + return node; + }; + }); + + instance.extend("toAssignable", function (inner) { + return function (node, isBinding) { + for (var _len9 = arguments.length, args = Array(_len9 > 2 ? _len9 - 2 : 0), _key9 = 2; _key9 < _len9; _key9++) { + args[_key9 - 2] = arguments[_key9]; + } + + if (isSimpleProperty(node)) { + this.toAssignable.apply(this, [node.value, isBinding].concat(args)); + + return node; + } else if (node.type === "ObjectExpression") { + node.type = "ObjectPattern"; + for (var _iterator2 = node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var prop = _ref3; + + if (prop.kind === "get" || prop.kind === "set") { + this.raise(prop.key.start, "Object pattern can't contain getter or setter"); + } else if (prop.method) { + this.raise(prop.key.start, "Object pattern can't contain methods"); + } else { + this.toAssignable(prop, isBinding, "object destructuring pattern"); + } + } + + return node; + } + + return inner.call.apply(inner, [this, node, isBinding].concat(args)); + }; + }); + }; + + /* eslint max-len: 0 */ + + var primitiveTypes = ["any", "mixed", "empty", "bool", "boolean", "number", "string", "void", "null"]; + + var pp$8 = Parser.prototype; + + pp$8.flowParseTypeInitialiser = function (tok) { + var oldInType = this.state.inType; + this.state.inType = true; + this.expect(tok || types.colon); + + var type = this.flowParseType(); + this.state.inType = oldInType; + return type; + }; + + pp$8.flowParsePredicate = function () { + var node = this.startNode(); + var moduloLoc = this.state.startLoc; + var moduloPos = this.state.start; + this.expect(types.modulo); + var checksLoc = this.state.startLoc; + this.expectContextual("checks"); + // Force '%' and 'checks' to be adjacent + if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) { + this.raise(moduloPos, "Spaces between ´%´ and ´checks´ are not allowed here."); + } + if (this.eat(types.parenL)) { + node.expression = this.parseExpression(); + this.expect(types.parenR); + return this.finishNode(node, "DeclaredPredicate"); + } else { + return this.finishNode(node, "InferredPredicate"); + } + }; + + pp$8.flowParseTypeAndPredicateInitialiser = function () { + var oldInType = this.state.inType; + this.state.inType = true; + this.expect(types.colon); + var type = null; + var predicate = null; + if (this.match(types.modulo)) { + this.state.inType = oldInType; + predicate = this.flowParsePredicate(); + } else { + type = this.flowParseType(); + this.state.inType = oldInType; + if (this.match(types.modulo)) { + predicate = this.flowParsePredicate(); + } + } + return [type, predicate]; + }; + + pp$8.flowParseDeclareClass = function (node) { + this.next(); + this.flowParseInterfaceish(node, true); + return this.finishNode(node, "DeclareClass"); + }; + + pp$8.flowParseDeclareFunction = function (node) { + this.next(); + + var id = node.id = this.parseIdentifier(); + + var typeNode = this.startNode(); + var typeContainer = this.startNode(); + + if (this.isRelational("<")) { + typeNode.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + typeNode.typeParameters = null; + } + + this.expect(types.parenL); + var tmp = this.flowParseFunctionTypeParams(); + typeNode.params = tmp.params; + typeNode.rest = tmp.rest; + this.expect(types.parenR); + var predicate = null; + + var _flowParseTypeAndPred = this.flowParseTypeAndPredicateInitialiser(); + + typeNode.returnType = _flowParseTypeAndPred[0]; + predicate = _flowParseTypeAndPred[1]; + + typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation"); + typeContainer.predicate = predicate; + id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation"); + + this.finishNode(id, id.type); + + this.semicolon(); + + return this.finishNode(node, "DeclareFunction"); + }; + + pp$8.flowParseDeclare = function (node) { + if (this.match(types._class)) { + return this.flowParseDeclareClass(node); + } else if (this.match(types._function)) { + return this.flowParseDeclareFunction(node); + } else if (this.match(types._var)) { + return this.flowParseDeclareVariable(node); + } else if (this.isContextual("module")) { + if (this.lookahead().type === types.dot) { + return this.flowParseDeclareModuleExports(node); + } else { + return this.flowParseDeclareModule(node); + } + } else if (this.isContextual("type")) { + return this.flowParseDeclareTypeAlias(node); + } else if (this.isContextual("interface")) { + return this.flowParseDeclareInterface(node); + } else { + this.unexpected(); + } + }; + + pp$8.flowParseDeclareVariable = function (node) { + this.next(); + node.id = this.flowParseTypeAnnotatableIdentifier(); + this.semicolon(); + return this.finishNode(node, "DeclareVariable"); + }; + + pp$8.flowParseDeclareModule = function (node) { + this.next(); + + if (this.match(types.string)) { + node.id = this.parseExprAtom(); + } else { + node.id = this.parseIdentifier(); + } + + var bodyNode = node.body = this.startNode(); + var body = bodyNode.body = []; + this.expect(types.braceL); + while (!this.match(types.braceR)) { + var _bodyNode = this.startNode(); + + if (this.match(types._import)) { + var lookahead = this.lookahead(); + if (lookahead.value !== "type" && lookahead.value !== "typeof") { + this.unexpected(null, "Imports within a `declare module` body must always be `import type` or `import typeof`"); + } + + this.parseImport(_bodyNode); + } else { + this.expectContextual("declare", "Only declares and type imports are allowed inside declare module"); + + _bodyNode = this.flowParseDeclare(_bodyNode, true); + } + + body.push(_bodyNode); + } + this.expect(types.braceR); + + this.finishNode(bodyNode, "BlockStatement"); + return this.finishNode(node, "DeclareModule"); + }; + + pp$8.flowParseDeclareModuleExports = function (node) { + this.expectContextual("module"); + this.expect(types.dot); + this.expectContextual("exports"); + node.typeAnnotation = this.flowParseTypeAnnotation(); + this.semicolon(); + + return this.finishNode(node, "DeclareModuleExports"); + }; + + pp$8.flowParseDeclareTypeAlias = function (node) { + this.next(); + this.flowParseTypeAlias(node); + return this.finishNode(node, "DeclareTypeAlias"); + }; + + pp$8.flowParseDeclareInterface = function (node) { + this.next(); + this.flowParseInterfaceish(node); + return this.finishNode(node, "DeclareInterface"); + }; + + // Interfaces + + pp$8.flowParseInterfaceish = function (node) { + node.id = this.parseIdentifier(); + + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + + node.extends = []; + node.mixins = []; + + if (this.eat(types._extends)) { + do { + node.extends.push(this.flowParseInterfaceExtends()); + } while (this.eat(types.comma)); + } + + if (this.isContextual("mixins")) { + this.next(); + do { + node.mixins.push(this.flowParseInterfaceExtends()); + } while (this.eat(types.comma)); + } + + node.body = this.flowParseObjectType(true, false, false); + }; + + pp$8.flowParseInterfaceExtends = function () { + var node = this.startNode(); + + node.id = this.flowParseQualifiedTypeIdentifier(); + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } else { + node.typeParameters = null; + } + + return this.finishNode(node, "InterfaceExtends"); + }; + + pp$8.flowParseInterface = function (node) { + this.flowParseInterfaceish(node, false); + return this.finishNode(node, "InterfaceDeclaration"); + }; + + pp$8.flowParseRestrictedIdentifier = function (liberal) { + if (primitiveTypes.indexOf(this.state.value) > -1) { + this.raise(this.state.start, "Cannot overwrite primitive type " + this.state.value); + } + + return this.parseIdentifier(liberal); + }; + + // Type aliases + + pp$8.flowParseTypeAlias = function (node) { + node.id = this.flowParseRestrictedIdentifier(); + + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + + node.right = this.flowParseTypeInitialiser(types.eq); + this.semicolon(); + + return this.finishNode(node, "TypeAlias"); + }; + + // Type annotations + + pp$8.flowParseTypeParameter = function () { + var node = this.startNode(); + + var variance = this.flowParseVariance(); + + var ident = this.flowParseTypeAnnotatableIdentifier(); + node.name = ident.name; + node.variance = variance; + node.bound = ident.typeAnnotation; + + if (this.match(types.eq)) { + this.eat(types.eq); + node.default = this.flowParseType(); + } + + return this.finishNode(node, "TypeParameter"); + }; + + pp$8.flowParseTypeParameterDeclaration = function () { + var oldInType = this.state.inType; + var node = this.startNode(); + node.params = []; + + this.state.inType = true; + + // istanbul ignore else: this condition is already checked at all call sites + if (this.isRelational("<") || this.match(types.jsxTagStart)) { + this.next(); + } else { + this.unexpected(); + } + + do { + node.params.push(this.flowParseTypeParameter()); + if (!this.isRelational(">")) { + this.expect(types.comma); + } + } while (!this.isRelational(">")); + this.expectRelational(">"); + + this.state.inType = oldInType; + + return this.finishNode(node, "TypeParameterDeclaration"); + }; + + pp$8.flowParseTypeParameterInstantiation = function () { + var node = this.startNode(); + var oldInType = this.state.inType; + node.params = []; + + this.state.inType = true; + + this.expectRelational("<"); + while (!this.isRelational(">")) { + node.params.push(this.flowParseType()); + if (!this.isRelational(">")) { + this.expect(types.comma); + } + } + this.expectRelational(">"); + + this.state.inType = oldInType; + + return this.finishNode(node, "TypeParameterInstantiation"); + }; + + pp$8.flowParseObjectPropertyKey = function () { + return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true); + }; + + pp$8.flowParseObjectTypeIndexer = function (node, isStatic, variance) { + node.static = isStatic; + + this.expect(types.bracketL); + if (this.lookahead().type === types.colon) { + node.id = this.flowParseObjectPropertyKey(); + node.key = this.flowParseTypeInitialiser(); + } else { + node.id = null; + node.key = this.flowParseType(); + } + this.expect(types.bracketR); + node.value = this.flowParseTypeInitialiser(); + node.variance = variance; + + this.flowObjectTypeSemicolon(); + return this.finishNode(node, "ObjectTypeIndexer"); + }; + + pp$8.flowParseObjectTypeMethodish = function (node) { + node.params = []; + node.rest = null; + node.typeParameters = null; + + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + + this.expect(types.parenL); + while (!this.match(types.parenR) && !this.match(types.ellipsis)) { + node.params.push(this.flowParseFunctionTypeParam()); + if (!this.match(types.parenR)) { + this.expect(types.comma); + } + } + + if (this.eat(types.ellipsis)) { + node.rest = this.flowParseFunctionTypeParam(); + } + this.expect(types.parenR); + node.returnType = this.flowParseTypeInitialiser(); + + return this.finishNode(node, "FunctionTypeAnnotation"); + }; + + pp$8.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) { + var node = this.startNodeAt(startPos, startLoc); + node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc)); + node.static = isStatic; + node.key = key; + node.optional = false; + this.flowObjectTypeSemicolon(); + return this.finishNode(node, "ObjectTypeProperty"); + }; + + pp$8.flowParseObjectTypeCallProperty = function (node, isStatic) { + var valueNode = this.startNode(); + node.static = isStatic; + node.value = this.flowParseObjectTypeMethodish(valueNode); + this.flowObjectTypeSemicolon(); + return this.finishNode(node, "ObjectTypeCallProperty"); + }; + + pp$8.flowParseObjectType = function (allowStatic, allowExact, allowSpread) { + var oldInType = this.state.inType; + this.state.inType = true; + + var nodeStart = this.startNode(); + var node = void 0; + var propertyKey = void 0; + var isStatic = false; + + nodeStart.callProperties = []; + nodeStart.properties = []; + nodeStart.indexers = []; + + var endDelim = void 0; + var exact = void 0; + if (allowExact && this.match(types.braceBarL)) { + this.expect(types.braceBarL); + endDelim = types.braceBarR; + exact = true; + } else { + this.expect(types.braceL); + endDelim = types.braceR; + exact = false; + } + + nodeStart.exact = exact; + + while (!this.match(endDelim)) { + var optional = false; + var startPos = this.state.start; + var startLoc = this.state.startLoc; + node = this.startNode(); + if (allowStatic && this.isContextual("static") && this.lookahead().type !== types.colon) { + this.next(); + isStatic = true; + } + + var variancePos = this.state.start; + var variance = this.flowParseVariance(); + + if (this.match(types.bracketL)) { + nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance)); + } else if (this.match(types.parenL) || this.isRelational("<")) { + if (variance) { + this.unexpected(variancePos); + } + nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic)); + } else { + if (this.match(types.ellipsis)) { + if (!allowSpread) { + this.unexpected(null, "Spread operator cannot appear in class or interface definitions"); + } + if (variance) { + this.unexpected(variance.start, "Spread properties cannot have variance"); + } + this.expect(types.ellipsis); + node.argument = this.flowParseType(); + this.flowObjectTypeSemicolon(); + nodeStart.properties.push(this.finishNode(node, "ObjectTypeSpreadProperty")); + } else { + propertyKey = this.flowParseObjectPropertyKey(); + if (this.isRelational("<") || this.match(types.parenL)) { + // This is a method property + if (variance) { + this.unexpected(variance.start); + } + nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey)); + } else { + if (this.eat(types.question)) { + optional = true; + } + node.key = propertyKey; + node.value = this.flowParseTypeInitialiser(); + node.optional = optional; + node.static = isStatic; + node.variance = variance; + this.flowObjectTypeSemicolon(); + nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty")); + } + } + } + + isStatic = false; + } + + this.expect(endDelim); + + var out = this.finishNode(nodeStart, "ObjectTypeAnnotation"); + + this.state.inType = oldInType; + + return out; + }; + + pp$8.flowObjectTypeSemicolon = function () { + if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) { + this.unexpected(); + } + }; + + pp$8.flowParseQualifiedTypeIdentifier = function (startPos, startLoc, id) { + startPos = startPos || this.state.start; + startLoc = startLoc || this.state.startLoc; + var node = id || this.parseIdentifier(); + + while (this.eat(types.dot)) { + var node2 = this.startNodeAt(startPos, startLoc); + node2.qualification = node; + node2.id = this.parseIdentifier(); + node = this.finishNode(node2, "QualifiedTypeIdentifier"); + } + + return node; + }; + + pp$8.flowParseGenericType = function (startPos, startLoc, id) { + var node = this.startNodeAt(startPos, startLoc); + + node.typeParameters = null; + node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id); + + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } + + return this.finishNode(node, "GenericTypeAnnotation"); + }; + + pp$8.flowParseTypeofType = function () { + var node = this.startNode(); + this.expect(types._typeof); + node.argument = this.flowParsePrimaryType(); + return this.finishNode(node, "TypeofTypeAnnotation"); + }; + + pp$8.flowParseTupleType = function () { + var node = this.startNode(); + node.types = []; + this.expect(types.bracketL); + // We allow trailing commas + while (this.state.pos < this.input.length && !this.match(types.bracketR)) { + node.types.push(this.flowParseType()); + if (this.match(types.bracketR)) break; + this.expect(types.comma); + } + this.expect(types.bracketR); + return this.finishNode(node, "TupleTypeAnnotation"); + }; + + pp$8.flowParseFunctionTypeParam = function () { + var name = null; + var optional = false; + var typeAnnotation = null; + var node = this.startNode(); + var lh = this.lookahead(); + if (lh.type === types.colon || lh.type === types.question) { + name = this.parseIdentifier(); + if (this.eat(types.question)) { + optional = true; + } + typeAnnotation = this.flowParseTypeInitialiser(); + } else { + typeAnnotation = this.flowParseType(); + } + node.name = name; + node.optional = optional; + node.typeAnnotation = typeAnnotation; + return this.finishNode(node, "FunctionTypeParam"); + }; + + pp$8.reinterpretTypeAsFunctionTypeParam = function (type) { + var node = this.startNodeAt(type.start, type.loc); + node.name = null; + node.optional = false; + node.typeAnnotation = type; + return this.finishNode(node, "FunctionTypeParam"); + }; + + pp$8.flowParseFunctionTypeParams = function () { + var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + var ret = { params: params, rest: null }; + while (!this.match(types.parenR) && !this.match(types.ellipsis)) { + ret.params.push(this.flowParseFunctionTypeParam()); + if (!this.match(types.parenR)) { + this.expect(types.comma); + } + } + if (this.eat(types.ellipsis)) { + ret.rest = this.flowParseFunctionTypeParam(); + } + return ret; + }; + + pp$8.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) { + switch (id.name) { + case "any": + return this.finishNode(node, "AnyTypeAnnotation"); + + case "void": + return this.finishNode(node, "VoidTypeAnnotation"); + + case "bool": + case "boolean": + return this.finishNode(node, "BooleanTypeAnnotation"); + + case "mixed": + return this.finishNode(node, "MixedTypeAnnotation"); + + case "empty": + return this.finishNode(node, "EmptyTypeAnnotation"); + + case "number": + return this.finishNode(node, "NumberTypeAnnotation"); + + case "string": + return this.finishNode(node, "StringTypeAnnotation"); + + default: + return this.flowParseGenericType(startPos, startLoc, id); + } + }; + + // The parsing of types roughly parallels the parsing of expressions, and + // primary types are kind of like primary expressions...they're the + // primitives with which other types are constructed. + pp$8.flowParsePrimaryType = function () { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var node = this.startNode(); + var tmp = void 0; + var type = void 0; + var isGroupedType = false; + var oldNoAnonFunctionType = this.state.noAnonFunctionType; + + switch (this.state.type) { + case types.name: + return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier()); + + case types.braceL: + return this.flowParseObjectType(false, false, true); + + case types.braceBarL: + return this.flowParseObjectType(false, true, true); + + case types.bracketL: + return this.flowParseTupleType(); + + case types.relational: + if (this.state.value === "<") { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + this.expect(types.parenL); + tmp = this.flowParseFunctionTypeParams(); + node.params = tmp.params; + node.rest = tmp.rest; + this.expect(types.parenR); + + this.expect(types.arrow); + + node.returnType = this.flowParseType(); + + return this.finishNode(node, "FunctionTypeAnnotation"); + } + break; + + case types.parenL: + this.next(); + + // Check to see if this is actually a grouped type + if (!this.match(types.parenR) && !this.match(types.ellipsis)) { + if (this.match(types.name)) { + var token = this.lookahead().type; + isGroupedType = token !== types.question && token !== types.colon; + } else { + isGroupedType = true; + } + } + + if (isGroupedType) { + this.state.noAnonFunctionType = false; + type = this.flowParseType(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + + // A `,` or a `) =>` means this is an anonymous function type + if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) { + this.expect(types.parenR); + return type; + } else { + // Eat a comma if there is one + this.eat(types.comma); + } + } + + if (type) { + tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]); + } else { + tmp = this.flowParseFunctionTypeParams(); + } + + node.params = tmp.params; + node.rest = tmp.rest; + + this.expect(types.parenR); + + this.expect(types.arrow); + + node.returnType = this.flowParseType(); + + node.typeParameters = null; + + return this.finishNode(node, "FunctionTypeAnnotation"); + + case types.string: + return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation"); + + case types._true:case types._false: + node.value = this.match(types._true); + this.next(); + return this.finishNode(node, "BooleanLiteralTypeAnnotation"); + + case types.plusMin: + if (this.state.value === "-") { + this.next(); + if (!this.match(types.num)) this.unexpected(null, "Unexpected token, expected number"); + + return this.parseLiteral(-this.state.value, "NumericLiteralTypeAnnotation", node.start, node.loc.start); + } + + this.unexpected(); + case types.num: + return this.parseLiteral(this.state.value, "NumericLiteralTypeAnnotation"); + + case types._null: + node.value = this.match(types._null); + this.next(); + return this.finishNode(node, "NullLiteralTypeAnnotation"); + + case types._this: + node.value = this.match(types._this); + this.next(); + return this.finishNode(node, "ThisTypeAnnotation"); + + case types.star: + this.next(); + return this.finishNode(node, "ExistentialTypeParam"); + + default: + if (this.state.type.keyword === "typeof") { + return this.flowParseTypeofType(); + } + } + + this.unexpected(); + }; + + pp$8.flowParsePostfixType = function () { + var startPos = this.state.start, + startLoc = this.state.startLoc; + var type = this.flowParsePrimaryType(); + while (!this.canInsertSemicolon() && this.match(types.bracketL)) { + var node = this.startNodeAt(startPos, startLoc); + node.elementType = type; + this.expect(types.bracketL); + this.expect(types.bracketR); + type = this.finishNode(node, "ArrayTypeAnnotation"); + } + return type; + }; + + pp$8.flowParsePrefixType = function () { + var node = this.startNode(); + if (this.eat(types.question)) { + node.typeAnnotation = this.flowParsePrefixType(); + return this.finishNode(node, "NullableTypeAnnotation"); + } else { + return this.flowParsePostfixType(); + } + }; + + pp$8.flowParseAnonFunctionWithoutParens = function () { + var param = this.flowParsePrefixType(); + if (!this.state.noAnonFunctionType && this.eat(types.arrow)) { + var node = this.startNodeAt(param.start, param.loc); + node.params = [this.reinterpretTypeAsFunctionTypeParam(param)]; + node.rest = null; + node.returnType = this.flowParseType(); + node.typeParameters = null; + return this.finishNode(node, "FunctionTypeAnnotation"); + } + return param; + }; + + pp$8.flowParseIntersectionType = function () { + var node = this.startNode(); + this.eat(types.bitwiseAND); + var type = this.flowParseAnonFunctionWithoutParens(); + node.types = [type]; + while (this.eat(types.bitwiseAND)) { + node.types.push(this.flowParseAnonFunctionWithoutParens()); + } + return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); + }; + + pp$8.flowParseUnionType = function () { + var node = this.startNode(); + this.eat(types.bitwiseOR); + var type = this.flowParseIntersectionType(); + node.types = [type]; + while (this.eat(types.bitwiseOR)) { + node.types.push(this.flowParseIntersectionType()); + } + return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation"); + }; + + pp$8.flowParseType = function () { + var oldInType = this.state.inType; + this.state.inType = true; + var type = this.flowParseUnionType(); + this.state.inType = oldInType; + return type; + }; + + pp$8.flowParseTypeAnnotation = function () { + var node = this.startNode(); + node.typeAnnotation = this.flowParseTypeInitialiser(); + return this.finishNode(node, "TypeAnnotation"); + }; + + pp$8.flowParseTypeAndPredicateAnnotation = function () { + var node = this.startNode(); + + var _flowParseTypeAndPred2 = this.flowParseTypeAndPredicateInitialiser(); + + node.typeAnnotation = _flowParseTypeAndPred2[0]; + node.predicate = _flowParseTypeAndPred2[1]; + + return this.finishNode(node, "TypeAnnotation"); + }; + + pp$8.flowParseTypeAnnotatableIdentifier = function () { + var ident = this.flowParseRestrictedIdentifier(); + if (this.match(types.colon)) { + ident.typeAnnotation = this.flowParseTypeAnnotation(); + this.finishNode(ident, ident.type); + } + return ident; + }; + + pp$8.typeCastToParameter = function (node) { + node.expression.typeAnnotation = node.typeAnnotation; + + return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end); + }; + + pp$8.flowParseVariance = function () { + var variance = null; + if (this.match(types.plusMin)) { + if (this.state.value === "+") { + variance = "plus"; + } else if (this.state.value === "-") { + variance = "minus"; + } + this.next(); + } + return variance; + }; + + var flowPlugin = function flowPlugin(instance) { + // plain function return types: function name(): string {} + instance.extend("parseFunctionBody", function (inner) { + return function (node, allowExpression) { + if (this.match(types.colon) && !allowExpression) { + // if allowExpression is true then we're parsing an arrow function and if + // there's a return type then it's been handled elsewhere + node.returnType = this.flowParseTypeAndPredicateAnnotation(); + } + + return inner.call(this, node, allowExpression); + }; + }); + + // interfaces + instance.extend("parseStatement", function (inner) { + return function (declaration, topLevel) { + // strict mode handling of `interface` since it's a reserved word + if (this.state.strict && this.match(types.name) && this.state.value === "interface") { + var node = this.startNode(); + this.next(); + return this.flowParseInterface(node); + } else { + return inner.call(this, declaration, topLevel); + } + }; + }); + + // declares, interfaces and type aliases + instance.extend("parseExpressionStatement", function (inner) { + return function (node, expr) { + if (expr.type === "Identifier") { + if (expr.name === "declare") { + if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var)) { + return this.flowParseDeclare(node); + } + } else if (this.match(types.name)) { + if (expr.name === "interface") { + return this.flowParseInterface(node); + } else if (expr.name === "type") { + return this.flowParseTypeAlias(node); + } + } + } + + return inner.call(this, node, expr); + }; + }); + + // export type + instance.extend("shouldParseExportDeclaration", function (inner) { + return function () { + return this.isContextual("type") || this.isContextual("interface") || inner.call(this); + }; + }); + + instance.extend("isExportDefaultSpecifier", function (inner) { + return function () { + if (this.match(types.name) && (this.state.value === "type" || this.state.value === "interface")) { + return false; + } + + return inner.call(this); + }; + }); + + instance.extend("parseConditional", function (inner) { + return function (expr, noIn, startPos, startLoc, refNeedsArrowPos) { + // only do the expensive clone if there is a question mark + // and if we come from inside parens + if (refNeedsArrowPos && this.match(types.question)) { + var state = this.state.clone(); + try { + return inner.call(this, expr, noIn, startPos, startLoc); + } catch (err) { + if (err instanceof SyntaxError) { + this.state = state; + refNeedsArrowPos.start = err.pos || this.state.start; + return expr; + } else { + // istanbul ignore next: no such error is expected + throw err; + } + } + } + + return inner.call(this, expr, noIn, startPos, startLoc); + }; + }); + + instance.extend("parseParenItem", function (inner) { + return function (node, startPos, startLoc) { + node = inner.call(this, node, startPos, startLoc); + if (this.eat(types.question)) { + node.optional = true; + } + + if (this.match(types.colon)) { + var typeCastNode = this.startNodeAt(startPos, startLoc); + typeCastNode.expression = node; + typeCastNode.typeAnnotation = this.flowParseTypeAnnotation(); + + return this.finishNode(typeCastNode, "TypeCastExpression"); + } + + return node; + }; + }); + + instance.extend("parseExport", function (inner) { + return function (node) { + node = inner.call(this, node); + if (node.type === "ExportNamedDeclaration") { + node.exportKind = node.exportKind || "value"; + } + return node; + }; + }); + + instance.extend("parseExportDeclaration", function (inner) { + return function (node) { + if (this.isContextual("type")) { + node.exportKind = "type"; + + var declarationNode = this.startNode(); + this.next(); + + if (this.match(types.braceL)) { + // export type { foo, bar }; + node.specifiers = this.parseExportSpecifiers(); + this.parseExportFrom(node); + return null; + } else { + // export type Foo = Bar; + return this.flowParseTypeAlias(declarationNode); + } + } else if (this.isContextual("interface")) { + node.exportKind = "type"; + var _declarationNode = this.startNode(); + this.next(); + return this.flowParseInterface(_declarationNode); + } else { + return inner.call(this, node); + } + }; + }); + + instance.extend("parseClassId", function (inner) { + return function (node) { + inner.apply(this, arguments); + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + }; + }); + + // don't consider `void` to be a keyword as then it'll use the void token type + // and set startExpr + instance.extend("isKeyword", function (inner) { + return function (name) { + if (this.state.inType && name === "void") { + return false; + } else { + return inner.call(this, name); + } + }; + }); + + // ensure that inside flow types, we bypass the jsx parser plugin + instance.extend("readToken", function (inner) { + return function (code) { + if (this.state.inType && (code === 62 || code === 60)) { + return this.finishOp(types.relational, 1); + } else { + return inner.call(this, code); + } + }; + }); + + // don't lex any token as a jsx one inside a flow type + instance.extend("jsx_readToken", function (inner) { + return function () { + if (!this.state.inType) return inner.call(this); + }; + }); + + instance.extend("toAssignable", function (inner) { + return function (node, isBinding, contextDescription) { + if (node.type === "TypeCastExpression") { + return inner.call(this, this.typeCastToParameter(node), isBinding, contextDescription); + } else { + return inner.call(this, node, isBinding, contextDescription); + } + }; + }); + + // turn type casts that we found in function parameter head into type annotated params + instance.extend("toAssignableList", function (inner) { + return function (exprList, isBinding, contextDescription) { + for (var i = 0; i < exprList.length; i++) { + var expr = exprList[i]; + if (expr && expr.type === "TypeCastExpression") { + exprList[i] = this.typeCastToParameter(expr); + } + } + return inner.call(this, exprList, isBinding, contextDescription); + }; + }); + + // this is a list of nodes, from something like a call expression, we need to filter the + // type casts that we've found that are illegal in this context + instance.extend("toReferencedList", function () { + return function (exprList) { + for (var i = 0; i < exprList.length; i++) { + var expr = exprList[i]; + if (expr && expr._exprListItem && expr.type === "TypeCastExpression") { + this.raise(expr.start, "Unexpected type cast"); + } + } + + return exprList; + }; + }); + + // parse an item inside a expression list eg. `(NODE, NODE)` where NODE represents + // the position where this function is called + instance.extend("parseExprListItem", function (inner) { + return function () { + var container = this.startNode(); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var node = inner.call.apply(inner, [this].concat(args)); + if (this.match(types.colon)) { + container._exprListItem = true; + container.expression = node; + container.typeAnnotation = this.flowParseTypeAnnotation(); + return this.finishNode(container, "TypeCastExpression"); + } else { + return node; + } + }; + }); + + instance.extend("checkLVal", function (inner) { + return function (node) { + if (node.type !== "TypeCastExpression") { + return inner.apply(this, arguments); + } + }; + }); + + // parse class property type annotations + instance.extend("parseClassProperty", function (inner) { + return function (node) { + delete node.variancePos; + if (this.match(types.colon)) { + node.typeAnnotation = this.flowParseTypeAnnotation(); + } + return inner.call(this, node); + }; + }); + + // determine whether or not we're currently in the position where a class method would appear + instance.extend("isClassMethod", function (inner) { + return function () { + return this.isRelational("<") || inner.call(this); + }; + }); + + // determine whether or not we're currently in the position where a class property would appear + instance.extend("isClassProperty", function (inner) { + return function () { + return this.match(types.colon) || inner.call(this); + }; + }); + + instance.extend("isNonstaticConstructor", function (inner) { + return function (method) { + return !this.match(types.colon) && inner.call(this, method); + }; + }); + + // parse type parameters for class methods + instance.extend("parseClassMethod", function (inner) { + return function (classBody, method) { + if (method.variance) { + this.unexpected(method.variancePos); + } + delete method.variance; + delete method.variancePos; + if (this.isRelational("<")) { + method.typeParameters = this.flowParseTypeParameterDeclaration(); + } + + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + inner.call.apply(inner, [this, classBody, method].concat(args)); + }; + }); + + // parse a the super class type parameters and implements + instance.extend("parseClassSuper", function (inner) { + return function (node, isStatement) { + inner.call(this, node, isStatement); + if (node.superClass && this.isRelational("<")) { + node.superTypeParameters = this.flowParseTypeParameterInstantiation(); + } + if (this.isContextual("implements")) { + this.next(); + var implemented = node.implements = []; + do { + var _node = this.startNode(); + _node.id = this.parseIdentifier(); + if (this.isRelational("<")) { + _node.typeParameters = this.flowParseTypeParameterInstantiation(); + } else { + _node.typeParameters = null; + } + implemented.push(this.finishNode(_node, "ClassImplements")); + } while (this.eat(types.comma)); + } + }; + }); + + instance.extend("parsePropertyName", function (inner) { + return function (node) { + var variancePos = this.state.start; + var variance = this.flowParseVariance(); + var key = inner.call(this, node); + node.variance = variance; + node.variancePos = variancePos; + return key; + }; + }); + + // parse type parameters for object method shorthand + instance.extend("parseObjPropValue", function (inner) { + return function (prop) { + if (prop.variance) { + this.unexpected(prop.variancePos); + } + delete prop.variance; + delete prop.variancePos; + + var typeParameters = void 0; + + // method shorthand + if (this.isRelational("<")) { + typeParameters = this.flowParseTypeParameterDeclaration(); + if (!this.match(types.parenL)) this.unexpected(); + } + + inner.apply(this, arguments); + + // add typeParameters if we found them + if (typeParameters) { + (prop.value || prop).typeParameters = typeParameters; + } + }; + }); + + instance.extend("parseAssignableListItemTypes", function () { + return function (param) { + if (this.eat(types.question)) { + param.optional = true; + } + if (this.match(types.colon)) { + param.typeAnnotation = this.flowParseTypeAnnotation(); + } + this.finishNode(param, param.type); + return param; + }; + }); + + instance.extend("parseMaybeDefault", function (inner) { + return function () { + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + var node = inner.apply(this, args); + + if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { + this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`"); + } + + return node; + }; + }); + + // parse typeof and type imports + instance.extend("parseImportSpecifiers", function (inner) { + return function (node) { + node.importKind = "value"; + + var kind = null; + if (this.match(types._typeof)) { + kind = "typeof"; + } else if (this.isContextual("type")) { + kind = "type"; + } + if (kind) { + var lh = this.lookahead(); + if (lh.type === types.name && lh.value !== "from" || lh.type === types.braceL || lh.type === types.star) { + this.next(); + node.importKind = kind; + } + } + + inner.call(this, node); + }; + }); + + // parse import-type/typeof shorthand + instance.extend("parseImportSpecifier", function () { + return function (node) { + var specifier = this.startNode(); + var firstIdentLoc = this.state.start; + var firstIdent = this.parseIdentifier(true); + + var specifierTypeKind = null; + if (firstIdent.name === "type") { + specifierTypeKind = "type"; + } else if (firstIdent.name === "typeof") { + specifierTypeKind = "typeof"; + } + + var isBinding = false; + if (this.isContextual("as")) { + var as_ident = this.parseIdentifier(true); + if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) { + // `import {type as ,` or `import {type as }` + specifier.imported = as_ident; + specifier.importKind = specifierTypeKind; + specifier.local = as_ident.__clone(); + } else { + // `import {type as foo` + specifier.imported = firstIdent; + specifier.importKind = null; + specifier.local = this.parseIdentifier(); + } + } else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) { + // `import {type foo` + specifier.imported = this.parseIdentifier(true); + specifier.importKind = specifierTypeKind; + if (this.eatContextual("as")) { + specifier.local = this.parseIdentifier(); + } else { + isBinding = true; + specifier.local = specifier.imported.__clone(); + } + } else { + isBinding = true; + specifier.imported = firstIdent; + specifier.importKind = null; + specifier.local = specifier.imported.__clone(); + } + + if ((node.importKind === "type" || node.importKind === "typeof") && (specifier.importKind === "type" || specifier.importKind === "typeof")) { + this.raise(firstIdentLoc, "`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements`"); + } + + if (isBinding) this.checkReservedWord(specifier.local.name, specifier.start, true, true); + + this.checkLVal(specifier.local, true, undefined, "import specifier"); + node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); + }; + }); + + // parse function type parameters - function foo<T>() {} + instance.extend("parseFunctionParams", function (inner) { + return function (node) { + if (this.isRelational("<")) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + inner.call(this, node); + }; + }); + + // parse flow type annotations on variable declarator heads - let foo: string = bar + instance.extend("parseVarHead", function (inner) { + return function (decl) { + inner.call(this, decl); + if (this.match(types.colon)) { + decl.id.typeAnnotation = this.flowParseTypeAnnotation(); + this.finishNode(decl.id, decl.id.type); + } + }; + }); + + // parse the return type of an async arrow function - let foo = (async (): number => {}); + instance.extend("parseAsyncArrowFromCallExpression", function (inner) { + return function (node, call) { + if (this.match(types.colon)) { + var oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = true; + node.returnType = this.flowParseTypeAnnotation(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + } + + return inner.call(this, node, call); + }; + }); + + // todo description + instance.extend("shouldParseAsyncArrow", function (inner) { + return function () { + return this.match(types.colon) || inner.call(this); + }; + }); + + // We need to support type parameter declarations for arrow functions. This + // is tricky. There are three situations we need to handle + // + // 1. This is either JSX or an arrow function. We'll try JSX first. If that + // fails, we'll try an arrow function. If that fails, we'll throw the JSX + // error. + // 2. This is an arrow function. We'll parse the type parameter declaration, + // parse the rest, make sure the rest is an arrow function, and go from + // there + // 3. This is neither. Just call the inner function + instance.extend("parseMaybeAssign", function (inner) { + return function () { + var jsxError = null; + + for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + if (types.jsxTagStart && this.match(types.jsxTagStart)) { + var state = this.state.clone(); + try { + return inner.apply(this, args); + } catch (err) { + if (err instanceof SyntaxError) { + this.state = state; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + this.state.context.length -= 2; + + jsxError = err; + } else { + // istanbul ignore next: no such error is expected + throw err; + } + } + } + + if (jsxError != null || this.isRelational("<")) { + var arrowExpression = void 0; + var typeParameters = void 0; + try { + typeParameters = this.flowParseTypeParameterDeclaration(); + + arrowExpression = inner.apply(this, args); + arrowExpression.typeParameters = typeParameters; + arrowExpression.start = typeParameters.start; + arrowExpression.loc.start = typeParameters.loc.start; + } catch (err) { + throw jsxError || err; + } + + if (arrowExpression.type === "ArrowFunctionExpression") { + return arrowExpression; + } else if (jsxError != null) { + throw jsxError; + } else { + this.raise(typeParameters.start, "Expected an arrow function after this type parameter declaration"); + } + } + + return inner.apply(this, args); + }; + }); + + // handle return types for arrow functions + instance.extend("parseArrow", function (inner) { + return function (node) { + if (this.match(types.colon)) { + var state = this.state.clone(); + try { + var oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = true; + var returnType = this.flowParseTypeAndPredicateAnnotation(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + + if (this.canInsertSemicolon()) this.unexpected(); + if (!this.match(types.arrow)) this.unexpected(); + // assign after it is clear it is an arrow + node.returnType = returnType; + } catch (err) { + if (err instanceof SyntaxError) { + this.state = state; + } else { + // istanbul ignore next: no such error is expected + throw err; + } + } + } + + return inner.call(this, node); + }; + }); + + instance.extend("shouldParseArrow", function (inner) { + return function () { + return this.match(types.colon) || inner.call(this); + }; + }); + }; + + // Adapted from String.fromcodepoint to export the function without modifying String + /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */ + + // The MIT License (MIT) + // Copyright (c) Mathias Bynens + // + // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + // associated documentation files (the "Software"), to deal in the Software without restriction, + // including without limitation the rights to use, copy, modify, merge, publish, distribute, + // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in all copies or + // substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT + // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + var fromCodePoint = String.fromCodePoint; + + if (!fromCodePoint) { + var stringFromCharCode = String.fromCharCode; + var floor = Math.floor; + fromCodePoint = function fromCodePoint() { + var MAX_SIZE = 0x4000; + var codeUnits = []; + var highSurrogate = void 0; + var lowSurrogate = void 0; + var index = -1; + var length = arguments.length; + if (!length) { + return ""; + } + var result = ""; + while (++index < length) { + var codePoint = Number(arguments[index]); + if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` + codePoint < 0 || // not a valid Unicode code point + codePoint > 0x10FFFF || // not a valid Unicode code point + floor(codePoint) != codePoint // not an integer + ) { + throw RangeError("Invalid code point: " + codePoint); + } + if (codePoint <= 0xFFFF) { + // BMP code point + codeUnits.push(codePoint); + } else { + // Astral code point; split in surrogate halves + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + codePoint -= 0x10000; + highSurrogate = (codePoint >> 10) + 0xD800; + lowSurrogate = codePoint % 0x400 + 0xDC00; + codeUnits.push(highSurrogate, lowSurrogate); + } + if (index + 1 == length || codeUnits.length > MAX_SIZE) { + result += stringFromCharCode.apply(null, codeUnits); + codeUnits.length = 0; + } + } + return result; + }; + } + + var fromCodePoint$1 = fromCodePoint; + + var XHTMLEntities = { + quot: "\"", + amp: "&", + apos: "'", + lt: "<", + gt: ">", + nbsp: "\xA0", + iexcl: "\xA1", + cent: "\xA2", + pound: "\xA3", + curren: "\xA4", + yen: "\xA5", + brvbar: "\xA6", + sect: "\xA7", + uml: "\xA8", + copy: "\xA9", + ordf: "\xAA", + laquo: "\xAB", + not: "\xAC", + shy: "\xAD", + reg: "\xAE", + macr: "\xAF", + deg: "\xB0", + plusmn: "\xB1", + sup2: "\xB2", + sup3: "\xB3", + acute: "\xB4", + micro: "\xB5", + para: "\xB6", + middot: "\xB7", + cedil: "\xB8", + sup1: "\xB9", + ordm: "\xBA", + raquo: "\xBB", + frac14: "\xBC", + frac12: "\xBD", + frac34: "\xBE", + iquest: "\xBF", + Agrave: "\xC0", + Aacute: "\xC1", + Acirc: "\xC2", + Atilde: "\xC3", + Auml: "\xC4", + Aring: "\xC5", + AElig: "\xC6", + Ccedil: "\xC7", + Egrave: "\xC8", + Eacute: "\xC9", + Ecirc: "\xCA", + Euml: "\xCB", + Igrave: "\xCC", + Iacute: "\xCD", + Icirc: "\xCE", + Iuml: "\xCF", + ETH: "\xD0", + Ntilde: "\xD1", + Ograve: "\xD2", + Oacute: "\xD3", + Ocirc: "\xD4", + Otilde: "\xD5", + Ouml: "\xD6", + times: "\xD7", + Oslash: "\xD8", + Ugrave: "\xD9", + Uacute: "\xDA", + Ucirc: "\xDB", + Uuml: "\xDC", + Yacute: "\xDD", + THORN: "\xDE", + szlig: "\xDF", + agrave: "\xE0", + aacute: "\xE1", + acirc: "\xE2", + atilde: "\xE3", + auml: "\xE4", + aring: "\xE5", + aelig: "\xE6", + ccedil: "\xE7", + egrave: "\xE8", + eacute: "\xE9", + ecirc: "\xEA", + euml: "\xEB", + igrave: "\xEC", + iacute: "\xED", + icirc: "\xEE", + iuml: "\xEF", + eth: "\xF0", + ntilde: "\xF1", + ograve: "\xF2", + oacute: "\xF3", + ocirc: "\xF4", + otilde: "\xF5", + ouml: "\xF6", + divide: "\xF7", + oslash: "\xF8", + ugrave: "\xF9", + uacute: "\xFA", + ucirc: "\xFB", + uuml: "\xFC", + yacute: "\xFD", + thorn: "\xFE", + yuml: "\xFF", + OElig: '\u0152', + oelig: '\u0153', + Scaron: '\u0160', + scaron: '\u0161', + Yuml: '\u0178', + fnof: '\u0192', + circ: '\u02C6', + tilde: '\u02DC', + Alpha: '\u0391', + Beta: '\u0392', + Gamma: '\u0393', + Delta: '\u0394', + Epsilon: '\u0395', + Zeta: '\u0396', + Eta: '\u0397', + Theta: '\u0398', + Iota: '\u0399', + Kappa: '\u039A', + Lambda: '\u039B', + Mu: '\u039C', + Nu: '\u039D', + Xi: '\u039E', + Omicron: '\u039F', + Pi: '\u03A0', + Rho: '\u03A1', + Sigma: '\u03A3', + Tau: '\u03A4', + Upsilon: '\u03A5', + Phi: '\u03A6', + Chi: '\u03A7', + Psi: '\u03A8', + Omega: '\u03A9', + alpha: '\u03B1', + beta: '\u03B2', + gamma: '\u03B3', + delta: '\u03B4', + epsilon: '\u03B5', + zeta: '\u03B6', + eta: '\u03B7', + theta: '\u03B8', + iota: '\u03B9', + kappa: '\u03BA', + lambda: '\u03BB', + mu: '\u03BC', + nu: '\u03BD', + xi: '\u03BE', + omicron: '\u03BF', + pi: '\u03C0', + rho: '\u03C1', + sigmaf: '\u03C2', + sigma: '\u03C3', + tau: '\u03C4', + upsilon: '\u03C5', + phi: '\u03C6', + chi: '\u03C7', + psi: '\u03C8', + omega: '\u03C9', + thetasym: '\u03D1', + upsih: '\u03D2', + piv: '\u03D6', + ensp: '\u2002', + emsp: '\u2003', + thinsp: '\u2009', + zwnj: '\u200C', + zwj: '\u200D', + lrm: '\u200E', + rlm: '\u200F', + ndash: '\u2013', + mdash: '\u2014', + lsquo: '\u2018', + rsquo: '\u2019', + sbquo: '\u201A', + ldquo: '\u201C', + rdquo: '\u201D', + bdquo: '\u201E', + dagger: '\u2020', + Dagger: '\u2021', + bull: '\u2022', + hellip: '\u2026', + permil: '\u2030', + prime: '\u2032', + Prime: '\u2033', + lsaquo: '\u2039', + rsaquo: '\u203A', + oline: '\u203E', + frasl: '\u2044', + euro: '\u20AC', + image: '\u2111', + weierp: '\u2118', + real: '\u211C', + trade: '\u2122', + alefsym: '\u2135', + larr: '\u2190', + uarr: '\u2191', + rarr: '\u2192', + darr: '\u2193', + harr: '\u2194', + crarr: '\u21B5', + lArr: '\u21D0', + uArr: '\u21D1', + rArr: '\u21D2', + dArr: '\u21D3', + hArr: '\u21D4', + forall: '\u2200', + part: '\u2202', + exist: '\u2203', + empty: '\u2205', + nabla: '\u2207', + isin: '\u2208', + notin: '\u2209', + ni: '\u220B', + prod: '\u220F', + sum: '\u2211', + minus: '\u2212', + lowast: '\u2217', + radic: '\u221A', + prop: '\u221D', + infin: '\u221E', + ang: '\u2220', + and: '\u2227', + or: '\u2228', + cap: '\u2229', + cup: '\u222A', + "int": '\u222B', + there4: '\u2234', + sim: '\u223C', + cong: '\u2245', + asymp: '\u2248', + ne: '\u2260', + equiv: '\u2261', + le: '\u2264', + ge: '\u2265', + sub: '\u2282', + sup: '\u2283', + nsub: '\u2284', + sube: '\u2286', + supe: '\u2287', + oplus: '\u2295', + otimes: '\u2297', + perp: '\u22A5', + sdot: '\u22C5', + lceil: '\u2308', + rceil: '\u2309', + lfloor: '\u230A', + rfloor: '\u230B', + lang: '\u2329', + rang: '\u232A', + loz: '\u25CA', + spades: '\u2660', + clubs: '\u2663', + hearts: '\u2665', + diams: '\u2666' + }; + + var HEX_NUMBER = /^[\da-fA-F]+$/; + var DECIMAL_NUMBER = /^\d+$/; + + types$1.j_oTag = new TokContext("<tag", false); + types$1.j_cTag = new TokContext("</tag", false); + types$1.j_expr = new TokContext("<tag>...</tag>", true, true); + + types.jsxName = new TokenType("jsxName"); + types.jsxText = new TokenType("jsxText", { beforeExpr: true }); + types.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true }); + types.jsxTagEnd = new TokenType("jsxTagEnd"); + + types.jsxTagStart.updateContext = function () { + this.state.context.push(types$1.j_expr); // treat as beginning of JSX expression + this.state.context.push(types$1.j_oTag); // start opening tag context + this.state.exprAllowed = false; + }; + + types.jsxTagEnd.updateContext = function (prevType) { + var out = this.state.context.pop(); + if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) { + this.state.context.pop(); + this.state.exprAllowed = this.curContext() === types$1.j_expr; + } else { + this.state.exprAllowed = true; + } + }; + + var pp$9 = Parser.prototype; + + // Reads inline JSX contents token. + + pp$9.jsxReadToken = function () { + var out = ""; + var chunkStart = this.state.pos; + for (;;) { + if (this.state.pos >= this.input.length) { + this.raise(this.state.start, "Unterminated JSX contents"); + } + + var ch = this.input.charCodeAt(this.state.pos); + + switch (ch) { + case 60: // "<" + case 123: + // "{" + if (this.state.pos === this.state.start) { + if (ch === 60 && this.state.exprAllowed) { + ++this.state.pos; + return this.finishToken(types.jsxTagStart); + } + return this.getTokenFromCode(ch); + } + out += this.input.slice(chunkStart, this.state.pos); + return this.finishToken(types.jsxText, out); + + case 38: + // "&" + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadEntity(); + chunkStart = this.state.pos; + break; + + default: + if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadNewLine(true); + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + } + }; + + pp$9.jsxReadNewLine = function (normalizeCRLF) { + var ch = this.input.charCodeAt(this.state.pos); + var out = void 0; + ++this.state.pos; + if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) { + ++this.state.pos; + out = normalizeCRLF ? "\n" : "\r\n"; + } else { + out = String.fromCharCode(ch); + } + ++this.state.curLine; + this.state.lineStart = this.state.pos; + + return out; + }; + + pp$9.jsxReadString = function (quote) { + var out = ""; + var chunkStart = ++this.state.pos; + for (;;) { + if (this.state.pos >= this.input.length) { + this.raise(this.state.start, "Unterminated string constant"); + } + + var ch = this.input.charCodeAt(this.state.pos); + if (ch === quote) break; + if (ch === 38) { + // "&" + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadEntity(); + chunkStart = this.state.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadNewLine(false); + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + out += this.input.slice(chunkStart, this.state.pos++); + return this.finishToken(types.string, out); + }; + + pp$9.jsxReadEntity = function () { + var str = ""; + var count = 0; + var entity = void 0; + var ch = this.input[this.state.pos]; + + var startPos = ++this.state.pos; + while (this.state.pos < this.input.length && count++ < 10) { + ch = this.input[this.state.pos++]; + if (ch === ";") { + if (str[0] === "#") { + if (str[1] === "x") { + str = str.substr(2); + if (HEX_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 16)); + } else { + str = str.substr(1); + if (DECIMAL_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 10)); + } + } else { + entity = XHTMLEntities[str]; + } + break; + } + str += ch; + } + if (!entity) { + this.state.pos = startPos; + return "&"; + } + return entity; + }; + + // Read a JSX identifier (valid tag or attribute name). + // + // Optimized version since JSX identifiers can"t contain + // escape characters and so can be read as single slice. + // Also assumes that first character was already checked + // by isIdentifierStart in readToken. + + pp$9.jsxReadWord = function () { + var ch = void 0; + var start = this.state.pos; + do { + ch = this.input.charCodeAt(++this.state.pos); + } while (isIdentifierChar(ch) || ch === 45); // "-" + return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos)); + }; + + // Transforms JSX element name to string. + + function getQualifiedJSXName(object) { + if (object.type === "JSXIdentifier") { + return object.name; + } + + if (object.type === "JSXNamespacedName") { + return object.namespace.name + ":" + object.name.name; + } + + if (object.type === "JSXMemberExpression") { + return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property); + } + } + + // Parse next token as JSX identifier + + pp$9.jsxParseIdentifier = function () { + var node = this.startNode(); + if (this.match(types.jsxName)) { + node.name = this.state.value; + } else if (this.state.type.keyword) { + node.name = this.state.type.keyword; + } else { + this.unexpected(); + } + this.next(); + return this.finishNode(node, "JSXIdentifier"); + }; + + // Parse namespaced identifier. + + pp$9.jsxParseNamespacedName = function () { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var name = this.jsxParseIdentifier(); + if (!this.eat(types.colon)) return name; + + var node = this.startNodeAt(startPos, startLoc); + node.namespace = name; + node.name = this.jsxParseIdentifier(); + return this.finishNode(node, "JSXNamespacedName"); + }; + + // Parses element name in any form - namespaced, member + // or single identifier. + + pp$9.jsxParseElementName = function () { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + var node = this.jsxParseNamespacedName(); + while (this.eat(types.dot)) { + var newNode = this.startNodeAt(startPos, startLoc); + newNode.object = node; + newNode.property = this.jsxParseIdentifier(); + node = this.finishNode(newNode, "JSXMemberExpression"); + } + return node; + }; + + // Parses any type of JSX attribute value. + + pp$9.jsxParseAttributeValue = function () { + var node = void 0; + switch (this.state.type) { + case types.braceL: + node = this.jsxParseExpressionContainer(); + if (node.expression.type === "JSXEmptyExpression") { + this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"); + } else { + return node; + } + + case types.jsxTagStart: + case types.string: + node = this.parseExprAtom(); + node.extra = null; + return node; + + default: + this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text"); + } + }; + + // JSXEmptyExpression is unique type since it doesn't actually parse anything, + // and so it should start at the end of last read token (left brace) and finish + // at the beginning of the next one (right brace). + + pp$9.jsxParseEmptyExpression = function () { + var node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc); + return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc); + }; + + // Parse JSX spread child + + pp$9.jsxParseSpreadChild = function () { + var node = this.startNode(); + this.expect(types.braceL); + this.expect(types.ellipsis); + node.expression = this.parseExpression(); + this.expect(types.braceR); + + return this.finishNode(node, "JSXSpreadChild"); + }; + + // Parses JSX expression enclosed into curly brackets. + + + pp$9.jsxParseExpressionContainer = function () { + var node = this.startNode(); + this.next(); + if (this.match(types.braceR)) { + node.expression = this.jsxParseEmptyExpression(); + } else { + node.expression = this.parseExpression(); + } + this.expect(types.braceR); + return this.finishNode(node, "JSXExpressionContainer"); + }; + + // Parses following JSX attribute name-value pair. + + pp$9.jsxParseAttribute = function () { + var node = this.startNode(); + if (this.eat(types.braceL)) { + this.expect(types.ellipsis); + node.argument = this.parseMaybeAssign(); + this.expect(types.braceR); + return this.finishNode(node, "JSXSpreadAttribute"); + } + node.name = this.jsxParseNamespacedName(); + node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null; + return this.finishNode(node, "JSXAttribute"); + }; + + // Parses JSX opening tag starting after "<". + + pp$9.jsxParseOpeningElementAt = function (startPos, startLoc) { + var node = this.startNodeAt(startPos, startLoc); + node.attributes = []; + node.name = this.jsxParseElementName(); + while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) { + node.attributes.push(this.jsxParseAttribute()); + } + node.selfClosing = this.eat(types.slash); + this.expect(types.jsxTagEnd); + return this.finishNode(node, "JSXOpeningElement"); + }; + + // Parses JSX closing tag starting after "</". + + pp$9.jsxParseClosingElementAt = function (startPos, startLoc) { + var node = this.startNodeAt(startPos, startLoc); + node.name = this.jsxParseElementName(); + this.expect(types.jsxTagEnd); + return this.finishNode(node, "JSXClosingElement"); + }; + + // Parses entire JSX element, including it"s opening tag + // (starting after "<"), attributes, contents and closing tag. + + pp$9.jsxParseElementAt = function (startPos, startLoc) { + var node = this.startNodeAt(startPos, startLoc); + var children = []; + var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc); + var closingElement = null; + + if (!openingElement.selfClosing) { + contents: for (;;) { + switch (this.state.type) { + case types.jsxTagStart: + startPos = this.state.start;startLoc = this.state.startLoc; + this.next(); + if (this.eat(types.slash)) { + closingElement = this.jsxParseClosingElementAt(startPos, startLoc); + break contents; + } + children.push(this.jsxParseElementAt(startPos, startLoc)); + break; + + case types.jsxText: + children.push(this.parseExprAtom()); + break; + + case types.braceL: + if (this.lookahead().type === types.ellipsis) { + children.push(this.jsxParseSpreadChild()); + } else { + children.push(this.jsxParseExpressionContainer()); + } + + break; + + // istanbul ignore next - should never happen + default: + this.unexpected(); + } + } + + if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { + this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">"); + } + } + + node.openingElement = openingElement; + node.closingElement = closingElement; + node.children = children; + if (this.match(types.relational) && this.state.value === "<") { + this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag"); + } + return this.finishNode(node, "JSXElement"); + }; + + // Parses entire JSX element from current position. + + pp$9.jsxParseElement = function () { + var startPos = this.state.start; + var startLoc = this.state.startLoc; + this.next(); + return this.jsxParseElementAt(startPos, startLoc); + }; + + var jsxPlugin = function jsxPlugin(instance) { + instance.extend("parseExprAtom", function (inner) { + return function (refShortHandDefaultPos) { + if (this.match(types.jsxText)) { + var node = this.parseLiteral(this.state.value, "JSXText"); + // https://github.com/babel/babel/issues/2078 + node.extra = null; + return node; + } else if (this.match(types.jsxTagStart)) { + return this.jsxParseElement(); + } else { + return inner.call(this, refShortHandDefaultPos); + } + }; + }); + + instance.extend("readToken", function (inner) { + return function (code) { + if (this.state.inPropertyName) return inner.call(this, code); + + var context = this.curContext(); + + if (context === types$1.j_expr) { + return this.jsxReadToken(); + } + + if (context === types$1.j_oTag || context === types$1.j_cTag) { + if (isIdentifierStart(code)) { + return this.jsxReadWord(); + } + + if (code === 62) { + ++this.state.pos; + return this.finishToken(types.jsxTagEnd); + } + + if ((code === 34 || code === 39) && context === types$1.j_oTag) { + return this.jsxReadString(code); + } + } + + if (code === 60 && this.state.exprAllowed) { + ++this.state.pos; + return this.finishToken(types.jsxTagStart); + } + + return inner.call(this, code); + }; + }); + + instance.extend("updateContext", function (inner) { + return function (prevType) { + if (this.match(types.braceL)) { + var curContext = this.curContext(); + if (curContext === types$1.j_oTag) { + this.state.context.push(types$1.braceExpression); + } else if (curContext === types$1.j_expr) { + this.state.context.push(types$1.templateQuasi); + } else { + inner.call(this, prevType); + } + this.state.exprAllowed = true; + } else if (this.match(types.slash) && prevType === types.jsxTagStart) { + this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore + this.state.context.push(types$1.j_cTag); // reconsider as closing tag context + this.state.exprAllowed = false; + } else { + return inner.call(this, prevType); + } + }; + }); + }; + + plugins.estree = estreePlugin; + plugins.flow = flowPlugin; + plugins.jsx = jsxPlugin; + + function parse(input, options) { + return new Parser(options, input).parse(); + } + + function parseExpression(input, options) { + var parser = new Parser(options, input); + if (parser.options.strictMode) { + parser.state.strict = true; + } + return parser.getExpression(); + } + + exports.parse = parse; + exports.parseExpression = parseExpression; + exports.tokTypes = types; + +/***/ }), +/* 88 */ +/***/ (function(module, exports) { + + "use strict"; + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ctx = __webpack_require__(54), + call = __webpack_require__(425), + isArrayIter = __webpack_require__(424), + anObject = __webpack_require__(19), + toLength = __webpack_require__(149), + getIterFn = __webpack_require__(233), + BREAK = {}, + RETURN = {}; + var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { + return iterable; + } : getIterFn(iterable), + f = ctx(fn, that, entries ? 2 : 1), + index = 0, + length, + step, + iterator, + result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } + }; + _exports.BREAK = BREAK; + _exports.RETURN = RETURN; + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + var anObject = __webpack_require__(19), + dPs = __webpack_require__(428), + enumBugKeys = __webpack_require__(139), + IE_PROTO = __webpack_require__(146)('IE_PROTO'), + Empty = function Empty() {/* empty */}, + PROTOTYPE = 'prototype'; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var _createDict = function createDict() { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(225)('iframe'), + i = enumBugKeys.length, + lt = '<', + gt = '>', + iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(423).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + _createDict = iframeDocument.F; + while (i--) { + delete _createDict[PROTOTYPE][enumBugKeys[i]]; + }return _createDict(); + }; + + module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = _createDict(); + return Properties === undefined ? result : dPs(result, Properties); + }; + +/***/ }), +/* 91 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.f = {}.propertyIsEnumerable; + +/***/ }), +/* 92 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var def = __webpack_require__(23).f, + has = __webpack_require__(27), + TAG = __webpack_require__(12)('toStringTag'); + + module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); + }; + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(88); + module.exports = function (it) { + return Object(defined(it)); + }; + +/***/ }), +/* 95 */ +/***/ (function(module, exports) { + + 'use strict'; + + var id = 0, + px = Math.random(); + module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); + }; + +/***/ }), +/* 96 */ +/***/ (function(module, exports) { + + "use strict"; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* + Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + (function () { + 'use strict'; + + exports.ast = __webpack_require__(452); + exports.code = __webpack_require__(235); + exports.keyword = __webpack_require__(453); + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var listCacheClear = __webpack_require__(537), + listCacheDelete = __webpack_require__(538), + listCacheGet = __webpack_require__(539), + listCacheHas = __webpack_require__(540), + listCacheSet = __webpack_require__(541); + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + module.exports = ListCache; + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ListCache = __webpack_require__(98), + stackClear = __webpack_require__(556), + stackDelete = __webpack_require__(557), + stackGet = __webpack_require__(558), + stackHas = __webpack_require__(559), + stackSet = __webpack_require__(560); + + /** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + module.exports = Stack; + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var eq = __webpack_require__(45); + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + module.exports = assocIndexOf; + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var identity = __webpack_require__(110), + overRest = __webpack_require__(551), + setToString = __webpack_require__(554); + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + module.exports = baseRest; + +/***/ }), +/* 102 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ + function baseUnary(func) { + return function (value) { + return func(value); + }; + } + + module.exports = baseUnary; + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseRest = __webpack_require__(101), + isIterateeCall = __webpack_require__(168); + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function (object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + module.exports = createAssigner; + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isKeyable = __webpack_require__(535); + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; + } + + module.exports = getMapData; + +/***/ }), +/* 105 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = typeof Ctor == 'function' && Ctor.prototype || objectProto; + + return value === proto; + } + + module.exports = isPrototype; + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38); + + /* Built-in method references that are verified to be native. */ + var nativeCreate = getNative(Object, 'create'); + + module.exports = nativeCreate; + +/***/ }), +/* 107 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function (value) { + result[++index] = value; + }); + return result; + } + + module.exports = setToArray; + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isSymbol = __webpack_require__(60); + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0; + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = value + ''; + return result == '0' && 1 / value == -INFINITY ? '-0' : result; + } + + module.exports = toKey; + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseClone = __webpack_require__(160); + + /** Used to compose bitmasks for cloning. */ + var CLONE_SYMBOLS_FLAG = 4; + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + module.exports = clone; + +/***/ }), +/* 110 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ + function identity(value) { + return value; + } + + module.exports = identity; + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIndexOf = __webpack_require__(162), + isArrayLike = __webpack_require__(24), + isString = __webpack_require__(578), + toInteger = __webpack_require__(47), + values = __webpack_require__(275); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max; + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; + } + + module.exports = includes; + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsArguments = __webpack_require__(484), + isObjectLike = __webpack_require__(25); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Built-in value references. */ + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + + /** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + var isArguments = baseIsArguments(function () { + return arguments; + }()) ? baseIsArguments : function (value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); + }; + + module.exports = isArguments; + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var root = __webpack_require__(15), + stubFalse = __webpack_require__(587); + + /** Detect free variable `exports`. */ + var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Built-in value references. */ + var Buffer = moduleExports ? root.Buffer : undefined; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + var isBuffer = nativeIsBuffer || stubFalse; + + module.exports = isBuffer; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module))) + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseToString = __webpack_require__(248); + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + module.exports = toString; + +/***/ }), +/* 115 */ +96, +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global, process) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var formatRegExp = /%[sdj%]/g; + exports.format = function (f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function (x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': + return String(args[i++]); + case '%d': + return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; + }; + + // Mark that a method should not be used. + // Returns a modified function which warns once by default. + // If --no-deprecation is set, then it is a no-op. + exports.deprecate = function (fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function () { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; + }; + + var debugs = {}; + var debugEnviron; + exports.debuglog = function (set) { + if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function () { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function () {}; + } + } + return debugs[set]; + }; + + /** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ + /* legacy: obj, showHidden, depth, colors*/ + function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); + } + exports.inspect = inspect; + + // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics + inspect.colors = { + 'bold': [1, 22], + 'italic': [3, 23], + 'underline': [4, 24], + 'inverse': [7, 27], + 'white': [37, 39], + 'grey': [90, 39], + 'black': [30, 39], + 'blue': [34, 39], + 'cyan': [36, 39], + 'green': [32, 39], + 'magenta': [35, 39], + 'red': [31, 39], + 'yellow': [33, 39] + }; + + // Don't use 'blue' not visible on cmd.exe + inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' + }; + + function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\x1B[' + inspect.colors[style][0] + 'm' + str + '\x1B[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } + } + + function stylizeNoColor(str, styleType) { + return str; + } + + function arrayToHash(array) { + var hash = {}; + + array.forEach(function (val, idx) { + hash[val] = true; + }); + + return hash; + } + + function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && value && isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', + array = false, + braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function (key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); + } + + function formatPrimitive(ctx, value) { + if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) return ctx.stylize('null', 'null'); + } + + function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; + } + + function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function (key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); + } + }); + return output; + } + + function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function (line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function (line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; + } + + function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function (prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; + } + + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { + return Array.isArray(ar); + } + exports.isArray = isArray; + + function isBoolean(arg) { + return typeof arg === 'boolean'; + } + exports.isBoolean = isBoolean; + + function isNull(arg) { + return arg === null; + } + exports.isNull = isNull; + + function isNullOrUndefined(arg) { + return arg == null; + } + exports.isNullOrUndefined = isNullOrUndefined; + + function isNumber(arg) { + return typeof arg === 'number'; + } + exports.isNumber = isNumber; + + function isString(arg) { + return typeof arg === 'string'; + } + exports.isString = isString; + + function isSymbol(arg) { + return (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'symbol'; + } + exports.isSymbol = isSymbol; + + function isUndefined(arg) { + return arg === void 0; + } + exports.isUndefined = isUndefined; + + function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; + } + exports.isRegExp = isRegExp; + + function isObject(arg) { + return (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg !== null; + } + exports.isObject = isObject; + + function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; + } + exports.isDate = isDate; + + function isError(e) { + return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error); + } + exports.isError = isError; + + function isFunction(arg) { + return typeof arg === 'function'; + } + exports.isFunction = isFunction; + + function isPrimitive(arg) { + return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; + } + exports.isPrimitive = isPrimitive; + + exports.isBuffer = __webpack_require__(618); + + function objectToString(o) { + return Object.prototype.toString.call(o); + } + + function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); + } + + var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + + // 26 Feb 16:19:34 + function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); + } + + // log is just a thin wrapper to console.log that prepends a timestamp + exports.log = function () { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); + }; + + /** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ + exports.inherits = __webpack_require__(617); + + exports._extend = function (origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; + }; + + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(8))) + +/***/ }), +/* 117 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + exports.default = function (loc) { + var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); + + if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null; + + var relativeMod = relativeModules[relative]; + + if (!relativeMod) { + relativeMod = new _module2.default(); + + var filename = _path2.default.join(relative, ".babelrc"); + relativeMod.id = filename; + relativeMod.filename = filename; + + relativeMod.paths = _module2.default._nodeModulePaths(relative); + relativeModules[relative] = relativeMod; + } + + try { + return _module2.default._resolveFilename(loc, relativeMod); + } catch (err) { + return null; + } + }; + + var _module = __webpack_require__(115); + + var _module2 = _interopRequireDefault(_module); + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var relativeModules = {}; + + module.exports = exports["default"]; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _map = __webpack_require__(132); + + var _map2 = _interopRequireDefault(_map); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Store = function (_Map) { + (0, _inherits3.default)(Store, _Map); + + function Store() { + (0, _classCallCheck3.default)(this, Store); + + var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this)); + + _this.dynamicData = {}; + return _this; + } + + Store.prototype.setDynamic = function setDynamic(key, fn) { + this.dynamicData[key] = fn; + }; + + Store.prototype.get = function get(key) { + if (this.has(key)) { + return _Map.prototype.get.call(this, key); + } else { + if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) { + var val = this.dynamicData[key](); + this.set(key, val); + return val; + } + } + }; + + return Store; + }(_map2.default); + + exports.default = Store; + module.exports = exports["default"]; + +/***/ }), +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _node = __webpack_require__(234); + + var _node2 = _interopRequireDefault(_node); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var verboseDebug = (0, _node2.default)("babel:verbose"); + var generalDebug = (0, _node2.default)("babel"); + + var seenDeprecatedMessages = []; + + var Logger = function () { + function Logger(file, filename) { + (0, _classCallCheck3.default)(this, Logger); + + this.filename = filename; + this.file = file; + } + + Logger.prototype._buildMessage = function _buildMessage(msg) { + var parts = "[BABEL] " + this.filename; + if (msg) parts += ": " + msg; + return parts; + }; + + Logger.prototype.warn = function warn(msg) { + console.warn(this._buildMessage(msg)); + }; + + Logger.prototype.error = function error(msg) { + var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error; + + throw new Constructor(this._buildMessage(msg)); + }; + + Logger.prototype.deprecate = function deprecate(msg) { + if (this.file.opts && this.file.opts.suppressDeprecationMessages) return; + + msg = this._buildMessage(msg); + + if (seenDeprecatedMessages.indexOf(msg) >= 0) return; + + seenDeprecatedMessages.push(msg); + + console.error(msg); + }; + + Logger.prototype.verbose = function verbose(msg) { + if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg)); + }; + + Logger.prototype.debug = function debug(msg) { + if (generalDebug.enabled) generalDebug(this._buildMessage(msg)); + }; + + Logger.prototype.deopt = function deopt(node, msg) { + this.debug(msg); + }; + + return Logger; + }(); + + exports.default = Logger; + module.exports = exports["default"]; + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.ImportDeclaration = exports.ModuleDeclaration = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.ExportDeclaration = ExportDeclaration; + exports.Scope = Scope; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var ModuleDeclaration = exports.ModuleDeclaration = { + enter: function enter(path, file) { + var node = path.node; + + if (node.source) { + node.source.value = file.resolveModuleSource(node.source.value); + } + } + }; + + var ImportDeclaration = exports.ImportDeclaration = { + exit: function exit(path, file) { + var node = path.node; + + var specifiers = []; + var imported = []; + file.metadata.modules.imports.push({ + source: node.source.value, + imported: imported, + specifiers: specifiers + }); + + for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var specifier = _ref; + + var local = specifier.node.local.name; + + if (specifier.isImportDefaultSpecifier()) { + imported.push("default"); + specifiers.push({ + kind: "named", + imported: "default", + local: local + }); + } + + if (specifier.isImportSpecifier()) { + var importedName = specifier.node.imported.name; + imported.push(importedName); + specifiers.push({ + kind: "named", + imported: importedName, + local: local + }); + } + + if (specifier.isImportNamespaceSpecifier()) { + imported.push("*"); + specifiers.push({ + kind: "namespace", + local: local + }); + } + } + } + }; + + function ExportDeclaration(path, file) { + var node = path.node; + + var source = node.source ? node.source.value : null; + var exports = file.metadata.modules.exports; + + var declar = path.get("declaration"); + if (declar.isStatement()) { + var bindings = declar.getBindingIdentifiers(); + + for (var name in bindings) { + exports.exported.push(name); + exports.specifiers.push({ + kind: "local", + local: name, + exported: path.isExportDefaultDeclaration() ? "default" : name + }); + } + } + + if (path.isExportNamedDeclaration() && node.specifiers) { + for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var specifier = _ref2; + + var exported = specifier.exported.name; + exports.exported.push(exported); + + if (t.isExportDefaultSpecifier(specifier)) { + exports.specifiers.push({ + kind: "external", + local: exported, + exported: exported, + source: source + }); + } + + if (t.isExportNamespaceSpecifier(specifier)) { + exports.specifiers.push({ + kind: "external-namespace", + exported: exported, + source: source + }); + } + + var local = specifier.local; + if (!local) continue; + + if (source) { + exports.specifiers.push({ + kind: "external", + local: local.name, + exported: exported, + source: source + }); + } + + if (!source) { + exports.specifiers.push({ + kind: "local", + local: local.name, + exported: exported + }); + } + } + } + + if (path.isExportAllDeclaration()) { + exports.specifiers.push({ + kind: "external-all", + source: source + }); + } + } + + function Scope(path) { + path.skip(); + } + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.inspect = exports.inherits = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _util = __webpack_require__(116); + + Object.defineProperty(exports, "inherits", { + enumerable: true, + get: function get() { + return _util.inherits; + } + }); + Object.defineProperty(exports, "inspect", { + enumerable: true, + get: function get() { + return _util.inspect; + } + }); + exports.canCompile = canCompile; + exports.list = list; + exports.regexify = regexify; + exports.arrayify = arrayify; + exports.booleanify = booleanify; + exports.shouldIgnore = shouldIgnore; + + var _escapeRegExp = __webpack_require__(568); + + var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp); + + var _startsWith = __webpack_require__(586); + + var _startsWith2 = _interopRequireDefault(_startsWith); + + var _minimatch = __webpack_require__(592); + + var _minimatch2 = _interopRequireDefault(_minimatch); + + var _includes = __webpack_require__(111); + + var _includes2 = _interopRequireDefault(_includes); + + var _isRegExp = __webpack_require__(271); + + var _isRegExp2 = _interopRequireDefault(_isRegExp); + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + var _slash = __webpack_require__(280); + + var _slash2 = _interopRequireDefault(_slash); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function canCompile(filename, altExts) { + var exts = altExts || canCompile.EXTENSIONS; + var ext = _path2.default.extname(filename); + return (0, _includes2.default)(exts, ext); + } + + canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"]; + + function list(val) { + if (!val) { + return []; + } else if (Array.isArray(val)) { + return val; + } else if (typeof val === "string") { + return val.split(","); + } else { + return [val]; + } + } + + function regexify(val) { + if (!val) { + return new RegExp(/.^/); + } + + if (Array.isArray(val)) { + val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i"); + } + + if (typeof val === "string") { + val = (0, _slash2.default)(val); + + if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2); + if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3); + + var regex = _minimatch2.default.makeRe(val, { nocase: true }); + return new RegExp(regex.source.slice(1, -1), "i"); + } + + if ((0, _isRegExp2.default)(val)) { + return val; + } + + throw new TypeError("illegal type for regexify"); + } + + function arrayify(val, mapFn) { + if (!val) return []; + if (typeof val === "boolean") return arrayify([val], mapFn); + if (typeof val === "string") return arrayify(list(val), mapFn); + + if (Array.isArray(val)) { + if (mapFn) val = val.map(mapFn); + return val; + } + + return [val]; + } + + function booleanify(val) { + if (val === "true" || val == 1) { + return true; + } + + if (val === "false" || val == 0 || !val) { + return false; + } + + return val; + } + + function shouldIgnore(filename) { + var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var only = arguments[2]; + + filename = filename.replace(/\\/g, "/"); + + if (only) { + for (var _iterator = only, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var pattern = _ref; + + if (_shouldIgnore(pattern, filename)) return false; + } + return true; + } else if (ignore.length) { + for (var _iterator2 = ignore, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _pattern = _ref2; + + if (_shouldIgnore(_pattern, filename)) return true; + } + } + + return false; + } + + function _shouldIgnore(pattern, filename) { + if (typeof pattern === "function") { + return pattern(filename); + } else { + return pattern.test(filename); + } + } + +/***/ }), +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.ArrayPattern = exports.ObjectPattern = exports.RestProperty = exports.SpreadProperty = exports.SpreadElement = undefined; + exports.Identifier = Identifier; + exports.RestElement = RestElement; + exports.ObjectExpression = ObjectExpression; + exports.ObjectMethod = ObjectMethod; + exports.ObjectProperty = ObjectProperty; + exports.ArrayExpression = ArrayExpression; + exports.RegExpLiteral = RegExpLiteral; + exports.BooleanLiteral = BooleanLiteral; + exports.NullLiteral = NullLiteral; + exports.NumericLiteral = NumericLiteral; + exports.StringLiteral = StringLiteral; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _jsesc = __webpack_require__(460); + + var _jsesc2 = _interopRequireDefault(_jsesc); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function Identifier(node) { + if (node.variance) { + if (node.variance === "plus") { + this.token("+"); + } else if (node.variance === "minus") { + this.token("-"); + } + } + + this.word(node.name); + } + + function RestElement(node) { + this.token("..."); + this.print(node.argument, node); + } + + exports.SpreadElement = RestElement; + exports.SpreadProperty = RestElement; + exports.RestProperty = RestElement; + function ObjectExpression(node) { + var props = node.properties; + + this.token("{"); + this.printInnerComments(node); + + if (props.length) { + this.space(); + this.printList(props, node, { indent: true, statement: true }); + this.space(); + } + + this.token("}"); + } + + exports.ObjectPattern = ObjectExpression; + function ObjectMethod(node) { + this.printJoin(node.decorators, node); + this._method(node); + } + + function ObjectProperty(node) { + this.printJoin(node.decorators, node); + + if (node.computed) { + this.token("["); + this.print(node.key, node); + this.token("]"); + } else { + if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) { + this.print(node.value, node); + return; + } + + this.print(node.key, node); + + if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) { + return; + } + } + + this.token(":"); + this.space(); + this.print(node.value, node); + } + + function ArrayExpression(node) { + var elems = node.elements; + var len = elems.length; + + this.token("["); + this.printInnerComments(node); + + for (var i = 0; i < elems.length; i++) { + var elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem, node); + if (i < len - 1) this.token(","); + } else { + this.token(","); + } + } + + this.token("]"); + } + + exports.ArrayPattern = ArrayExpression; + function RegExpLiteral(node) { + this.word("/" + node.pattern + "/" + node.flags); + } + + function BooleanLiteral(node) { + this.word(node.value ? "true" : "false"); + } + + function NullLiteral() { + this.word("null"); + } + + function NumericLiteral(node) { + var raw = this.getPossibleRaw(node); + var value = node.value + ""; + if (raw == null) { + this.number(value); + } else if (this.format.minified) { + this.number(raw.length < value.length ? raw : value); + } else { + this.number(raw); + } + } + + function StringLiteral(node, parent) { + var raw = this.getPossibleRaw(node); + if (!this.format.minified && raw != null) { + this.token(raw); + return; + } + + var opts = { + quotes: t.isJSX(parent) ? "double" : this.format.quotes, + wrap: true + }; + if (this.format.jsonCompatibleStrings) { + opts.json = true; + } + var val = (0, _jsesc2.default)(node.value, opts); + + return this.token(val); + } + +/***/ }), +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (path, file, helpers) { + if (!helpers) { + helpers = { wrapAsync: file }; + file = null; + } + path.traverse(awaitVisitor, { + file: file, + wrapAwait: helpers.wrapAwait + }); + + if (path.isClassMethod() || path.isObjectMethod()) { + classOrObjectMethod(path, helpers.wrapAsync); + } else { + plainFunction(path, helpers.wrapAsync); + } + }; + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _forAwait = __webpack_require__(316); + + var _forAwait2 = _interopRequireDefault(_forAwait); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildWrapper = (0, _babelTemplate2.default)("\n (() => {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })\n"); + + var namedBuildWrapper = (0, _babelTemplate2.default)("\n (() => {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })\n"); + + var awaitVisitor = { + Function: function Function(path) { + if (path.isArrowFunctionExpression() && !path.node.async) { + path.arrowFunctionToShadowed(); + return; + } + path.skip(); + }, + AwaitExpression: function AwaitExpression(_ref, _ref2) { + var node = _ref.node; + var wrapAwait = _ref2.wrapAwait; + + node.type = "YieldExpression"; + if (wrapAwait) { + node.argument = t.callExpression(wrapAwait, [node.argument]); + } + }, + ForAwaitStatement: function ForAwaitStatement(path, _ref3) { + var file = _ref3.file, + wrapAwait = _ref3.wrapAwait; + var node = path.node; + + var build = (0, _forAwait2.default)(path, { + getAsyncIterator: file.addHelper("asyncIterator"), + wrapAwait: wrapAwait + }); + + var declar = build.declar, + loop = build.loop; + + var block = loop.body; + + path.ensureBlock(); + + if (declar) { + block.body.push(declar); + } + + block.body = block.body.concat(node.body.body); + + t.inherits(loop, node); + t.inherits(loop.body, node.body); + + if (build.replaceParent) { + path.parentPath.replaceWithMultiple(build.node); + path.remove(); + } else { + path.replaceWithMultiple(build.node); + } + } + }; + + function classOrObjectMethod(path, callId) { + var node = path.node; + var body = node.body; + + node.async = false; + + var container = t.functionExpression(null, [], t.blockStatement(body.body), true); + container.shadow = true; + body.body = [t.returnStatement(t.callExpression(t.callExpression(callId, [container]), []))]; + + node.generator = false; + } + + function plainFunction(path, callId) { + var node = path.node; + var isDeclaration = path.isFunctionDeclaration(); + var asyncFnId = node.id; + var wrapper = buildWrapper; + + if (path.isArrowFunctionExpression()) { + path.arrowFunctionToShadowed(); + } else if (!isDeclaration && asyncFnId) { + wrapper = namedBuildWrapper; + } + + node.async = false; + node.generator = true; + + node.id = null; + + if (isDeclaration) { + node.type = "FunctionExpression"; + } + + var built = t.callExpression(callId, [node]); + var container = wrapper({ + NAME: asyncFnId, + REF: path.scope.generateUidIdentifier("ref"), + FUNCTION: built, + PARAMS: node.params.reduce(function (acc, param) { + acc.done = acc.done || t.isAssignmentPattern(param) || t.isRestElement(param); + + if (!acc.done) { + acc.params.push(path.scope.generateUidIdentifier("x")); + } + + return acc; + }, { + params: [], + done: false + }).params + }).expression; + + if (isDeclaration) { + var declar = t.variableDeclaration("let", [t.variableDeclarator(t.identifier(asyncFnId.name), t.callExpression(container, []))]); + declar._blockHoist = true; + + path.replaceWith(declar); + } else { + var retFunction = container.body.body[1].argument; + if (!asyncFnId) { + (0, _babelHelperFunctionName2.default)({ + node: retFunction, + parent: path.parent, + scope: path.scope + }); + } + + if (!retFunction || retFunction.id || node.params.length) { + path.replaceWith(t.callExpression(container, [])); + } else { + path.replaceWith(built); + } + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 124 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("decorators"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 125 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("flow"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 126 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("jsx"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 127 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("trailingFunctionCommas"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + inherits: __webpack_require__(65), + + visitor: { + Function: function Function(path, state) { + if (!path.node.async || path.node.generator) return; + + (0, _babelHelperRemapAsyncToGenerator2.default)(path, state.file, { + wrapAsync: state.addHelper("asyncToGenerator") + }); + } + } + }; + }; + + var _babelHelperRemapAsyncToGenerator = __webpack_require__(123); + + var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + exports.default = function () { + return { + visitor: { + ObjectExpression: function ObjectExpression(path) { + var node = path.node; + + var plainProps = node.properties.filter(function (prop) { + return !t.isSpreadProperty(prop) && !prop.computed; + }); + + var alreadySeenData = (0, _create2.default)(null); + var alreadySeenGetters = (0, _create2.default)(null); + var alreadySeenSetters = (0, _create2.default)(null); + + for (var _iterator = plainProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var prop = _ref; + + var name = getName(prop.key); + var isDuplicate = false; + switch (prop.kind) { + case "get": + if (alreadySeenData[name] || alreadySeenGetters[name]) { + isDuplicate = true; + } + alreadySeenGetters[name] = true; + break; + case "set": + if (alreadySeenData[name] || alreadySeenSetters[name]) { + isDuplicate = true; + } + alreadySeenSetters[name] = true; + break; + default: + if (alreadySeenData[name] || alreadySeenGetters[name] || alreadySeenSetters[name]) { + isDuplicate = true; + } + alreadySeenData[name] = true; + } + + if (isDuplicate) { + prop.computed = true; + prop.key = t.stringLiteral(name); + } + } + } + } + }; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getName(key) { + if (t.isIdentifier(key)) { + return key.name; + } + return key.value.toString(); + } + + module.exports = exports["default"]; + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + exports.default = function (_ref) { + var t = _ref.types; + + function isValidRequireCall(path) { + if (!path.isCallExpression()) return false; + if (!path.get("callee").isIdentifier({ name: "require" })) return false; + if (path.scope.getBinding("require")) return false; + + var args = path.get("arguments"); + if (args.length !== 1) return false; + + var arg = args[0]; + if (!arg.isStringLiteral()) return false; + + return true; + } + + var amdVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(_ref2) { + var node = _ref2.node, + scope = _ref2.scope; + + if (node.name === "exports" && !scope.getBinding("exports")) { + this.hasExports = true; + } + + if (node.name === "module" && !scope.getBinding("module")) { + this.hasModule = true; + } + }, + CallExpression: function CallExpression(path) { + if (!isValidRequireCall(path)) return; + this.bareSources.push(path.node.arguments[0]); + path.remove(); + }, + VariableDeclarator: function VariableDeclarator(path) { + var id = path.get("id"); + if (!id.isIdentifier()) return; + + var init = path.get("init"); + if (!isValidRequireCall(init)) return; + + var source = init.node.arguments[0]; + this.sourceNames[source.value] = true; + this.sources.push([id.node, source]); + + path.remove(); + } + }; + + return { + inherits: __webpack_require__(75), + + pre: function pre() { + this.sources = []; + this.sourceNames = (0, _create2.default)(null); + + this.bareSources = []; + + this.hasExports = false; + this.hasModule = false; + }, + + visitor: { + Program: { + exit: function exit(path) { + var _this = this; + + if (this.ran) return; + this.ran = true; + + path.traverse(amdVisitor, this); + + var params = this.sources.map(function (source) { + return source[0]; + }); + var sources = this.sources.map(function (source) { + return source[1]; + }); + + sources = sources.concat(this.bareSources.filter(function (str) { + return !_this.sourceNames[str.value]; + })); + + var moduleName = this.getModuleName(); + if (moduleName) moduleName = t.stringLiteral(moduleName); + + if (this.hasExports) { + sources.unshift(t.stringLiteral("exports")); + params.unshift(t.identifier("exports")); + } + + if (this.hasModule) { + sources.unshift(t.stringLiteral("module")); + params.unshift(t.identifier("module")); + } + + var node = path.node; + + var factory = buildFactory({ + PARAMS: params, + BODY: node.body + }); + factory.expression.body.directives = node.directives; + node.directives = []; + + node.body = [buildDefine({ + MODULE_NAME: moduleName, + SOURCES: sources, + FACTORY: factory + })]; + } + } + } + }; + }; + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildDefine = (0, _babelTemplate2.default)("\n define(MODULE_NAME, [SOURCES], FACTORY);\n"); + + var buildFactory = (0, _babelTemplate2.default)("\n (function (PARAMS) {\n BODY;\n })\n"); + + module.exports = exports["default"]; + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + inherits: __webpack_require__(195), + + visitor: (0, _babelHelperBuilderBinaryAssignmentOperatorVisitor2.default)({ + operator: "**", + + build: function build(left, right) { + return t.callExpression(t.memberExpression(t.identifier("Math"), t.identifier("pow")), [left, right]); + } + }) + }; + }; + + var _babelHelperBuilderBinaryAssignmentOperatorVisitor = __webpack_require__(312); + + var _babelHelperBuilderBinaryAssignmentOperatorVisitor2 = _interopRequireDefault(_babelHelperBuilderBinaryAssignmentOperatorVisitor); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(402), __esModule: true }; + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _map = __webpack_require__(132); + + var _map2 = _interopRequireDefault(_map); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _includes = __webpack_require__(111); + + var _includes2 = _interopRequireDefault(_includes); + + var _repeat = __webpack_require__(273); + + var _repeat2 = _interopRequireDefault(_repeat); + + var _renamer = __webpack_require__(379); + + var _renamer2 = _interopRequireDefault(_renamer); + + var _index = __webpack_require__(7); + + var _index2 = _interopRequireDefault(_index); + + var _defaults = __webpack_require__(268); + + var _defaults2 = _interopRequireDefault(_defaults); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _binding2 = __webpack_require__(221); + + var _binding3 = _interopRequireDefault(_binding2); + + var _globals = __webpack_require__(454); + + var _globals2 = _interopRequireDefault(_globals); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _cache = __webpack_require__(86); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var _crawlCallsCount = 0; + + function getCache(path, parentScope, self) { + var scopes = _cache.scope.get(path.node) || []; + + for (var _iterator = scopes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var scope = _ref; + + if (scope.parent === parentScope && scope.path === path) return scope; + } + + scopes.push(self); + + if (!_cache.scope.has(path.node)) { + _cache.scope.set(path.node, scopes); + } + } + + function gatherNodeParts(node, parts) { + if (t.isModuleDeclaration(node)) { + if (node.source) { + gatherNodeParts(node.source, parts); + } else if (node.specifiers && node.specifiers.length) { + for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var specifier = _ref2; + + gatherNodeParts(specifier, parts); + } + } else if (node.declaration) { + gatherNodeParts(node.declaration, parts); + } + } else if (t.isModuleSpecifier(node)) { + gatherNodeParts(node.local, parts); + } else if (t.isMemberExpression(node)) { + gatherNodeParts(node.object, parts); + gatherNodeParts(node.property, parts); + } else if (t.isIdentifier(node)) { + parts.push(node.name); + } else if (t.isLiteral(node)) { + parts.push(node.value); + } else if (t.isCallExpression(node)) { + gatherNodeParts(node.callee, parts); + } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) { + for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var prop = _ref3; + + gatherNodeParts(prop.key || prop.argument, parts); + } + } + } + + var collectorVisitor = { + For: function For(path) { + for (var _iterator4 = t.FOR_INIT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var key = _ref4; + + var declar = path.get(key); + if (declar.isVar()) path.scope.getFunctionParent().registerBinding("var", declar); + } + }, + Declaration: function Declaration(path) { + if (path.isBlockScoped()) return; + + if (path.isExportDeclaration() && path.get("declaration").isDeclaration()) return; + + path.scope.getFunctionParent().registerDeclaration(path); + }, + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + state.references.push(path); + }, + ForXStatement: function ForXStatement(path, state) { + var left = path.get("left"); + if (left.isPattern() || left.isIdentifier()) { + state.constantViolations.push(left); + } + }, + + ExportDeclaration: { + exit: function exit(path) { + var node = path.node, + scope = path.scope; + + var declar = node.declaration; + if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) { + var _id = declar.id; + if (!_id) return; + + var binding = scope.getBinding(_id.name); + if (binding) binding.reference(path); + } else if (t.isVariableDeclaration(declar)) { + for (var _iterator5 = declar.declarations, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var decl = _ref5; + + var ids = t.getBindingIdentifiers(decl); + for (var name in ids) { + var _binding = scope.getBinding(name); + if (_binding) _binding.reference(path); + } + } + } + } + }, + + LabeledStatement: function LabeledStatement(path) { + path.scope.getProgramParent().addGlobal(path.node); + path.scope.getBlockParent().registerDeclaration(path); + }, + AssignmentExpression: function AssignmentExpression(path, state) { + state.assignments.push(path); + }, + UpdateExpression: function UpdateExpression(path, state) { + state.constantViolations.push(path.get("argument")); + }, + UnaryExpression: function UnaryExpression(path, state) { + if (path.node.operator === "delete") { + state.constantViolations.push(path.get("argument")); + } + }, + BlockScoped: function BlockScoped(path) { + var scope = path.scope; + if (scope.path === path) scope = scope.parent; + scope.getBlockParent().registerDeclaration(path); + }, + ClassDeclaration: function ClassDeclaration(path) { + var id = path.node.id; + if (!id) return; + + var name = id.name; + path.scope.bindings[name] = path.scope.getBinding(name); + }, + Block: function Block(path) { + var paths = path.get("body"); + for (var _iterator6 = paths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref6; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref6 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref6 = _i6.value; + } + + var bodyPath = _ref6; + + if (bodyPath.isFunctionDeclaration()) { + path.scope.getBlockParent().registerDeclaration(bodyPath); + } + } + } + }; + + var uid = 0; + + var Scope = function () { + function Scope(path, parentScope) { + (0, _classCallCheck3.default)(this, Scope); + + if (parentScope && parentScope.block === path.node) { + return parentScope; + } + + var cached = getCache(path, parentScope, this); + if (cached) return cached; + + this.uid = uid++; + this.parent = parentScope; + this.hub = path.hub; + + this.parentBlock = path.parent; + this.block = path.node; + this.path = path; + + this.labels = new _map2.default(); + } + + Scope.prototype.traverse = function traverse(node, opts, state) { + (0, _index2.default)(node, opts, this, state, this.path); + }; + + Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() { + var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; + + var id = this.generateUidIdentifier(name); + this.push({ id: id }); + return id; + }; + + Scope.prototype.generateUidIdentifier = function generateUidIdentifier() { + var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; + + return t.identifier(this.generateUid(name)); + }; + + Scope.prototype.generateUid = function generateUid() { + var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp"; + + name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, ""); + + var uid = void 0; + var i = 0; + do { + uid = this._generateUid(name, i); + i++; + } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); + + var program = this.getProgramParent(); + program.references[uid] = true; + program.uids[uid] = true; + + return uid; + }; + + Scope.prototype._generateUid = function _generateUid(name, i) { + var id = name; + if (i > 1) id += i; + return "_" + id; + }; + + Scope.prototype.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(parent, defaultName) { + var node = parent; + + if (t.isAssignmentExpression(parent)) { + node = parent.left; + } else if (t.isVariableDeclarator(parent)) { + node = parent.id; + } else if (t.isObjectProperty(node) || t.isObjectMethod(node)) { + node = node.key; + } + + var parts = []; + gatherNodeParts(node, parts); + + var id = parts.join("$"); + id = id.replace(/^_/, "") || defaultName || "ref"; + + return this.generateUidIdentifier(id.slice(0, 20)); + }; + + Scope.prototype.isStatic = function isStatic(node) { + if (t.isThisExpression(node) || t.isSuper(node)) { + return true; + } + + if (t.isIdentifier(node)) { + var binding = this.getBinding(node.name); + if (binding) { + return binding.constant; + } else { + return this.hasBinding(node.name); + } + } + + return false; + }; + + Scope.prototype.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) { + if (this.isStatic(node)) { + return null; + } else { + var _id2 = this.generateUidIdentifierBasedOnNode(node); + if (!dontPush) this.push({ id: _id2 }); + return _id2; + } + }; + + Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) { + if (kind === "param") return; + + if (kind === "hoisted" && local.kind === "let") return; + + var duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && (kind === "let" || kind === "const"); + + if (duplicate) { + throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError); + } + }; + + Scope.prototype.rename = function rename(oldName, newName, block) { + var binding = this.getBinding(oldName); + if (binding) { + newName = newName || this.generateUidIdentifier(oldName).name; + return new _renamer2.default(binding, oldName, newName).rename(block); + } + }; + + Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { + if (map[oldName]) { + map[newName] = value; + map[oldName] = null; + } + }; + + Scope.prototype.dump = function dump() { + var sep = (0, _repeat2.default)("-", 60); + console.log(sep); + var scope = this; + do { + console.log("#", scope.block.type); + for (var name in scope.bindings) { + var binding = scope.bindings[name]; + console.log(" -", name, { + constant: binding.constant, + references: binding.references, + violations: binding.constantViolations.length, + kind: binding.kind + }); + } + } while (scope = scope.parent); + console.log(sep); + }; + + Scope.prototype.toArray = function toArray(node, i) { + var file = this.hub.file; + + if (t.isIdentifier(node)) { + var binding = this.getBinding(node.name); + if (binding && binding.constant && binding.path.isGenericType("Array")) return node; + } + + if (t.isArrayExpression(node)) { + return node; + } + + if (t.isIdentifier(node, { name: "arguments" })) { + return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]); + } + + var helperName = "toArray"; + var args = [node]; + if (i === true) { + helperName = "toConsumableArray"; + } else if (i) { + args.push(t.numericLiteral(i)); + helperName = "slicedToArray"; + } + return t.callExpression(file.addHelper(helperName), args); + }; + + Scope.prototype.hasLabel = function hasLabel(name) { + return !!this.getLabel(name); + }; + + Scope.prototype.getLabel = function getLabel(name) { + return this.labels.get(name); + }; + + Scope.prototype.registerLabel = function registerLabel(path) { + this.labels.set(path.node.label.name, path); + }; + + Scope.prototype.registerDeclaration = function registerDeclaration(path) { + if (path.isLabeledStatement()) { + this.registerLabel(path); + } else if (path.isFunctionDeclaration()) { + this.registerBinding("hoisted", path.get("id"), path); + } else if (path.isVariableDeclaration()) { + var declarations = path.get("declarations"); + for (var _iterator7 = declarations, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref7; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref7 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref7 = _i7.value; + } + + var declar = _ref7; + + this.registerBinding(path.node.kind, declar); + } + } else if (path.isClassDeclaration()) { + this.registerBinding("let", path); + } else if (path.isImportDeclaration()) { + var specifiers = path.get("specifiers"); + for (var _iterator8 = specifiers, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) { + var _ref8; + + if (_isArray8) { + if (_i8 >= _iterator8.length) break; + _ref8 = _iterator8[_i8++]; + } else { + _i8 = _iterator8.next(); + if (_i8.done) break; + _ref8 = _i8.value; + } + + var specifier = _ref8; + + this.registerBinding("module", specifier); + } + } else if (path.isExportDeclaration()) { + var _declar = path.get("declaration"); + if (_declar.isClassDeclaration() || _declar.isFunctionDeclaration() || _declar.isVariableDeclaration()) { + this.registerDeclaration(_declar); + } + } else { + this.registerBinding("unknown", path); + } + }; + + Scope.prototype.buildUndefinedNode = function buildUndefinedNode() { + if (this.hasBinding("undefined")) { + return t.unaryExpression("void", t.numericLiteral(0), true); + } else { + return t.identifier("undefined"); + } + }; + + Scope.prototype.registerConstantViolation = function registerConstantViolation(path) { + var ids = path.getBindingIdentifiers(); + for (var name in ids) { + var binding = this.getBinding(name); + if (binding) binding.reassign(path); + } + }; + + Scope.prototype.registerBinding = function registerBinding(kind, path) { + var bindingPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : path; + + if (!kind) throw new ReferenceError("no `kind`"); + + if (path.isVariableDeclaration()) { + var declarators = path.get("declarations"); + for (var _iterator9 = declarators, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) { + var _ref9; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref9 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref9 = _i9.value; + } + + var declar = _ref9; + + this.registerBinding(kind, declar); + } + return; + } + + var parent = this.getProgramParent(); + var ids = path.getBindingIdentifiers(true); + + for (var name in ids) { + for (var _iterator10 = ids[name], _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) { + var _ref10; + + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref10 = _iterator10[_i10++]; + } else { + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref10 = _i10.value; + } + + var _id3 = _ref10; + + var local = this.getOwnBinding(name); + if (local) { + if (local.identifier === _id3) continue; + + this.checkBlockScopedCollisions(local, kind, name, _id3); + } + + if (local && local.path.isFlow()) local = null; + + parent.references[name] = true; + + this.bindings[name] = new _binding3.default({ + identifier: _id3, + existing: local, + scope: this, + path: bindingPath, + kind: kind + }); + } + } + }; + + Scope.prototype.addGlobal = function addGlobal(node) { + this.globals[node.name] = node; + }; + + Scope.prototype.hasUid = function hasUid(name) { + var scope = this; + + do { + if (scope.uids[name]) return true; + } while (scope = scope.parent); + + return false; + }; + + Scope.prototype.hasGlobal = function hasGlobal(name) { + var scope = this; + + do { + if (scope.globals[name]) return true; + } while (scope = scope.parent); + + return false; + }; + + Scope.prototype.hasReference = function hasReference(name) { + var scope = this; + + do { + if (scope.references[name]) return true; + } while (scope = scope.parent); + + return false; + }; + + Scope.prototype.isPure = function isPure(node, constantsOnly) { + if (t.isIdentifier(node)) { + var binding = this.getBinding(node.name); + if (!binding) return false; + if (constantsOnly) return binding.constant; + return true; + } else if (t.isClass(node)) { + if (node.superClass && !this.isPure(node.superClass, constantsOnly)) return false; + return this.isPure(node.body, constantsOnly); + } else if (t.isClassBody(node)) { + for (var _iterator11 = node.body, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : (0, _getIterator3.default)(_iterator11);;) { + var _ref11; + + if (_isArray11) { + if (_i11 >= _iterator11.length) break; + _ref11 = _iterator11[_i11++]; + } else { + _i11 = _iterator11.next(); + if (_i11.done) break; + _ref11 = _i11.value; + } + + var method = _ref11; + + if (!this.isPure(method, constantsOnly)) return false; + } + return true; + } else if (t.isBinary(node)) { + return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); + } else if (t.isArrayExpression(node)) { + for (var _iterator12 = node.elements, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : (0, _getIterator3.default)(_iterator12);;) { + var _ref12; + + if (_isArray12) { + if (_i12 >= _iterator12.length) break; + _ref12 = _iterator12[_i12++]; + } else { + _i12 = _iterator12.next(); + if (_i12.done) break; + _ref12 = _i12.value; + } + + var elem = _ref12; + + if (!this.isPure(elem, constantsOnly)) return false; + } + return true; + } else if (t.isObjectExpression(node)) { + for (var _iterator13 = node.properties, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : (0, _getIterator3.default)(_iterator13);;) { + var _ref13; + + if (_isArray13) { + if (_i13 >= _iterator13.length) break; + _ref13 = _iterator13[_i13++]; + } else { + _i13 = _iterator13.next(); + if (_i13.done) break; + _ref13 = _i13.value; + } + + var prop = _ref13; + + if (!this.isPure(prop, constantsOnly)) return false; + } + return true; + } else if (t.isClassMethod(node)) { + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (node.kind === "get" || node.kind === "set") return false; + return true; + } else if (t.isClassProperty(node) || t.isObjectProperty(node)) { + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + return this.isPure(node.value, constantsOnly); + } else if (t.isUnaryExpression(node)) { + return this.isPure(node.argument, constantsOnly); + } else { + return t.isPureish(node); + } + }; + + Scope.prototype.setData = function setData(key, val) { + return this.data[key] = val; + }; + + Scope.prototype.getData = function getData(key) { + var scope = this; + do { + var data = scope.data[key]; + if (data != null) return data; + } while (scope = scope.parent); + }; + + Scope.prototype.removeData = function removeData(key) { + var scope = this; + do { + var data = scope.data[key]; + if (data != null) scope.data[key] = null; + } while (scope = scope.parent); + }; + + Scope.prototype.init = function init() { + if (!this.references) this.crawl(); + }; + + Scope.prototype.crawl = function crawl() { + _crawlCallsCount++; + this._crawl(); + _crawlCallsCount--; + }; + + Scope.prototype._crawl = function _crawl() { + var path = this.path; + + this.references = (0, _create2.default)(null); + this.bindings = (0, _create2.default)(null); + this.globals = (0, _create2.default)(null); + this.uids = (0, _create2.default)(null); + this.data = (0, _create2.default)(null); + + if (path.isLoop()) { + for (var _iterator14 = t.FOR_INIT_KEYS, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : (0, _getIterator3.default)(_iterator14);;) { + var _ref14; + + if (_isArray14) { + if (_i14 >= _iterator14.length) break; + _ref14 = _iterator14[_i14++]; + } else { + _i14 = _iterator14.next(); + if (_i14.done) break; + _ref14 = _i14.value; + } + + var key = _ref14; + + var node = path.get(key); + if (node.isBlockScoped()) this.registerBinding(node.node.kind, node); + } + } + + if (path.isFunctionExpression() && path.has("id")) { + if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { + this.registerBinding("local", path.get("id"), path); + } + } + + if (path.isClassExpression() && path.has("id")) { + if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { + this.registerBinding("local", path); + } + } + + if (path.isFunction()) { + var params = path.get("params"); + for (var _iterator15 = params, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : (0, _getIterator3.default)(_iterator15);;) { + var _ref15; + + if (_isArray15) { + if (_i15 >= _iterator15.length) break; + _ref15 = _iterator15[_i15++]; + } else { + _i15 = _iterator15.next(); + if (_i15.done) break; + _ref15 = _i15.value; + } + + var param = _ref15; + + this.registerBinding("param", param); + } + } + + if (path.isCatchClause()) { + this.registerBinding("let", path); + } + + var parent = this.getProgramParent(); + if (parent.crawling) return; + + var state = { + references: [], + constantViolations: [], + assignments: [] + }; + + this.crawling = true; + path.traverse(collectorVisitor, state); + this.crawling = false; + + for (var _iterator16 = state.assignments, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : (0, _getIterator3.default)(_iterator16);;) { + var _ref16; + + if (_isArray16) { + if (_i16 >= _iterator16.length) break; + _ref16 = _iterator16[_i16++]; + } else { + _i16 = _iterator16.next(); + if (_i16.done) break; + _ref16 = _i16.value; + } + + var _path = _ref16; + + var ids = _path.getBindingIdentifiers(); + var programParent = void 0; + for (var name in ids) { + if (_path.scope.getBinding(name)) continue; + + programParent = programParent || _path.scope.getProgramParent(); + programParent.addGlobal(ids[name]); + } + + _path.scope.registerConstantViolation(_path); + } + + for (var _iterator17 = state.references, _isArray17 = Array.isArray(_iterator17), _i17 = 0, _iterator17 = _isArray17 ? _iterator17 : (0, _getIterator3.default)(_iterator17);;) { + var _ref17; + + if (_isArray17) { + if (_i17 >= _iterator17.length) break; + _ref17 = _iterator17[_i17++]; + } else { + _i17 = _iterator17.next(); + if (_i17.done) break; + _ref17 = _i17.value; + } + + var ref = _ref17; + + var binding = ref.scope.getBinding(ref.node.name); + if (binding) { + binding.reference(ref); + } else { + ref.scope.getProgramParent().addGlobal(ref.node); + } + } + + for (var _iterator18 = state.constantViolations, _isArray18 = Array.isArray(_iterator18), _i18 = 0, _iterator18 = _isArray18 ? _iterator18 : (0, _getIterator3.default)(_iterator18);;) { + var _ref18; + + if (_isArray18) { + if (_i18 >= _iterator18.length) break; + _ref18 = _iterator18[_i18++]; + } else { + _i18 = _iterator18.next(); + if (_i18.done) break; + _ref18 = _i18.value; + } + + var _path2 = _ref18; + + _path2.scope.registerConstantViolation(_path2); + } + }; + + Scope.prototype.push = function push(opts) { + var path = this.path; + + if (!path.isBlockStatement() && !path.isProgram()) { + path = this.getBlockParent().path; + } + + if (path.isSwitchStatement()) { + path = this.getFunctionParent().path; + } + + if (path.isLoop() || path.isCatchClause() || path.isFunction()) { + t.ensureBlock(path.node); + path = path.get("body"); + } + + var unique = opts.unique; + var kind = opts.kind || "var"; + var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; + + var dataKey = "declaration:" + kind + ":" + blockHoist; + var declarPath = !unique && path.getData(dataKey); + + if (!declarPath) { + var declar = t.variableDeclaration(kind, []); + declar._generated = true; + declar._blockHoist = blockHoist; + + var _path$unshiftContaine = path.unshiftContainer("body", [declar]); + + declarPath = _path$unshiftContaine[0]; + + if (!unique) path.setData(dataKey, declarPath); + } + + var declarator = t.variableDeclarator(opts.id, opts.init); + declarPath.node.declarations.push(declarator); + this.registerBinding(kind, declarPath.get("declarations").pop()); + }; + + Scope.prototype.getProgramParent = function getProgramParent() { + var scope = this; + do { + if (scope.path.isProgram()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a Function or Program..."); + }; + + Scope.prototype.getFunctionParent = function getFunctionParent() { + var scope = this; + do { + if (scope.path.isFunctionParent()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a Function or Program..."); + }; + + Scope.prototype.getBlockParent = function getBlockParent() { + var scope = this; + do { + if (scope.path.isBlockParent()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + }; + + Scope.prototype.getAllBindings = function getAllBindings() { + var ids = (0, _create2.default)(null); + + var scope = this; + do { + (0, _defaults2.default)(ids, scope.bindings); + scope = scope.parent; + } while (scope); + + return ids; + }; + + Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind() { + var ids = (0, _create2.default)(null); + + for (var _iterator19 = arguments, _isArray19 = Array.isArray(_iterator19), _i19 = 0, _iterator19 = _isArray19 ? _iterator19 : (0, _getIterator3.default)(_iterator19);;) { + var _ref19; + + if (_isArray19) { + if (_i19 >= _iterator19.length) break; + _ref19 = _iterator19[_i19++]; + } else { + _i19 = _iterator19.next(); + if (_i19.done) break; + _ref19 = _i19.value; + } + + var kind = _ref19; + + var scope = this; + do { + for (var name in scope.bindings) { + var binding = scope.bindings[name]; + if (binding.kind === kind) ids[name] = binding; + } + scope = scope.parent; + } while (scope); + } + + return ids; + }; + + Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) { + return this.getBindingIdentifier(name) === node; + }; + + Scope.prototype.warnOnFlowBinding = function warnOnFlowBinding(binding) { + if (_crawlCallsCount === 0 && binding && binding.path.isFlow()) { + console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 7. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n "); + } + return binding; + }; + + Scope.prototype.getBinding = function getBinding(name) { + var scope = this; + + do { + var binding = scope.getOwnBinding(name); + if (binding) return this.warnOnFlowBinding(binding); + } while (scope = scope.parent); + }; + + Scope.prototype.getOwnBinding = function getOwnBinding(name) { + return this.warnOnFlowBinding(this.bindings[name]); + }; + + Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) { + var info = this.getBinding(name); + return info && info.identifier; + }; + + Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) { + var binding = this.bindings[name]; + return binding && binding.identifier; + }; + + Scope.prototype.hasOwnBinding = function hasOwnBinding(name) { + return !!this.getOwnBinding(name); + }; + + Scope.prototype.hasBinding = function hasBinding(name, noGlobals) { + if (!name) return false; + if (this.hasOwnBinding(name)) return true; + if (this.parentHasBinding(name, noGlobals)) return true; + if (this.hasUid(name)) return true; + if (!noGlobals && (0, _includes2.default)(Scope.globals, name)) return true; + if (!noGlobals && (0, _includes2.default)(Scope.contextVariables, name)) return true; + return false; + }; + + Scope.prototype.parentHasBinding = function parentHasBinding(name, noGlobals) { + return this.parent && this.parent.hasBinding(name, noGlobals); + }; + + Scope.prototype.moveBindingTo = function moveBindingTo(name, scope) { + var info = this.getBinding(name); + if (info) { + info.scope.removeOwnBinding(name); + info.scope = scope; + scope.bindings[name] = info; + } + }; + + Scope.prototype.removeOwnBinding = function removeOwnBinding(name) { + delete this.bindings[name]; + }; + + Scope.prototype.removeBinding = function removeBinding(name) { + var info = this.getBinding(name); + if (info) { + info.scope.removeOwnBinding(name); + } + + var scope = this; + do { + if (scope.uids[name]) { + scope.uids[name] = false; + } + } while (scope = scope.parent); + }; + + return Scope; + }(); + + Scope.globals = (0, _keys2.default)(_globals2.default.builtin); + Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; + exports.default = Scope; + module.exports = exports["default"]; + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; + + var _for = __webpack_require__(358); + + var _for2 = _interopRequireDefault(_for); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; + var FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"]; + var FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"]; + var COMMENT_KEYS = exports.COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; + + var LOGICAL_OPERATORS = exports.LOGICAL_OPERATORS = ["||", "&&"]; + var UPDATE_OPERATORS = exports.UPDATE_OPERATORS = ["++", "--"]; + + var BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; + var EQUALITY_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; + var COMPARISON_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]); + var BOOLEAN_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS); + var NUMBER_BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; + var BINARY_OPERATORS = exports.BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS); + + var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; + var NUMBER_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; + var STRING_UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = ["typeof"]; + var UNARY_OPERATORS = exports.UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS); + + var INHERIT_KEYS = exports.INHERIT_KEYS = { + optional: ["typeAnnotation", "typeParameters", "returnType"], + force: ["start", "loc", "end"] + }; + + var BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = (0, _for2.default)("var used to be block scoped"); + var NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = (0, _for2.default)("should not be considered a local binding"); + +/***/ }), +/* 135 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) { + throw TypeError(name + ': incorrect invocation!'); + }return it; + }; + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 0 -> Array#forEach + // 1 -> Array#map + // 2 -> Array#filter + // 3 -> Array#some + // 4 -> Array#every + // 5 -> Array#find + // 6 -> Array#findIndex + var ctx = __webpack_require__(54), + IObject = __webpack_require__(140), + toObject = __webpack_require__(94), + toLength = __webpack_require__(149), + asc = __webpack_require__(419); + module.exports = function (TYPE, $create) { + var IS_MAP = TYPE == 1, + IS_FILTER = TYPE == 2, + IS_SOME = TYPE == 3, + IS_EVERY = TYPE == 4, + IS_FIND_INDEX = TYPE == 6, + NO_HOLES = TYPE == 5 || IS_FIND_INDEX, + create = $create || asc; + return function ($this, callbackfn, that) { + var O = toObject($this), + self = IObject(O), + f = ctx(callbackfn, that, 3), + length = toLength(self.length), + index = 0, + result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined, + val, + res; + for (; length > index; index++) { + if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: + return true; // some + case 5: + return val; // find + case 6: + return index; // findIndex + case 2: + result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; + }; + +/***/ }), +/* 137 */ +/***/ (function(module, exports) { + + "use strict"; + + var toString = {}.toString; + + module.exports = function (it) { + return toString.call(it).slice(8, -1); + }; + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var global = __webpack_require__(14), + $export = __webpack_require__(21), + meta = __webpack_require__(56), + fails = __webpack_require__(36), + hide = __webpack_require__(28), + redefineAll = __webpack_require__(144), + forOf = __webpack_require__(89), + anInstance = __webpack_require__(135), + isObject = __webpack_require__(22), + setToStringTag = __webpack_require__(93), + dP = __webpack_require__(23).f, + each = __webpack_require__(136)(0), + DESCRIPTORS = __webpack_require__(20); + + module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME], + C = Base, + ADDER = IS_MAP ? 'set' : 'add', + proto = C && C.prototype, + O = {}; + if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + C = wrapper(function (target, iterable) { + anInstance(target, C, NAME, '_c'); + target._c = new Base(); + if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target); + }); + each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) { + var IS_ADDER = KEY == 'add' || KEY == 'set'; + if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) { + anInstance(this, C, KEY); + if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; + var result = this._c[KEY](a === 0 ? 0 : a, b); + return IS_ADDER ? this : result; + }); + }); + if ('size' in proto) dP(C.prototype, 'size', { + get: function get() { + return this._c.size; + } + }); + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F, O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; + }; + +/***/ }), +/* 139 */ +/***/ (function(module, exports) { + + 'use strict'; + + // IE 8- don't enum bug keys + module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var cof = __webpack_require__(137); + module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); + }; + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var LIBRARY = __webpack_require__(142), + $export = __webpack_require__(21), + redefine = __webpack_require__(145), + hide = __webpack_require__(28), + has = __webpack_require__(27), + Iterators = __webpack_require__(55), + $iterCreate = __webpack_require__(426), + setToStringTag = __webpack_require__(93), + getPrototypeOf = __webpack_require__(430), + ITERATOR = __webpack_require__(12)('iterator'), + BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` + , + FF_ITERATOR = '@@iterator', + KEYS = 'keys', + VALUES = 'values'; + + var returnThis = function returnThis() { + return this; + }; + + module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function getMethod(kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: + return function keys() { + return new Constructor(this, kind); + }; + case VALUES: + return function values() { + return new Constructor(this, kind); + }; + }return function entries() { + return new Constructor(this, kind); + }; + }; + var TAG = NAME + ' Iterator', + DEF_VALUES = DEFAULT == VALUES, + VALUES_BUG = false, + proto = Base.prototype, + $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT], + $default = $native || getMethod(DEFAULT), + $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined, + $anyNative = NAME == 'Array' ? proto.entries || $native : $native, + methods, + key, + IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { + return $native.call(this); + }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; + }; + +/***/ }), +/* 142 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = true; + +/***/ }), +/* 143 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.f = Object.getOwnPropertySymbols; + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var hide = __webpack_require__(28); + module.exports = function (target, src, safe) { + for (var key in src) { + if (safe && target[key]) target[key] = src[key];else hide(target, key, src[key]); + }return target; + }; + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(28); + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var shared = __webpack_require__(147)('keys'), + uid = __webpack_require__(95); + module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); + }; + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var global = __webpack_require__(14), + SHARED = '__core-js_shared__', + store = global[SHARED] || (global[SHARED] = {}); + module.exports = function (key) { + return store[key] || (store[key] = {}); + }; + +/***/ }), +/* 148 */ +/***/ (function(module, exports) { + + "use strict"; + + // 7.1.4 ToInteger + var ceil = Math.ceil, + floor = Math.floor; + module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + }; + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 7.1.15 ToLength + var toInteger = __webpack_require__(148), + min = Math.min; + module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }; + +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 7.1.1 ToPrimitive(input [, PreferredType]) + var isObject = __webpack_require__(22); + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); + }; + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var global = __webpack_require__(14), + core = __webpack_require__(5), + LIBRARY = __webpack_require__(142), + wksExt = __webpack_require__(152), + defineProperty = __webpack_require__(23).f; + module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); + }; + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.f = __webpack_require__(12); + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var $at = __webpack_require__(434)(true); + + // 21.1.3.27 String.prototype[@@iterator]() + __webpack_require__(141)(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, function () { + var O = this._t, + index = this._i, + point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; + }); + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + // ECMAScript 6 symbols shim + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var global = __webpack_require__(14), + has = __webpack_require__(27), + DESCRIPTORS = __webpack_require__(20), + $export = __webpack_require__(21), + redefine = __webpack_require__(145), + META = __webpack_require__(56).KEY, + $fails = __webpack_require__(36), + shared = __webpack_require__(147), + setToStringTag = __webpack_require__(93), + uid = __webpack_require__(95), + wks = __webpack_require__(12), + wksExt = __webpack_require__(152), + wksDefine = __webpack_require__(151), + keyOf = __webpack_require__(427), + enumKeys = __webpack_require__(422), + isArray = __webpack_require__(227), + anObject = __webpack_require__(19), + toIObject = __webpack_require__(37), + toPrimitive = __webpack_require__(150), + createDesc = __webpack_require__(92), + _create = __webpack_require__(90), + gOPNExt = __webpack_require__(429), + $GOPD = __webpack_require__(230), + $DP = __webpack_require__(23), + $keys = __webpack_require__(43), + gOPD = $GOPD.f, + dP = $DP.f, + gOPN = gOPNExt.f, + $Symbol = global.Symbol, + $JSON = global.JSON, + _stringify = $JSON && $JSON.stringify, + PROTOTYPE = 'prototype', + HIDDEN = wks('_hidden'), + TO_PRIMITIVE = wks('toPrimitive'), + isEnum = {}.propertyIsEnumerable, + SymbolRegistry = shared('symbol-registry'), + AllSymbols = shared('symbols'), + OPSymbols = shared('op-symbols'), + ObjectProto = Object[PROTOTYPE], + USE_NATIVE = typeof $Symbol == 'function', + QObject = global.QObject; + // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 + var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + + // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function get() { + return dP(this, 'a', { value: 7 }).a; + } + })).a != 7; + }) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); + } : dP; + + var wrap = function wrap(tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; + }; + + var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) { + return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol'; + } : function (it) { + return it instanceof $Symbol; + }; + + var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + }return setSymbolDesc(it, key, D); + }return dP(it, key, D); + }; + var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)), + i = 0, + l = keys.length, + key; + while (l > i) { + $defineProperty(it, key = keys[i++], P[key]); + }return it; + }; + var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); + }; + var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; + }; + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; + }; + var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + }return result; + }; + var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto, + names = gOPN(IS_OP ? OPSymbols : toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + }return result; + }; + + // 19.4.1.1 Symbol([description]) + if (!USE_NATIVE) { + $Symbol = function _Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function $set(value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + __webpack_require__(231).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(91).f = $propertyIsEnumerable; + __webpack_require__(143).f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !__webpack_require__(142)) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function (name) { + return wrap(wks(name)); + }; + } + + $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + + for (var symbols = + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), i = 0; symbols.length > i;) { + wks(symbols[i++]); + }for (var symbols = $keys(wks.store), i = 0; symbols.length > i;) { + wksDefine(symbols[i++]); + }$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function _for(key) { + return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(key) { + if (isSymbol(key)) return keyOf(SymbolRegistry, key); + throw TypeError(key + ' is not a symbol!'); + }, + useSetter: function useSetter() { + setter = true; + }, + useSimple: function useSimple() { + setter = false; + } + }); + + $export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols + }); + + // 24.3.2 JSON.stringify(value [, replacer [, space]]) + $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; + })), 'JSON', { + stringify: function stringify(it) { + if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + var args = [it], + i = 1, + replacer, + $replacer; + while (arguments.length > i) { + args.push(arguments[i++]); + }replacer = args[1]; + if (typeof replacer == 'function') $replacer = replacer; + if ($replacer || !isArray(replacer)) replacer = function replacer(key, value) { + if ($replacer) value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } + }); + + // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) + $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(28)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); + // 19.4.3.5 Symbol.prototype[@@toStringTag] + setToStringTag($Symbol, 'Symbol'); + // 20.2.1.9 Math[@@toStringTag] + setToStringTag(Math, 'Math', true); + // 24.3.3 JSON[@@toStringTag] + setToStringTag(global.JSON, 'JSON', true); + +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38), + root = __webpack_require__(15); + + /* Built-in method references that are verified to be native. */ + var Map = getNative(root, 'Map'); + + module.exports = Map; + +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var mapCacheClear = __webpack_require__(542), + mapCacheDelete = __webpack_require__(543), + mapCacheGet = __webpack_require__(544), + mapCacheHas = __webpack_require__(545), + mapCacheSet = __webpack_require__(546); + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + module.exports = MapCache; + +/***/ }), +/* 157 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + module.exports = arrayPush; + +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseAssignValue = __webpack_require__(159), + eq = __webpack_require__(45); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) { + baseAssignValue(object, key, value); + } + } + + module.exports = assignValue; + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var defineProperty = __webpack_require__(254); + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + module.exports = baseAssignValue; + +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Stack = __webpack_require__(99), + arrayEach = __webpack_require__(469), + assignValue = __webpack_require__(158), + baseAssign = __webpack_require__(474), + baseAssignIn = __webpack_require__(475), + cloneBuffer = __webpack_require__(251), + copyArray = __webpack_require__(164), + copySymbols = __webpack_require__(514), + copySymbolsIn = __webpack_require__(515), + getAllKeys = __webpack_require__(257), + getAllKeysIn = __webpack_require__(523), + getTag = __webpack_require__(259), + initCloneArray = __webpack_require__(532), + initCloneByTag = __webpack_require__(533), + initCloneObject = __webpack_require__(261), + isArray = __webpack_require__(6), + isBuffer = __webpack_require__(113), + isObject = __webpack_require__(16), + keys = __webpack_require__(31); + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + weakMapTag = '[object WeakMap]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; + + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || isFunc && !object) { + result = isFlat || isFunc ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, baseClone, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack()); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; + + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function (subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + module.exports = baseClone; + +/***/ }), +/* 161 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while (fromRight ? index-- : ++index < length) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + module.exports = baseFindIndex; + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseFindIndex = __webpack_require__(161), + baseIsNaN = __webpack_require__(487), + strictIndexOf = __webpack_require__(561); + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); + } + + module.exports = baseIndexOf; + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Uint8Array = __webpack_require__(238); + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + module.exports = cloneArrayBuffer; + +/***/ }), +/* 164 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + module.exports = copyArray; + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var overArg = __webpack_require__(266); + + /** Built-in value references. */ + var getPrototype = overArg(Object.getPrototypeOf, Object); + + module.exports = getPrototype; + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayFilter = __webpack_require__(470), + stubArray = __webpack_require__(274); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Built-in value references. */ + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeGetSymbols = Object.getOwnPropertySymbols; + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray : function (object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function (symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + + module.exports = getSymbols; + +/***/ }), +/* 167 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; + } + + module.exports = isIndex; + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var eq = __webpack_require__(45), + isArrayLike = __webpack_require__(24), + isIndex = __webpack_require__(167), + isObject = __webpack_require__(16); + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index === 'undefined' ? 'undefined' : _typeof(index); + if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) { + return eq(object[index], value); + } + return false; + } + + module.exports = isIterateeCall; + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var isArray = __webpack_require__(6), + isSymbol = __webpack_require__(60); + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); + if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); + } + + module.exports = isKey; + +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assignValue = __webpack_require__(158), + copyObject = __webpack_require__(30), + createAssigner = __webpack_require__(103), + isArrayLike = __webpack_require__(24), + isPrototype = __webpack_require__(105), + keys = __webpack_require__(31); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function (object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + module.exports = assign; + +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + isObject = __webpack_require__(16); + + /** `Object#toString` result references. */ + var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + module.exports = isFunction; + +/***/ }), +/* 172 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + module.exports = isLength; + +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsTypedArray = __webpack_require__(490), + baseUnary = __webpack_require__(102), + nodeUtil = __webpack_require__(265); + + /* Node.js helper references. */ + var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + + module.exports = isTypedArray; + +/***/ }), +/* 174 */ +/***/ (function(module, exports, __webpack_require__) { + + var map = { + "./index": 49, + "./index.js": 49, + "./logger": 119, + "./logger.js": 119, + "./metadata": 120, + "./metadata.js": 120, + "./options/build-config-chain": 50, + "./options/build-config-chain.js": 50, + "./options/config": 32, + "./options/config.js": 32, + "./options/index": 51, + "./options/index.js": 51, + "./options/option-manager": 33, + "./options/option-manager.js": 33, + "./options/parsers": 52, + "./options/parsers.js": 52, + "./options/removed": 53, + "./options/removed.js": 53 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 174; + + +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { + + var map = { + "./build-config-chain": 50, + "./build-config-chain.js": 50, + "./config": 32, + "./config.js": 32, + "./index": 51, + "./index.js": 51, + "./option-manager": 33, + "./option-manager.js": 33, + "./parsers": 52, + "./parsers.js": 52, + "./removed": 53, + "./removed.js": 53 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 175; + + +/***/ }), +/* 176 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function () { + return (/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g + ); + }; + +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (rawLines, lineNumber, colNumber) { + var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + + colNumber = Math.max(colNumber, 0); + + var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor; + var chalk = _chalk2.default; + if (opts.forceColor) { + chalk = new _chalk2.default.constructor({ enabled: true }); + } + var maybeHighlight = function maybeHighlight(chalkFn, string) { + return highlighted ? chalkFn(string) : string; + }; + var defs = getDefs(chalk); + if (highlighted) rawLines = highlight(defs, rawLines); + + var linesAbove = opts.linesAbove || 2; + var linesBelow = opts.linesBelow || 3; + + var lines = rawLines.split(NEWLINE); + var start = Math.max(lineNumber - (linesAbove + 1), 0); + var end = Math.min(lines.length, lineNumber + linesBelow); + + if (!lineNumber && !colNumber) { + start = 0; + end = lines.length; + } + + var numberMaxWidth = String(end).length; + + var frame = lines.slice(start, end).map(function (line, index) { + var number = start + 1 + index; + var paddedNumber = (" " + number).slice(-numberMaxWidth); + var gutter = " " + paddedNumber + " | "; + if (number === lineNumber) { + var markerLine = ""; + if (colNumber) { + var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " "); + markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join(""); + } + return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); + } else { + return " " + maybeHighlight(defs.gutter, gutter) + line; + } + }).join("\n"); + + if (highlighted) { + return chalk.reset(frame); + } else { + return frame; + } + }; + + var _jsTokens = __webpack_require__(459); + + var _jsTokens2 = _interopRequireDefault(_jsTokens); + + var _esutils = __webpack_require__(97); + + var _esutils2 = _interopRequireDefault(_esutils); + + var _chalk = __webpack_require__(397); + + var _chalk2 = _interopRequireDefault(_chalk); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getDefs(chalk) { + return { + keyword: chalk.cyan, + capitalized: chalk.yellow, + jsx_tag: chalk.yellow, + punctuator: chalk.yellow, + + number: chalk.magenta, + string: chalk.green, + regex: chalk.magenta, + comment: chalk.grey, + invalid: chalk.white.bgRed.bold, + gutter: chalk.grey, + marker: chalk.red.bold + }; + } + + var NEWLINE = /\r\n|[\n\r\u2028\u2029]/; + + var JSX_TAG = /^[a-z][\w-]*$/i; + + var BRACKET = /^[()\[\]{}]$/; + + function getTokenType(match) { + var _match$slice = match.slice(-2), + offset = _match$slice[0], + text = _match$slice[1]; + + var token = (0, _jsTokens.matchToToken)(match); + + if (token.type === "name") { + if (_esutils2.default.keyword.isReservedWordES6(token.value)) { + return "keyword"; + } + + if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) { + return "jsx_tag"; + } + + if (token.value[0] !== token.value[0].toLowerCase()) { + return "capitalized"; + } + } + + if (token.type === "punctuator" && BRACKET.test(token.value)) { + return "bracket"; + } + + return token.type; + } + + function highlight(defs, text) { + return text.replace(_jsTokens2.default, function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var type = getTokenType(args); + var colorize = defs[type]; + if (colorize) { + return args[0].split(NEWLINE).map(function (str) { + return colorize(str); + }).join("\n"); + } else { + return args[0]; + } + }); + } + + module.exports = exports["default"]; + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined; + + var _file = __webpack_require__(49); + + Object.defineProperty(exports, "File", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_file).default; + } + }); + + var _config = __webpack_require__(32); + + Object.defineProperty(exports, "options", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_config).default; + } + }); + + var _buildExternalHelpers = __webpack_require__(291); + + Object.defineProperty(exports, "buildExternalHelpers", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_buildExternalHelpers).default; + } + }); + + var _babelTemplate = __webpack_require__(4); + + Object.defineProperty(exports, "template", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_babelTemplate).default; + } + }); + + var _resolvePlugin = __webpack_require__(180); + + Object.defineProperty(exports, "resolvePlugin", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_resolvePlugin).default; + } + }); + + var _resolvePreset = __webpack_require__(181); + + Object.defineProperty(exports, "resolvePreset", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_resolvePreset).default; + } + }); + + var _package = __webpack_require__(619); + + Object.defineProperty(exports, "version", { + enumerable: true, + get: function get() { + return _package.version; + } + }); + exports.Plugin = Plugin; + exports.transformFile = transformFile; + exports.transformFileSync = transformFileSync; + + var _fs = __webpack_require__(115); + + var _fs2 = _interopRequireDefault(_fs); + + var _util = __webpack_require__(121); + + var util = _interopRequireWildcard(_util); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + var _optionManager = __webpack_require__(33); + + var _optionManager2 = _interopRequireDefault(_optionManager); + + var _pipeline = __webpack_require__(294); + + var _pipeline2 = _interopRequireDefault(_pipeline); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.util = util; + exports.messages = messages; + exports.types = t; + exports.traverse = _babelTraverse2.default; + exports.OptionManager = _optionManager2.default; + function Plugin(alias) { + throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6."); + } + + exports.Pipeline = _pipeline2.default; + + var pipeline = new _pipeline2.default(); + var analyse = exports.analyse = pipeline.analyse.bind(pipeline); + var transform = exports.transform = pipeline.transform.bind(pipeline); + var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline); + + function transformFile(filename, opts, callback) { + if (typeof opts === "function") { + callback = opts; + opts = {}; + } + + opts.filename = filename; + + _fs2.default.readFile(filename, function (err, code) { + var result = void 0; + + if (!err) { + try { + result = transform(code, opts); + } catch (_err) { + err = _err; + } + } + + if (err) { + callback(err); + } else { + callback(null, result); + } + }); + } + + function transformFileSync(filename) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + opts.filename = filename; + return transform(_fs2.default.readFileSync(filename, "utf8"), opts); + } + +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.default = resolveFromPossibleNames; + + var _resolve = __webpack_require__(117); + + var _resolve2 = _interopRequireDefault(_resolve); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function resolveFromPossibleNames(possibleNames, dirname) { + return possibleNames.reduce(function (accum, curr) { + return accum || (0, _resolve2.default)(curr, dirname); + }, null); + } + module.exports = exports["default"]; + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + exports.default = resolvePlugin; + + var _resolveFromPossibleNames = __webpack_require__(179); + + var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames); + + var _getPossiblePluginNames = __webpack_require__(287); + + var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function resolvePlugin(pluginName) { + var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); + + return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname); + } + module.exports = exports["default"]; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {"use strict"; + + exports.__esModule = true; + exports.default = resolvePreset; + + var _resolveFromPossibleNames = __webpack_require__(179); + + var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames); + + var _getPossiblePresetNames = __webpack_require__(288); + + var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function resolvePreset(presetName) { + var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); + + return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname); + } + module.exports = exports["default"]; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.CodeGenerator = undefined; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + exports.default = function (ast, opts, code) { + var gen = new Generator(ast, opts, code); + return gen.generate(); + }; + + var _detectIndent = __webpack_require__(450); + + var _detectIndent2 = _interopRequireDefault(_detectIndent); + + var _sourceMap = __webpack_require__(309); + + var _sourceMap2 = _interopRequireDefault(_sourceMap); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _printer = __webpack_require__(308); + + var _printer2 = _interopRequireDefault(_printer); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Generator = function (_Printer) { + (0, _inherits3.default)(Generator, _Printer); + + function Generator(ast) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var code = arguments[2]; + (0, _classCallCheck3.default)(this, Generator); + + var tokens = ast.tokens || []; + var format = normalizeOptions(code, opts, tokens); + var map = opts.sourceMaps ? new _sourceMap2.default(opts, code) : null; + + var _this = (0, _possibleConstructorReturn3.default)(this, _Printer.call(this, format, map, tokens)); + + _this.ast = ast; + return _this; + } + + Generator.prototype.generate = function generate() { + return _Printer.prototype.generate.call(this, this.ast); + }; + + return Generator; + }(_printer2.default); + + function normalizeOptions(code, opts, tokens) { + var style = " "; + if (code && typeof code === "string") { + var indent = (0, _detectIndent2.default)(code).indent; + if (indent && indent !== " ") style = indent; + } + + var format = { + auxiliaryCommentBefore: opts.auxiliaryCommentBefore, + auxiliaryCommentAfter: opts.auxiliaryCommentAfter, + shouldPrintComment: opts.shouldPrintComment, + retainLines: opts.retainLines, + retainFunctionParens: opts.retainFunctionParens, + comments: opts.comments == null || opts.comments, + compact: opts.compact, + minified: opts.minified, + concise: opts.concise, + quotes: opts.quotes || findCommonStringDelimiter(code, tokens), + jsonCompatibleStrings: opts.jsonCompatibleStrings, + indent: { + adjustMultilineComment: true, + style: style, + base: 0 + }, + flowCommaSeparator: opts.flowCommaSeparator + }; + + if (format.minified) { + format.compact = true; + + format.shouldPrintComment = format.shouldPrintComment || function () { + return format.comments; + }; + } else { + format.shouldPrintComment = format.shouldPrintComment || function (value) { + return format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0; + }; + } + + if (format.compact === "auto") { + format.compact = code.length > 500000; + + if (format.compact) { + console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "500KB")); + } + } + + if (format.compact) { + format.indent.adjustMultilineComment = false; + } + + return format; + } + + function findCommonStringDelimiter(code, tokens) { + var DEFAULT_STRING_DELIMITER = "double"; + if (!code) { + return DEFAULT_STRING_DELIMITER; + } + + var occurrences = { + single: 0, + double: 0 + }; + + var checked = 0; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type.label !== "string") continue; + + var raw = code.slice(token.start, token.end); + if (raw[0] === "'") { + occurrences.single++; + } else { + occurrences.double++; + } + + checked++; + if (checked >= 3) break; + } + if (occurrences.single > occurrences.double) { + return "single"; + } else { + return "double"; + } + } + + var CodeGenerator = exports.CodeGenerator = function () { + function CodeGenerator(ast, opts, code) { + (0, _classCallCheck3.default)(this, CodeGenerator); + + this._generator = new Generator(ast, opts, code); + } + + CodeGenerator.prototype.generate = function generate() { + return this._generator.generate(); + }; + + return CodeGenerator; + }(); + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + exports.needsWhitespace = needsWhitespace; + exports.needsWhitespaceBefore = needsWhitespaceBefore; + exports.needsWhitespaceAfter = needsWhitespaceAfter; + exports.needsParens = needsParens; + + var _whitespace = __webpack_require__(307); + + var _whitespace2 = _interopRequireDefault(_whitespace); + + var _parentheses = __webpack_require__(306); + + var parens = _interopRequireWildcard(_parentheses); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function expandAliases(obj) { + var newObj = {}; + + function add(type, func) { + var fn = newObj[type]; + newObj[type] = fn ? function (node, parent, stack) { + var result = fn(node, parent, stack); + + return result == null ? func(node, parent, stack) : result; + } : func; + } + + for (var _iterator = (0, _keys2.default)(obj), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var type = _ref; + + var aliases = t.FLIPPED_ALIAS_KEYS[type]; + if (aliases) { + for (var _iterator2 = aliases, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var alias = _ref2; + + add(alias, obj[type]); + } + } else { + add(type, obj[type]); + } + } + + return newObj; + } + + var expandedParens = expandAliases(parens); + var expandedWhitespaceNodes = expandAliases(_whitespace2.default.nodes); + var expandedWhitespaceList = expandAliases(_whitespace2.default.list); + + function find(obj, node, parent, printStack) { + var fn = obj[node.type]; + return fn ? fn(node, parent, printStack) : null; + } + + function isOrHasCallExpression(node) { + if (t.isCallExpression(node)) { + return true; + } + + if (t.isMemberExpression(node)) { + return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property); + } else { + return false; + } + } + + function needsWhitespace(node, parent, type) { + if (!node) return 0; + + if (t.isExpressionStatement(node)) { + node = node.expression; + } + + var linesInfo = find(expandedWhitespaceNodes, node, parent); + + if (!linesInfo) { + var items = find(expandedWhitespaceList, node, parent); + if (items) { + for (var i = 0; i < items.length; i++) { + linesInfo = needsWhitespace(items[i], node, type); + if (linesInfo) break; + } + } + } + + return linesInfo && linesInfo[type] || 0; + } + + function needsWhitespaceBefore(node, parent) { + return needsWhitespace(node, parent, "before"); + } + + function needsWhitespaceAfter(node, parent) { + return needsWhitespace(node, parent, "after"); + } + + function needsParens(node, parent, printStack) { + if (!parent) return false; + + if (t.isNewExpression(parent) && parent.callee === node) { + if (isOrHasCallExpression(node)) return true; + } + + return find(expandedParens, node, parent, printStack); + } + +/***/ }), +/* 184 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + exports.push = push; + exports.hasComputed = hasComputed; + exports.toComputedObjectFromClass = toComputedObjectFromClass; + exports.toClassObject = toClassObject; + exports.toDefineObject = toDefineObject; + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + var _has = __webpack_require__(269); + + var _has2 = _interopRequireDefault(_has); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function toKind(node) { + if (t.isClassMethod(node) || t.isObjectMethod(node)) { + if (node.kind === "get" || node.kind === "set") { + return node.kind; + } + } + + return "value"; + } + + function push(mutatorMap, node, kind, file, scope) { + var alias = t.toKeyAlias(node); + + var map = {}; + if ((0, _has2.default)(mutatorMap, alias)) map = mutatorMap[alias]; + mutatorMap[alias] = map; + + map._inherits = map._inherits || []; + map._inherits.push(node); + + map._key = node.key; + + if (node.computed) { + map._computed = true; + } + + if (node.decorators) { + var decorators = map.decorators = map.decorators || t.arrayExpression([]); + decorators.elements = decorators.elements.concat(node.decorators.map(function (dec) { + return dec.expression; + }).reverse()); + } + + if (map.value || map.initializer) { + throw file.buildCodeFrameError(node, "Key conflict with sibling node"); + } + + var key = void 0, + value = void 0; + + if (t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node)) { + key = t.toComputedKey(node, node.key); + } + + if (t.isObjectProperty(node) || t.isClassProperty(node)) { + value = node.value; + } else if (t.isObjectMethod(node) || t.isClassMethod(node)) { + value = t.functionExpression(null, node.params, node.body, node.generator, node.async); + value.returnType = node.returnType; + } + + var inheritedKind = toKind(node); + if (!kind || inheritedKind !== "value") { + kind = inheritedKind; + } + + if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) { + value = (0, _babelHelperFunctionName2.default)({ id: key, node: value, scope: scope }); + } + + if (value) { + t.inheritsComments(value, node); + map[kind] = value; + } + + return map; + } + + function hasComputed(mutatorMap) { + for (var key in mutatorMap) { + if (mutatorMap[key]._computed) { + return true; + } + } + return false; + } + + function toComputedObjectFromClass(obj) { + var objExpr = t.arrayExpression([]); + + for (var i = 0; i < obj.properties.length; i++) { + var prop = obj.properties[i]; + var val = prop.value; + val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop))); + objExpr.elements.push(val); + } + + return objExpr; + } + + function toClassObject(mutatorMap) { + var objExpr = t.objectExpression([]); + + (0, _keys2.default)(mutatorMap).forEach(function (mutatorMapKey) { + var map = mutatorMap[mutatorMapKey]; + var mapNode = t.objectExpression([]); + + var propNode = t.objectProperty(map._key, mapNode, map._computed); + + (0, _keys2.default)(map).forEach(function (key) { + var node = map[key]; + if (key[0] === "_") return; + + var inheritNode = node; + if (t.isClassMethod(node) || t.isClassProperty(node)) node = node.value; + + var prop = t.objectProperty(t.identifier(key), node); + t.inheritsComments(prop, inheritNode); + t.removeComments(inheritNode); + + mapNode.properties.push(prop); + }); + + objExpr.properties.push(propNode); + }); + + return objExpr; + } + + function toDefineObject(mutatorMap) { + (0, _keys2.default)(mutatorMap).forEach(function (key) { + var map = mutatorMap[key]; + if (map.value) map.writable = t.booleanLiteral(true); + map.configurable = t.booleanLiteral(true); + map.enumerable = t.booleanLiteral(true); + }); + + return toClassObject(mutatorMap); + } + +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (node) { + var params = node.params; + for (var i = 0; i < params.length; i++) { + var param = params[i]; + if (t.isAssignmentPattern(param) || t.isRestElement(param)) { + return i; + } + } + return params.length; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 186 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (path, emit) { + var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "var"; + + path.traverse(visitor, { kind: kind, emit: emit }); + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var visitor = { + Scope: function Scope(path, state) { + if (state.kind === "let") path.skip(); + }, + Function: function Function(path) { + path.skip(); + }, + VariableDeclaration: function VariableDeclaration(path, state) { + if (state.kind && path.node.kind !== state.kind) return; + + var nodes = []; + + var declarations = path.get("declarations"); + var firstId = void 0; + + for (var _iterator = declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var declar = _ref; + + firstId = declar.node.id; + + if (declar.node.init) { + nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init))); + } + + for (var name in declar.getBindingIdentifiers()) { + state.emit(t.identifier(name), name); + } + } + + if (path.parentPath.isFor({ left: path.node })) { + path.replaceWith(firstId); + } else { + path.replaceWithMultiple(nodes); + } + } + }; + + module.exports = exports["default"]; + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (callee, thisNode, args) { + if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) { + return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]); + } else { + return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode].concat(args)); + } + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 188 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.is = is; + exports.pullFlag = pullFlag; + + var _pull = __webpack_require__(272); + + var _pull2 = _interopRequireDefault(_pull); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function is(node, flag) { + return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0; + } + + function pullFlag(node, flag) { + var flags = node.flags.split(""); + if (node.flags.indexOf(flag) < 0) return; + (0, _pull2.default)(flags, flag); + node.flags = flags.join(""); + } + +/***/ }), +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + var _babelHelperOptimiseCallExpression = __webpack_require__(187); + + var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var HARDCORE_THIS_REF = (0, _symbol2.default)(); + + function isIllegalBareSuper(node, parent) { + if (!t.isSuper(node)) return false; + if (t.isMemberExpression(parent, { computed: false })) return false; + if (t.isCallExpression(parent, { callee: node })) return false; + return true; + } + + function isMemberExpressionSuper(node) { + return t.isMemberExpression(node) && t.isSuper(node.object); + } + + function getPrototypeOfExpression(objectRef, isStatic) { + var targetRef = isStatic ? objectRef : t.memberExpression(objectRef, t.identifier("prototype")); + + return t.logicalExpression("||", t.memberExpression(targetRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [targetRef])); + } + + var visitor = { + Function: function Function(path) { + if (!path.inShadow("this")) { + path.skip(); + } + }, + ReturnStatement: function ReturnStatement(path, state) { + if (!path.inShadow("this")) { + state.returns.push(path); + } + }, + ThisExpression: function ThisExpression(path, state) { + if (!path.node[HARDCORE_THIS_REF]) { + state.thises.push(path); + } + }, + enter: function enter(path, state) { + var callback = state.specHandle; + if (state.isLoose) callback = state.looseHandle; + + var isBareSuper = path.isCallExpression() && path.get("callee").isSuper(); + + var result = callback.call(state, path); + + if (result) { + state.hasSuper = true; + } + + if (isBareSuper) { + state.bareSupers.push(path); + } + + if (result === true) { + path.requeue(); + } + + if (result !== true && result) { + if (Array.isArray(result)) { + path.replaceWithMultiple(result); + } else { + path.replaceWith(result); + } + } + } + }; + + var ReplaceSupers = function () { + function ReplaceSupers(opts) { + var inClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + (0, _classCallCheck3.default)(this, ReplaceSupers); + + this.forceSuperMemoisation = opts.forceSuperMemoisation; + this.methodPath = opts.methodPath; + this.methodNode = opts.methodNode; + this.superRef = opts.superRef; + this.isStatic = opts.isStatic; + this.hasSuper = false; + this.inClass = inClass; + this.isLoose = opts.isLoose; + this.scope = this.methodPath.scope; + this.file = opts.file; + this.opts = opts; + + this.bareSupers = []; + this.returns = []; + this.thises = []; + } + + ReplaceSupers.prototype.getObjectRef = function getObjectRef() { + return this.opts.objectRef || this.opts.getObjectRef(); + }; + + ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed) { + return t.callExpression(this.file.addHelper("set"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), value, t.thisExpression()]); + }; + + ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed) { + return t.callExpression(this.file.addHelper("get"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), t.thisExpression()]); + }; + + ReplaceSupers.prototype.replace = function replace() { + this.methodPath.traverse(visitor, this); + }; + + ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) { + var methodNode = this.methodNode; + var superRef = this.superRef || t.identifier("Function"); + + if (parent.property === id) { + return; + } else if (t.isCallExpression(parent, { callee: id })) { + return; + } else if (t.isMemberExpression(parent) && !methodNode.static) { + return t.memberExpression(superRef, t.identifier("prototype")); + } else { + return superRef; + } + }; + + ReplaceSupers.prototype.looseHandle = function looseHandle(path) { + var node = path.node; + if (path.isSuper()) { + return this.getLooseSuperProperty(node, path.parent); + } else if (path.isCallExpression()) { + var callee = node.callee; + if (!t.isMemberExpression(callee)) return; + if (!t.isSuper(callee.object)) return; + + t.appendToMemberExpression(callee, t.identifier("call")); + node.arguments.unshift(t.thisExpression()); + return true; + } + }; + + ReplaceSupers.prototype.specHandleAssignmentExpression = function specHandleAssignmentExpression(ref, path, node) { + if (node.operator === "=") { + return this.setSuperProperty(node.left.property, node.right, node.left.computed); + } else { + ref = ref || path.scope.generateUidIdentifier("ref"); + return [t.variableDeclaration("var", [t.variableDeclarator(ref, node.left)]), t.expressionStatement(t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)))]; + } + }; + + ReplaceSupers.prototype.specHandle = function specHandle(path) { + var property = void 0; + var computed = void 0; + var args = void 0; + + var parent = path.parent; + var node = path.node; + + if (isIllegalBareSuper(node, parent)) { + throw path.buildCodeFrameError(messages.get("classesIllegalBareSuper")); + } + + if (t.isCallExpression(node)) { + var callee = node.callee; + if (t.isSuper(callee)) { + return; + } else if (isMemberExpressionSuper(callee)) { + property = callee.property; + computed = callee.computed; + args = node.arguments; + } + } else if (t.isMemberExpression(node) && t.isSuper(node.object)) { + property = node.property; + computed = node.computed; + } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) { + var binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1)); + if (node.prefix) { + return this.specHandleAssignmentExpression(null, path, binary); + } else { + var ref = path.scope.generateUidIdentifier("ref"); + return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref)); + } + } else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) { + return this.specHandleAssignmentExpression(null, path, node); + } + + if (!property) return; + + var superProperty = this.getSuperProperty(property, computed); + + if (args) { + return this.optimiseCall(superProperty, args); + } else { + return superProperty; + } + }; + + ReplaceSupers.prototype.optimiseCall = function optimiseCall(callee, args) { + var thisNode = t.thisExpression(); + thisNode[HARDCORE_THIS_REF] = true; + return (0, _babelHelperOptimiseCallExpression2.default)(callee, thisNode, args); + }; + + return ReplaceSupers; + }(); + + exports.default = ReplaceSupers; + module.exports = exports["default"]; + +/***/ }), +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.list = undefined; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + exports.get = get; + + var _helpers = __webpack_require__(317); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function get(name) { + var fn = _helpers2.default[name]; + if (!fn) throw new ReferenceError("Unknown helper " + name); + + return fn().expression; + } + + var list = exports.list = (0, _keys2.default)(_helpers2.default).map(function (name) { + return name.replace(/^_/, ""); + }).filter(function (name) { + return name !== "__esModule"; + }); + + exports.default = get; + +/***/ }), +/* 191 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("asyncGenerators"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 192 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("classConstructorCall"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 193 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("classProperties"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 194 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("doExpressions"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 195 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("exponentiationOperator"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 196 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("exportExtensions"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 197 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("functionBind"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 198 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("objectRestSpread"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 199 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (_ref) { + var t = _ref.types; + + var ALREADY_VISITED = (0, _symbol2.default)(); + + function findConstructorCall(path) { + var methods = path.get("body.body"); + + for (var _iterator = methods, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var method = _ref2; + + if (method.node.kind === "constructorCall") { + return method; + } + } + + return null; + } + + function handleClassWithCall(constructorCall, classPath) { + var _classPath = classPath, + node = _classPath.node; + + var ref = node.id || classPath.scope.generateUidIdentifier("class"); + + if (classPath.parentPath.isExportDefaultDeclaration()) { + classPath = classPath.parentPath; + classPath.insertAfter(t.exportDefaultDeclaration(ref)); + } + + classPath.replaceWithMultiple(buildWrapper({ + CLASS_REF: classPath.scope.generateUidIdentifier(ref.name), + CALL_REF: classPath.scope.generateUidIdentifier(ref.name + "Call"), + CALL: t.functionExpression(null, constructorCall.node.params, constructorCall.node.body), + CLASS: t.toExpression(node), + WRAPPER_REF: ref + })); + + constructorCall.remove(); + } + + return { + inherits: __webpack_require__(192), + + visitor: { + Class: function Class(path) { + if (path.node[ALREADY_VISITED]) return; + path.node[ALREADY_VISITED] = true; + + var constructorCall = findConstructorCall(path); + + if (constructorCall) { + handleClassWithCall(constructorCall, path); + } else { + return; + } + } + } + }; + }; + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildWrapper = (0, _babelTemplate2.default)("\n let CLASS_REF = CLASS;\n var CALL_REF = CALL;\n var WRAPPER_REF = function (...args) {\n if (this instanceof WRAPPER_REF) {\n return Reflect.construct(CLASS_REF, args);\n } else {\n return CALL_REF.apply(this, args);\n }\n };\n WRAPPER_REF.__proto__ = CLASS_REF;\n WRAPPER_REF;\n"); + + module.exports = exports["default"]; + +/***/ }), +/* 200 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + var findBareSupers = { + Super: function Super(path) { + if (path.parentPath.isCallExpression({ callee: path.node })) { + this.push(path.parentPath); + } + } + }; + + var referenceVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(path) { + if (this.scope.hasOwnBinding(path.node.name)) { + this.collision = true; + path.skip(); + } + } + }; + + var buildObjectDefineProperty = (0, _babelTemplate2.default)("\n Object.defineProperty(REF, KEY, {\n // configurable is false by default\n enumerable: true,\n writable: true,\n value: VALUE\n });\n "); + + var buildClassPropertySpec = function buildClassPropertySpec(ref, _ref2) { + var key = _ref2.key, + value = _ref2.value, + computed = _ref2.computed; + return buildObjectDefineProperty({ + REF: ref, + KEY: t.isIdentifier(key) && !computed ? t.stringLiteral(key.name) : key, + VALUE: value ? value : t.identifier("undefined") + }); + }; + + var buildClassPropertyNonSpec = function buildClassPropertyNonSpec(ref, _ref3) { + var key = _ref3.key, + value = _ref3.value, + computed = _ref3.computed; + return t.expressionStatement(t.assignmentExpression("=", t.memberExpression(ref, key, computed || t.isLiteral(key)), value)); + }; + + return { + inherits: __webpack_require__(193), + + visitor: { + Class: function Class(path, state) { + var buildClassProperty = state.opts.spec ? buildClassPropertySpec : buildClassPropertyNonSpec; + var isDerived = !!path.node.superClass; + var constructor = void 0; + var props = []; + var body = path.get("body"); + + for (var _iterator = body.get("body"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref4; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref4 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref4 = _i.value; + } + + var _path = _ref4; + + if (_path.isClassProperty()) { + props.push(_path); + } else if (_path.isClassMethod({ kind: "constructor" })) { + constructor = _path; + } + } + + if (!props.length) return; + + var nodes = []; + var ref = void 0; + + if (path.isClassExpression() || !path.node.id) { + (0, _babelHelperFunctionName2.default)(path); + ref = path.scope.generateUidIdentifier("class"); + } else { + ref = path.node.id; + } + + var instanceBody = []; + + for (var _iterator2 = props, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref5; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref5 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref5 = _i2.value; + } + + var _prop = _ref5; + + var propNode = _prop.node; + if (propNode.decorators && propNode.decorators.length > 0) continue; + + if (!state.opts.spec && !propNode.value) continue; + + var isStatic = propNode.static; + + if (isStatic) { + nodes.push(buildClassProperty(ref, propNode)); + } else { + if (!propNode.value) continue; + instanceBody.push(buildClassProperty(t.thisExpression(), propNode)); + } + } + + if (instanceBody.length) { + if (!constructor) { + var newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([])); + if (isDerived) { + newConstructor.params = [t.restElement(t.identifier("args"))]; + newConstructor.body.body.push(t.returnStatement(t.callExpression(t.super(), [t.spreadElement(t.identifier("args"))]))); + } + + var _body$unshiftContaine = body.unshiftContainer("body", newConstructor); + + constructor = _body$unshiftContaine[0]; + } + + var collisionState = { + collision: false, + scope: constructor.scope + }; + + for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref6; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref6 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref6 = _i3.value; + } + + var prop = _ref6; + + prop.traverse(referenceVisitor, collisionState); + if (collisionState.collision) break; + } + + if (collisionState.collision) { + var initialisePropsRef = path.scope.generateUidIdentifier("initialiseProps"); + + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(initialisePropsRef, t.functionExpression(null, [], t.blockStatement(instanceBody)))])); + + instanceBody = [t.expressionStatement(t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [t.thisExpression()]))]; + } + + if (isDerived) { + var bareSupers = []; + constructor.traverse(findBareSupers, bareSupers); + for (var _iterator4 = bareSupers, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref7; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref7 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref7 = _i4.value; + } + + var bareSuper = _ref7; + + bareSuper.insertAfter(instanceBody); + } + } else { + constructor.get("body").unshiftContainer("body", instanceBody); + } + } + + for (var _iterator5 = props, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref8; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref8 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref8 = _i5.value; + } + + var _prop2 = _ref8; + + _prop2.remove(); + } + + if (!nodes.length) return; + + if (path.isClassExpression()) { + path.scope.push({ id: ref }); + path.replaceWith(t.assignmentExpression("=", ref, path.node)); + } else { + if (!path.node.id) { + path.node.id = ref; + } + + if (path.parentPath.isExportDeclaration()) { + path = path.parentPath; + } + } + + path.insertAfter(nodes); + }, + ArrowFunctionExpression: function ArrowFunctionExpression(path) { + var classExp = path.get("body"); + if (!classExp.isClassExpression()) return; + + var body = classExp.get("body"); + var members = body.get("body"); + if (members.some(function (member) { + return member.isClassProperty(); + })) { + path.ensureBlock(); + } + } + } + }; + }; + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 201 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function cleanDecorators(decorators) { + return decorators.reverse().map(function (dec) { + return dec.expression; + }); + } + + function transformClass(path, ref, state) { + var nodes = []; + + state; + + var classDecorators = path.node.decorators; + if (classDecorators) { + path.node.decorators = null; + classDecorators = cleanDecorators(classDecorators); + + for (var _iterator = classDecorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var decorator = _ref2; + + nodes.push(buildClassDecorator({ + CLASS_REF: ref, + DECORATOR: decorator + })); + } + } + + var map = (0, _create2.default)(null); + + for (var _iterator2 = path.get("body.body"), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var method = _ref3; + + var decorators = method.node.decorators; + if (!decorators) continue; + + var _alias = t.toKeyAlias(method.node); + map[_alias] = map[_alias] || []; + map[_alias].push(method.node); + + method.remove(); + } + + for (var alias in map) { + var items = map[alias]; + + items; + } + + return nodes; + } + + function hasDecorators(path) { + if (path.isClass()) { + if (path.node.decorators) return true; + + for (var _iterator3 = path.node.body.body, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + var method = _ref4; + + if (method.decorators) { + return true; + } + } + } else if (path.isObjectExpression()) { + for (var _iterator4 = path.node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref5; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref5 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref5 = _i4.value; + } + + var prop = _ref5; + + if (prop.decorators) { + return true; + } + } + } + + return false; + } + + function doError(path) { + throw path.buildCodeFrameError("Decorators are not officially supported yet in 6.x pending a proposal update.\nHowever, if you need to use them you can install the legacy decorators transform with:\n\nnpm install babel-plugin-transform-decorators-legacy --save-dev\n\nand add the following line to your .babelrc file:\n\n{\n \"plugins\": [\"transform-decorators-legacy\"]\n}\n\nThe repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy.\n "); + } + + return { + inherits: __webpack_require__(124), + + visitor: { + ClassExpression: function ClassExpression(path) { + if (!hasDecorators(path)) return; + doError(path); + + (0, _babelHelperExplodeClass2.default)(path); + + var ref = path.scope.generateDeclaredUidIdentifier("ref"); + var nodes = []; + + nodes.push(t.assignmentExpression("=", ref, path.node)); + + nodes = nodes.concat(transformClass(path, ref, this)); + + nodes.push(ref); + + path.replaceWith(t.sequenceExpression(nodes)); + }, + ClassDeclaration: function ClassDeclaration(path) { + if (!hasDecorators(path)) return; + doError(path); + (0, _babelHelperExplodeClass2.default)(path); + + var ref = path.node.id; + var nodes = []; + + nodes = nodes.concat(transformClass(path, ref, this).map(function (expr) { + return t.expressionStatement(expr); + })); + nodes.push(t.expressionStatement(ref)); + + path.insertAfter(nodes); + }, + ObjectExpression: function ObjectExpression(path) { + if (!hasDecorators(path)) return; + doError(path); + } + } + }; + }; + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelHelperExplodeClass = __webpack_require__(315); + + var _babelHelperExplodeClass2 = _interopRequireDefault(_babelHelperExplodeClass); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildClassDecorator = (0, _babelTemplate2.default)("\n CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF;\n"); + + module.exports = exports["default"]; + +/***/ }), +/* 202 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + inherits: __webpack_require__(194), + + visitor: { + DoExpression: function DoExpression(path) { + var body = path.node.body.body; + if (body.length) { + path.replaceWithMultiple(body); + } else { + path.replaceWith(path.scope.buildUndefinedNode()); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 203 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _babelTraverse = __webpack_require__(7); + + var _babelHelperReplaceSupers = __webpack_require__(189); + + var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers); + + var _babelHelperOptimiseCallExpression = __webpack_require__(187); + + var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression); + + var _babelHelperDefineMap = __webpack_require__(184); + + var defineMap = _interopRequireWildcard(_babelHelperDefineMap); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildDerivedConstructor = (0, _babelTemplate2.default)("\n (function () {\n super(...arguments);\n })\n"); + + var noMethodVisitor = { + "FunctionExpression|FunctionDeclaration": function FunctionExpressionFunctionDeclaration(path) { + if (!path.is("shadow")) { + path.skip(); + } + }, + Method: function Method(path) { + path.skip(); + } + }; + + var verifyConstructorVisitor = _babelTraverse.visitors.merge([noMethodVisitor, { + Super: function Super(path) { + if (this.isDerived && !this.hasBareSuper && !path.parentPath.isCallExpression({ callee: path.node })) { + throw path.buildCodeFrameError("'super.*' is not allowed before super()"); + } + }, + + CallExpression: { + exit: function exit(path) { + if (path.get("callee").isSuper()) { + this.hasBareSuper = true; + + if (!this.isDerived) { + throw path.buildCodeFrameError("super() is only allowed in a derived constructor"); + } + } + } + }, + + ThisExpression: function ThisExpression(path) { + if (this.isDerived && !this.hasBareSuper) { + if (!path.inShadow("this")) { + throw path.buildCodeFrameError("'this' is not allowed before super()"); + } + } + } + }]); + + var findThisesVisitor = _babelTraverse.visitors.merge([noMethodVisitor, { + ThisExpression: function ThisExpression(path) { + this.superThises.push(path); + } + }]); + + var ClassTransformer = function () { + function ClassTransformer(path, file) { + (0, _classCallCheck3.default)(this, ClassTransformer); + + this.parent = path.parent; + this.scope = path.scope; + this.node = path.node; + this.path = path; + this.file = file; + + this.clearDescriptors(); + + this.instancePropBody = []; + this.instancePropRefs = {}; + this.staticPropBody = []; + this.body = []; + + this.bareSuperAfter = []; + this.bareSupers = []; + + this.pushedConstructor = false; + this.pushedInherits = false; + this.isLoose = false; + + this.superThises = []; + + this.classId = this.node.id; + + this.classRef = this.node.id ? t.identifier(this.node.id.name) : this.scope.generateUidIdentifier("class"); + + this.superName = this.node.superClass || t.identifier("Function"); + this.isDerived = !!this.node.superClass; + } + + ClassTransformer.prototype.run = function run() { + var _this = this; + + var superName = this.superName; + var file = this.file; + var body = this.body; + + var constructorBody = this.constructorBody = t.blockStatement([]); + this.constructor = this.buildConstructor(); + + var closureParams = []; + var closureArgs = []; + + if (this.isDerived) { + closureArgs.push(superName); + + superName = this.scope.generateUidIdentifierBasedOnNode(superName); + closureParams.push(superName); + + this.superName = superName; + } + + this.buildBody(); + + constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("classCallCheck"), [t.thisExpression(), this.classRef]))); + + body = body.concat(this.staticPropBody.map(function (fn) { + return fn(_this.classRef); + })); + + if (this.classId) { + if (body.length === 1) return t.toExpression(body[0]); + } + + body.push(t.returnStatement(this.classRef)); + + var container = t.functionExpression(null, closureParams, t.blockStatement(body)); + container.shadow = true; + return t.callExpression(container, closureArgs); + }; + + ClassTransformer.prototype.buildConstructor = function buildConstructor() { + var func = t.functionDeclaration(this.classRef, [], this.constructorBody); + t.inherits(func, this.node); + return func; + }; + + ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable) { + var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "value"; + var scope = arguments[3]; + + var mutatorMap = void 0; + if (node.static) { + this.hasStaticDescriptors = true; + mutatorMap = this.staticMutatorMap; + } else { + this.hasInstanceDescriptors = true; + mutatorMap = this.instanceMutatorMap; + } + + var map = defineMap.push(mutatorMap, node, kind, this.file, scope); + + if (enumerable) { + map.enumerable = t.booleanLiteral(true); + } + + return map; + }; + + ClassTransformer.prototype.constructorMeMaybe = function constructorMeMaybe() { + var hasConstructor = false; + var paths = this.path.get("body.body"); + for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var path = _ref; + + hasConstructor = path.equals("kind", "constructor"); + if (hasConstructor) break; + } + if (hasConstructor) return; + + var params = void 0, + body = void 0; + + if (this.isDerived) { + var _constructor = buildDerivedConstructor().expression; + params = _constructor.params; + body = _constructor.body; + } else { + params = []; + body = t.blockStatement([]); + } + + this.path.get("body").unshiftContainer("body", t.classMethod("constructor", t.identifier("constructor"), params, body)); + }; + + ClassTransformer.prototype.buildBody = function buildBody() { + this.constructorMeMaybe(); + this.pushBody(); + this.verifyConstructor(); + + if (this.userConstructor) { + var constructorBody = this.constructorBody; + constructorBody.body = constructorBody.body.concat(this.userConstructor.body.body); + t.inherits(this.constructor, this.userConstructor); + t.inherits(constructorBody, this.userConstructor.body); + } + + this.pushDescriptors(); + }; + + ClassTransformer.prototype.pushBody = function pushBody() { + var classBodyPaths = this.path.get("body.body"); + + for (var _iterator2 = classBodyPaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var path = _ref2; + + var node = path.node; + + if (path.isClassProperty()) { + throw path.buildCodeFrameError("Missing class properties transform."); + } + + if (node.decorators) { + throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one."); + } + + if (t.isClassMethod(node)) { + var isConstructor = node.kind === "constructor"; + + if (isConstructor) { + path.traverse(verifyConstructorVisitor, this); + + if (!this.hasBareSuper && this.isDerived) { + throw path.buildCodeFrameError("missing super() call in constructor"); + } + } + + var replaceSupers = new _babelHelperReplaceSupers2.default({ + forceSuperMemoisation: isConstructor, + methodPath: path, + methodNode: node, + objectRef: this.classRef, + superRef: this.superName, + isStatic: node.static, + isLoose: this.isLoose, + scope: this.scope, + file: this.file + }, true); + + replaceSupers.replace(); + + if (isConstructor) { + this.pushConstructor(replaceSupers, node, path); + } else { + this.pushMethod(node, path); + } + } + } + }; + + ClassTransformer.prototype.clearDescriptors = function clearDescriptors() { + this.hasInstanceDescriptors = false; + this.hasStaticDescriptors = false; + + this.instanceMutatorMap = {}; + this.staticMutatorMap = {}; + }; + + ClassTransformer.prototype.pushDescriptors = function pushDescriptors() { + this.pushInherits(); + + var body = this.body; + + var instanceProps = void 0; + var staticProps = void 0; + + if (this.hasInstanceDescriptors) { + instanceProps = defineMap.toClassObject(this.instanceMutatorMap); + } + + if (this.hasStaticDescriptors) { + staticProps = defineMap.toClassObject(this.staticMutatorMap); + } + + if (instanceProps || staticProps) { + if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps); + if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps); + + var nullNode = t.nullLiteral(); + + var args = [this.classRef, nullNode, nullNode, nullNode, nullNode]; + + if (instanceProps) args[1] = instanceProps; + if (staticProps) args[2] = staticProps; + + if (this.instanceInitializersId) { + args[3] = this.instanceInitializersId; + body.unshift(this.buildObjectAssignment(this.instanceInitializersId)); + } + + if (this.staticInitializersId) { + args[4] = this.staticInitializersId; + body.unshift(this.buildObjectAssignment(this.staticInitializersId)); + } + + var lastNonNullIndex = 0; + for (var i = 0; i < args.length; i++) { + if (args[i] !== nullNode) lastNonNullIndex = i; + } + args = args.slice(0, lastNonNullIndex + 1); + + body.push(t.expressionStatement(t.callExpression(this.file.addHelper("createClass"), args))); + } + + this.clearDescriptors(); + }; + + ClassTransformer.prototype.buildObjectAssignment = function buildObjectAssignment(id) { + return t.variableDeclaration("var", [t.variableDeclarator(id, t.objectExpression([]))]); + }; + + ClassTransformer.prototype.wrapSuperCall = function wrapSuperCall(bareSuper, superRef, thisRef, body) { + var bareSuperNode = bareSuper.node; + + if (this.isLoose) { + bareSuperNode.arguments.unshift(t.thisExpression()); + if (bareSuperNode.arguments.length === 2 && t.isSpreadElement(bareSuperNode.arguments[1]) && t.isIdentifier(bareSuperNode.arguments[1].argument, { name: "arguments" })) { + bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument; + bareSuperNode.callee = t.memberExpression(superRef, t.identifier("apply")); + } else { + bareSuperNode.callee = t.memberExpression(superRef, t.identifier("call")); + } + } else { + bareSuperNode = (0, _babelHelperOptimiseCallExpression2.default)(t.logicalExpression("||", t.memberExpression(this.classRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.classRef])), t.thisExpression(), bareSuperNode.arguments); + } + + var call = t.callExpression(this.file.addHelper("possibleConstructorReturn"), [t.thisExpression(), bareSuperNode]); + + var bareSuperAfter = this.bareSuperAfter.map(function (fn) { + return fn(thisRef); + }); + + if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) { + + if (this.superThises.length || bareSuperAfter.length) { + bareSuper.scope.push({ id: thisRef }); + call = t.assignmentExpression("=", thisRef, call); + } + + if (bareSuperAfter.length) { + call = t.toSequenceExpression([call].concat(bareSuperAfter, [thisRef])); + } + + bareSuper.parentPath.replaceWith(t.returnStatement(call)); + } else { + bareSuper.replaceWithMultiple([t.variableDeclaration("var", [t.variableDeclarator(thisRef, call)])].concat(bareSuperAfter, [t.expressionStatement(thisRef)])); + } + }; + + ClassTransformer.prototype.verifyConstructor = function verifyConstructor() { + var _this2 = this; + + if (!this.isDerived) return; + + var path = this.userConstructorPath; + var body = path.get("body"); + + path.traverse(findThisesVisitor, this); + + var guaranteedSuperBeforeFinish = !!this.bareSupers.length; + + var superRef = this.superName || t.identifier("Function"); + var thisRef = path.scope.generateUidIdentifier("this"); + + for (var _iterator3 = this.bareSupers, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var bareSuper = _ref3; + + this.wrapSuperCall(bareSuper, superRef, thisRef, body); + + if (guaranteedSuperBeforeFinish) { + bareSuper.find(function (parentPath) { + if (parentPath === path) { + return true; + } + + if (parentPath.isLoop() || parentPath.isConditional()) { + guaranteedSuperBeforeFinish = false; + return true; + } + }); + } + } + + for (var _iterator4 = this.superThises, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var thisPath = _ref4; + + thisPath.replaceWith(thisRef); + } + + var wrapReturn = function wrapReturn(returnArg) { + return t.callExpression(_this2.file.addHelper("possibleConstructorReturn"), [thisRef].concat(returnArg || [])); + }; + + var bodyPaths = body.get("body"); + if (bodyPaths.length && !bodyPaths.pop().isReturnStatement()) { + body.pushContainer("body", t.returnStatement(guaranteedSuperBeforeFinish ? thisRef : wrapReturn())); + } + + for (var _iterator5 = this.superReturns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var returnPath = _ref5; + + if (returnPath.node.argument) { + var ref = returnPath.scope.generateDeclaredUidIdentifier("ret"); + returnPath.get("argument").replaceWithMultiple([t.assignmentExpression("=", ref, returnPath.node.argument), wrapReturn(ref)]); + } else { + returnPath.get("argument").replaceWith(wrapReturn()); + } + } + }; + + ClassTransformer.prototype.pushMethod = function pushMethod(node, path) { + var scope = path ? path.scope : this.scope; + + if (node.kind === "method") { + if (this._processMethod(node, scope)) return; + } + + this.pushToMap(node, false, null, scope); + }; + + ClassTransformer.prototype._processMethod = function _processMethod() { + return false; + }; + + ClassTransformer.prototype.pushConstructor = function pushConstructor(replaceSupers, method, path) { + this.bareSupers = replaceSupers.bareSupers; + this.superReturns = replaceSupers.returns; + + if (path.scope.hasOwnBinding(this.classRef.name)) { + path.scope.rename(this.classRef.name); + } + + var construct = this.constructor; + + this.userConstructorPath = path; + this.userConstructor = method; + this.hasConstructor = true; + + t.inheritsComments(construct, method); + + construct._ignoreUserWhitespace = true; + construct.params = method.params; + + t.inherits(construct.body, method.body); + construct.body.directives = method.body.directives; + + this._pushConstructor(); + }; + + ClassTransformer.prototype._pushConstructor = function _pushConstructor() { + if (this.pushedConstructor) return; + this.pushedConstructor = true; + + if (this.hasInstanceDescriptors || this.hasStaticDescriptors) { + this.pushDescriptors(); + } + + this.body.push(this.constructor); + + this.pushInherits(); + }; + + ClassTransformer.prototype.pushInherits = function pushInherits() { + if (!this.isDerived || this.pushedInherits) return; + + this.pushedInherits = true; + this.body.unshift(t.expressionStatement(t.callExpression(this.file.addHelper("inherits"), [this.classRef, this.superName]))); + }; + + return ClassTransformer; + }(); + + exports.default = ClassTransformer; + module.exports = exports["default"]; + +/***/ }), +/* 204 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + exports.default = function (_ref) { + var t = _ref.types; + + var IGNORE_REASSIGNMENT_SYMBOL = (0, _symbol2.default)(); + + var reassignmentVisitor = { + "AssignmentExpression|UpdateExpression": function AssignmentExpressionUpdateExpression(path) { + if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return; + path.node[IGNORE_REASSIGNMENT_SYMBOL] = true; + + var arg = path.get(path.isAssignmentExpression() ? "left" : "argument"); + if (!arg.isIdentifier()) return; + + var name = arg.node.name; + + if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; + + var exportedNames = this.exports[name]; + if (!exportedNames) return; + + var node = path.node; + + var isPostUpdateExpression = path.isUpdateExpression() && !node.prefix; + if (isPostUpdateExpression) { + if (node.operator === "++") node = t.binaryExpression("+", node.argument, t.numericLiteral(1));else if (node.operator === "--") node = t.binaryExpression("-", node.argument, t.numericLiteral(1));else isPostUpdateExpression = false; + } + + for (var _iterator = exportedNames, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var exportedName = _ref2; + + node = this.buildCall(exportedName, node).expression; + } + + if (isPostUpdateExpression) node = t.sequenceExpression([node, path.node]); + + path.replaceWith(node); + } + }; + + return { + visitor: { + CallExpression: function CallExpression(path, state) { + if (path.node.callee.type === TYPE_IMPORT) { + var contextIdent = state.contextIdent; + path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), path.node.arguments)); + } + }, + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + if (path.node.name == "__moduleName" && !path.scope.hasBinding("__moduleName")) { + path.replaceWith(t.memberExpression(state.contextIdent, t.identifier("id"))); + } + }, + + Program: { + enter: function enter(path, state) { + state.contextIdent = path.scope.generateUidIdentifier("context"); + }, + exit: function exit(path, state) { + var exportIdent = path.scope.generateUidIdentifier("export"); + var contextIdent = state.contextIdent; + + var exportNames = (0, _create2.default)(null); + var modules = []; + + var beforeBody = []; + var setters = []; + var sources = []; + var variableIds = []; + var removedPaths = []; + + function addExportName(key, val) { + exportNames[key] = exportNames[key] || []; + exportNames[key].push(val); + } + + function pushModule(source, key, specifiers) { + var module = void 0; + modules.forEach(function (m) { + if (m.key === source) { + module = m; + } + }); + if (!module) { + modules.push(module = { key: source, imports: [], exports: [] }); + } + module[key] = module[key].concat(specifiers); + } + + function buildExportCall(name, val) { + return t.expressionStatement(t.callExpression(exportIdent, [t.stringLiteral(name), val])); + } + + var body = path.get("body"); + + var canHoist = true; + for (var _iterator2 = body, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var _path = _ref3; + + if (_path.isExportDeclaration()) _path = _path.get("declaration"); + if (_path.isVariableDeclaration() && _path.node.kind !== "var") { + canHoist = false; + break; + } + } + + for (var _iterator3 = body, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + var _path2 = _ref4; + + if (canHoist && _path2.isFunctionDeclaration()) { + beforeBody.push(_path2.node); + removedPaths.push(_path2); + } else if (_path2.isImportDeclaration()) { + var source = _path2.node.source.value; + pushModule(source, "imports", _path2.node.specifiers); + for (var name in _path2.getBindingIdentifiers()) { + _path2.scope.removeBinding(name); + variableIds.push(t.identifier(name)); + } + _path2.remove(); + } else if (_path2.isExportAllDeclaration()) { + pushModule(_path2.node.source.value, "exports", _path2.node); + _path2.remove(); + } else if (_path2.isExportDefaultDeclaration()) { + var declar = _path2.get("declaration"); + if (declar.isClassDeclaration() || declar.isFunctionDeclaration()) { + var id = declar.node.id; + var nodes = []; + + if (id) { + nodes.push(declar.node); + nodes.push(buildExportCall("default", id)); + addExportName(id.name, "default"); + } else { + nodes.push(buildExportCall("default", t.toExpression(declar.node))); + } + + if (!canHoist || declar.isClassDeclaration()) { + _path2.replaceWithMultiple(nodes); + } else { + beforeBody = beforeBody.concat(nodes); + removedPaths.push(_path2); + } + } else { + _path2.replaceWith(buildExportCall("default", declar.node)); + } + } else if (_path2.isExportNamedDeclaration()) { + var _declar = _path2.get("declaration"); + + if (_declar.node) { + _path2.replaceWith(_declar); + + var _nodes = []; + var bindingIdentifiers = void 0; + if (_path2.isFunction()) { + var node = _declar.node; + var _name = node.id.name; + if (canHoist) { + addExportName(_name, _name); + beforeBody.push(node); + beforeBody.push(buildExportCall(_name, node.id)); + removedPaths.push(_path2); + } else { + var _bindingIdentifiers; + + bindingIdentifiers = (_bindingIdentifiers = {}, _bindingIdentifiers[_name] = node.id, _bindingIdentifiers); + } + } else { + bindingIdentifiers = _declar.getBindingIdentifiers(); + } + for (var _name2 in bindingIdentifiers) { + addExportName(_name2, _name2); + _nodes.push(buildExportCall(_name2, t.identifier(_name2))); + } + _path2.insertAfter(_nodes); + } else { + var specifiers = _path2.node.specifiers; + if (specifiers && specifiers.length) { + if (_path2.node.source) { + pushModule(_path2.node.source.value, "exports", specifiers); + _path2.remove(); + } else { + var _nodes2 = []; + + for (var _iterator7 = specifiers, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref8; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref8 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref8 = _i7.value; + } + + var specifier = _ref8; + + _nodes2.push(buildExportCall(specifier.exported.name, specifier.local)); + addExportName(specifier.local.name, specifier.exported.name); + } + + _path2.replaceWithMultiple(_nodes2); + } + } + } + } + } + + modules.forEach(function (specifiers) { + var setterBody = []; + var target = path.scope.generateUidIdentifier(specifiers.key); + + for (var _iterator4 = specifiers.imports, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref5; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref5 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref5 = _i4.value; + } + + var specifier = _ref5; + + if (t.isImportNamespaceSpecifier(specifier)) { + setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, target))); + } else if (t.isImportDefaultSpecifier(specifier)) { + specifier = t.importSpecifier(specifier.local, t.identifier("default")); + } + + if (t.isImportSpecifier(specifier)) { + setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, t.memberExpression(target, specifier.imported)))); + } + } + + if (specifiers.exports.length) { + var exportObjRef = path.scope.generateUidIdentifier("exportObj"); + + setterBody.push(t.variableDeclaration("var", [t.variableDeclarator(exportObjRef, t.objectExpression([]))])); + + for (var _iterator5 = specifiers.exports, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref6; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref6 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref6 = _i5.value; + } + + var node = _ref6; + + if (t.isExportAllDeclaration(node)) { + setterBody.push(buildExportAll({ + KEY: path.scope.generateUidIdentifier("key"), + EXPORT_OBJ: exportObjRef, + TARGET: target + })); + } else if (t.isExportSpecifier(node)) { + setterBody.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(exportObjRef, node.exported), t.memberExpression(target, node.local)))); + } else {} + } + + setterBody.push(t.expressionStatement(t.callExpression(exportIdent, [exportObjRef]))); + } + + sources.push(t.stringLiteral(specifiers.key)); + setters.push(t.functionExpression(null, [target], t.blockStatement(setterBody))); + }); + + var moduleName = this.getModuleName(); + if (moduleName) moduleName = t.stringLiteral(moduleName); + + if (canHoist) { + (0, _babelHelperHoistVariables2.default)(path, function (id) { + return variableIds.push(id); + }); + } + + if (variableIds.length) { + beforeBody.unshift(t.variableDeclaration("var", variableIds.map(function (id) { + return t.variableDeclarator(id); + }))); + } + + path.traverse(reassignmentVisitor, { + exports: exportNames, + buildCall: buildExportCall, + scope: path.scope + }); + + for (var _iterator6 = removedPaths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref7; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref7 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref7 = _i6.value; + } + + var _path3 = _ref7; + + _path3.remove(); + } + + path.node.body = [buildTemplate({ + SYSTEM_REGISTER: t.memberExpression(t.identifier(state.opts.systemGlobal || "System"), t.identifier("register")), + BEFORE_BODY: beforeBody, + MODULE_NAME: moduleName, + SETTERS: setters, + SOURCES: sources, + BODY: path.node.body, + EXPORT_IDENTIFIER: exportIdent, + CONTEXT_IDENTIFIER: contextIdent + })]; + } + } + } + }; + }; + + var _babelHelperHoistVariables = __webpack_require__(186); + + var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildTemplate = (0, _babelTemplate2.default)("\n SYSTEM_REGISTER(MODULE_NAME, [SOURCES], function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n \"use strict\";\n BEFORE_BODY;\n return {\n setters: [SETTERS],\n execute: function () {\n BODY;\n }\n };\n });\n"); + + var buildExportAll = (0, _babelTemplate2.default)("\n for (var KEY in TARGET) {\n if (KEY !== \"default\" && KEY !== \"__esModule\") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n"); + + var TYPE_IMPORT = "Import"; + + module.exports = exports["default"]; + +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function isValidDefine(path) { + if (!path.isExpressionStatement()) return; + + var expr = path.get("expression"); + if (!expr.isCallExpression()) return false; + if (!expr.get("callee").isIdentifier({ name: "define" })) return false; + + var args = expr.get("arguments"); + if (args.length === 3 && !args.shift().isStringLiteral()) return false; + if (args.length !== 2) return false; + if (!args.shift().isArrayExpression()) return false; + if (!args.shift().isFunctionExpression()) return false; + + return true; + } + + return { + inherits: __webpack_require__(130), + + visitor: { + Program: { + exit: function exit(path, state) { + var last = path.get("body").pop(); + if (!isValidDefine(last)) return; + + var call = last.node.expression; + var args = call.arguments; + + var moduleName = args.length === 3 ? args.shift() : null; + var amdArgs = call.arguments[0]; + var func = call.arguments[1]; + var browserGlobals = state.opts.globals || {}; + + var commonArgs = amdArgs.elements.map(function (arg) { + if (arg.value === "module" || arg.value === "exports") { + return t.identifier(arg.value); + } else { + return t.callExpression(t.identifier("require"), [arg]); + } + }); + + var browserArgs = amdArgs.elements.map(function (arg) { + if (arg.value === "module") { + return t.identifier("mod"); + } else if (arg.value === "exports") { + return t.memberExpression(t.identifier("mod"), t.identifier("exports")); + } else { + var memberExpression = void 0; + + if (state.opts.exactGlobals) { + var globalRef = browserGlobals[arg.value]; + if (globalRef) { + memberExpression = globalRef.split(".").reduce(function (accum, curr) { + return t.memberExpression(accum, t.identifier(curr)); + }, t.identifier("global")); + } else { + memberExpression = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(arg.value))); + } + } else { + var requireName = (0, _path.basename)(arg.value, (0, _path.extname)(arg.value)); + var globalName = browserGlobals[requireName] || requireName; + memberExpression = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(globalName))); + } + + return memberExpression; + } + }); + + var moduleNameOrBasename = moduleName ? moduleName.value : this.file.opts.basename; + var globalToAssign = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(moduleNameOrBasename))); + var prerequisiteAssignments = null; + + if (state.opts.exactGlobals) { + var globalName = browserGlobals[moduleNameOrBasename]; + + if (globalName) { + prerequisiteAssignments = []; + + var members = globalName.split("."); + globalToAssign = members.slice(1).reduce(function (accum, curr) { + prerequisiteAssignments.push(buildPrerequisiteAssignment({ GLOBAL_REFERENCE: accum })); + return t.memberExpression(accum, t.identifier(curr)); + }, t.memberExpression(t.identifier("global"), t.identifier(members[0]))); + } + } + + var globalExport = buildGlobalExport({ + BROWSER_ARGUMENTS: browserArgs, + PREREQUISITE_ASSIGNMENTS: prerequisiteAssignments, + GLOBAL_TO_ASSIGN: globalToAssign + }); + + last.replaceWith(buildWrapper({ + MODULE_NAME: moduleName, + AMD_ARGUMENTS: amdArgs, + COMMON_ARGUMENTS: commonArgs, + GLOBAL_EXPORT: globalExport, + FUNC: func + })); + } + } + } + }; + }; + + var _path = __webpack_require__(17); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildPrerequisiteAssignment = (0, _babelTemplate2.default)("\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n"); + + var buildGlobalExport = (0, _babelTemplate2.default)("\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n PREREQUISITE_ASSIGNMENTS\n GLOBAL_TO_ASSIGN = mod.exports;\n"); + + var buildWrapper = (0, _babelTemplate2.default)("\n (function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== \"undefined\") {\n factory(COMMON_ARGUMENTS);\n } else {\n GLOBAL_EXPORT\n }\n })(this, FUNC);\n"); + + module.exports = exports["default"]; + +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function build(node, nodes, scope) { + var first = node.specifiers[0]; + if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return; + + var specifier = node.specifiers.shift(); + var uid = scope.generateUidIdentifier(specifier.exported.name); + + var newSpecifier = void 0; + if (t.isExportNamespaceSpecifier(specifier)) { + newSpecifier = t.importNamespaceSpecifier(uid); + } else { + newSpecifier = t.importDefaultSpecifier(uid); + } + + nodes.push(t.importDeclaration([newSpecifier], node.source)); + nodes.push(t.exportNamedDeclaration(null, [t.exportSpecifier(uid, specifier.exported)])); + + build(node, nodes, scope); + } + + return { + inherits: __webpack_require__(196), + + visitor: { + ExportNamedDeclaration: function ExportNamedDeclaration(path) { + var node = path.node, + scope = path.scope; + + var nodes = []; + build(node, nodes, scope); + if (!nodes.length) return; + + if (node.specifiers.length >= 1) { + nodes.push(node); + } + path.replaceWithMultiple(nodes); + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 207 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + var FLOW_DIRECTIVE = "@flow"; + + return { + inherits: __webpack_require__(125), + + visitor: { + Program: function Program(path, _ref2) { + var comments = _ref2.file.ast.comments; + + for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var comment = _ref3; + + if (comment.value.indexOf(FLOW_DIRECTIVE) >= 0) { + comment.value = comment.value.replace(FLOW_DIRECTIVE, ""); + + if (!comment.value.replace(/\*/g, "").trim()) comment.ignore = true; + } + } + }, + Flow: function Flow(path) { + path.remove(); + }, + ClassProperty: function ClassProperty(path) { + path.node.variance = null; + path.node.typeAnnotation = null; + if (!path.node.value) path.remove(); + }, + Class: function Class(path) { + path.node.implements = null; + + path.get("body.body").forEach(function (child) { + if (child.isClassProperty()) { + child.node.typeAnnotation = null; + if (!child.node.value) child.remove(); + } + }); + }, + AssignmentPattern: function AssignmentPattern(_ref4) { + var node = _ref4.node; + + node.left.optional = false; + }, + Function: function Function(_ref5) { + var node = _ref5.node; + + for (var i = 0; i < node.params.length; i++) { + var param = node.params[i]; + param.optional = false; + } + }, + TypeCastExpression: function TypeCastExpression(path) { + var node = path.node; + + do { + node = node.expression; + } while (t.isTypeCastExpression(node)); + path.replaceWith(node); + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 208 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function getTempId(scope) { + var id = scope.path.getData("functionBind"); + if (id) return id; + + id = scope.generateDeclaredUidIdentifier("context"); + return scope.path.setData("functionBind", id); + } + + function getStaticContext(bind, scope) { + var object = bind.object || bind.callee.object; + return scope.isStatic(object) && object; + } + + function inferBindContext(bind, scope) { + var staticContext = getStaticContext(bind, scope); + if (staticContext) return staticContext; + + var tempId = getTempId(scope); + if (bind.object) { + bind.callee = t.sequenceExpression([t.assignmentExpression("=", tempId, bind.object), bind.callee]); + } else { + bind.callee.object = t.assignmentExpression("=", tempId, bind.callee.object); + } + return tempId; + } + + return { + inherits: __webpack_require__(197), + + visitor: { + CallExpression: function CallExpression(_ref2) { + var node = _ref2.node, + scope = _ref2.scope; + + var bind = node.callee; + if (!t.isBindExpression(bind)) return; + + var context = inferBindContext(bind, scope); + node.callee = t.memberExpression(bind.callee, t.identifier("call")); + node.arguments.unshift(context); + }, + BindExpression: function BindExpression(path) { + var node = path.node, + scope = path.scope; + + var context = inferBindContext(node, scope); + path.replaceWith(t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context])); + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 209 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function hasRestProperty(path) { + var foundRestProperty = false; + path.traverse({ + RestProperty: function RestProperty() { + foundRestProperty = true; + path.stop(); + } + }); + return foundRestProperty; + } + + function hasSpread(node) { + for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var prop = _ref2; + + if (t.isSpreadProperty(prop)) { + return true; + } + } + return false; + } + + function createObjectSpread(file, props, objRef) { + var restProperty = props.pop(); + + var keys = []; + for (var _iterator2 = props, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var prop = _ref3; + + var key = prop.key; + if (t.isIdentifier(key) && !prop.computed) { + key = t.stringLiteral(prop.key.name); + } + keys.push(key); + } + + return [restProperty.argument, t.callExpression(file.addHelper("objectWithoutProperties"), [objRef, t.arrayExpression(keys)])]; + } + + function replaceRestProperty(parentPath, paramPath, i, numParams) { + if (paramPath.isAssignmentPattern()) { + replaceRestProperty(parentPath, paramPath.get("left"), i, numParams); + return; + } + + if (paramPath.isObjectPattern() && hasRestProperty(paramPath)) { + var uid = parentPath.scope.generateUidIdentifier("ref"); + + var declar = t.variableDeclaration("let", [t.variableDeclarator(paramPath.node, uid)]); + declar._blockHoist = i ? numParams - i : 1; + + parentPath.ensureBlock(); + parentPath.get("body").unshiftContainer("body", declar); + paramPath.replaceWith(uid); + } + } + + return { + inherits: __webpack_require__(198), + + visitor: { + Function: function Function(path) { + var params = path.get("params"); + for (var i = 0; i < params.length; i++) { + replaceRestProperty(params[i].parentPath, params[i], i, params.length); + } + }, + VariableDeclarator: function VariableDeclarator(path, file) { + if (!path.get("id").isObjectPattern()) { + return; + } + + var insertionPath = path; + + path.get("id").traverse({ + RestProperty: function RestProperty(path) { + if (this.originalPath.node.id.properties.length > 1 && !t.isIdentifier(this.originalPath.node.init)) { + var initRef = path.scope.generateUidIdentifierBasedOnNode(this.originalPath.node.init, "ref"); + + this.originalPath.insertBefore(t.variableDeclarator(initRef, this.originalPath.node.init)); + + this.originalPath.replaceWith(t.variableDeclarator(this.originalPath.node.id, initRef)); + + return; + } + + var ref = this.originalPath.node.init; + + path.findParent(function (path) { + if (path.isObjectProperty()) { + ref = t.memberExpression(ref, t.identifier(path.node.key.name)); + } else if (path.isVariableDeclarator()) { + return true; + } + }); + + var _createObjectSpread = createObjectSpread(file, path.parentPath.node.properties, ref), + argument = _createObjectSpread[0], + callExpression = _createObjectSpread[1]; + + insertionPath.insertAfter(t.variableDeclarator(argument, callExpression)); + + insertionPath = insertionPath.getSibling(insertionPath.key + 1); + + if (path.parentPath.node.properties.length === 0) { + path.findParent(function (path) { + return path.isObjectProperty() || path.isVariableDeclarator(); + }).remove(); + } + } + }, { + originalPath: path + }); + }, + ExportNamedDeclaration: function ExportNamedDeclaration(path) { + var declaration = path.get("declaration"); + if (!declaration.isVariableDeclaration()) return; + if (!hasRestProperty(declaration)) return; + + var specifiers = []; + + for (var name in path.getOuterBindingIdentifiers(path)) { + var id = t.identifier(name); + specifiers.push(t.exportSpecifier(id, id)); + } + + path.replaceWith(declaration.node); + path.insertAfter(t.exportNamedDeclaration(null, specifiers)); + }, + CatchClause: function CatchClause(path) { + var paramPath = path.get("param"); + replaceRestProperty(paramPath.parentPath, paramPath); + }, + AssignmentExpression: function AssignmentExpression(path, file) { + var leftPath = path.get("left"); + if (leftPath.isObjectPattern() && hasRestProperty(leftPath)) { + var nodes = []; + + var ref = void 0; + if (path.isCompletionRecord() || path.parentPath.isExpressionStatement()) { + ref = path.scope.generateUidIdentifierBasedOnNode(path.node.right, "ref"); + + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(ref, path.node.right)])); + } + + var _createObjectSpread2 = createObjectSpread(file, path.node.left.properties, ref), + argument = _createObjectSpread2[0], + callExpression = _createObjectSpread2[1]; + + var nodeWithoutSpread = t.clone(path.node); + nodeWithoutSpread.right = ref; + nodes.push(t.expressionStatement(nodeWithoutSpread)); + nodes.push(t.toStatement(t.assignmentExpression("=", argument, callExpression))); + + if (ref) { + nodes.push(t.expressionStatement(ref)); + } + + path.replaceWithMultiple(nodes); + } + }, + ForXStatement: function ForXStatement(path) { + var node = path.node, + scope = path.scope; + + var leftPath = path.get("left"); + var left = node.left; + + if (t.isObjectPattern(left) && hasRestProperty(leftPath)) { + var temp = scope.generateUidIdentifier("ref"); + + node.left = t.variableDeclaration("var", [t.variableDeclarator(temp)]); + + path.ensureBlock(); + + node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(left, temp)])); + + return; + } + + if (!t.isVariableDeclaration(left)) return; + + var pattern = left.declarations[0].id; + if (!t.isObjectPattern(pattern)) return; + + var key = scope.generateUidIdentifier("ref"); + node.left = t.variableDeclaration(left.kind, [t.variableDeclarator(key, null)]); + + path.ensureBlock(); + + node.body.body.unshift(t.variableDeclaration(node.left.kind, [t.variableDeclarator(pattern, key)])); + }, + ObjectExpression: function ObjectExpression(path, file) { + if (!hasSpread(path.node)) return; + + var useBuiltIns = file.opts.useBuiltIns || false; + if (typeof useBuiltIns !== "boolean") { + throw new Error("transform-object-rest-spread currently only accepts a boolean " + "option for useBuiltIns (defaults to false)"); + } + + var args = []; + var props = []; + + function push() { + if (!props.length) return; + args.push(t.objectExpression(props)); + props = []; + } + + for (var _iterator3 = path.node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + var prop = _ref4; + + if (t.isSpreadProperty(prop)) { + push(); + args.push(prop.argument); + } else { + props.push(prop); + } + } + + push(); + + if (!t.isObjectExpression(args[0])) { + args.unshift(t.objectExpression([])); + } + + var helper = useBuiltIns ? t.memberExpression(t.identifier("Object"), t.identifier("assign")) : file.addHelper("extends"); + + path.replaceWith(t.callExpression(helper, args)); + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function addDisplayName(id, call) { + var props = call.arguments[0].properties; + var safe = true; + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + var key = t.toComputedKey(prop); + if (t.isLiteral(key, { value: "displayName" })) { + safe = false; + break; + } + } + + if (safe) { + props.unshift(t.objectProperty(t.identifier("displayName"), t.stringLiteral(id))); + } + } + + var isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass"); + var isCreateClassAddon = function isCreateClassAddon(callee) { + return callee.name === "createReactClass"; + }; + + function isCreateClass(node) { + if (!node || !t.isCallExpression(node)) return false; + + if (!isCreateClassCallExpression(node.callee) && !isCreateClassAddon(node.callee)) return false; + + var args = node.arguments; + if (args.length !== 1) return false; + + var first = args[0]; + if (!t.isObjectExpression(first)) return false; + + return true; + } + + return { + visitor: { + ExportDefaultDeclaration: function ExportDefaultDeclaration(_ref2, state) { + var node = _ref2.node; + + if (isCreateClass(node.declaration)) { + var displayName = state.file.opts.basename; + + if (displayName === "index") { + displayName = _path2.default.basename(_path2.default.dirname(state.file.opts.filename)); + } + + addDisplayName(displayName, node.declaration); + } + }, + CallExpression: function CallExpression(path) { + var node = path.node; + + if (!isCreateClass(node)) return; + + var id = void 0; + + path.find(function (path) { + if (path.isAssignmentExpression()) { + id = path.node.left; + } else if (path.isObjectProperty()) { + id = path.node.key; + } else if (path.isVariableDeclarator()) { + id = path.node.id; + } else if (path.isStatement()) { + return true; + } + + if (id) return true; + }); + + if (!id) return; + + if (t.isMemberExpression(id)) { + id = id.property; + } + + if (t.isIdentifier(id)) { + addDisplayName(id.name, node); + } + } + } + }; + }; + + var _path = __webpack_require__(17); + + var _path2 = _interopRequireDefault(_path); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 211 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + var JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + + var visitor = (0, _babelHelperBuilderReactJsx2.default)({ + pre: function pre(state) { + var tagName = state.tagName; + var args = state.args; + if (t.react.isCompatTag(tagName)) { + args.push(t.stringLiteral(tagName)); + } else { + args.push(state.tagExpr); + } + }, + post: function post(state, pass) { + state.callee = pass.get("jsxIdentifier")(); + } + }); + + visitor.Program = function (path, state) { + var file = state.file; + + var id = state.opts.pragma || "React.createElement"; + + for (var _iterator = file.ast.comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var comment = _ref2; + + var matches = JSX_ANNOTATION_REGEX.exec(comment.value); + if (matches) { + id = matches[1]; + if (id === "React.DOM") { + throw file.buildCodeFrameError(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12"); + } else { + break; + } + } + } + + state.set("jsxIdentifier", function () { + return id.split(".").map(function (name) { + return t.identifier(name); + }).reduce(function (object, property) { + return t.memberExpression(object, property); + }); + }); + }; + + return { + inherits: _babelPluginSyntaxJsx2.default, + visitor: visitor + }; + }; + + var _babelPluginSyntaxJsx = __webpack_require__(126); + + var _babelPluginSyntaxJsx2 = _interopRequireDefault(_babelPluginSyntaxJsx); + + var _babelHelperBuilderReactJsx = __webpack_require__(347); + + var _babelHelperBuilderReactJsx2 = _interopRequireDefault(_babelHelperBuilderReactJsx); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 212 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function () { + return { + visitor: { + Program: function Program(path, state) { + if (state.opts.strict === false || state.opts.strictMode === false) return; + + var node = path.node; + + for (var _iterator = node.directives, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var directive = _ref; + + if (directive.value.value === "use strict") return; + } + + path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict"))); + } + } + }; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 213 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPluginTransformEs2015TemplateLiterals = __webpack_require__(81); + + var _babelPluginTransformEs2015TemplateLiterals2 = _interopRequireDefault(_babelPluginTransformEs2015TemplateLiterals); + + var _babelPluginTransformEs2015Literals = __webpack_require__(74); + + var _babelPluginTransformEs2015Literals2 = _interopRequireDefault(_babelPluginTransformEs2015Literals); + + var _babelPluginTransformEs2015FunctionName = __webpack_require__(73); + + var _babelPluginTransformEs2015FunctionName2 = _interopRequireDefault(_babelPluginTransformEs2015FunctionName); + + var _babelPluginTransformEs2015ArrowFunctions = __webpack_require__(66); + + var _babelPluginTransformEs2015ArrowFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015ArrowFunctions); + + var _babelPluginTransformEs2015BlockScopedFunctions = __webpack_require__(67); + + var _babelPluginTransformEs2015BlockScopedFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScopedFunctions); + + var _babelPluginTransformEs2015Classes = __webpack_require__(69); + + var _babelPluginTransformEs2015Classes2 = _interopRequireDefault(_babelPluginTransformEs2015Classes); + + var _babelPluginTransformEs2015ObjectSuper = __webpack_require__(76); + + var _babelPluginTransformEs2015ObjectSuper2 = _interopRequireDefault(_babelPluginTransformEs2015ObjectSuper); + + var _babelPluginTransformEs2015ShorthandProperties = __webpack_require__(78); + + var _babelPluginTransformEs2015ShorthandProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ShorthandProperties); + + var _babelPluginTransformEs2015DuplicateKeys = __webpack_require__(129); + + var _babelPluginTransformEs2015DuplicateKeys2 = _interopRequireDefault(_babelPluginTransformEs2015DuplicateKeys); + + var _babelPluginTransformEs2015ComputedProperties = __webpack_require__(70); + + var _babelPluginTransformEs2015ComputedProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ComputedProperties); + + var _babelPluginTransformEs2015ForOf = __webpack_require__(72); + + var _babelPluginTransformEs2015ForOf2 = _interopRequireDefault(_babelPluginTransformEs2015ForOf); + + var _babelPluginTransformEs2015StickyRegex = __webpack_require__(80); + + var _babelPluginTransformEs2015StickyRegex2 = _interopRequireDefault(_babelPluginTransformEs2015StickyRegex); + + var _babelPluginTransformEs2015UnicodeRegex = __webpack_require__(83); + + var _babelPluginTransformEs2015UnicodeRegex2 = _interopRequireDefault(_babelPluginTransformEs2015UnicodeRegex); + + var _babelPluginCheckEs2015Constants = __webpack_require__(64); + + var _babelPluginCheckEs2015Constants2 = _interopRequireDefault(_babelPluginCheckEs2015Constants); + + var _babelPluginTransformEs2015Spread = __webpack_require__(79); + + var _babelPluginTransformEs2015Spread2 = _interopRequireDefault(_babelPluginTransformEs2015Spread); + + var _babelPluginTransformEs2015Parameters = __webpack_require__(77); + + var _babelPluginTransformEs2015Parameters2 = _interopRequireDefault(_babelPluginTransformEs2015Parameters); + + var _babelPluginTransformEs2015Destructuring = __webpack_require__(71); + + var _babelPluginTransformEs2015Destructuring2 = _interopRequireDefault(_babelPluginTransformEs2015Destructuring); + + var _babelPluginTransformEs2015BlockScoping = __webpack_require__(68); + + var _babelPluginTransformEs2015BlockScoping2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScoping); + + var _babelPluginTransformEs2015TypeofSymbol = __webpack_require__(82); + + var _babelPluginTransformEs2015TypeofSymbol2 = _interopRequireDefault(_babelPluginTransformEs2015TypeofSymbol); + + var _babelPluginTransformEs2015ModulesCommonjs = __webpack_require__(75); + + var _babelPluginTransformEs2015ModulesCommonjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesCommonjs); + + var _babelPluginTransformEs2015ModulesSystemjs = __webpack_require__(204); + + var _babelPluginTransformEs2015ModulesSystemjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesSystemjs); + + var _babelPluginTransformEs2015ModulesAmd = __webpack_require__(130); + + var _babelPluginTransformEs2015ModulesAmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesAmd); + + var _babelPluginTransformEs2015ModulesUmd = __webpack_require__(205); + + var _babelPluginTransformEs2015ModulesUmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesUmd); + + var _babelPluginTransformRegenerator = __webpack_require__(84); + + var _babelPluginTransformRegenerator2 = _interopRequireDefault(_babelPluginTransformRegenerator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function preset(context) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var moduleTypes = ["commonjs", "amd", "umd", "systemjs"]; + var loose = false; + var modules = "commonjs"; + var spec = false; + + if (opts !== undefined) { + if (opts.loose !== undefined) loose = opts.loose; + if (opts.modules !== undefined) modules = opts.modules; + if (opts.spec !== undefined) spec = opts.spec; + } + + if (typeof loose !== "boolean") throw new Error("Preset es2015 'loose' option must be a boolean."); + if (typeof spec !== "boolean") throw new Error("Preset es2015 'spec' option must be a boolean."); + if (modules !== false && moduleTypes.indexOf(modules) === -1) { + throw new Error("Preset es2015 'modules' option must be 'false' to indicate no modules\n" + "or a module type which be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'"); + } + + var optsLoose = { loose: loose }; + + return { + plugins: [[_babelPluginTransformEs2015TemplateLiterals2.default, { loose: loose, spec: spec }], _babelPluginTransformEs2015Literals2.default, _babelPluginTransformEs2015FunctionName2.default, [_babelPluginTransformEs2015ArrowFunctions2.default, { spec: spec }], _babelPluginTransformEs2015BlockScopedFunctions2.default, [_babelPluginTransformEs2015Classes2.default, optsLoose], _babelPluginTransformEs2015ObjectSuper2.default, _babelPluginTransformEs2015ShorthandProperties2.default, _babelPluginTransformEs2015DuplicateKeys2.default, [_babelPluginTransformEs2015ComputedProperties2.default, optsLoose], [_babelPluginTransformEs2015ForOf2.default, optsLoose], _babelPluginTransformEs2015StickyRegex2.default, _babelPluginTransformEs2015UnicodeRegex2.default, _babelPluginCheckEs2015Constants2.default, [_babelPluginTransformEs2015Spread2.default, optsLoose], _babelPluginTransformEs2015Parameters2.default, [_babelPluginTransformEs2015Destructuring2.default, optsLoose], _babelPluginTransformEs2015BlockScoping2.default, _babelPluginTransformEs2015TypeofSymbol2.default, modules === "commonjs" && [_babelPluginTransformEs2015ModulesCommonjs2.default, optsLoose], modules === "systemjs" && [_babelPluginTransformEs2015ModulesSystemjs2.default, optsLoose], modules === "amd" && [_babelPluginTransformEs2015ModulesAmd2.default, optsLoose], modules === "umd" && [_babelPluginTransformEs2015ModulesUmd2.default, optsLoose], [_babelPluginTransformRegenerator2.default, { async: false, asyncGenerators: false }]].filter(Boolean) }; + } + + var oldConfig = preset({}); + + exports.default = oldConfig; + + Object.defineProperty(oldConfig, "buildPreset", { + configurable: true, + writable: true, + + enumerable: false, + value: preset + }); + module.exports = exports["default"]; + +/***/ }), +/* 214 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPluginTransformExponentiationOperator = __webpack_require__(131); + + var _babelPluginTransformExponentiationOperator2 = _interopRequireDefault(_babelPluginTransformExponentiationOperator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + plugins: [_babelPluginTransformExponentiationOperator2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 215 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPluginSyntaxTrailingFunctionCommas = __webpack_require__(127); + + var _babelPluginSyntaxTrailingFunctionCommas2 = _interopRequireDefault(_babelPluginSyntaxTrailingFunctionCommas); + + var _babelPluginTransformAsyncToGenerator = __webpack_require__(128); + + var _babelPluginTransformAsyncToGenerator2 = _interopRequireDefault(_babelPluginTransformAsyncToGenerator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + plugins: [_babelPluginSyntaxTrailingFunctionCommas2.default, _babelPluginTransformAsyncToGenerator2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 216 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPresetStage = __webpack_require__(217); + + var _babelPresetStage2 = _interopRequireDefault(_babelPresetStage); + + var _babelPluginTransformClassConstructorCall = __webpack_require__(199); + + var _babelPluginTransformClassConstructorCall2 = _interopRequireDefault(_babelPluginTransformClassConstructorCall); + + var _babelPluginTransformExportExtensions = __webpack_require__(206); + + var _babelPluginTransformExportExtensions2 = _interopRequireDefault(_babelPluginTransformExportExtensions); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + presets: [_babelPresetStage2.default], + plugins: [_babelPluginTransformClassConstructorCall2.default, _babelPluginTransformExportExtensions2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 217 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPresetStage = __webpack_require__(218); + + var _babelPresetStage2 = _interopRequireDefault(_babelPresetStage); + + var _babelPluginTransformClassProperties = __webpack_require__(200); + + var _babelPluginTransformClassProperties2 = _interopRequireDefault(_babelPluginTransformClassProperties); + + var _babelPluginTransformDecorators = __webpack_require__(201); + + var _babelPluginTransformDecorators2 = _interopRequireDefault(_babelPluginTransformDecorators); + + var _babelPluginSyntaxDynamicImport = __webpack_require__(320); + + var _babelPluginSyntaxDynamicImport2 = _interopRequireDefault(_babelPluginSyntaxDynamicImport); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + presets: [_babelPresetStage2.default], + plugins: [_babelPluginSyntaxDynamicImport2.default, _babelPluginTransformClassProperties2.default, _babelPluginTransformDecorators2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 218 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPluginSyntaxTrailingFunctionCommas = __webpack_require__(127); + + var _babelPluginSyntaxTrailingFunctionCommas2 = _interopRequireDefault(_babelPluginSyntaxTrailingFunctionCommas); + + var _babelPluginTransformAsyncToGenerator = __webpack_require__(128); + + var _babelPluginTransformAsyncToGenerator2 = _interopRequireDefault(_babelPluginTransformAsyncToGenerator); + + var _babelPluginTransformExponentiationOperator = __webpack_require__(131); + + var _babelPluginTransformExponentiationOperator2 = _interopRequireDefault(_babelPluginTransformExponentiationOperator); + + var _babelPluginTransformObjectRestSpread = __webpack_require__(209); + + var _babelPluginTransformObjectRestSpread2 = _interopRequireDefault(_babelPluginTransformObjectRestSpread); + + var _babelPluginTransformAsyncGeneratorFunctions = __webpack_require__(323); + + var _babelPluginTransformAsyncGeneratorFunctions2 = _interopRequireDefault(_babelPluginTransformAsyncGeneratorFunctions); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + plugins: [_babelPluginSyntaxTrailingFunctionCommas2.default, _babelPluginTransformAsyncToGenerator2.default, _babelPluginTransformExponentiationOperator2.default, _babelPluginTransformAsyncGeneratorFunctions2.default, _babelPluginTransformObjectRestSpread2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 219 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Hub = function Hub(file, options) { + (0, _classCallCheck3.default)(this, Hub); + + this.file = file; + this.options = options; + }; + + exports.default = Hub; + module.exports = exports["default"]; + +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = undefined; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var ReferencedIdentifier = exports.ReferencedIdentifier = { + types: ["Identifier", "JSXIdentifier"], + checkPath: function checkPath(_ref, opts) { + var node = _ref.node, + parent = _ref.parent; + + if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) { + if (t.isJSXIdentifier(node, opts)) { + if (_babelTypes.react.isCompatTag(node.name)) return false; + } else { + return false; + } + } + + return t.isReferenced(node, parent); + } + }; + + var ReferencedMemberExpression = exports.ReferencedMemberExpression = { + types: ["MemberExpression"], + checkPath: function checkPath(_ref2) { + var node = _ref2.node, + parent = _ref2.parent; + + return t.isMemberExpression(node) && t.isReferenced(node, parent); + } + }; + + var BindingIdentifier = exports.BindingIdentifier = { + types: ["Identifier"], + checkPath: function checkPath(_ref3) { + var node = _ref3.node, + parent = _ref3.parent; + + return t.isIdentifier(node) && t.isBinding(node, parent); + } + }; + + var Statement = exports.Statement = { + types: ["Statement"], + checkPath: function checkPath(_ref4) { + var node = _ref4.node, + parent = _ref4.parent; + + if (t.isStatement(node)) { + if (t.isVariableDeclaration(node)) { + if (t.isForXStatement(parent, { left: node })) return false; + if (t.isForStatement(parent, { init: node })) return false; + } + + return true; + } else { + return false; + } + } + }; + + var Expression = exports.Expression = { + types: ["Expression"], + checkPath: function checkPath(path) { + if (path.isIdentifier()) { + return path.isReferencedIdentifier(); + } else { + return t.isExpression(path.node); + } + } + }; + + var Scope = exports.Scope = { + types: ["Scopable"], + checkPath: function checkPath(path) { + return t.isScope(path.node, path.parent); + } + }; + + var Referenced = exports.Referenced = { + checkPath: function checkPath(path) { + return t.isReferenced(path.node, path.parent); + } + }; + + var BlockScoped = exports.BlockScoped = { + checkPath: function checkPath(path) { + return t.isBlockScoped(path.node); + } + }; + + var Var = exports.Var = { + types: ["VariableDeclaration"], + checkPath: function checkPath(path) { + return t.isVar(path.node); + } + }; + + var User = exports.User = { + checkPath: function checkPath(path) { + return path.node && !!path.node.loc; + } + }; + + var Generated = exports.Generated = { + checkPath: function checkPath(path) { + return !path.isUser(); + } + }; + + var Pure = exports.Pure = { + checkPath: function checkPath(path, opts) { + return path.scope.isPure(path.node, opts); + } + }; + + var Flow = exports.Flow = { + types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"], + checkPath: function checkPath(_ref5) { + var node = _ref5.node; + + if (t.isFlow(node)) { + return true; + } else if (t.isImportDeclaration(node)) { + return node.importKind === "type" || node.importKind === "typeof"; + } else if (t.isExportDeclaration(node)) { + return node.exportKind === "type"; + } else if (t.isImportSpecifier(node)) { + return node.importKind === "type" || node.importKind === "typeof"; + } else { + return false; + } + } + }; + +/***/ }), +/* 221 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Binding = function () { + function Binding(_ref) { + var existing = _ref.existing, + identifier = _ref.identifier, + scope = _ref.scope, + path = _ref.path, + kind = _ref.kind; + (0, _classCallCheck3.default)(this, Binding); + + this.identifier = identifier; + this.scope = scope; + this.path = path; + this.kind = kind; + + this.constantViolations = []; + this.constant = true; + + this.referencePaths = []; + this.referenced = false; + this.references = 0; + + this.clearValue(); + + if (existing) { + this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations); + } + } + + Binding.prototype.deoptValue = function deoptValue() { + this.clearValue(); + this.hasDeoptedValue = true; + }; + + Binding.prototype.setValue = function setValue(value) { + if (this.hasDeoptedValue) return; + this.hasValue = true; + this.value = value; + }; + + Binding.prototype.clearValue = function clearValue() { + this.hasDeoptedValue = false; + this.hasValue = false; + this.value = null; + }; + + Binding.prototype.reassign = function reassign(path) { + this.constant = false; + if (this.constantViolations.indexOf(path) !== -1) { + return; + } + this.constantViolations.push(path); + }; + + Binding.prototype.reference = function reference(path) { + if (this.referencePaths.indexOf(path) !== -1) { + return; + } + this.referenced = true; + this.references++; + this.referencePaths.push(path); + }; + + Binding.prototype.dereference = function dereference() { + this.references--; + this.referenced = !!this.references; + }; + + return Binding; + }(); + + exports.default = Binding; + module.exports = exports["default"]; + +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + exports.getBindingIdentifiers = getBindingIdentifiers; + exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers; + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getBindingIdentifiers(node, duplicates, outerOnly) { + var search = [].concat(node); + var ids = (0, _create2.default)(null); + + while (search.length) { + var id = search.shift(); + if (!id) continue; + + var keys = t.getBindingIdentifiers.keys[id.type]; + + if (t.isIdentifier(id)) { + if (duplicates) { + var _ids = ids[id.name] = ids[id.name] || []; + _ids.push(id); + } else { + ids[id.name] = id; + } + continue; + } + + if (t.isExportDeclaration(id)) { + if (t.isDeclaration(id.declaration)) { + search.push(id.declaration); + } + continue; + } + + if (outerOnly) { + if (t.isFunctionDeclaration(id)) { + search.push(id.id); + continue; + } + + if (t.isFunctionExpression(id)) { + continue; + } + } + + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (id[key]) { + search = search.concat(id[key]); + } + } + } + } + + return ids; + } + + getBindingIdentifiers.keys = { + DeclareClass: ["id"], + DeclareFunction: ["id"], + DeclareModule: ["id"], + DeclareVariable: ["id"], + InterfaceDeclaration: ["id"], + TypeAlias: ["id"], + + CatchClause: ["param"], + LabeledStatement: ["label"], + UnaryExpression: ["argument"], + AssignmentExpression: ["left"], + + ImportSpecifier: ["local"], + ImportNamespaceSpecifier: ["local"], + ImportDefaultSpecifier: ["local"], + ImportDeclaration: ["specifiers"], + + ExportSpecifier: ["exported"], + ExportNamespaceSpecifier: ["exported"], + ExportDefaultSpecifier: ["exported"], + + FunctionDeclaration: ["id", "params"], + FunctionExpression: ["id", "params"], + + ClassDeclaration: ["id"], + ClassExpression: ["id"], + + RestElement: ["argument"], + UpdateExpression: ["argument"], + + RestProperty: ["argument"], + ObjectProperty: ["value"], + + AssignmentPattern: ["left"], + ArrayPattern: ["elements"], + ObjectPattern: ["properties"], + + VariableDeclaration: ["declarations"], + VariableDeclarator: ["id"] + }; + + function getOuterBindingIdentifiers(node, duplicates) { + return getBindingIdentifiers(node, duplicates, true); + } + +/***/ }), +/* 223 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(137), + TAG = __webpack_require__(12)('toStringTag' + // ES3 wrong here + ), + ARG = cof(function () { + return arguments; + }()) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function tryGet(it, key) { + try { + return it[key]; + } catch (e) {/* empty */} + }; + + module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O + // ES3 arguments fallback + ) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + }; + +/***/ }), +/* 224 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var redefineAll = __webpack_require__(144), + getWeak = __webpack_require__(56).getWeak, + anObject = __webpack_require__(19), + isObject = __webpack_require__(22), + anInstance = __webpack_require__(135), + forOf = __webpack_require__(89), + createArrayMethod = __webpack_require__(136), + $has = __webpack_require__(27), + arrayFind = createArrayMethod(5), + arrayFindIndex = createArrayMethod(6), + id = 0; + + // fallback for uncaught frozen keys + var uncaughtFrozenStore = function uncaughtFrozenStore(that) { + return that._l || (that._l = new UncaughtFrozenStore()); + }; + var UncaughtFrozenStore = function UncaughtFrozenStore() { + this.a = []; + }; + var findUncaughtFrozen = function findUncaughtFrozen(store, key) { + return arrayFind(store.a, function (it) { + return it[0] === key; + }); + }; + UncaughtFrozenStore.prototype = { + get: function get(key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function has(key) { + return !!findUncaughtFrozen(this, key); + }, + set: function set(key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value;else this.a.push([key, value]); + }, + 'delete': function _delete(key) { + var index = arrayFindIndex(this.a, function (it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } + }; + + module.exports = { + getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + 'delete': function _delete(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this)['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function def(that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore + }; + +/***/ }), +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(22), + document = __webpack_require__(14).document + // in old IE typeof document.createElement is 'object' + , + is = isObject(document) && isObject(document.createElement); + module.exports = function (it) { + return is ? document.createElement(it) : {}; + }; + +/***/ }), +/* 226 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = !__webpack_require__(20) && !__webpack_require__(36)(function () { + return Object.defineProperty(__webpack_require__(225)('div'), 'a', { get: function get() { + return 7; + } }).a != 7; + }); + +/***/ }), +/* 227 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 7.2.2 IsArray(argument) + var cof = __webpack_require__(137); + module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; + }; + +/***/ }), +/* 228 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function (done, value) { + return { value: value, done: !!done }; + }; + +/***/ }), +/* 229 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + // 19.1.2.1 Object.assign(target, source, ...) + + var getKeys = __webpack_require__(43), + gOPS = __webpack_require__(143), + pIE = __webpack_require__(91), + toObject = __webpack_require__(94), + IObject = __webpack_require__(140), + $assign = Object.assign; + + // should work with symbols and should have deterministic property order (V8 bug) + module.exports = !$assign || __webpack_require__(36)(function () { + var A = {}, + B = {}, + S = Symbol(), + K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { + B[k] = k; + }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; + }) ? function assign(target, source) { + // eslint-disable-line no-unused-vars + var T = toObject(target), + aLen = arguments.length, + index = 1, + getSymbols = gOPS.f, + isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]), + keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S), + length = keys.length, + j = 0, + key; + while (length > j) { + if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } + }return T; + } : $assign; + +/***/ }), +/* 230 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var pIE = __webpack_require__(91), + createDesc = __webpack_require__(92), + toIObject = __webpack_require__(37), + toPrimitive = __webpack_require__(150), + has = __webpack_require__(27), + IE8_DOM_DEFINE = __webpack_require__(226), + gOPD = Object.getOwnPropertyDescriptor; + + exports.f = __webpack_require__(20) ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) {/* empty */} + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); + }; + +/***/ }), +/* 231 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + var $keys = __webpack_require__(232), + hiddenKeys = __webpack_require__(139).concat('length', 'prototype'); + + exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); + }; + +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var has = __webpack_require__(27), + toIObject = __webpack_require__(37), + arrayIndexOf = __webpack_require__(417)(false), + IE_PROTO = __webpack_require__(146)('IE_PROTO'); + + module.exports = function (object, names) { + var O = toIObject(object), + i = 0, + result = [], + key; + for (key in O) { + if (key != IE_PROTO) has(O, key) && result.push(key); + } // Don't enum bug & hidden keys + while (names.length > i) { + if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + }return result; + }; + +/***/ }), +/* 233 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var classof = __webpack_require__(223), + ITERATOR = __webpack_require__(12)('iterator'), + Iterators = __webpack_require__(55); + module.exports = __webpack_require__(5).getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; + }; + +/***/ }), +/* 234 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = __webpack_require__(449); + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); + + /** + * Colors. + */ + + exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson']; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || + // is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || + // double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + exports.formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } + }; + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit' + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + );var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === 'undefined' ? 'undefined' : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch (e) {} + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + function load() { + var r; + try { + r = exports.storage.debug; + } catch (e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ + + exports.enable(load()); + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 235 */ +/***/ (function(module, exports) { + + 'use strict'; + + /* + Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com> + Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + (function () { + 'use strict'; + + var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; + + // See `tools/generate-identifier-regex.js`. + ES5Regex = { + // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, + // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + }; + + ES6Regex = { + // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/, + // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + + function isDecimalDigit(ch) { + return 0x30 <= ch && ch <= 0x39; // 0..9 + } + + function isHexDigit(ch) { + return 0x30 <= ch && ch <= 0x39 || // 0..9 + 0x61 <= ch && ch <= 0x66 || // a..f + 0x41 <= ch && ch <= 0x46; // A..F + } + + function isOctalDigit(ch) { + return ch >= 0x30 && ch <= 0x37; // 0..7 + } + + // 7.2 White Space + + NON_ASCII_WHITESPACES = [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF]; + + function isWhiteSpace(ch) { + return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; + } + + // 7.6 Identifier Names and Identifiers + + function fromCodePoint(cp) { + if (cp <= 0xFFFF) { + return String.fromCharCode(cp); + } + var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); + var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00); + return cu1 + cu2; + } + + IDENTIFIER_START = new Array(0x80); + for (ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + IDENTIFIER_PART = new Array(0x80); + for (ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch >= 0x30 && ch <= 0x39 || // 0..9 + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + function isIdentifierStartES5(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES5(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + function isIdentifierStartES6(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES6(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + module.exports = { + isDecimalDigit: isDecimalDigit, + isHexDigit: isHexDigit, + isOctalDigit: isOctalDigit, + isWhiteSpace: isWhiteSpace, + isLineTerminator: isLineTerminator, + isIdentifierStartES5: isIdentifierStartES5, + isIdentifierPartES5: isIdentifierPartES5, + isIdentifierStartES6: isIdentifierStartES6, + isIdentifierPartES6: isIdentifierPartES6 + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +/***/ }), +/* 236 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38), + root = __webpack_require__(15); + + /* Built-in method references that are verified to be native. */ + var Set = getNative(root, 'Set'); + + module.exports = Set; + +/***/ }), +/* 237 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var MapCache = __webpack_require__(156), + setCacheAdd = __webpack_require__(552), + setCacheHas = __webpack_require__(553); + + /** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + module.exports = SetCache; + +/***/ }), +/* 238 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var root = __webpack_require__(15); + + /** Built-in value references. */ + var Uint8Array = root.Uint8Array; + + module.exports = Uint8Array; + +/***/ }), +/* 239 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + module.exports = apply; + +/***/ }), +/* 240 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseTimes = __webpack_require__(504), + isArguments = __webpack_require__(112), + isArray = __webpack_require__(6), + isBuffer = __webpack_require__(113), + isIndex = __webpack_require__(167), + isTypedArray = __webpack_require__(173); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == 'offset' || key == 'parent') || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || + // Skip index properties. + isIndex(key, length)))) { + result.push(key); + } + } + return result; + } + + module.exports = arrayLikeKeys; + +/***/ }), +/* 241 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + module.exports = arrayReduce; + +/***/ }), +/* 242 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseAssignValue = __webpack_require__(159), + eq = __webpack_require__(45); + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignMergeValue(object, key, value) { + if (value !== undefined && !eq(object[key], value) || value === undefined && !(key in object)) { + baseAssignValue(object, key, value); + } + } + + module.exports = assignMergeValue; + +/***/ }), +/* 243 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var createBaseFor = __webpack_require__(518); + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + module.exports = baseFor; + +/***/ }), +/* 244 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var castPath = __webpack_require__(250), + toKey = __webpack_require__(108); + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return index && index == length ? object : undefined; + } + + module.exports = baseGet; + +/***/ }), +/* 245 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayPush = __webpack_require__(157), + isArray = __webpack_require__(6); + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + } + + module.exports = baseGetAllKeys; + +/***/ }), +/* 246 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsEqualDeep = __webpack_require__(485), + isObjectLike = __webpack_require__(25); + + /** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + + module.exports = baseIsEqual; + +/***/ }), +/* 247 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseEach = __webpack_require__(478), + isArrayLike = __webpack_require__(24); + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function (value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + module.exports = baseMap; + +/***/ }), +/* 248 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44), + arrayMap = __webpack_require__(58), + isArray = __webpack_require__(6), + isSymbol = __webpack_require__(60); + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = value + ''; + return result == '0' && 1 / value == -INFINITY ? '-0' : result; + } + + module.exports = baseToString; + +/***/ }), +/* 249 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + module.exports = cacheHas; + +/***/ }), +/* 250 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isArray = __webpack_require__(6), + isKey = __webpack_require__(169), + stringToPath = __webpack_require__(562), + toString = __webpack_require__(114); + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + module.exports = castPath; + +/***/ }), +/* 251 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var root = __webpack_require__(15); + + /** Detect free variable `exports`. */ + var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Built-in value references. */ + var Buffer = moduleExports ? root.Buffer : undefined, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + module.exports = cloneBuffer; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module))) + +/***/ }), +/* 252 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var cloneArrayBuffer = __webpack_require__(163); + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + module.exports = cloneTypedArray; + +/***/ }), +/* 253 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIteratee = __webpack_require__(59), + isArrayLike = __webpack_require__(24), + keys = __webpack_require__(31); + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function (collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = baseIteratee(predicate, 3); + collection = keys(collection); + predicate = function predicate(key) { + return iteratee(iterable[key], key, iterable); + }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + module.exports = createFind; + +/***/ }), +/* 254 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38); + + var defineProperty = function () { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }(); + + module.exports = defineProperty; + +/***/ }), +/* 255 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var SetCache = __webpack_require__(237), + arraySome = __webpack_require__(473), + cacheHas = __webpack_require__(249); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function (othValue, othIndex) { + if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; + } + + module.exports = equalArrays; + +/***/ }), +/* 256 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global; + + module.exports = freeGlobal; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 257 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetAllKeys = __webpack_require__(245), + getSymbols = __webpack_require__(166), + keys = __webpack_require__(31); + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + module.exports = getAllKeys; + +/***/ }), +/* 258 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayPush = __webpack_require__(157), + getPrototype = __webpack_require__(165), + getSymbols = __webpack_require__(166), + stubArray = __webpack_require__(274); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeGetSymbols = Object.getOwnPropertySymbols; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; + }; + + module.exports = getSymbolsIn; + +/***/ }), +/* 259 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var DataView = __webpack_require__(463), + Map = __webpack_require__(155), + Promise = __webpack_require__(465), + Set = __webpack_require__(236), + WeakMap = __webpack_require__(466), + baseGetTag = __webpack_require__(29), + toSource = __webpack_require__(267); + + /** `Object#toString` result references. */ + var mapTag = '[object Map]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + setTag = '[object Set]', + weakMapTag = '[object WeakMap]'; + + var dataViewTag = '[object DataView]'; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { + getTag = function getTag(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result; + }; + } + + module.exports = getTag; + +/***/ }), +/* 260 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var castPath = __webpack_require__(250), + isArguments = __webpack_require__(112), + isArray = __webpack_require__(6), + isIndex = __webpack_require__(167), + isLength = __webpack_require__(172), + toKey = __webpack_require__(108); + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); + } + + module.exports = hasPath; + +/***/ }), +/* 261 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseCreate = __webpack_require__(477), + getPrototype = __webpack_require__(165), + isPrototype = __webpack_require__(105); + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; + } + + module.exports = initCloneObject; + +/***/ }), +/* 262 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(16); + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + module.exports = isStrictComparable; + +/***/ }), +/* 263 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function (value, key) { + result[++index] = [key, value]; + }); + return result; + } + + module.exports = mapToArray; + +/***/ }), +/* 264 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function (object) { + if (object == null) { + return false; + } + return object[key] === srcValue && (srcValue !== undefined || key in Object(object)); + }; + } + + module.exports = matchesStrictComparable; + +/***/ }), +/* 265 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var freeGlobal = __webpack_require__(256); + + /** Detect free variable `exports`. */ + var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = function () { + try { + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }(); + + module.exports = nodeUtil; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module))) + +/***/ }), +/* 266 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function (arg) { + return func(transform(arg)); + }; + } + + module.exports = overArg; + +/***/ }), +/* 267 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used for built-in method references. */ + var funcProto = Function.prototype; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ''; + } catch (e) {} + } + return ''; + } + + module.exports = toSource; + +/***/ }), +/* 268 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var apply = __webpack_require__(239), + assignInWith = __webpack_require__(564), + baseRest = __webpack_require__(101), + customDefaultsAssignIn = __webpack_require__(520); + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function (args) { + args.push(undefined, customDefaultsAssignIn); + return apply(assignInWith, undefined, args); + }); + + module.exports = defaults; + +/***/ }), +/* 269 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseHas = __webpack_require__(481), + hasPath = __webpack_require__(260); + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + module.exports = has; + +/***/ }), +/* 270 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + getPrototype = __webpack_require__(165), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var objectTag = '[object Object]'; + + /** Used for built-in method references. */ + var funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; + } + + module.exports = isPlainObject; + +/***/ }), +/* 271 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsRegExp = __webpack_require__(489), + baseUnary = __webpack_require__(102), + nodeUtil = __webpack_require__(265); + + /* Node.js helper references. */ + var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + module.exports = isRegExp; + +/***/ }), +/* 272 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseRest = __webpack_require__(101), + pullAll = __webpack_require__(584); + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + module.exports = pull; + +/***/ }), +/* 273 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseRepeat = __webpack_require__(501), + isIterateeCall = __webpack_require__(168), + toInteger = __webpack_require__(47), + toString = __webpack_require__(114); + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if (guard ? isIterateeCall(string, n, guard) : n === undefined) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + module.exports = repeat; + +/***/ }), +/* 274 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ + function stubArray() { + return []; + } + + module.exports = stubArray; + +/***/ }), +/* 275 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseValues = __webpack_require__(506), + keys = __webpack_require__(31); + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + module.exports = values; + +/***/ }), +/* 276 */ +/***/ (function(module, exports) { + + "use strict"; + + var originalObject = Object; + var originalDefProp = Object.defineProperty; + var originalCreate = Object.create; + + function defProp(obj, name, value) { + if (originalDefProp) try { + originalDefProp.call(originalObject, obj, name, { value: value }); + } catch (definePropertyIsBrokenInIE8) { + obj[name] = value; + } else { + obj[name] = value; + } + } + + // For functions that will be invoked using .call or .apply, we need to + // define those methods on the function objects themselves, rather than + // inheriting them from Function.prototype, so that a malicious or clumsy + // third party cannot interfere with the functionality of this module by + // redefining Function.prototype.call or .apply. + function makeSafeToCall(fun) { + if (fun) { + defProp(fun, "call", fun.call); + defProp(fun, "apply", fun.apply); + } + return fun; + } + + makeSafeToCall(originalDefProp); + makeSafeToCall(originalCreate); + + var hasOwn = makeSafeToCall(Object.prototype.hasOwnProperty); + var numToStr = makeSafeToCall(Number.prototype.toString); + var strSlice = makeSafeToCall(String.prototype.slice); + + var cloner = function cloner() {}; + function create(prototype) { + if (originalCreate) { + return originalCreate.call(originalObject, prototype); + } + cloner.prototype = prototype || null; + return new cloner(); + } + + var rand = Math.random; + var uniqueKeys = create(null); + + function makeUniqueKey() { + // Collisions are highly unlikely, but this module is in the business of + // making guarantees rather than safe bets. + do { + var uniqueKey = internString(strSlice.call(numToStr.call(rand(), 36), 2)); + } while (hasOwn.call(uniqueKeys, uniqueKey)); + return uniqueKeys[uniqueKey] = uniqueKey; + } + + function internString(str) { + var obj = {}; + obj[str] = true; + return Object.keys(obj)[0]; + } + + // External users might find this function useful, but it is not necessary + // for the typical use of this module. + exports.makeUniqueKey = makeUniqueKey; + + // Object.getOwnPropertyNames is the only way to enumerate non-enumerable + // properties, so if we wrap it to ignore our secret keys, there should be + // no way (except guessing) to access those properties. + var originalGetOPNs = Object.getOwnPropertyNames; + Object.getOwnPropertyNames = function getOwnPropertyNames(object) { + for (var names = originalGetOPNs(object), src = 0, dst = 0, len = names.length; src < len; ++src) { + if (!hasOwn.call(uniqueKeys, names[src])) { + if (src > dst) { + names[dst] = names[src]; + } + ++dst; + } + } + names.length = dst; + return names; + }; + + function defaultCreatorFn(object) { + return create(null); + } + + function makeAccessor(secretCreatorFn) { + var brand = makeUniqueKey(); + var passkey = create(null); + + secretCreatorFn = secretCreatorFn || defaultCreatorFn; + + function register(object) { + var secret; // Created lazily. + + function vault(key, forget) { + // Only code that has access to the passkey can retrieve (or forget) + // the secret object. + if (key === passkey) { + return forget ? secret = null : secret || (secret = secretCreatorFn(object)); + } + } + + defProp(object, brand, vault); + } + + function accessor(object) { + if (!hasOwn.call(object, brand)) register(object); + return object[brand](passkey); + } + + accessor.forget = function (object) { + if (hasOwn.call(object, brand)) object[brand](passkey, true); + }; + + return accessor; + } + + exports.makeAccessor = makeAccessor; + +/***/ }), +/* 277 */ +/***/ (function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /*! https://mths.be/regenerate v1.3.2 by @mathias | MIT license */ + ;(function (root) { + + // Detect free variables `exports`. + var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports; + + // Detect free variable `module`. + var freeModule = ( false ? 'undefined' : _typeof(module)) == 'object' && module && module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js/io.js or Browserified code, + // and use it as `root`. + var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var ERRORS = { + 'rangeOrder': 'A range\u2019s `stop` value must be greater than or equal ' + 'to the `start` value.', + 'codePointRange': 'Invalid code point value. Code points range from ' + 'U+000000 to U+10FFFF.' + }; + + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs + var HIGH_SURROGATE_MIN = 0xD800; + var HIGH_SURROGATE_MAX = 0xDBFF; + var LOW_SURROGATE_MIN = 0xDC00; + var LOW_SURROGATE_MAX = 0xDFFF; + + // In Regenerate output, `\0` is never preceded by `\` because we sort by + // code point value, so let’s keep this regular expression simple. + var regexNull = /\\x00([^0123456789]|$)/g; + + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + var extend = function extend(destination, source) { + var key; + for (key in source) { + if (hasOwnProperty.call(source, key)) { + destination[key] = source[key]; + } } - } - return destination; - }; + return destination; + }; - var forEach = function(array, callback) { - var index = -1; - var length = array.length; - while (++index < length) { - callback(array[index], index); - } - }; + var forEach = function forEach(array, callback) { + var index = -1; + var length = array.length; + while (++index < length) { + callback(array[index], index); + } + }; - var toString = object.toString; - var isArray = function(value) { - return toString.call(value) == '[object Array]'; - }; - var isNumber = function(value) { - return typeof value == 'number' || - toString.call(value) == '[object Number]'; - }; + var toString = object.toString; + var isArray = function isArray(value) { + return toString.call(value) == '[object Array]'; + }; + var isNumber = function isNumber(value) { + return typeof value == 'number' || toString.call(value) == '[object Number]'; + }; - // This assumes that `number` is a positive integer that `toString()`s nicely - // (which is the case for all code point values). - var zeroes = '0000'; - var pad = function(number, totalCharacters) { - var string = String(number); - return string.length < totalCharacters - ? (zeroes + string).slice(-totalCharacters) - : string; - }; + // This assumes that `number` is a positive integer that `toString()`s nicely + // (which is the case for all code point values). + var zeroes = '0000'; + var pad = function pad(number, totalCharacters) { + var string = String(number); + return string.length < totalCharacters ? (zeroes + string).slice(-totalCharacters) : string; + }; - var hex = function(number) { - return Number(number).toString(16).toUpperCase(); - }; + var hex = function hex(number) { + return Number(number).toString(16).toUpperCase(); + }; - var slice = [].slice; + var slice = [].slice; - /*--------------------------------------------------------------------------*/ + /*--------------------------------------------------------------------------*/ - var dataFromCodePoints = function(codePoints) { - var index = -1; - var length = codePoints.length; - var max = length - 1; - var result = []; - var isStart = true; - var tmp; - var previous = 0; - while (++index < length) { - tmp = codePoints[index]; - if (isStart) { - result.push(tmp); - previous = tmp; - isStart = false; - } else { - if (tmp == previous + 1) { - if (index != max) { - previous = tmp; - continue; - } else { - isStart = true; - result.push(tmp + 1); - } - } else { - // End the previous range and start a new one. - result.push(previous + 1, tmp); + var dataFromCodePoints = function dataFromCodePoints(codePoints) { + var index = -1; + var length = codePoints.length; + var max = length - 1; + var result = []; + var isStart = true; + var tmp; + var previous = 0; + while (++index < length) { + tmp = codePoints[index]; + if (isStart) { + result.push(tmp); previous = tmp; + isStart = false; + } else { + if (tmp == previous + 1) { + if (index != max) { + previous = tmp; + continue; + } else { + isStart = true; + result.push(tmp + 1); + } + } else { + // End the previous range and start a new one. + result.push(previous + 1, tmp); + previous = tmp; + } } } - } - if (!isStart) { - result.push(tmp + 1); - } - return result; - }; + if (!isStart) { + result.push(tmp + 1); + } + return result; + }; - var dataRemove = function(data, codePoint) { - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var length = data.length; - while (index < length) { - start = data[index]; - end = data[index + 1]; - if (codePoint >= start && codePoint < end) { - // Modify this pair. - if (codePoint == start) { - if (end == start + 1) { - // Just remove `start` and `end`. - data.splice(index, 2); + var dataRemove = function dataRemove(data, codePoint) { + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var length = data.length; + while (index < length) { + start = data[index]; + end = data[index + 1]; + if (codePoint >= start && codePoint < end) { + // Modify this pair. + if (codePoint == start) { + if (end == start + 1) { + // Just remove `start` and `end`. + data.splice(index, 2); + return data; + } else { + // Just replace `start` with a new value. + data[index] = codePoint + 1; + return data; + } + } else if (codePoint == end - 1) { + // Just replace `end` with a new value. + data[index + 1] = codePoint; return data; } else { - // Just replace `start` with a new value. - data[index] = codePoint + 1; + // Replace `[start, end]` with `[startA, endA, startB, endB]`. + data.splice(index, 2, start, codePoint, codePoint + 1, end); return data; } - } else if (codePoint == end - 1) { - // Just replace `end` with a new value. - data[index + 1] = codePoint; - return data; - } else { - // Replace `[start, end]` with `[startA, endA, startB, endB]`. - data.splice(index, 2, start, codePoint, codePoint + 1, end); - return data; } + index += 2; } - index += 2; - } - return data; - }; + return data; + }; - var dataRemoveRange = function(data, rangeStart, rangeEnd) { - if (rangeEnd < rangeStart) { - throw Error(ERRORS.rangeOrder); - } - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - while (index < data.length) { - start = data[index]; - end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. - - // Exit as soon as no more matching pairs can be found. - if (start > rangeEnd) { - return data; + var dataRemoveRange = function dataRemoveRange(data, rangeStart, rangeEnd) { + if (rangeEnd < rangeStart) { + throw Error(ERRORS.rangeOrder); } + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + while (index < data.length) { + start = data[index]; + end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. - // Check if this range pair is equal to, or forms a subset of, the range - // to be removed. - // E.g. we have `[0, 11, 40, 51]` and want to remove 0-10 → `[40, 51]`. - // E.g. we have `[40, 51]` and want to remove 0-100 → `[]`. - if (rangeStart <= start && rangeEnd >= end) { - // Remove this pair. - data.splice(index, 2); - continue; - } - - // Check if both `rangeStart` and `rangeEnd` are within the bounds of - // this pair. - // E.g. we have `[0, 11]` and want to remove 4-6 → `[0, 4, 7, 11]`. - if (rangeStart >= start && rangeEnd < end) { - if (rangeStart == start) { - // Replace `[start, end]` with `[startB, endB]`. - data[index] = rangeEnd + 1; - data[index + 1] = end + 1; - return data; - } - // Replace `[start, end]` with `[startA, endA, startB, endB]`. - data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1); - return data; - } - - // Check if only `rangeStart` is within the bounds of this pair. - // E.g. we have `[0, 11]` and want to remove 4-20 → `[0, 4]`. - if (rangeStart >= start && rangeStart <= end) { - // Replace `end` with `rangeStart`. - data[index + 1] = rangeStart; - // Note: we cannot `return` just yet, in case any following pairs still - // contain matching code points. - // E.g. we have `[0, 11, 14, 31]` and want to remove 4-20 - // → `[0, 4, 21, 31]`. - } - - // Check if only `rangeEnd` is within the bounds of this pair. - // E.g. we have `[14, 31]` and want to remove 4-20 → `[21, 31]`. - else if (rangeEnd >= start && rangeEnd <= end) { - // Just replace `start`. - data[index] = rangeEnd + 1; - return data; - } - - index += 2; - } - return data; - }; - - var dataAdd = function(data, codePoint) { - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var lastIndex = null; - var length = data.length; - if (codePoint < 0x0 || codePoint > 0x10FFFF) { - throw RangeError(ERRORS.codePointRange); - } - while (index < length) { - start = data[index]; - end = data[index + 1]; - - // Check if the code point is already in the set. - if (codePoint >= start && codePoint < end) { - return data; - } - - if (codePoint == start - 1) { - // Just replace `start` with a new value. - data[index] = codePoint; - return data; - } - - // At this point, if `start` is `greater` than `codePoint`, insert a new - // `[start, end]` pair before the current pair, or after the current pair - // if there is a known `lastIndex`. - if (start > codePoint) { - data.splice( - lastIndex != null ? lastIndex + 2 : 0, - 0, - codePoint, - codePoint + 1 - ); - return data; - } - - if (codePoint == end) { - // Check if adding this code point causes two separate ranges to become - // a single range, e.g. `dataAdd([0, 4, 5, 10], 4)` → `[0, 10]`. - if (codePoint + 1 == data[index + 2]) { - data.splice(index, 4, start, data[index + 3]); - return data; - } - // Else, just replace `end` with a new value. - data[index + 1] = codePoint + 1; - return data; - } - lastIndex = index; - index += 2; - } - // The loop has finished; add the new pair to the end of the data set. - data.push(codePoint, codePoint + 1); - return data; - }; - - var dataAddData = function(dataA, dataB) { - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var data = dataA.slice(); - var length = dataB.length; - while (index < length) { - start = dataB[index]; - end = dataB[index + 1] - 1; - if (start == end) { - data = dataAdd(data, start); - } else { - data = dataAddRange(data, start, end); - } - index += 2; - } - return data; - }; - - var dataRemoveData = function(dataA, dataB) { - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var data = dataA.slice(); - var length = dataB.length; - while (index < length) { - start = dataB[index]; - end = dataB[index + 1] - 1; - if (start == end) { - data = dataRemove(data, start); - } else { - data = dataRemoveRange(data, start, end); - } - index += 2; - } - return data; - }; - - var dataAddRange = function(data, rangeStart, rangeEnd) { - if (rangeEnd < rangeStart) { - throw Error(ERRORS.rangeOrder); - } - if ( - rangeStart < 0x0 || rangeStart > 0x10FFFF || - rangeEnd < 0x0 || rangeEnd > 0x10FFFF - ) { - throw RangeError(ERRORS.codePointRange); - } - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var added = false; - var length = data.length; - while (index < length) { - start = data[index]; - end = data[index + 1]; - - if (added) { - // The range has already been added to the set; at this point, we just - // need to get rid of the following ranges in case they overlap. - - // Check if this range can be combined with the previous range. - if (start == rangeEnd + 1) { - data.splice(index - 1, 2); - return data; - } - - // Exit as soon as no more possibly overlapping pairs can be found. + // Exit as soon as no more matching pairs can be found. if (start > rangeEnd) { return data; } - // E.g. `[0, 11, 12, 16]` and we’ve added 5-15, so we now have - // `[0, 16, 12, 16]`. Remove the `12,16` part, as it lies within the - // `0,16` range that was previously added. - if (start >= rangeStart && start <= rangeEnd) { - // `start` lies within the range that was previously added. + // Check if this range pair is equal to, or forms a subset of, the range + // to be removed. + // E.g. we have `[0, 11, 40, 51]` and want to remove 0-10 → `[40, 51]`. + // E.g. we have `[40, 51]` and want to remove 0-100 → `[]`. + if (rangeStart <= start && rangeEnd >= end) { + // Remove this pair. + data.splice(index, 2); + continue; + } - if (end > rangeStart && end - 1 <= rangeEnd) { - // `end` lies within the range that was previously added as well, - // so remove this pair. - data.splice(index, 2); - index -= 2; - // Note: we cannot `return` just yet, as there may still be other - // overlapping pairs. - } else { - // `start` lies within the range that was previously added, but - // `end` doesn’t. E.g. `[0, 11, 12, 31]` and we’ve added 5-15, so - // now we have `[0, 16, 12, 31]`. This must be written as `[0, 31]`. - // Remove the previously added `end` and the current `start`. - data.splice(index - 1, 2); - index -= 2; + // Check if both `rangeStart` and `rangeEnd` are within the bounds of + // this pair. + // E.g. we have `[0, 11]` and want to remove 4-6 → `[0, 4, 7, 11]`. + if (rangeStart >= start && rangeEnd < end) { + if (rangeStart == start) { + // Replace `[start, end]` with `[startB, endB]`. + data[index] = rangeEnd + 1; + data[index + 1] = end + 1; + return data; + } + // Replace `[start, end]` with `[startA, endA, startB, endB]`. + data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1); + return data; + } + + // Check if only `rangeStart` is within the bounds of this pair. + // E.g. we have `[0, 11]` and want to remove 4-20 → `[0, 4]`. + if (rangeStart >= start && rangeStart <= end) { + // Replace `end` with `rangeStart`. + data[index + 1] = rangeStart; + // Note: we cannot `return` just yet, in case any following pairs still + // contain matching code points. + // E.g. we have `[0, 11, 14, 31]` and want to remove 4-20 + // → `[0, 4, 21, 31]`. + } + + // Check if only `rangeEnd` is within the bounds of this pair. + // E.g. we have `[14, 31]` and want to remove 4-20 → `[21, 31]`. + else if (rangeEnd >= start && rangeEnd <= end) { + // Just replace `start`. + data[index] = rangeEnd + 1; + return data; } - // Note: we cannot return yet. + index += 2; + } + return data; + }; + + var dataAdd = function dataAdd(data, codePoint) { + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var lastIndex = null; + var length = data.length; + if (codePoint < 0x0 || codePoint > 0x10FFFF) { + throw RangeError(ERRORS.codePointRange); + } + while (index < length) { + start = data[index]; + end = data[index + 1]; + + // Check if the code point is already in the set. + if (codePoint >= start && codePoint < end) { + return data; } - } - - else if (start == rangeEnd + 1) { - data[index] = rangeStart; - return data; - } - - // Check if a new pair must be inserted *before* the current one. - else if (start > rangeEnd) { - data.splice(index, 0, rangeStart, rangeEnd + 1); - return data; - } - - else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) { - // The new range lies entirely within an existing range pair. No action - // needed. - return data; - } - - else if ( - // E.g. `[0, 11]` and you add 5-15 → `[0, 16]`. - (rangeStart >= start && rangeStart < end) || - // E.g. `[0, 3]` and you add 3-6 → `[0, 7]`. - end == rangeStart - ) { - // Replace `end` with the new value. - data[index + 1] = rangeEnd + 1; - // Make sure the next range pair doesn’t overlap, e.g. `[0, 11, 12, 14]` - // and you add 5-15 → `[0, 16]`, i.e. remove the `12,14` part. - added = true; - // Note: we cannot `return` just yet. - } - - else if (rangeStart <= start && rangeEnd + 1 >= end) { - // The new range is a superset of the old range. - data[index] = rangeStart; - data[index + 1] = rangeEnd + 1; - added = true; - } - - index += 2; - } - // The loop has finished without doing anything; add the new pair to the end - // of the data set. - if (!added) { - data.push(rangeStart, rangeEnd + 1); - } - return data; - }; - - var dataContains = function(data, codePoint) { - var index = 0; - var length = data.length; - // Exit early if `codePoint` is not within `data`’s overall range. - var start = data[index]; - var end = data[length - 1]; - if (length >= 2) { - if (codePoint < start || codePoint > end) { - return false; - } - } - // Iterate over the data per `(start, end)` pair. - while (index < length) { - start = data[index]; - end = data[index + 1]; - if (codePoint >= start && codePoint < end) { - return true; - } - index += 2; - } - return false; - }; - - var dataIntersection = function(data, codePoints) { - var index = 0; - var length = codePoints.length; - var codePoint; - var result = []; - while (index < length) { - codePoint = codePoints[index]; - if (dataContains(data, codePoint)) { - result.push(codePoint); - } - ++index; - } - return dataFromCodePoints(result); - }; - - var dataIsEmpty = function(data) { - return !data.length; - }; - - var dataIsSingleton = function(data) { - // Check if the set only represents a single code point. - return data.length == 2 && data[0] + 1 == data[1]; - }; - - var dataToArray = function(data) { - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var result = []; - var length = data.length; - while (index < length) { - start = data[index]; - end = data[index + 1]; - while (start < end) { - result.push(start); - ++start; - } - index += 2; - } - return result; - }; - - /*--------------------------------------------------------------------------*/ - - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - var floor = Math.floor; - var highSurrogate = function(codePoint) { - return parseInt( - floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN, - 10 - ); - }; - - var lowSurrogate = function(codePoint) { - return parseInt( - (codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN, - 10 - ); - }; - - var stringFromCharCode = String.fromCharCode; - var codePointToString = function(codePoint) { - var string; - // https://mathiasbynens.be/notes/javascript-escapes#single - // Note: the `\b` escape sequence for U+0008 BACKSPACE in strings has a - // different meaning in regular expressions (word boundary), so it cannot - // be used here. - if (codePoint == 0x09) { - string = '\\t'; - } - // Note: IE < 9 treats `'\v'` as `'v'`, so avoid using it. - // else if (codePoint == 0x0B) { - // string = '\\v'; - // } - else if (codePoint == 0x0A) { - string = '\\n'; - } - else if (codePoint == 0x0C) { - string = '\\f'; - } - else if (codePoint == 0x0D) { - string = '\\r'; - } - else if (codePoint == 0x5C) { - string = '\\\\'; - } - else if ( - codePoint == 0x24 || - (codePoint >= 0x28 && codePoint <= 0x2B) || - codePoint == 0x2D || codePoint == 0x2E || codePoint == 0x3F || - (codePoint >= 0x5B && codePoint <= 0x5E) || - (codePoint >= 0x7B && codePoint <= 0x7D) - ) { - // The code point maps to an unsafe printable ASCII character; - // backslash-escape it. Here’s the list of those symbols: - // - // $()*+-.?[\]^{|} - // - // See #7 for more info. - string = '\\' + stringFromCharCode(codePoint); - } - else if (codePoint >= 0x20 && codePoint <= 0x7E) { - // The code point maps to one of these printable ASCII symbols - // (including the space character): - // - // !"#%&',/0123456789:;<=>@ABCDEFGHIJKLMNO - // PQRSTUVWXYZ_`abcdefghijklmnopqrstuvwxyz~ - // - // These can safely be used directly. - string = stringFromCharCode(codePoint); - } - else if (codePoint <= 0xFF) { - // https://mathiasbynens.be/notes/javascript-escapes#hexadecimal - string = '\\x' + pad(hex(codePoint), 2); - } - else { // `codePoint <= 0xFFFF` holds true. - // https://mathiasbynens.be/notes/javascript-escapes#unicode - string = '\\u' + pad(hex(codePoint), 4); - } - - // There’s no need to account for astral symbols / surrogate pairs here, - // since `codePointToString` is private and only used for BMP code points. - // But if that’s what you need, just add an `else` block with this code: - // - // string = '\\u' + pad(hex(highSurrogate(codePoint)), 4) - // + '\\u' + pad(hex(lowSurrogate(codePoint)), 4); - - return string; - }; - - var symbolToCodePoint = function(symbol) { - var length = symbol.length; - var first = symbol.charCodeAt(0); - var second; - if ( - first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX && - length > 1 // There is a next code unit. - ) { - // `first` is a high surrogate, and there is a next character. Assume - // it’s a low surrogate (else it’s invalid usage of Regenerate anyway). - second = symbol.charCodeAt(1); - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - HIGH_SURROGATE_MIN) * 0x400 + - second - LOW_SURROGATE_MIN + 0x10000; - } - return first; - }; - - var createBMPCharacterClasses = function(data) { - // Iterate over the data per `(start, end)` pair. - var result = ''; - var index = 0; - var start; - var end; - var length = data.length; - if (dataIsSingleton(data)) { - return codePointToString(data[0]); - } - while (index < length) { - start = data[index]; - end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. - if (start == end) { - result += codePointToString(start); - } else if (start + 1 == end) { - result += codePointToString(start) + codePointToString(end); - } else { - result += codePointToString(start) + '-' + codePointToString(end); - } - index += 2; - } - return '[' + result + ']'; - }; - - var splitAtBMP = function(data) { - // Iterate over the data per `(start, end)` pair. - var loneHighSurrogates = []; - var loneLowSurrogates = []; - var bmp = []; - var astral = []; - var index = 0; - var start; - var end; - var length = data.length; - while (index < length) { - start = data[index]; - end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. - - if (start < HIGH_SURROGATE_MIN) { - - // The range starts and ends before the high surrogate range. - // E.g. (0, 0x10). - if (end < HIGH_SURROGATE_MIN) { - bmp.push(start, end + 1); + if (codePoint == start - 1) { + // Just replace `start` with a new value. + data[index] = codePoint; + return data; } - // The range starts before the high surrogate range and ends within it. - // E.g. (0, 0xD855). - if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { - bmp.push(start, HIGH_SURROGATE_MIN); - loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1); + // At this point, if `start` is `greater` than `codePoint`, insert a new + // `[start, end]` pair before the current pair, or after the current pair + // if there is a known `lastIndex`. + if (start > codePoint) { + data.splice(lastIndex != null ? lastIndex + 2 : 0, 0, codePoint, codePoint + 1); + return data; } - // The range starts before the high surrogate range and ends in the low - // surrogate range. E.g. (0, 0xDCFF). - if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { - bmp.push(start, HIGH_SURROGATE_MIN); - loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); - loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); - } - - // The range starts before the high surrogate range and ends after the - // low surrogate range. E.g. (0, 0x10FFFF). - if (end > LOW_SURROGATE_MAX) { - bmp.push(start, HIGH_SURROGATE_MIN); - loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); - loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); - if (end <= 0xFFFF) { - bmp.push(LOW_SURROGATE_MAX + 1, end + 1); - } else { - bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); - astral.push(0xFFFF + 1, end + 1); + if (codePoint == end) { + // Check if adding this code point causes two separate ranges to become + // a single range, e.g. `dataAdd([0, 4, 5, 10], 4)` → `[0, 10]`. + if (codePoint + 1 == data[index + 2]) { + data.splice(index, 4, start, data[index + 3]); + return data; } + // Else, just replace `end` with a new value. + data[index + 1] = codePoint + 1; + return data; } + lastIndex = index; + index += 2; + } + // The loop has finished; add the new pair to the end of the data set. + data.push(codePoint, codePoint + 1); + return data; + }; - } else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) { - - // The range starts and ends in the high surrogate range. - // E.g. (0xD855, 0xD866). - if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { - loneHighSurrogates.push(start, end + 1); - } - - // The range starts in the high surrogate range and ends in the low - // surrogate range. E.g. (0xD855, 0xDCFF). - if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { - loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); - loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); - } - - // The range starts in the high surrogate range and ends after the low - // surrogate range. E.g. (0xD855, 0x10FFFF). - if (end > LOW_SURROGATE_MAX) { - loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); - loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); - if (end <= 0xFFFF) { - bmp.push(LOW_SURROGATE_MAX + 1, end + 1); - } else { - bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); - astral.push(0xFFFF + 1, end + 1); - } - } - - } else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) { - - // The range starts and ends in the low surrogate range. - // E.g. (0xDCFF, 0xDDFF). - if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { - loneLowSurrogates.push(start, end + 1); - } - - // The range starts in the low surrogate range and ends after the low - // surrogate range. E.g. (0xDCFF, 0x10FFFF). - if (end > LOW_SURROGATE_MAX) { - loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1); - if (end <= 0xFFFF) { - bmp.push(LOW_SURROGATE_MAX + 1, end + 1); - } else { - bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); - astral.push(0xFFFF + 1, end + 1); - } - } - - } else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) { - - // The range starts and ends after the low surrogate range. - // E.g. (0xFFAA, 0x10FFFF). - if (end <= 0xFFFF) { - bmp.push(start, end + 1); + var dataAddData = function dataAddData(dataA, dataB) { + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var data = dataA.slice(); + var length = dataB.length; + while (index < length) { + start = dataB[index]; + end = dataB[index + 1] - 1; + if (start == end) { + data = dataAdd(data, start); } else { - bmp.push(start, 0xFFFF + 1); - astral.push(0xFFFF + 1, end + 1); + data = dataAddRange(data, start, end); + } + index += 2; + } + return data; + }; + + var dataRemoveData = function dataRemoveData(dataA, dataB) { + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var data = dataA.slice(); + var length = dataB.length; + while (index < length) { + start = dataB[index]; + end = dataB[index + 1] - 1; + if (start == end) { + data = dataRemove(data, start); + } else { + data = dataRemoveRange(data, start, end); + } + index += 2; + } + return data; + }; + + var dataAddRange = function dataAddRange(data, rangeStart, rangeEnd) { + if (rangeEnd < rangeStart) { + throw Error(ERRORS.rangeOrder); + } + if (rangeStart < 0x0 || rangeStart > 0x10FFFF || rangeEnd < 0x0 || rangeEnd > 0x10FFFF) { + throw RangeError(ERRORS.codePointRange); + } + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var added = false; + var length = data.length; + while (index < length) { + start = data[index]; + end = data[index + 1]; + + if (added) { + // The range has already been added to the set; at this point, we just + // need to get rid of the following ranges in case they overlap. + + // Check if this range can be combined with the previous range. + if (start == rangeEnd + 1) { + data.splice(index - 1, 2); + return data; + } + + // Exit as soon as no more possibly overlapping pairs can be found. + if (start > rangeEnd) { + return data; + } + + // E.g. `[0, 11, 12, 16]` and we’ve added 5-15, so we now have + // `[0, 16, 12, 16]`. Remove the `12,16` part, as it lies within the + // `0,16` range that was previously added. + if (start >= rangeStart && start <= rangeEnd) { + // `start` lies within the range that was previously added. + + if (end > rangeStart && end - 1 <= rangeEnd) { + // `end` lies within the range that was previously added as well, + // so remove this pair. + data.splice(index, 2); + index -= 2; + // Note: we cannot `return` just yet, as there may still be other + // overlapping pairs. + } else { + // `start` lies within the range that was previously added, but + // `end` doesn’t. E.g. `[0, 11, 12, 31]` and we’ve added 5-15, so + // now we have `[0, 16, 12, 31]`. This must be written as `[0, 31]`. + // Remove the previously added `end` and the current `start`. + data.splice(index - 1, 2); + index -= 2; + } + + // Note: we cannot return yet. + } + } else if (start == rangeEnd + 1) { + data[index] = rangeStart; + return data; } - } else { + // Check if a new pair must be inserted *before* the current one. + else if (start > rangeEnd) { + data.splice(index, 0, rangeStart, rangeEnd + 1); + return data; + } else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) { + // The new range lies entirely within an existing range pair. No action + // needed. + return data; + } else if ( + // E.g. `[0, 11]` and you add 5-15 → `[0, 16]`. + rangeStart >= start && rangeStart < end || + // E.g. `[0, 3]` and you add 3-6 → `[0, 7]`. + end == rangeStart) { + // Replace `end` with the new value. + data[index + 1] = rangeEnd + 1; + // Make sure the next range pair doesn’t overlap, e.g. `[0, 11, 12, 14]` + // and you add 5-15 → `[0, 16]`, i.e. remove the `12,14` part. + added = true; + // Note: we cannot `return` just yet. + } else if (rangeStart <= start && rangeEnd + 1 >= end) { + // The new range is a superset of the old range. + data[index] = rangeStart; + data[index + 1] = rangeEnd + 1; + added = true; + } - // The range starts and ends in the astral range. - astral.push(start, end + 1); + index += 2; + } + // The loop has finished without doing anything; add the new pair to the end + // of the data set. + if (!added) { + data.push(rangeStart, rangeEnd + 1); + } + return data; + }; + var dataContains = function dataContains(data, codePoint) { + var index = 0; + var length = data.length; + // Exit early if `codePoint` is not within `data`’s overall range. + var start = data[index]; + var end = data[length - 1]; + if (length >= 2) { + if (codePoint < start || codePoint > end) { + return false; + } + } + // Iterate over the data per `(start, end)` pair. + while (index < length) { + start = data[index]; + end = data[index + 1]; + if (codePoint >= start && codePoint < end) { + return true; + } + index += 2; + } + return false; + }; + + var dataIntersection = function dataIntersection(data, codePoints) { + var index = 0; + var length = codePoints.length; + var codePoint; + var result = []; + while (index < length) { + codePoint = codePoints[index]; + if (dataContains(data, codePoint)) { + result.push(codePoint); + } + ++index; + } + return dataFromCodePoints(result); + }; + + var dataIsEmpty = function dataIsEmpty(data) { + return !data.length; + }; + + var dataIsSingleton = function dataIsSingleton(data) { + // Check if the set only represents a single code point. + return data.length == 2 && data[0] + 1 == data[1]; + }; + + var dataToArray = function dataToArray(data) { + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var result = []; + var length = data.length; + while (index < length) { + start = data[index]; + end = data[index + 1]; + while (start < end) { + result.push(start); + ++start; + } + index += 2; + } + return result; + }; + + /*--------------------------------------------------------------------------*/ + + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + var floor = Math.floor; + var highSurrogate = function highSurrogate(codePoint) { + return parseInt(floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN, 10); + }; + + var lowSurrogate = function lowSurrogate(codePoint) { + return parseInt((codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN, 10); + }; + + var stringFromCharCode = String.fromCharCode; + var codePointToString = function codePointToString(codePoint) { + var string; + // https://mathiasbynens.be/notes/javascript-escapes#single + // Note: the `\b` escape sequence for U+0008 BACKSPACE in strings has a + // different meaning in regular expressions (word boundary), so it cannot + // be used here. + if (codePoint == 0x09) { + string = '\\t'; + } + // Note: IE < 9 treats `'\v'` as `'v'`, so avoid using it. + // else if (codePoint == 0x0B) { + // string = '\\v'; + // } + else if (codePoint == 0x0A) { + string = '\\n'; + } else if (codePoint == 0x0C) { + string = '\\f'; + } else if (codePoint == 0x0D) { + string = '\\r'; + } else if (codePoint == 0x5C) { + string = '\\\\'; + } else if (codePoint == 0x24 || codePoint >= 0x28 && codePoint <= 0x2B || codePoint == 0x2D || codePoint == 0x2E || codePoint == 0x3F || codePoint >= 0x5B && codePoint <= 0x5E || codePoint >= 0x7B && codePoint <= 0x7D) { + // The code point maps to an unsafe printable ASCII character; + // backslash-escape it. Here’s the list of those symbols: + // + // $()*+-.?[\]^{|} + // + // See #7 for more info. + string = '\\' + stringFromCharCode(codePoint); + } else if (codePoint >= 0x20 && codePoint <= 0x7E) { + // The code point maps to one of these printable ASCII symbols + // (including the space character): + // + // !"#%&',/0123456789:;<=>@ABCDEFGHIJKLMNO + // PQRSTUVWXYZ_`abcdefghijklmnopqrstuvwxyz~ + // + // These can safely be used directly. + string = stringFromCharCode(codePoint); + } else if (codePoint <= 0xFF) { + // https://mathiasbynens.be/notes/javascript-escapes#hexadecimal + string = '\\x' + pad(hex(codePoint), 2); + } else { + // `codePoint <= 0xFFFF` holds true. + // https://mathiasbynens.be/notes/javascript-escapes#unicode + string = '\\u' + pad(hex(codePoint), 4); + } + + // There’s no need to account for astral symbols / surrogate pairs here, + // since `codePointToString` is private and only used for BMP code points. + // But if that’s what you need, just add an `else` block with this code: + // + // string = '\\u' + pad(hex(highSurrogate(codePoint)), 4) + // + '\\u' + pad(hex(lowSurrogate(codePoint)), 4); + + return string; + }; + + var codePointToStringUnicode = function codePointToStringUnicode(codePoint) { + if (codePoint <= 0xFFFF) { + return codePointToString(codePoint); + } + return '\\u{' + codePoint.toString(16).toUpperCase() + '}'; + }; + + var symbolToCodePoint = function symbolToCodePoint(symbol) { + var length = symbol.length; + var first = symbol.charCodeAt(0); + var second; + if (first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX && length > 1 // There is a next code unit. + ) { + // `first` is a high surrogate, and there is a next character. Assume + // it’s a low surrogate (else it’s invalid usage of Regenerate anyway). + second = symbol.charCodeAt(1); + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - HIGH_SURROGATE_MIN) * 0x400 + second - LOW_SURROGATE_MIN + 0x10000; + } + return first; + }; + + var createBMPCharacterClasses = function createBMPCharacterClasses(data) { + // Iterate over the data per `(start, end)` pair. + var result = ''; + var index = 0; + var start; + var end; + var length = data.length; + if (dataIsSingleton(data)) { + return codePointToString(data[0]); + } + while (index < length) { + start = data[index]; + end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. + if (start == end) { + result += codePointToString(start); + } else if (start + 1 == end) { + result += codePointToString(start) + codePointToString(end); + } else { + result += codePointToString(start) + '-' + codePointToString(end); + } + index += 2; + } + return '[' + result + ']'; + }; + + var createUnicodeCharacterClasses = function createUnicodeCharacterClasses(data) { + // Iterate over the data per `(start, end)` pair. + var result = ''; + var index = 0; + var start; + var end; + var length = data.length; + if (dataIsSingleton(data)) { + return codePointToStringUnicode(data[0]); + } + while (index < length) { + start = data[index]; + end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. + if (start == end) { + result += codePointToStringUnicode(start); + } else if (start + 1 == end) { + result += codePointToStringUnicode(start) + codePointToStringUnicode(end); + } else { + result += codePointToStringUnicode(start) + '-' + codePointToStringUnicode(end); + } + index += 2; + } + return '[' + result + ']'; + }; + + var splitAtBMP = function splitAtBMP(data) { + // Iterate over the data per `(start, end)` pair. + var loneHighSurrogates = []; + var loneLowSurrogates = []; + var bmp = []; + var astral = []; + var index = 0; + var start; + var end; + var length = data.length; + while (index < length) { + start = data[index]; + end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. + + if (start < HIGH_SURROGATE_MIN) { + + // The range starts and ends before the high surrogate range. + // E.g. (0, 0x10). + if (end < HIGH_SURROGATE_MIN) { + bmp.push(start, end + 1); + } + + // The range starts before the high surrogate range and ends within it. + // E.g. (0, 0xD855). + if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { + bmp.push(start, HIGH_SURROGATE_MIN); + loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1); + } + + // The range starts before the high surrogate range and ends in the low + // surrogate range. E.g. (0, 0xDCFF). + if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { + bmp.push(start, HIGH_SURROGATE_MIN); + loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); + loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); + } + + // The range starts before the high surrogate range and ends after the + // low surrogate range. E.g. (0, 0x10FFFF). + if (end > LOW_SURROGATE_MAX) { + bmp.push(start, HIGH_SURROGATE_MIN); + loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); + loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); + if (end <= 0xFFFF) { + bmp.push(LOW_SURROGATE_MAX + 1, end + 1); + } else { + bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); + astral.push(0xFFFF + 1, end + 1); + } + } + } else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) { + + // The range starts and ends in the high surrogate range. + // E.g. (0xD855, 0xD866). + if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { + loneHighSurrogates.push(start, end + 1); + } + + // The range starts in the high surrogate range and ends in the low + // surrogate range. E.g. (0xD855, 0xDCFF). + if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { + loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); + loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); + } + + // The range starts in the high surrogate range and ends after the low + // surrogate range. E.g. (0xD855, 0x10FFFF). + if (end > LOW_SURROGATE_MAX) { + loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); + loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); + if (end <= 0xFFFF) { + bmp.push(LOW_SURROGATE_MAX + 1, end + 1); + } else { + bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); + astral.push(0xFFFF + 1, end + 1); + } + } + } else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) { + + // The range starts and ends in the low surrogate range. + // E.g. (0xDCFF, 0xDDFF). + if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { + loneLowSurrogates.push(start, end + 1); + } + + // The range starts in the low surrogate range and ends after the low + // surrogate range. E.g. (0xDCFF, 0x10FFFF). + if (end > LOW_SURROGATE_MAX) { + loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1); + if (end <= 0xFFFF) { + bmp.push(LOW_SURROGATE_MAX + 1, end + 1); + } else { + bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); + astral.push(0xFFFF + 1, end + 1); + } + } + } else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) { + + // The range starts and ends after the low surrogate range. + // E.g. (0xFFAA, 0x10FFFF). + if (end <= 0xFFFF) { + bmp.push(start, end + 1); + } else { + bmp.push(start, 0xFFFF + 1); + astral.push(0xFFFF + 1, end + 1); + } + } else { + + // The range starts and ends in the astral range. + astral.push(start, end + 1); + } + + index += 2; + } + return { + 'loneHighSurrogates': loneHighSurrogates, + 'loneLowSurrogates': loneLowSurrogates, + 'bmp': bmp, + 'astral': astral + }; + }; + + var optimizeSurrogateMappings = function optimizeSurrogateMappings(surrogateMappings) { + var result = []; + var tmpLow = []; + var addLow = false; + var mapping; + var nextMapping; + var highSurrogates; + var lowSurrogates; + var nextHighSurrogates; + var nextLowSurrogates; + var index = -1; + var length = surrogateMappings.length; + while (++index < length) { + mapping = surrogateMappings[index]; + nextMapping = surrogateMappings[index + 1]; + if (!nextMapping) { + result.push(mapping); + continue; + } + highSurrogates = mapping[0]; + lowSurrogates = mapping[1]; + nextHighSurrogates = nextMapping[0]; + nextLowSurrogates = nextMapping[1]; + + // Check for identical high surrogate ranges. + tmpLow = lowSurrogates; + while (nextHighSurrogates && highSurrogates[0] == nextHighSurrogates[0] && highSurrogates[1] == nextHighSurrogates[1]) { + // Merge with the next item. + if (dataIsSingleton(nextLowSurrogates)) { + tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]); + } else { + tmpLow = dataAddRange(tmpLow, nextLowSurrogates[0], nextLowSurrogates[1] - 1); + } + ++index; + mapping = surrogateMappings[index]; + highSurrogates = mapping[0]; + lowSurrogates = mapping[1]; + nextMapping = surrogateMappings[index + 1]; + nextHighSurrogates = nextMapping && nextMapping[0]; + nextLowSurrogates = nextMapping && nextMapping[1]; + addLow = true; + } + result.push([highSurrogates, addLow ? tmpLow : lowSurrogates]); + addLow = false; + } + return optimizeByLowSurrogates(result); + }; + + var optimizeByLowSurrogates = function optimizeByLowSurrogates(surrogateMappings) { + if (surrogateMappings.length == 1) { + return surrogateMappings; + } + var index = -1; + var innerIndex = -1; + while (++index < surrogateMappings.length) { + var mapping = surrogateMappings[index]; + var lowSurrogates = mapping[1]; + var lowSurrogateStart = lowSurrogates[0]; + var lowSurrogateEnd = lowSurrogates[1]; + innerIndex = index; // Note: the loop starts at the next index. + while (++innerIndex < surrogateMappings.length) { + var otherMapping = surrogateMappings[innerIndex]; + var otherLowSurrogates = otherMapping[1]; + var otherLowSurrogateStart = otherLowSurrogates[0]; + var otherLowSurrogateEnd = otherLowSurrogates[1]; + if (lowSurrogateStart == otherLowSurrogateStart && lowSurrogateEnd == otherLowSurrogateEnd) { + // Add the code points in the other item to this one. + if (dataIsSingleton(otherMapping[0])) { + mapping[0] = dataAdd(mapping[0], otherMapping[0][0]); + } else { + mapping[0] = dataAddRange(mapping[0], otherMapping[0][0], otherMapping[0][1] - 1); + } + // Remove the other, now redundant, item. + surrogateMappings.splice(innerIndex, 1); + --innerIndex; + } + } + } + return surrogateMappings; + }; + + var surrogateSet = function surrogateSet(data) { + // Exit early if `data` is an empty set. + if (!data.length) { + return []; } - index += 2; + // Iterate over the data per `(start, end)` pair. + var index = 0; + var start; + var end; + var startHigh; + var startLow; + var endHigh; + var endLow; + var surrogateMappings = []; + var length = data.length; + while (index < length) { + start = data[index]; + end = data[index + 1] - 1; + + startHigh = highSurrogate(start); + startLow = lowSurrogate(start); + endHigh = highSurrogate(end); + endLow = lowSurrogate(end); + + var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN; + var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX; + var complete = false; + + // Append the previous high-surrogate-to-low-surrogate mappings. + // Step 1: `(startHigh, startLow)` to `(startHigh, LOW_SURROGATE_MAX)`. + if (startHigh == endHigh || startsWithLowestLowSurrogate && endsWithHighestLowSurrogate) { + surrogateMappings.push([[startHigh, endHigh + 1], [startLow, endLow + 1]]); + complete = true; + } else { + surrogateMappings.push([[startHigh, startHigh + 1], [startLow, LOW_SURROGATE_MAX + 1]]); + } + + // Step 2: `(startHigh + 1, LOW_SURROGATE_MIN)` to + // `(endHigh - 1, LOW_SURROGATE_MAX)`. + if (!complete && startHigh + 1 < endHigh) { + if (endsWithHighestLowSurrogate) { + // Combine step 2 and step 3. + surrogateMappings.push([[startHigh + 1, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); + complete = true; + } else { + surrogateMappings.push([[startHigh + 1, endHigh], [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1]]); + } + } + + // Step 3. `(endHigh, LOW_SURROGATE_MIN)` to `(endHigh, endLow)`. + if (!complete) { + surrogateMappings.push([[endHigh, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); + } + + index += 2; + } + + // The format of `surrogateMappings` is as follows: + // + // [ surrogateMapping1, surrogateMapping2 ] + // + // i.e.: + // + // [ + // [ highSurrogates1, lowSurrogates1 ], + // [ highSurrogates2, lowSurrogates2 ] + // ] + return optimizeSurrogateMappings(surrogateMappings); + }; + + var createSurrogateCharacterClasses = function createSurrogateCharacterClasses(surrogateMappings) { + var result = []; + forEach(surrogateMappings, function (surrogateMapping) { + var highSurrogates = surrogateMapping[0]; + var lowSurrogates = surrogateMapping[1]; + result.push(createBMPCharacterClasses(highSurrogates) + createBMPCharacterClasses(lowSurrogates)); + }); + return result.join('|'); + }; + + var createCharacterClassesFromData = function createCharacterClassesFromData(data, bmpOnly, hasUnicodeFlag) { + if (hasUnicodeFlag) { + return createUnicodeCharacterClasses(data); + } + var result = []; + + var parts = splitAtBMP(data); + var loneHighSurrogates = parts.loneHighSurrogates; + var loneLowSurrogates = parts.loneLowSurrogates; + var bmp = parts.bmp; + var astral = parts.astral; + var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates); + var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates); + + var surrogateMappings = surrogateSet(astral); + + if (bmpOnly) { + bmp = dataAddData(bmp, loneHighSurrogates); + hasLoneHighSurrogates = false; + bmp = dataAddData(bmp, loneLowSurrogates); + hasLoneLowSurrogates = false; + } + + if (!dataIsEmpty(bmp)) { + // The data set contains BMP code points that are not high surrogates + // needed for astral code points in the set. + result.push(createBMPCharacterClasses(bmp)); + } + if (surrogateMappings.length) { + // The data set contains astral code points; append character classes + // based on their surrogate pairs. + result.push(createSurrogateCharacterClasses(surrogateMappings)); + } + // https://gist.github.com/mathiasbynens/bbe7f870208abcfec860 + if (hasLoneHighSurrogates) { + result.push(createBMPCharacterClasses(loneHighSurrogates) + + // Make sure the high surrogates aren’t part of a surrogate pair. + '(?![\\uDC00-\\uDFFF])'); + } + if (hasLoneLowSurrogates) { + result.push( + // It is not possible to accurately assert the low surrogates aren’t + // part of a surrogate pair, since JavaScript regular expressions do + // not support lookbehind. + '(?:[^\\uD800-\\uDBFF]|^)' + createBMPCharacterClasses(loneLowSurrogates)); + } + return result.join('|'); + }; + + /*--------------------------------------------------------------------------*/ + + // `regenerate` can be used as a constructor (and new methods can be added to + // its prototype) but also as a regular function, the latter of which is the + // documented and most common usage. For that reason, it’s not capitalized. + var regenerate = function regenerate(value) { + if (arguments.length > 1) { + value = slice.call(arguments); + } + if (this instanceof regenerate) { + this.data = []; + return value ? this.add(value) : this; + } + return new regenerate().add(value); + }; + + regenerate.version = '1.3.2'; + + var proto = regenerate.prototype; + extend(proto, { + 'add': function add(value) { + var $this = this; + if (value == null) { + return $this; + } + if (value instanceof regenerate) { + // Allow passing other Regenerate instances. + $this.data = dataAddData($this.data, value.data); + return $this; + } + if (arguments.length > 1) { + value = slice.call(arguments); + } + if (isArray(value)) { + forEach(value, function (item) { + $this.add(item); + }); + return $this; + } + $this.data = dataAdd($this.data, isNumber(value) ? value : symbolToCodePoint(value)); + return $this; + }, + 'remove': function remove(value) { + var $this = this; + if (value == null) { + return $this; + } + if (value instanceof regenerate) { + // Allow passing other Regenerate instances. + $this.data = dataRemoveData($this.data, value.data); + return $this; + } + if (arguments.length > 1) { + value = slice.call(arguments); + } + if (isArray(value)) { + forEach(value, function (item) { + $this.remove(item); + }); + return $this; + } + $this.data = dataRemove($this.data, isNumber(value) ? value : symbolToCodePoint(value)); + return $this; + }, + 'addRange': function addRange(start, end) { + var $this = this; + $this.data = dataAddRange($this.data, isNumber(start) ? start : symbolToCodePoint(start), isNumber(end) ? end : symbolToCodePoint(end)); + return $this; + }, + 'removeRange': function removeRange(start, end) { + var $this = this; + var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start); + var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end); + $this.data = dataRemoveRange($this.data, startCodePoint, endCodePoint); + return $this; + }, + 'intersection': function intersection(argument) { + var $this = this; + // Allow passing other Regenerate instances. + // TODO: Optimize this by writing and using `dataIntersectionData()`. + var array = argument instanceof regenerate ? dataToArray(argument.data) : argument; + $this.data = dataIntersection($this.data, array); + return $this; + }, + 'contains': function contains(codePoint) { + return dataContains(this.data, isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint)); + }, + 'clone': function clone() { + var set = new regenerate(); + set.data = this.data.slice(0); + return set; + }, + 'toString': function toString(options) { + var result = createCharacterClassesFromData(this.data, options ? options.bmpOnly : false, options ? options.hasUnicodeFlag : false); + if (!result) { + // For an empty set, return something that can be inserted `/here/` to + // form a valid regular expression. Avoid `(?:)` since that matches the + // empty string. + return '[]'; + } + // Use `\0` instead of `\x00` where possible. + return result.replace(regexNull, '\\0$1'); + }, + 'toRegExp': function toRegExp(flags) { + var pattern = this.toString(flags && flags.indexOf('u') != -1 ? { 'hasUnicodeFlag': true } : null); + return RegExp(pattern, flags || ''); + }, + 'valueOf': function valueOf() { + // Note: `valueOf` is aliased as `toArray`. + return dataToArray(this.data); + } + }); + + proto.toArray = proto.valueOf; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ("function" == 'function' && _typeof(__webpack_require__(48)) == 'object' && __webpack_require__(48)) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { + return regenerate; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = regenerate; + } else { + // in Narwhal or RingoJS v0.7.0- + freeExports.regenerate = regenerate; + } + } else { + // in Rhino or a web browser + root.regenerate = regenerate; } + })(undefined); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module), (function() { return this; }()))) + +/***/ }), +/* 278 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _assert = __webpack_require__(62); + + var _assert2 = _interopRequireDefault(_assert); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _leap = __webpack_require__(598); + + var leap = _interopRequireWildcard(_leap); + + var _meta = __webpack_require__(599); + + var meta = _interopRequireWildcard(_meta); + + var _util = __webpack_require__(279); + + var util = _interopRequireWildcard(_util); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var hasOwn = Object.prototype.hasOwnProperty; /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + function Emitter(contextId) { + _assert2.default.ok(this instanceof Emitter); + t.assertIdentifier(contextId); + + // Used to generate unique temporary names. + this.nextTempId = 0; + + // In order to make sure the context object does not collide with + // anything in the local scope, we might have to rename it, so we + // refer to it symbolically instead of just assuming that it will be + // called "context". + this.contextId = contextId; + + // An append-only list of Statements that grows each time this.emit is + // called. + this.listing = []; + + // A sparse array whose keys correspond to locations in this.listing + // that have been marked as branch/jump targets. + this.marked = [true]; + + // The last location will be marked when this.getDispatchLoop is + // called. + this.finalLoc = loc(); + + // A list of all leap.TryEntry statements emitted. + this.tryEntries = []; + + // Each time we evaluate the body of a loop, we tell this.leapManager + // to enter a nested loop context that determines the meaning of break + // and continue statements therein. + this.leapManager = new leap.LeapManager(this); + } + + var Ep = Emitter.prototype; + exports.Emitter = Emitter; + + // Offsets into this.listing that could be used as targets for branches or + // jumps are represented as numeric Literal nodes. This representation has + // the amazingly convenient benefit of allowing the exact value of the + // location to be determined at any time, even after generating code that + // refers to the location. + function loc() { + return t.numericLiteral(-1); + } + + // Sets the exact value of the given location to the offset of the next + // Statement emitted. + Ep.mark = function (loc) { + t.assertLiteral(loc); + var index = this.listing.length; + if (loc.value === -1) { + loc.value = index; + } else { + // Locations can be marked redundantly, but their values cannot change + // once set the first time. + _assert2.default.strictEqual(loc.value, index); + } + this.marked[index] = true; + return loc; + }; + + Ep.emit = function (node) { + if (t.isExpression(node)) { + node = t.expressionStatement(node); + } + + t.assertStatement(node); + this.listing.push(node); + }; + + // Shorthand for emitting assignment statements. This will come in handy + // for assignments to temporary variables. + Ep.emitAssign = function (lhs, rhs) { + this.emit(this.assign(lhs, rhs)); + return lhs; + }; + + // Shorthand for an assignment statement. + Ep.assign = function (lhs, rhs) { + return t.expressionStatement(t.assignmentExpression("=", lhs, rhs)); + }; + + // Convenience function for generating expressions like context.next, + // context.sent, and context.rval. + Ep.contextProperty = function (name, computed) { + return t.memberExpression(this.contextId, computed ? t.stringLiteral(name) : t.identifier(name), !!computed); + }; + + // Shorthand for setting context.rval and jumping to `context.stop()`. + Ep.stop = function (rval) { + if (rval) { + this.setReturnValue(rval); + } + + this.jump(this.finalLoc); + }; + + Ep.setReturnValue = function (valuePath) { + t.assertExpression(valuePath.value); + + this.emitAssign(this.contextProperty("rval"), this.explodeExpression(valuePath)); + }; + + Ep.clearPendingException = function (tryLoc, assignee) { + t.assertLiteral(tryLoc); + + var catchCall = t.callExpression(this.contextProperty("catch", true), [tryLoc]); + + if (assignee) { + this.emitAssign(assignee, catchCall); + } else { + this.emit(catchCall); + } + }; + + // Emits code for an unconditional jump to the given location, even if the + // exact value of the location is not yet known. + Ep.jump = function (toLoc) { + this.emitAssign(this.contextProperty("next"), toLoc); + this.emit(t.breakStatement()); + }; + + // Conditional jump. + Ep.jumpIf = function (test, toLoc) { + t.assertExpression(test); + t.assertLiteral(toLoc); + + this.emit(t.ifStatement(test, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()]))); + }; + + // Conditional jump, with the condition negated. + Ep.jumpIfNot = function (test, toLoc) { + t.assertExpression(test); + t.assertLiteral(toLoc); + + var negatedTest = void 0; + if (t.isUnaryExpression(test) && test.operator === "!") { + // Avoid double negation. + negatedTest = test.argument; + } else { + negatedTest = t.unaryExpression("!", test); + } + + this.emit(t.ifStatement(negatedTest, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()]))); + }; + + // Returns a unique MemberExpression that can be used to store and + // retrieve temporary values. Since the object of the member expression is + // the context object, which is presumed to coexist peacefully with all + // other local variables, and since we just increment `nextTempId` + // monotonically, uniqueness is assured. + Ep.makeTempVar = function () { + return this.contextProperty("t" + this.nextTempId++); + }; + + Ep.getContextFunction = function (id) { + return t.functionExpression(id || null /*Anonymous*/ + , [this.contextId], t.blockStatement([this.getDispatchLoop()]), false, // Not a generator anymore! + false // Nor an expression. + ); + }; + + // Turns this.listing into a loop of the form + // + // while (1) switch (context.next) { + // case 0: + // ... + // case n: + // return context.stop(); + // } + // + // Each marked location in this.listing will correspond to one generated + // case statement. + Ep.getDispatchLoop = function () { + var self = this; + var cases = []; + var current = void 0; + + // If we encounter a break, continue, or return statement in a switch + // case, we can skip the rest of the statements until the next case. + var alreadyEnded = false; + + self.listing.forEach(function (stmt, i) { + if (self.marked.hasOwnProperty(i)) { + cases.push(t.switchCase(t.numericLiteral(i), current = [])); + alreadyEnded = false; + } + + if (!alreadyEnded) { + current.push(stmt); + if (t.isCompletionStatement(stmt)) alreadyEnded = true; + } + }); + + // Now that we know how many statements there will be in this.listing, + // we can finally resolve this.finalLoc.value. + this.finalLoc.value = this.listing.length; + + cases.push(t.switchCase(this.finalLoc, [ + // Intentionally fall through to the "end" case... + ]), + + // So that the runtime can jump to the final location without having + // to know its offset, we provide the "end" case as a synonym. + t.switchCase(t.stringLiteral("end"), [ + // This will check/clear both context.thrown and context.rval. + t.returnStatement(t.callExpression(this.contextProperty("stop"), []))])); + + return t.whileStatement(t.numericLiteral(1), t.switchStatement(t.assignmentExpression("=", this.contextProperty("prev"), this.contextProperty("next")), cases)); + }; + + Ep.getTryLocsList = function () { + if (this.tryEntries.length === 0) { + // To avoid adding a needless [] to the majority of runtime.wrap + // argument lists, force the caller to handle this case specially. + return null; + } + + var lastLocValue = 0; + + return t.arrayExpression(this.tryEntries.map(function (tryEntry) { + var thisLocValue = tryEntry.firstLoc.value; + _assert2.default.ok(thisLocValue >= lastLocValue, "try entries out of order"); + lastLocValue = thisLocValue; + + var ce = tryEntry.catchEntry; + var fe = tryEntry.finallyEntry; + + var locs = [tryEntry.firstLoc, + // The null here makes a hole in the array. + ce ? ce.firstLoc : null]; + + if (fe) { + locs[2] = fe.firstLoc; + locs[3] = fe.afterLoc; + } + + return t.arrayExpression(locs); + })); + }; + + // All side effects must be realized in order. + + // If any subexpression harbors a leap, all subexpressions must be + // neutered of side effects. + + // No destructive modification of AST nodes. + + Ep.explode = function (path, ignoreResult) { + var node = path.node; + var self = this; + + t.assertNode(node); + + if (t.isDeclaration(node)) throw getDeclError(node); + + if (t.isStatement(node)) return self.explodeStatement(path); + + if (t.isExpression(node)) return self.explodeExpression(path, ignoreResult); + + switch (node.type) { + case "Program": + return path.get("body").map(self.explodeStatement, self); + + case "VariableDeclarator": + throw getDeclError(node); + + // These node types should be handled by their parent nodes + // (ObjectExpression, SwitchStatement, and TryStatement, respectively). + case "Property": + case "SwitchCase": + case "CatchClause": + throw new Error(node.type + " nodes should be handled by their parents"); + + default: + throw new Error("unknown Node of type " + (0, _stringify2.default)(node.type)); + } + }; + + function getDeclError(node) { + return new Error("all declarations should have been transformed into " + "assignments before the Exploder began its work: " + (0, _stringify2.default)(node)); + } + + Ep.explodeStatement = function (path, labelId) { + var stmt = path.node; + var self = this; + var before = void 0, + after = void 0, + head = void 0; + + t.assertStatement(stmt); + + if (labelId) { + t.assertIdentifier(labelId); + } else { + labelId = null; + } + + // Explode BlockStatement nodes even if they do not contain a yield, + // because we don't want or need the curly braces. + if (t.isBlockStatement(stmt)) { + path.get("body").forEach(function (path) { + self.explodeStatement(path); + }); + return; + } + + if (!meta.containsLeap(stmt)) { + // Technically we should be able to avoid emitting the statement + // altogether if !meta.hasSideEffects(stmt), but that leads to + // confusing generated code (for instance, `while (true) {}` just + // disappears) and is probably a more appropriate job for a dedicated + // dead code elimination pass. + self.emit(stmt); + return; + } + + switch (stmt.type) { + case "ExpressionStatement": + self.explodeExpression(path.get("expression"), true); + break; + + case "LabeledStatement": + after = loc(); + + // Did you know you can break from any labeled block statement or + // control structure? Well, you can! Note: when a labeled loop is + // encountered, the leap.LabeledEntry created here will immediately + // enclose a leap.LoopEntry on the leap manager's stack, and both + // entries will have the same label. Though this works just fine, it + // may seem a bit redundant. In theory, we could check here to + // determine if stmt knows how to handle its own label; for example, + // stmt happens to be a WhileStatement and so we know it's going to + // establish its own LoopEntry when we explode it (below). Then this + // LabeledEntry would be unnecessary. Alternatively, we might be + // tempted not to pass stmt.label down into self.explodeStatement, + // because we've handled the label here, but that's a mistake because + // labeled loops may contain labeled continue statements, which is not + // something we can handle in this generic case. All in all, I think a + // little redundancy greatly simplifies the logic of this case, since + // it's clear that we handle all possible LabeledStatements correctly + // here, regardless of whether they interact with the leap manager + // themselves. Also remember that labels and break/continue-to-label + // statements are rare, and all of this logic happens at transform + // time, so it has no additional runtime cost. + self.leapManager.withEntry(new leap.LabeledEntry(after, stmt.label), function () { + self.explodeStatement(path.get("body"), stmt.label); + }); + + self.mark(after); + + break; + + case "WhileStatement": + before = loc(); + after = loc(); + + self.mark(before); + self.jumpIfNot(self.explodeExpression(path.get("test")), after); + self.leapManager.withEntry(new leap.LoopEntry(after, before, labelId), function () { + self.explodeStatement(path.get("body")); + }); + self.jump(before); + self.mark(after); + + break; + + case "DoWhileStatement": + var first = loc(); + var test = loc(); + after = loc(); + + self.mark(first); + self.leapManager.withEntry(new leap.LoopEntry(after, test, labelId), function () { + self.explode(path.get("body")); + }); + self.mark(test); + self.jumpIf(self.explodeExpression(path.get("test")), first); + self.mark(after); + + break; + + case "ForStatement": + head = loc(); + var update = loc(); + after = loc(); + + if (stmt.init) { + // We pass true here to indicate that if stmt.init is an expression + // then we do not care about its result. + self.explode(path.get("init"), true); + } + + self.mark(head); + + if (stmt.test) { + self.jumpIfNot(self.explodeExpression(path.get("test")), after); + } else { + // No test means continue unconditionally. + } + + self.leapManager.withEntry(new leap.LoopEntry(after, update, labelId), function () { + self.explodeStatement(path.get("body")); + }); + + self.mark(update); + + if (stmt.update) { + // We pass true here to indicate that if stmt.update is an + // expression then we do not care about its result. + self.explode(path.get("update"), true); + } + + self.jump(head); + + self.mark(after); + + break; + + case "TypeCastExpression": + return self.explodeExpression(path.get("expression")); + + case "ForInStatement": + head = loc(); + after = loc(); + + var keyIterNextFn = self.makeTempVar(); + self.emitAssign(keyIterNextFn, t.callExpression(util.runtimeProperty("keys"), [self.explodeExpression(path.get("right"))])); + + self.mark(head); + + var keyInfoTmpVar = self.makeTempVar(); + self.jumpIf(t.memberExpression(t.assignmentExpression("=", keyInfoTmpVar, t.callExpression(keyIterNextFn, [])), t.identifier("done"), false), after); + + self.emitAssign(stmt.left, t.memberExpression(keyInfoTmpVar, t.identifier("value"), false)); + + self.leapManager.withEntry(new leap.LoopEntry(after, head, labelId), function () { + self.explodeStatement(path.get("body")); + }); + + self.jump(head); + + self.mark(after); + + break; + + case "BreakStatement": + self.emitAbruptCompletion({ + type: "break", + target: self.leapManager.getBreakLoc(stmt.label) + }); + + break; + + case "ContinueStatement": + self.emitAbruptCompletion({ + type: "continue", + target: self.leapManager.getContinueLoc(stmt.label) + }); + + break; + + case "SwitchStatement": + // Always save the discriminant into a temporary variable in case the + // test expressions overwrite values like context.sent. + var disc = self.emitAssign(self.makeTempVar(), self.explodeExpression(path.get("discriminant"))); + + after = loc(); + var defaultLoc = loc(); + var condition = defaultLoc; + var caseLocs = []; + + // If there are no cases, .cases might be undefined. + var cases = stmt.cases || []; + + for (var i = cases.length - 1; i >= 0; --i) { + var c = cases[i]; + t.assertSwitchCase(c); + + if (c.test) { + condition = t.conditionalExpression(t.binaryExpression("===", disc, c.test), caseLocs[i] = loc(), condition); + } else { + caseLocs[i] = defaultLoc; + } + } + + var discriminant = path.get("discriminant"); + discriminant.replaceWith(condition); + self.jump(self.explodeExpression(discriminant)); + + self.leapManager.withEntry(new leap.SwitchEntry(after), function () { + path.get("cases").forEach(function (casePath) { + var i = casePath.key; + self.mark(caseLocs[i]); + + casePath.get("consequent").forEach(function (path) { + self.explodeStatement(path); + }); + }); + }); + + self.mark(after); + if (defaultLoc.value === -1) { + self.mark(defaultLoc); + _assert2.default.strictEqual(after.value, defaultLoc.value); + } + + break; + + case "IfStatement": + var elseLoc = stmt.alternate && loc(); + after = loc(); + + self.jumpIfNot(self.explodeExpression(path.get("test")), elseLoc || after); + + self.explodeStatement(path.get("consequent")); + + if (elseLoc) { + self.jump(after); + self.mark(elseLoc); + self.explodeStatement(path.get("alternate")); + } + + self.mark(after); + + break; + + case "ReturnStatement": + self.emitAbruptCompletion({ + type: "return", + value: self.explodeExpression(path.get("argument")) + }); + + break; + + case "WithStatement": + throw new Error("WithStatement not supported in generator functions."); + + case "TryStatement": + after = loc(); + + var handler = stmt.handler; + + var catchLoc = handler && loc(); + var catchEntry = catchLoc && new leap.CatchEntry(catchLoc, handler.param); + + var finallyLoc = stmt.finalizer && loc(); + var finallyEntry = finallyLoc && new leap.FinallyEntry(finallyLoc, after); + + var tryEntry = new leap.TryEntry(self.getUnmarkedCurrentLoc(), catchEntry, finallyEntry); + + self.tryEntries.push(tryEntry); + self.updateContextPrevLoc(tryEntry.firstLoc); + + self.leapManager.withEntry(tryEntry, function () { + self.explodeStatement(path.get("block")); + + if (catchLoc) { + if (finallyLoc) { + // If we have both a catch block and a finally block, then + // because we emit the catch block first, we need to jump over + // it to the finally block. + self.jump(finallyLoc); + } else { + // If there is no finally block, then we need to jump over the + // catch block to the fall-through location. + self.jump(after); + } + + self.updateContextPrevLoc(self.mark(catchLoc)); + + var bodyPath = path.get("handler.body"); + var safeParam = self.makeTempVar(); + self.clearPendingException(tryEntry.firstLoc, safeParam); + + bodyPath.traverse(catchParamVisitor, { + safeParam: safeParam, + catchParamName: handler.param.name + }); + + self.leapManager.withEntry(catchEntry, function () { + self.explodeStatement(bodyPath); + }); + } + + if (finallyLoc) { + self.updateContextPrevLoc(self.mark(finallyLoc)); + + self.leapManager.withEntry(finallyEntry, function () { + self.explodeStatement(path.get("finalizer")); + }); + + self.emit(t.returnStatement(t.callExpression(self.contextProperty("finish"), [finallyEntry.firstLoc]))); + } + }); + + self.mark(after); + + break; + + case "ThrowStatement": + self.emit(t.throwStatement(self.explodeExpression(path.get("argument")))); + + break; + + default: + throw new Error("unknown Statement of type " + (0, _stringify2.default)(stmt.type)); + } + }; + + var catchParamVisitor = { + Identifier: function Identifier(path, state) { + if (path.node.name === state.catchParamName && util.isReference(path)) { + path.replaceWith(state.safeParam); + } + }, + + Scope: function Scope(path, state) { + if (path.scope.hasOwnBinding(state.catchParamName)) { + // Don't descend into nested scopes that shadow the catch + // parameter with their own declarations. + path.skip(); + } + } + }; + + Ep.emitAbruptCompletion = function (record) { + if (!isValidCompletion(record)) { + _assert2.default.ok(false, "invalid completion record: " + (0, _stringify2.default)(record)); + } + + _assert2.default.notStrictEqual(record.type, "normal", "normal completions are not abrupt"); + + var abruptArgs = [t.stringLiteral(record.type)]; + + if (record.type === "break" || record.type === "continue") { + t.assertLiteral(record.target); + abruptArgs[1] = record.target; + } else if (record.type === "return" || record.type === "throw") { + if (record.value) { + t.assertExpression(record.value); + abruptArgs[1] = record.value; + } + } + + this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"), abruptArgs))); + }; + + function isValidCompletion(record) { + var type = record.type; + + if (type === "normal") { + return !hasOwn.call(record, "target"); + } + + if (type === "break" || type === "continue") { + return !hasOwn.call(record, "value") && t.isLiteral(record.target); + } + + if (type === "return" || type === "throw") { + return hasOwn.call(record, "value") && !hasOwn.call(record, "target"); + } + + return false; + } + + // Not all offsets into emitter.listing are potential jump targets. For + // example, execution typically falls into the beginning of a try block + // without jumping directly there. This method returns the current offset + // without marking it, so that a switch case will not necessarily be + // generated for this offset (I say "not necessarily" because the same + // location might end up being marked in the process of emitting other + // statements). There's no logical harm in marking such locations as jump + // targets, but minimizing the number of switch cases keeps the generated + // code shorter. + Ep.getUnmarkedCurrentLoc = function () { + return t.numericLiteral(this.listing.length); + }; + + // The context.prev property takes the value of context.next whenever we + // evaluate the switch statement discriminant, which is generally good + // enough for tracking the last location we jumped to, but sometimes + // context.prev needs to be more precise, such as when we fall + // successfully out of a try block and into a finally block without + // jumping. This method exists to update context.prev to the freshest + // available location. If we were implementing a full interpreter, we + // would know the location of the current instruction with complete + // precision at all times, but we don't have that luxury here, as it would + // be costly and verbose to set context.prev before every statement. + Ep.updateContextPrevLoc = function (loc) { + if (loc) { + t.assertLiteral(loc); + + if (loc.value === -1) { + // If an uninitialized location literal was passed in, set its value + // to the current this.listing.length. + loc.value = this.listing.length; + } else { + // Otherwise assert that the location matches the current offset. + _assert2.default.strictEqual(loc.value, this.listing.length); + } + } else { + loc = this.getUnmarkedCurrentLoc(); + } + + // Make sure context.prev is up to date in case we fell into this try + // statement without jumping to it. TODO Consider avoiding this + // assignment when we know control must have jumped here. + this.emitAssign(this.contextProperty("prev"), loc); + }; + + Ep.explodeExpression = function (path, ignoreResult) { + var expr = path.node; + if (expr) { + t.assertExpression(expr); + } else { + return expr; + } + + var self = this; + var result = void 0; // Used optionally by several cases below. + var after = void 0; + + function finish(expr) { + t.assertExpression(expr); + if (ignoreResult) { + self.emit(expr); + } else { + return expr; + } + } + + // If the expression does not contain a leap, then we either emit the + // expression as a standalone statement or return it whole. + if (!meta.containsLeap(expr)) { + return finish(expr); + } + + // If any child contains a leap (such as a yield or labeled continue or + // break statement), then any sibling subexpressions will almost + // certainly have to be exploded in order to maintain the order of their + // side effects relative to the leaping child(ren). + var hasLeapingChildren = meta.containsLeap.onlyChildren(expr); + + // In order to save the rest of explodeExpression from a combinatorial + // trainwreck of special cases, explodeViaTempVar is responsible for + // deciding when a subexpression needs to be "exploded," which is my + // very technical term for emitting the subexpression as an assignment + // to a temporary variable and the substituting the temporary variable + // for the original subexpression. Think of exploded view diagrams, not + // Michael Bay movies. The point of exploding subexpressions is to + // control the precise order in which the generated code realizes the + // side effects of those subexpressions. + function explodeViaTempVar(tempVar, childPath, ignoreChildResult) { + _assert2.default.ok(!ignoreChildResult || !tempVar, "Ignoring the result of a child expression but forcing it to " + "be assigned to a temporary variable?"); + + var result = self.explodeExpression(childPath, ignoreChildResult); + + if (ignoreChildResult) { + // Side effects already emitted above. + + } else if (tempVar || hasLeapingChildren && !t.isLiteral(result)) { + // If tempVar was provided, then the result will always be assigned + // to it, even if the result does not otherwise need to be assigned + // to a temporary variable. When no tempVar is provided, we have + // the flexibility to decide whether a temporary variable is really + // necessary. Unfortunately, in general, a temporary variable is + // required whenever any child contains a yield expression, since it + // is difficult to prove (at all, let alone efficiently) whether + // this result would evaluate to the same value before and after the + // yield (see #206). One narrow case where we can prove it doesn't + // matter (and thus we do not need a temporary variable) is when the + // result in question is a Literal value. + result = self.emitAssign(tempVar || self.makeTempVar(), result); + } + return result; + } + + // If ignoreResult is true, then we must take full responsibility for + // emitting the expression with all its side effects, and we should not + // return a result. + + switch (expr.type) { + case "MemberExpression": + return finish(t.memberExpression(self.explodeExpression(path.get("object")), expr.computed ? explodeViaTempVar(null, path.get("property")) : expr.property, expr.computed)); + + case "CallExpression": + var calleePath = path.get("callee"); + var argsPath = path.get("arguments"); + + var newCallee = void 0; + var newArgs = []; + + var hasLeapingArgs = false; + argsPath.forEach(function (argPath) { + hasLeapingArgs = hasLeapingArgs || meta.containsLeap(argPath.node); + }); + + if (t.isMemberExpression(calleePath.node)) { + if (hasLeapingArgs) { + // If the arguments of the CallExpression contained any yield + // expressions, then we need to be sure to evaluate the callee + // before evaluating the arguments, but if the callee was a member + // expression, then we must be careful that the object of the + // member expression still gets bound to `this` for the call. + + var newObject = explodeViaTempVar( + // Assign the exploded callee.object expression to a temporary + // variable so that we can use it twice without reevaluating it. + self.makeTempVar(), calleePath.get("object")); + + var newProperty = calleePath.node.computed ? explodeViaTempVar(null, calleePath.get("property")) : calleePath.node.property; + + newArgs.unshift(newObject); + + newCallee = t.memberExpression(t.memberExpression(newObject, newProperty, calleePath.node.computed), t.identifier("call"), false); + } else { + newCallee = self.explodeExpression(calleePath); + } + } else { + newCallee = explodeViaTempVar(null, calleePath); + + if (t.isMemberExpression(newCallee)) { + // If the callee was not previously a MemberExpression, then the + // CallExpression was "unqualified," meaning its `this` object + // should be the global object. If the exploded expression has + // become a MemberExpression (e.g. a context property, probably a + // temporary variable), then we need to force it to be unqualified + // by using the (0, object.property)(...) trick; otherwise, it + // will receive the object of the MemberExpression as its `this` + // object. + newCallee = t.sequenceExpression([t.numericLiteral(0), newCallee]); + } + } + + argsPath.forEach(function (argPath) { + newArgs.push(explodeViaTempVar(null, argPath)); + }); + + return finish(t.callExpression(newCallee, newArgs)); + + case "NewExpression": + return finish(t.newExpression(explodeViaTempVar(null, path.get("callee")), path.get("arguments").map(function (argPath) { + return explodeViaTempVar(null, argPath); + }))); + + case "ObjectExpression": + return finish(t.objectExpression(path.get("properties").map(function (propPath) { + if (propPath.isObjectProperty()) { + return t.objectProperty(propPath.node.key, explodeViaTempVar(null, propPath.get("value")), propPath.node.computed); + } else { + return propPath.node; + } + }))); + + case "ArrayExpression": + return finish(t.arrayExpression(path.get("elements").map(function (elemPath) { + return explodeViaTempVar(null, elemPath); + }))); + + case "SequenceExpression": + var lastIndex = expr.expressions.length - 1; + + path.get("expressions").forEach(function (exprPath) { + if (exprPath.key === lastIndex) { + result = self.explodeExpression(exprPath, ignoreResult); + } else { + self.explodeExpression(exprPath, true); + } + }); + + return result; + + case "LogicalExpression": + after = loc(); + + if (!ignoreResult) { + result = self.makeTempVar(); + } + + var left = explodeViaTempVar(result, path.get("left")); + + if (expr.operator === "&&") { + self.jumpIfNot(left, after); + } else { + _assert2.default.strictEqual(expr.operator, "||"); + self.jumpIf(left, after); + } + + explodeViaTempVar(result, path.get("right"), ignoreResult); + + self.mark(after); + + return result; + + case "ConditionalExpression": + var elseLoc = loc(); + after = loc(); + var test = self.explodeExpression(path.get("test")); + + self.jumpIfNot(test, elseLoc); + + if (!ignoreResult) { + result = self.makeTempVar(); + } + + explodeViaTempVar(result, path.get("consequent"), ignoreResult); + self.jump(after); + + self.mark(elseLoc); + explodeViaTempVar(result, path.get("alternate"), ignoreResult); + + self.mark(after); + + return result; + + case "UnaryExpression": + return finish(t.unaryExpression(expr.operator, + // Can't (and don't need to) break up the syntax of the argument. + // Think about delete a[b]. + self.explodeExpression(path.get("argument")), !!expr.prefix)); + + case "BinaryExpression": + return finish(t.binaryExpression(expr.operator, explodeViaTempVar(null, path.get("left")), explodeViaTempVar(null, path.get("right")))); + + case "AssignmentExpression": + return finish(t.assignmentExpression(expr.operator, self.explodeExpression(path.get("left")), self.explodeExpression(path.get("right")))); + + case "UpdateExpression": + return finish(t.updateExpression(expr.operator, self.explodeExpression(path.get("argument")), expr.prefix)); + + case "YieldExpression": + after = loc(); + var arg = expr.argument && self.explodeExpression(path.get("argument")); + + if (arg && expr.delegate) { + var _result = self.makeTempVar(); + + self.emit(t.returnStatement(t.callExpression(self.contextProperty("delegateYield"), [arg, t.stringLiteral(_result.property.name), after]))); + + self.mark(after); + + return _result; + } + + self.emitAssign(self.contextProperty("next"), after); + self.emit(t.returnStatement(arg || null)); + self.mark(after); + + return self.contextProperty("sent"); + + default: + throw new Error("unknown Expression of type " + (0, _stringify2.default)(expr.type)); + } + }; + +/***/ }), +/* 279 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.runtimeProperty = runtimeProperty; + exports.isReference = isReference; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function runtimeProperty(name) { + return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false); + } /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + function isReference(path) { + return path.isReferenced() || path.parentPath.isAssignmentExpression({ left: path.node }); + } + +/***/ }), +/* 280 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function (str) { + var isExtendedLengthPath = /^\\\\\?\\/.test(str); + var hasNonAscii = /[^\x00-\x80]+/.test(str); + + if (isExtendedLengthPath || hasNonAscii) { + return str; + } + + return str.replace(/\\/g, '/'); + }; + +/***/ }), +/* 281 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(61); + var has = Object.prototype.hasOwnProperty; + + /** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ + function ArraySet() { + this._array = []; + this._set = Object.create(null); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + }; + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + ArraySet.prototype.size = function ArraySet_size() { + return Object.getOwnPropertyNames(this._set).length; + }; + + /** + * Add the given string to this set. + * + * @param String aStr + */ + ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = util.toSetString(aStr); + var isDuplicate = has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + this._set[sStr] = idx; + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + throw new Error('"' + aStr + '" is not in the set.'); + }; + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); + }; + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); + }; + + exports.ArraySet = ArraySet; + +/***/ }), +/* 282 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + var base64 = __webpack_require__(607); + + // A single base 64 digit can contain 6 bits of data. For the base 64 variable + // length quantities we use in the source map spec, the first bit is the sign, + // the next four bits are the actual value, and the 6th bit is the + // continuation bit. The continuation bit tells us whether there are more + // digits in this value following this digit. + // + // Continuation + // | Sign + // | | + // V V + // 101011 + + var VLQ_BASE_SHIFT = 5; + + // binary: 100000 + var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + + // binary: 011111 + var VLQ_BASE_MASK = VLQ_BASE - 1; + + // binary: 100000 + var VLQ_CONTINUATION_BIT = VLQ_BASE; + + /** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ + function toVLQSigned(aValue) { + return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0; + } + + /** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ + function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative ? -shifted : shifted; + } + + /** + * Returns the base 64 VLQ encoded value. + */ + exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; + }; + + /** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ + exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; + }; + +/***/ }), +/* 283 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var base64VLQ = __webpack_require__(282); + var util = __webpack_require__(61); + var ArraySet = __webpack_require__(281).ArraySet; + var MappingList = __webpack_require__(609).MappingList; + + /** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ + function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + SourceMapGenerator.prototype._version = 3; + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + + /** + * Set the source content for a source file. + */ + SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.'); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source); + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) { + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) { + // Cases 2 and 3. + return; + } else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = ''; + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + + SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null; + }, this); + }; + + /** + * Externalize the source map. + */ + SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + + /** + * Render the source map being generated to a string. + */ + SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + + exports.SourceMapGenerator = SourceMapGenerator; + +/***/ }), +/* 284 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ + exports.SourceMapGenerator = __webpack_require__(283).SourceMapGenerator; + exports.SourceMapConsumer = __webpack_require__(611).SourceMapConsumer; + exports.SourceNode = __webpack_require__(612).SourceNode; + +/***/ }), +/* 285 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + function assembleStyles() { + var styles = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } + }; + + // fix humans + styles.colors.grey = styles.colors.gray; + + Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; + + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\x1B[' + style[0] + 'm', + close: '\x1B[' + style[1] + 'm' + }; + }); + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + }); + + return styles; + } + + Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles + }); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module))) + +/***/ }), +/* 286 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = __webpack_require__(178); + +/***/ }), +/* 287 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports.default = getPossiblePluginNames; + function getPossiblePluginNames(pluginName) { + return ["babel-plugin-" + pluginName, pluginName]; + } + module.exports = exports["default"]; + +/***/ }), +/* 288 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports.default = getPossiblePresetNames; + function getPossiblePresetNames(presetName) { + var possibleNames = ["babel-preset-" + presetName, presetName]; + + var matches = presetName.match(/^(@[^/]+)\/(.+)$/); + if (matches) { + var orgName = matches[1], + presetPath = matches[2]; + + possibleNames.push(orgName + "/babel-preset-" + presetPath); + } + + return possibleNames; + } + module.exports = exports["default"]; + +/***/ }), +/* 289 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (dest, src) { + if (!dest || !src) return; + + return (0, _mergeWith2.default)(dest, src, function (a, b) { + if (b && Array.isArray(a)) { + var newArray = b.slice(0); + + for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var item = _ref; + + if (newArray.indexOf(item) < 0) { + newArray.push(item); + } + } + + return newArray; + } + }); + }; + + var _mergeWith = __webpack_require__(581); + + var _mergeWith2 = _interopRequireDefault(_mergeWith); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 290 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (ast, comments, tokens) { + if (ast) { + if (ast.type === "Program") { + return t.file(ast, comments || [], tokens || []); + } else if (ast.type === "File") { + return ast; + } + } + + throw new Error("Not a valid ast?"); + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + module.exports = exports["default"]; + +/***/ }), +/* 291 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (whitelist) { + var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global"; + + var namespace = t.identifier("babelHelpers"); + + var builder = function builder(body) { + return buildHelpers(body, namespace, whitelist); + }; + + var tree = void 0; + + var build = { + global: buildGlobal, + umd: buildUmd, + var: buildVar + }[outputType]; + + if (build) { + tree = build(namespace, builder); + } else { + throw new Error(messages.get("unsupportedOutputType", outputType)); + } + + return (0, _babelGenerator2.default)(tree).code; + }; + + var _babelHelpers = __webpack_require__(190); + + var helpers = _interopRequireWildcard(_babelHelpers); + + var _babelGenerator = __webpack_require__(182); + + var _babelGenerator2 = _interopRequireDefault(_babelGenerator); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var buildUmdWrapper = (0, _babelTemplate2.default)("\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n"); + + function buildGlobal(namespace, builder) { + var body = []; + var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); + var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); + + body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))])); + + builder(body); + + return tree; + } + + function buildUmd(namespace, builder) { + var body = []; + body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))])); + + builder(body); + + return t.program([buildUmdWrapper({ + FACTORY_PARAMETERS: t.identifier("global"), + BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])), + COMMON_ARGUMENTS: t.identifier("exports"), + AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]), + FACTORY_BODY: body, + UMD_ROOT: t.identifier("this") + })]); + } + + function buildVar(namespace, builder) { + var body = []; + body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))])); + builder(body); + body.push(t.expressionStatement(namespace)); + return t.program(body); + } + + function buildHelpers(body, namespace, whitelist) { + helpers.list.forEach(function (name) { + if (whitelist && whitelist.indexOf(name) < 0) return; + + var key = t.identifier(name); + body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name)))); + }); + } + module.exports = exports["default"]; + +/***/ }), +/* 292 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _plugin = __webpack_require__(63); + + var _plugin2 = _interopRequireDefault(_plugin); + + var _sortBy = __webpack_require__(585); + + var _sortBy2 = _interopRequireDefault(_sortBy); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = new _plugin2.default({ + + name: "internal.blockHoist", + + visitor: { + Block: { + exit: function exit(_ref) { + var node = _ref.node; + + var hasChange = false; + for (var i = 0; i < node.body.length; i++) { + var bodyNode = node.body[i]; + if (bodyNode && bodyNode._blockHoist != null) { + hasChange = true; + break; + } + } + if (!hasChange) return; + + node.body = (0, _sortBy2.default)(node.body, function (bodyNode) { + var priority = bodyNode && bodyNode._blockHoist; + if (priority == null) priority = 1; + if (priority === true) priority = 2; + + return -1 * priority; + }); + } + } + } + }); + module.exports = exports["default"]; + +/***/ }), +/* 293 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _symbol = __webpack_require__(10); + + var _symbol2 = _interopRequireDefault(_symbol); + + var _plugin = __webpack_require__(63); + + var _plugin2 = _interopRequireDefault(_plugin); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound"); + + var superVisitor = { + CallExpression: function CallExpression(path) { + if (!path.get("callee").isSuper()) return; + + var node = path.node; + + if (node[SUPER_THIS_BOUND]) return; + node[SUPER_THIS_BOUND] = true; + + path.replaceWith(t.assignmentExpression("=", this.id, node)); + } + }; + + exports.default = new _plugin2.default({ + name: "internal.shadowFunctions", + + visitor: { + ThisExpression: function ThisExpression(path) { + remap(path, "this"); + }, + ReferencedIdentifier: function ReferencedIdentifier(path) { + if (path.node.name === "arguments") { + remap(path, "arguments"); + } + } + } + }); + + function shouldShadow(path, shadowPath) { + if (path.is("_forceShadow")) { + return true; + } else { + return shadowPath; + } + } + + function remap(path, key) { + var shadowPath = path.inShadow(key); + if (!shouldShadow(path, shadowPath)) return; + + var shadowFunction = path.node._shadowedFunctionLiteral; + + var currentFunction = void 0; + var passedShadowFunction = false; + + var fnPath = path.find(function (innerPath) { + if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") { + return true; + } + if (path === innerPath) return false; + if (innerPath.isProgram() || innerPath.isFunction()) { + currentFunction = currentFunction || innerPath; + } + + if (innerPath.isProgram()) { + passedShadowFunction = true; + + return true; + } else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) { + if (shadowFunction) { + if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true; + } else { + if (!innerPath.is("shadow")) return true; + } + + passedShadowFunction = true; + return false; + } + + return false; + }); + + if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) { + fnPath = path.findParent(function (p) { + return p.isProgram() || p.isFunction(); + }); + } + + if (fnPath === currentFunction) return; + + if (!passedShadowFunction) return; + + var cached = fnPath.getData(key); + if (cached) return path.replaceWith(cached); + + var id = path.scope.generateUidIdentifier(key); + + fnPath.setData(key, id); + + var classPath = fnPath.findParent(function (p) { + return p.isClass(); + }); + var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); + + if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) { + fnPath.scope.push({ id: id }); + + fnPath.traverse(superVisitor, { id: id }); + } else { + var init = key === "this" ? t.thisExpression() : t.identifier(key); + + if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction; + + fnPath.scope.push({ id: id, init: init }); + } + + return path.replaceWith(id); + } + module.exports = exports["default"]; + +/***/ }), +/* 294 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _normalizeAst = __webpack_require__(290); + + var _normalizeAst2 = _interopRequireDefault(_normalizeAst); + + var _plugin = __webpack_require__(63); + + var _plugin2 = _interopRequireDefault(_plugin); + + var _file = __webpack_require__(49); + + var _file2 = _interopRequireDefault(_file); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Pipeline = function () { + function Pipeline() { + (0, _classCallCheck3.default)(this, Pipeline); + } + + Pipeline.prototype.lint = function lint(code) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + opts.code = false; + opts.mode = "lint"; + return this.transform(code, opts); + }; + + Pipeline.prototype.pretransform = function pretransform(code, opts) { + var file = new _file2.default(opts, this); + return file.wrap(code, function () { + file.addCode(code); + file.parseCode(code); + return file; + }); + }; + + Pipeline.prototype.transform = function transform(code, opts) { + var file = new _file2.default(opts, this); + return file.wrap(code, function () { + file.addCode(code); + file.parseCode(code); + return file.transform(); + }); + }; + + Pipeline.prototype.analyse = function analyse(code) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var visitor = arguments[2]; + + opts.code = false; + if (visitor) { + opts.plugins = opts.plugins || []; + opts.plugins.push(new _plugin2.default({ visitor: visitor })); + } + return this.transform(code, opts).metadata; + }; + + Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) { + ast = (0, _normalizeAst2.default)(ast); + + var file = new _file2.default(opts, this); + return file.wrap(code, function () { + file.addCode(code); + file.addAst(ast); + return file.transform(); + }); + }; + + return Pipeline; + }(); + + exports.default = Pipeline; + module.exports = exports["default"]; + +/***/ }), +/* 295 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _store = __webpack_require__(118); + + var _store2 = _interopRequireDefault(_store); + + var _file5 = __webpack_require__(49); + + var _file6 = _interopRequireDefault(_file5); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var PluginPass = function (_Store) { + (0, _inherits3.default)(PluginPass, _Store); + + function PluginPass(file, plugin) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + (0, _classCallCheck3.default)(this, PluginPass); + + var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this)); + + _this.plugin = plugin; + _this.key = plugin.key; + _this.file = file; + _this.opts = options; + return _this; + } + + PluginPass.prototype.addHelper = function addHelper() { + var _file; + + return (_file = this.file).addHelper.apply(_file, arguments); + }; + + PluginPass.prototype.addImport = function addImport() { + var _file2; + + return (_file2 = this.file).addImport.apply(_file2, arguments); + }; + + PluginPass.prototype.getModuleName = function getModuleName() { + var _file3; + + return (_file3 = this.file).getModuleName.apply(_file3, arguments); + }; + + PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() { + var _file4; + + return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments); + }; + + return PluginPass; + }(_store2.default); + + exports.default = PluginPass; + module.exports = exports["default"]; + +/***/ }), +/* 296 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _trimRight = __webpack_require__(616); + + var _trimRight2 = _interopRequireDefault(_trimRight); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var SPACES_RE = /^[ \t]+$/; + + var Buffer = function () { + function Buffer(map) { + (0, _classCallCheck3.default)(this, Buffer); + this._map = null; + this._buf = []; + this._last = ""; + this._queue = []; + this._position = { + line: 1, + column: 0 + }; + this._sourcePosition = { + identifierName: null, + line: null, + column: null, + filename: null + }; + + this._map = map; + } + + Buffer.prototype.get = function get() { + this._flush(); + + var map = this._map; + var result = { + code: (0, _trimRight2.default)(this._buf.join("")), + map: null, + rawMappings: map && map.getRawMappings() + }; + + if (map) { + Object.defineProperty(result, "map", { + configurable: true, + enumerable: true, + get: function get() { + return this.map = map.get(); + }, + set: function set(value) { + Object.defineProperty(this, "map", { value: value, writable: true }); + } + }); + } + + return result; + }; + + Buffer.prototype.append = function append(str) { + this._flush(); + var _sourcePosition = this._sourcePosition, + line = _sourcePosition.line, + column = _sourcePosition.column, + filename = _sourcePosition.filename, + identifierName = _sourcePosition.identifierName; + + this._append(str, line, column, identifierName, filename); + }; + + Buffer.prototype.queue = function queue(str) { + if (str === "\n") while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) { + this._queue.shift(); + }var _sourcePosition2 = this._sourcePosition, + line = _sourcePosition2.line, + column = _sourcePosition2.column, + filename = _sourcePosition2.filename, + identifierName = _sourcePosition2.identifierName; + + this._queue.unshift([str, line, column, identifierName, filename]); + }; + + Buffer.prototype._flush = function _flush() { + var item = void 0; + while (item = this._queue.pop()) { + this._append.apply(this, item); + } + }; + + Buffer.prototype._append = function _append(str, line, column, identifierName, filename) { + if (this._map && str[0] !== "\n") { + this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename); + } + + this._buf.push(str); + this._last = str[str.length - 1]; + + for (var i = 0; i < str.length; i++) { + if (str[i] === "\n") { + this._position.line++; + this._position.column = 0; + } else { + this._position.column++; + } + } + }; + + Buffer.prototype.removeTrailingNewline = function removeTrailingNewline() { + if (this._queue.length > 0 && this._queue[0][0] === "\n") this._queue.shift(); + }; + + Buffer.prototype.removeLastSemicolon = function removeLastSemicolon() { + if (this._queue.length > 0 && this._queue[0][0] === ";") this._queue.shift(); + }; + + Buffer.prototype.endsWith = function endsWith(suffix) { + if (suffix.length === 1) { + var last = void 0; + if (this._queue.length > 0) { + var str = this._queue[0][0]; + last = str[str.length - 1]; + } else { + last = this._last; + } + + return last === suffix; + } + + var end = this._last + this._queue.reduce(function (acc, item) { + return item[0] + acc; + }, ""); + if (suffix.length <= end.length) { + return end.slice(-suffix.length) === suffix; + } + + return false; + }; + + Buffer.prototype.hasContent = function hasContent() { + return this._queue.length > 0 || !!this._last; + }; + + Buffer.prototype.source = function source(prop, loc) { + if (prop && !loc) return; + + var pos = loc ? loc[prop] : null; + + this._sourcePosition.identifierName = loc && loc.identifierName || null; + this._sourcePosition.line = pos ? pos.line : null; + this._sourcePosition.column = pos ? pos.column : null; + this._sourcePosition.filename = loc && loc.filename || null; + }; + + Buffer.prototype.withSource = function withSource(prop, loc, cb) { + if (!this._map) return cb(); + + var originalLine = this._sourcePosition.line; + var originalColumn = this._sourcePosition.column; + var originalFilename = this._sourcePosition.filename; + var originalIdentifierName = this._sourcePosition.identifierName; + + this.source(prop, loc); + + cb(); + + this._sourcePosition.line = originalLine; + this._sourcePosition.column = originalColumn; + this._sourcePosition.filename = originalFilename; + this._sourcePosition.identifierName = originalIdentifierName; + }; + + Buffer.prototype.getCurrentColumn = function getCurrentColumn() { + var extra = this._queue.reduce(function (acc, item) { + return item[0] + acc; + }, ""); + var lastIndex = extra.lastIndexOf("\n"); + + return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex; + }; + + Buffer.prototype.getCurrentLine = function getCurrentLine() { + var extra = this._queue.reduce(function (acc, item) { + return item[0] + acc; + }, ""); + + var count = 0; + for (var i = 0; i < extra.length; i++) { + if (extra[i] === "\n") count++; + } + + return this._position.line + count; + }; + + return Buffer; + }(); + + exports.default = Buffer; + module.exports = exports["default"]; + +/***/ }), +/* 297 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.File = File; + exports.Program = Program; + exports.BlockStatement = BlockStatement; + exports.Noop = Noop; + exports.Directive = Directive; + + var _types = __webpack_require__(122); + + Object.defineProperty(exports, "DirectiveLiteral", { + enumerable: true, + get: function get() { + return _types.StringLiteral; + } + }); + function File(node) { + this.print(node.program, node); + } + + function Program(node) { + this.printInnerComments(node, false); + + this.printSequence(node.directives, node); + if (node.directives && node.directives.length) this.newline(); + + this.printSequence(node.body, node); + } + + function BlockStatement(node) { + this.token("{"); + this.printInnerComments(node); + + var hasDirectives = node.directives && node.directives.length; + + if (node.body.length || hasDirectives) { + this.newline(); + + this.printSequence(node.directives, node, { indent: true }); + if (hasDirectives) this.newline(); + + this.printSequence(node.body, node, { indent: true }); + this.removeTrailingNewline(); + + this.source("end", node.loc); + + if (!this.endsWith("\n")) this.newline(); + + this.rightBrace(); + } else { + this.source("end", node.loc); + this.token("}"); + } + } + + function Noop() {} + + function Directive(node) { + this.print(node.value, node); + this.semicolon(); + } + +/***/ }), +/* 298 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports.ClassDeclaration = ClassDeclaration; + exports.ClassBody = ClassBody; + exports.ClassProperty = ClassProperty; + exports.ClassMethod = ClassMethod; + function ClassDeclaration(node) { + this.printJoin(node.decorators, node); + this.word("class"); + + if (node.id) { + this.space(); + this.print(node.id, node); + } + + this.print(node.typeParameters, node); + + if (node.superClass) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.superClass, node); + this.print(node.superTypeParameters, node); + } + + if (node.implements) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements, node); + } + + this.space(); + this.print(node.body, node); + } + + exports.ClassExpression = ClassDeclaration; + function ClassBody(node) { + this.token("{"); + this.printInnerComments(node); + if (node.body.length === 0) { + this.token("}"); + } else { + this.newline(); + + this.indent(); + this.printSequence(node.body, node); + this.dedent(); + + if (!this.endsWith("\n")) this.newline(); + + this.rightBrace(); + } + } + + function ClassProperty(node) { + this.printJoin(node.decorators, node); + + if (node.static) { + this.word("static"); + this.space(); + } + if (node.computed) { + this.token("["); + this.print(node.key, node); + this.token("]"); + } else { + this._variance(node); + this.print(node.key, node); + } + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.token("="); + this.space(); + this.print(node.value, node); + } + this.semicolon(); + } + + function ClassMethod(node) { + this.printJoin(node.decorators, node); + + if (node.static) { + this.word("static"); + this.space(); + } + + if (node.kind === "constructorCall") { + this.word("call"); + this.space(); + } + + this._method(node); + } + +/***/ }), +/* 299 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.LogicalExpression = exports.BinaryExpression = exports.AwaitExpression = exports.YieldExpression = undefined; + exports.UnaryExpression = UnaryExpression; + exports.DoExpression = DoExpression; + exports.ParenthesizedExpression = ParenthesizedExpression; + exports.UpdateExpression = UpdateExpression; + exports.ConditionalExpression = ConditionalExpression; + exports.NewExpression = NewExpression; + exports.SequenceExpression = SequenceExpression; + exports.ThisExpression = ThisExpression; + exports.Super = Super; + exports.Decorator = Decorator; + exports.CallExpression = CallExpression; + exports.Import = Import; + exports.EmptyStatement = EmptyStatement; + exports.ExpressionStatement = ExpressionStatement; + exports.AssignmentPattern = AssignmentPattern; + exports.AssignmentExpression = AssignmentExpression; + exports.BindExpression = BindExpression; + exports.MemberExpression = MemberExpression; + exports.MetaProperty = MetaProperty; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _node = __webpack_require__(183); + + var n = _interopRequireWildcard(_node); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function UnaryExpression(node) { + if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") { + this.word(node.operator); + this.space(); + } else { + this.token(node.operator); + } + + this.print(node.argument, node); + } + + function DoExpression(node) { + this.word("do"); + this.space(); + this.print(node.body, node); + } + + function ParenthesizedExpression(node) { + this.token("("); + this.print(node.expression, node); + this.token(")"); + } + + function UpdateExpression(node) { + if (node.prefix) { + this.token(node.operator); + this.print(node.argument, node); + } else { + this.print(node.argument, node); + this.token(node.operator); + } + } + + function ConditionalExpression(node) { + this.print(node.test, node); + this.space(); + this.token("?"); + this.space(); + this.print(node.consequent, node); + this.space(); + this.token(":"); + this.space(); + this.print(node.alternate, node); + } + + function NewExpression(node, parent) { + this.word("new"); + this.space(); + this.print(node.callee, node); + if (node.arguments.length === 0 && this.format.minified && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) return; + + this.token("("); + this.printList(node.arguments, node); + this.token(")"); + } + + function SequenceExpression(node) { + this.printList(node.expressions, node); + } + + function ThisExpression() { + this.word("this"); + } + + function Super() { + this.word("super"); + } + + function Decorator(node) { + this.token("@"); + this.print(node.expression, node); + this.newline(); + } + + function commaSeparatorNewline() { + this.token(","); + this.newline(); + + if (!this.endsWith("\n")) this.space(); + } + + function CallExpression(node) { + this.print(node.callee, node); + + this.token("("); + + var isPrettyCall = node._prettyCall; + + var separator = void 0; + if (isPrettyCall) { + separator = commaSeparatorNewline; + this.newline(); + this.indent(); + } + + this.printList(node.arguments, node, { separator: separator }); + + if (isPrettyCall) { + this.newline(); + this.dedent(); + } + + this.token(")"); + } + + function Import() { + this.word("import"); + } + + function buildYieldAwait(keyword) { + return function (node) { + this.word(keyword); + + if (node.delegate) { + this.token("*"); + } + + if (node.argument) { + this.space(); + var terminatorState = this.startTerminatorless(); + this.print(node.argument, node); + this.endTerminatorless(terminatorState); + } + }; + } + + var YieldExpression = exports.YieldExpression = buildYieldAwait("yield"); + var AwaitExpression = exports.AwaitExpression = buildYieldAwait("await"); + + function EmptyStatement() { + this.semicolon(true); + } + + function ExpressionStatement(node) { + this.print(node.expression, node); + this.semicolon(); + } + + function AssignmentPattern(node) { + this.print(node.left, node); + if (node.left.optional) this.token("?"); + this.print(node.left.typeAnnotation, node); + this.space(); + this.token("="); + this.space(); + this.print(node.right, node); + } + + function AssignmentExpression(node, parent) { + var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); + + if (parens) { + this.token("("); + } + + this.print(node.left, node); + + this.space(); + if (node.operator === "in" || node.operator === "instanceof") { + this.word(node.operator); + } else { + this.token(node.operator); + } + this.space(); + + this.print(node.right, node); + + if (parens) { + this.token(")"); + } + } + + function BindExpression(node) { + this.print(node.object, node); + this.token("::"); + this.print(node.callee, node); + } + + exports.BinaryExpression = AssignmentExpression; + exports.LogicalExpression = AssignmentExpression; + function MemberExpression(node) { + this.print(node.object, node); + + if (!node.computed && t.isMemberExpression(node.property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + + var computed = node.computed; + if (t.isLiteral(node.property) && typeof node.property.value === "number") { + computed = true; + } + + if (computed) { + this.token("["); + this.print(node.property, node); + this.token("]"); + } else { + this.token("."); + this.print(node.property, node); + } + } + + function MetaProperty(node) { + this.print(node.meta, node); + this.token("."); + this.print(node.property, node); + } + +/***/ }), +/* 300 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.AnyTypeAnnotation = AnyTypeAnnotation; + exports.ArrayTypeAnnotation = ArrayTypeAnnotation; + exports.BooleanTypeAnnotation = BooleanTypeAnnotation; + exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; + exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation; + exports.DeclareClass = DeclareClass; + exports.DeclareFunction = DeclareFunction; + exports.DeclareInterface = DeclareInterface; + exports.DeclareModule = DeclareModule; + exports.DeclareModuleExports = DeclareModuleExports; + exports.DeclareTypeAlias = DeclareTypeAlias; + exports.DeclareVariable = DeclareVariable; + exports.ExistentialTypeParam = ExistentialTypeParam; + exports.FunctionTypeAnnotation = FunctionTypeAnnotation; + exports.FunctionTypeParam = FunctionTypeParam; + exports.InterfaceExtends = InterfaceExtends; + exports._interfaceish = _interfaceish; + exports._variance = _variance; + exports.InterfaceDeclaration = InterfaceDeclaration; + exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; + exports.MixedTypeAnnotation = MixedTypeAnnotation; + exports.EmptyTypeAnnotation = EmptyTypeAnnotation; + exports.NullableTypeAnnotation = NullableTypeAnnotation; + + var _types = __webpack_require__(122); + + Object.defineProperty(exports, "NumericLiteralTypeAnnotation", { + enumerable: true, + get: function get() { + return _types.NumericLiteral; + } + }); + Object.defineProperty(exports, "StringLiteralTypeAnnotation", { + enumerable: true, + get: function get() { + return _types.StringLiteral; + } + }); + exports.NumberTypeAnnotation = NumberTypeAnnotation; + exports.StringTypeAnnotation = StringTypeAnnotation; + exports.ThisTypeAnnotation = ThisTypeAnnotation; + exports.TupleTypeAnnotation = TupleTypeAnnotation; + exports.TypeofTypeAnnotation = TypeofTypeAnnotation; + exports.TypeAlias = TypeAlias; + exports.TypeAnnotation = TypeAnnotation; + exports.TypeParameter = TypeParameter; + exports.TypeParameterInstantiation = TypeParameterInstantiation; + exports.ObjectTypeAnnotation = ObjectTypeAnnotation; + exports.ObjectTypeCallProperty = ObjectTypeCallProperty; + exports.ObjectTypeIndexer = ObjectTypeIndexer; + exports.ObjectTypeProperty = ObjectTypeProperty; + exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty; + exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; + exports.UnionTypeAnnotation = UnionTypeAnnotation; + exports.TypeCastExpression = TypeCastExpression; + exports.VoidTypeAnnotation = VoidTypeAnnotation; + function AnyTypeAnnotation() { + this.word("any"); + } + + function ArrayTypeAnnotation(node) { + this.print(node.elementType, node); + this.token("["); + this.token("]"); + } + + function BooleanTypeAnnotation() { + this.word("boolean"); + } + + function BooleanLiteralTypeAnnotation(node) { + this.word(node.value ? "true" : "false"); + } + + function NullLiteralTypeAnnotation() { + this.word("null"); + } + + function DeclareClass(node) { + this.word("declare"); + this.space(); + this.word("class"); + this.space(); + this._interfaceish(node); + } + + function DeclareFunction(node) { + this.word("declare"); + this.space(); + this.word("function"); + this.space(); + this.print(node.id, node); + this.print(node.id.typeAnnotation.typeAnnotation, node); + this.semicolon(); + } + + function DeclareInterface(node) { + this.word("declare"); + this.space(); + this.InterfaceDeclaration(node); + } + + function DeclareModule(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.space(); + this.print(node.id, node); + this.space(); + this.print(node.body, node); + } + + function DeclareModuleExports(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.token("."); + this.word("exports"); + this.print(node.typeAnnotation, node); + } + + function DeclareTypeAlias(node) { + this.word("declare"); + this.space(); + this.TypeAlias(node); + } + + function DeclareVariable(node) { + this.word("declare"); + this.space(); + this.word("var"); + this.space(); + this.print(node.id, node); + this.print(node.id.typeAnnotation, node); + this.semicolon(); + } + + function ExistentialTypeParam() { + this.token("*"); + } + + function FunctionTypeAnnotation(node, parent) { + this.print(node.typeParameters, node); + this.token("("); + this.printList(node.params, node); + + if (node.rest) { + if (node.params.length) { + this.token(","); + this.space(); + } + this.token("..."); + this.print(node.rest, node); + } + + this.token(")"); + + if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") { + this.token(":"); + } else { + this.space(); + this.token("=>"); + } + + this.space(); + this.print(node.returnType, node); + } + + function FunctionTypeParam(node) { + this.print(node.name, node); + if (node.optional) this.token("?"); + this.token(":"); + this.space(); + this.print(node.typeAnnotation, node); + } + + function InterfaceExtends(node) { + this.print(node.id, node); + this.print(node.typeParameters, node); + } + + exports.ClassImplements = InterfaceExtends; + exports.GenericTypeAnnotation = InterfaceExtends; + function _interfaceish(node) { + this.print(node.id, node); + this.print(node.typeParameters, node); + if (node.extends.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(node.extends, node); + } + if (node.mixins && node.mixins.length) { + this.space(); + this.word("mixins"); + this.space(); + this.printList(node.mixins, node); + } + this.space(); + this.print(node.body, node); + } + + function _variance(node) { + if (node.variance === "plus") { + this.token("+"); + } else if (node.variance === "minus") { + this.token("-"); + } + } + + function InterfaceDeclaration(node) { + this.word("interface"); + this.space(); + this._interfaceish(node); + } + + function andSeparator() { + this.space(); + this.token("&"); + this.space(); + } + + function IntersectionTypeAnnotation(node) { + this.printJoin(node.types, node, { separator: andSeparator }); + } + + function MixedTypeAnnotation() { + this.word("mixed"); + } + + function EmptyTypeAnnotation() { + this.word("empty"); + } + + function NullableTypeAnnotation(node) { + this.token("?"); + this.print(node.typeAnnotation, node); + } + + function NumberTypeAnnotation() { + this.word("number"); + } + + function StringTypeAnnotation() { + this.word("string"); + } + + function ThisTypeAnnotation() { + this.word("this"); + } + + function TupleTypeAnnotation(node) { + this.token("["); + this.printList(node.types, node); + this.token("]"); + } + + function TypeofTypeAnnotation(node) { + this.word("typeof"); + this.space(); + this.print(node.argument, node); + } + + function TypeAlias(node) { + this.word("type"); + this.space(); + this.print(node.id, node); + this.print(node.typeParameters, node); + this.space(); + this.token("="); + this.space(); + this.print(node.right, node); + this.semicolon(); + } + + function TypeAnnotation(node) { + this.token(":"); + this.space(); + if (node.optional) this.token("?"); + this.print(node.typeAnnotation, node); + } + + function TypeParameter(node) { + this._variance(node); + + this.word(node.name); + + if (node.bound) { + this.print(node.bound, node); + } + + if (node.default) { + this.space(); + this.token("="); + this.space(); + this.print(node.default, node); + } + } + + function TypeParameterInstantiation(node) { + this.token("<"); + this.printList(node.params, node, {}); + this.token(">"); + } + + exports.TypeParameterDeclaration = TypeParameterInstantiation; + function ObjectTypeAnnotation(node) { + var _this = this; + + if (node.exact) { + this.token("{|"); + } else { + this.token("{"); + } + + var props = node.properties.concat(node.callProperties, node.indexers); + + if (props.length) { + this.space(); + + this.printJoin(props, node, { + addNewlines: function addNewlines(leading) { + if (leading && !props[0]) return 1; + }, + + indent: true, + statement: true, + iterator: function iterator() { + if (props.length !== 1) { + if (_this.format.flowCommaSeparator) { + _this.token(","); + } else { + _this.semicolon(); + } + _this.space(); + } + } + }); + + this.space(); + } + + if (node.exact) { + this.token("|}"); + } else { + this.token("}"); + } + } + + function ObjectTypeCallProperty(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this.print(node.value, node); + } + + function ObjectTypeIndexer(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this._variance(node); + this.token("["); + this.print(node.id, node); + this.token(":"); + this.space(); + this.print(node.key, node); + this.token("]"); + this.token(":"); + this.space(); + this.print(node.value, node); + } + + function ObjectTypeProperty(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this._variance(node); + this.print(node.key, node); + if (node.optional) this.token("?"); + this.token(":"); + this.space(); + this.print(node.value, node); + } + + function ObjectTypeSpreadProperty(node) { + this.token("..."); + this.print(node.argument, node); + } + + function QualifiedTypeIdentifier(node) { + this.print(node.qualification, node); + this.token("."); + this.print(node.id, node); + } + + function orSeparator() { + this.space(); + this.token("|"); + this.space(); + } + + function UnionTypeAnnotation(node) { + this.printJoin(node.types, node, { separator: orSeparator }); + } + + function TypeCastExpression(node) { + this.token("("); + this.print(node.expression, node); + this.print(node.typeAnnotation, node); + this.token(")"); + } + + function VoidTypeAnnotation() { + this.word("void"); + } + +/***/ }), +/* 301 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.JSXAttribute = JSXAttribute; + exports.JSXIdentifier = JSXIdentifier; + exports.JSXNamespacedName = JSXNamespacedName; + exports.JSXMemberExpression = JSXMemberExpression; + exports.JSXSpreadAttribute = JSXSpreadAttribute; + exports.JSXExpressionContainer = JSXExpressionContainer; + exports.JSXSpreadChild = JSXSpreadChild; + exports.JSXText = JSXText; + exports.JSXElement = JSXElement; + exports.JSXOpeningElement = JSXOpeningElement; + exports.JSXClosingElement = JSXClosingElement; + exports.JSXEmptyExpression = JSXEmptyExpression; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function JSXAttribute(node) { + this.print(node.name, node); + if (node.value) { + this.token("="); + this.print(node.value, node); + } + } + + function JSXIdentifier(node) { + this.word(node.name); + } + + function JSXNamespacedName(node) { + this.print(node.namespace, node); + this.token(":"); + this.print(node.name, node); + } + + function JSXMemberExpression(node) { + this.print(node.object, node); + this.token("."); + this.print(node.property, node); + } + + function JSXSpreadAttribute(node) { + this.token("{"); + this.token("..."); + this.print(node.argument, node); + this.token("}"); + } + + function JSXExpressionContainer(node) { + this.token("{"); + this.print(node.expression, node); + this.token("}"); + } + + function JSXSpreadChild(node) { + this.token("{"); + this.token("..."); + this.print(node.expression, node); + this.token("}"); + } + + function JSXText(node) { + this.token(node.value); + } + + function JSXElement(node) { + var open = node.openingElement; + this.print(open, node); + if (open.selfClosing) return; + + this.indent(); + for (var _iterator = node.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var child = _ref; + + this.print(child, node); + } + this.dedent(); + + this.print(node.closingElement, node); + } + + function spaceSeparator() { + this.space(); + } + + function JSXOpeningElement(node) { + this.token("<"); + this.print(node.name, node); + if (node.attributes.length > 0) { + this.space(); + this.printJoin(node.attributes, node, { separator: spaceSeparator }); + } + if (node.selfClosing) { + this.space(); + this.token("/>"); + } else { + this.token(">"); + } + } + + function JSXClosingElement(node) { + this.token("</"); + this.print(node.name, node); + this.token(">"); + } + + function JSXEmptyExpression() {} + +/***/ }), +/* 302 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.FunctionDeclaration = undefined; + exports._params = _params; + exports._method = _method; + exports.FunctionExpression = FunctionExpression; + exports.ArrowFunctionExpression = ArrowFunctionExpression; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _params(node) { + var _this = this; + + this.print(node.typeParameters, node); + this.token("("); + this.printList(node.params, node, { + iterator: function iterator(node) { + if (node.optional) _this.token("?"); + _this.print(node.typeAnnotation, node); + } + }); + this.token(")"); + + if (node.returnType) { + this.print(node.returnType, node); + } + } + + function _method(node) { + var kind = node.kind; + var key = node.key; + + if (kind === "method" || kind === "init") { + if (node.generator) { + this.token("*"); + } + } + + if (kind === "get" || kind === "set") { + this.word(kind); + this.space(); + } + + if (node.async) { + this.word("async"); + this.space(); + } + + if (node.computed) { + this.token("["); + this.print(key, node); + this.token("]"); + } else { + this.print(key, node); + } + + this._params(node); + this.space(); + this.print(node.body, node); + } + + function FunctionExpression(node) { + if (node.async) { + this.word("async"); + this.space(); + } + this.word("function"); + if (node.generator) this.token("*"); + + if (node.id) { + this.space(); + this.print(node.id, node); + } else { + this.space(); + } + + this._params(node); + this.space(); + this.print(node.body, node); + } + + exports.FunctionDeclaration = FunctionExpression; + function ArrowFunctionExpression(node) { + if (node.async) { + this.word("async"); + this.space(); + } + + var firstParam = node.params[0]; + + if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) { + this.print(firstParam, node); + } else { + this._params(node); + } + + this.space(); + this.token("=>"); + this.space(); + + this.print(node.body, node); + } + + function hasTypes(node, param) { + return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments; + } + +/***/ }), +/* 303 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.ImportSpecifier = ImportSpecifier; + exports.ImportDefaultSpecifier = ImportDefaultSpecifier; + exports.ExportDefaultSpecifier = ExportDefaultSpecifier; + exports.ExportSpecifier = ExportSpecifier; + exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; + exports.ExportAllDeclaration = ExportAllDeclaration; + exports.ExportNamedDeclaration = ExportNamedDeclaration; + exports.ExportDefaultDeclaration = ExportDefaultDeclaration; + exports.ImportDeclaration = ImportDeclaration; + exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function ImportSpecifier(node) { + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + + this.print(node.imported, node); + if (node.local && node.local.name !== node.imported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); + } + } + + function ImportDefaultSpecifier(node) { + this.print(node.local, node); + } + + function ExportDefaultSpecifier(node) { + this.print(node.exported, node); + } + + function ExportSpecifier(node) { + this.print(node.local, node); + if (node.exported && node.local.name !== node.exported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); + } + } + + function ExportNamespaceSpecifier(node) { + this.token("*"); + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); + } + + function ExportAllDeclaration(node) { + this.word("export"); + this.space(); + this.token("*"); + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + this.semicolon(); + } + + function ExportNamedDeclaration() { + this.word("export"); + this.space(); + ExportDeclaration.apply(this, arguments); + } + + function ExportDefaultDeclaration() { + this.word("export"); + this.space(); + this.word("default"); + this.space(); + ExportDeclaration.apply(this, arguments); + } + + function ExportDeclaration(node) { + if (node.declaration) { + var declar = node.declaration; + this.print(declar, node); + if (!t.isStatement(declar)) this.semicolon(); + } else { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + + var specifiers = node.specifiers.slice(0); + + var hasSpecial = false; + while (true) { + var first = specifiers[0]; + if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) { + hasSpecial = true; + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.token(","); + this.space(); + } + } else { + break; + } + } + + if (specifiers.length || !specifiers.length && !hasSpecial) { + this.token("{"); + if (specifiers.length) { + this.space(); + this.printList(specifiers, node); + this.space(); + } + this.token("}"); + } + + if (node.source) { + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + } + + this.semicolon(); + } + } + + function ImportDeclaration(node) { + this.word("import"); + this.space(); + + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + + var specifiers = node.specifiers.slice(0); + if (specifiers && specifiers.length) { + while (true) { + var first = specifiers[0]; + if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) { + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.token(","); + this.space(); + } + } else { + break; + } + } + + if (specifiers.length) { + this.token("{"); + this.space(); + this.printList(specifiers, node); + this.space(); + this.token("}"); + } + + this.space(); + this.word("from"); + this.space(); + } + + this.print(node.source, node); + this.semicolon(); + } + + function ImportNamespaceSpecifier(node) { + this.token("*"); + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); + } + +/***/ }), +/* 304 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForAwaitStatement = exports.ForOfStatement = exports.ForInStatement = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.WithStatement = WithStatement; + exports.IfStatement = IfStatement; + exports.ForStatement = ForStatement; + exports.WhileStatement = WhileStatement; + exports.DoWhileStatement = DoWhileStatement; + exports.LabeledStatement = LabeledStatement; + exports.TryStatement = TryStatement; + exports.CatchClause = CatchClause; + exports.SwitchStatement = SwitchStatement; + exports.SwitchCase = SwitchCase; + exports.DebuggerStatement = DebuggerStatement; + exports.VariableDeclaration = VariableDeclaration; + exports.VariableDeclarator = VariableDeclarator; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function WithStatement(node) { + this.word("with"); + this.space(); + this.token("("); + this.print(node.object, node); + this.token(")"); + this.printBlock(node); + } + + function IfStatement(node) { + this.word("if"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.space(); + + var needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent)); + if (needsBlock) { + this.token("{"); + this.newline(); + this.indent(); + } + + this.printAndIndentOnComments(node.consequent, node); + + if (needsBlock) { + this.dedent(); + this.newline(); + this.token("}"); + } + + if (node.alternate) { + if (this.endsWith("}")) this.space(); + this.word("else"); + this.space(); + this.printAndIndentOnComments(node.alternate, node); + } + } + + function getLastStatement(statement) { + if (!t.isStatement(statement.body)) return statement; + return getLastStatement(statement.body); + } + + function ForStatement(node) { + this.word("for"); + this.space(); + this.token("("); + + this.inForStatementInitCounter++; + this.print(node.init, node); + this.inForStatementInitCounter--; + this.token(";"); + + if (node.test) { + this.space(); + this.print(node.test, node); + } + this.token(";"); + + if (node.update) { + this.space(); + this.print(node.update, node); + } + + this.token(")"); + this.printBlock(node); + } + + function WhileStatement(node) { + this.word("while"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.printBlock(node); + } + + var buildForXStatement = function buildForXStatement(op) { + return function (node) { + this.word("for"); + this.space(); + if (op === "await") { + this.word("await"); + this.space(); + } + this.token("("); + + this.print(node.left, node); + this.space(); + this.word(op === "await" ? "of" : op); + this.space(); + this.print(node.right, node); + this.token(")"); + this.printBlock(node); + }; + }; + + var ForInStatement = exports.ForInStatement = buildForXStatement("in"); + var ForOfStatement = exports.ForOfStatement = buildForXStatement("of"); + var ForAwaitStatement = exports.ForAwaitStatement = buildForXStatement("await"); + + function DoWhileStatement(node) { + this.word("do"); + this.space(); + this.print(node.body, node); + this.space(); + this.word("while"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.semicolon(); + } + + function buildLabelStatement(prefix) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "label"; + + return function (node) { + this.word(prefix); + + var label = node[key]; + if (label) { + this.space(); + + var terminatorState = this.startTerminatorless(); + this.print(label, node); + this.endTerminatorless(terminatorState); + } + + this.semicolon(); + }; + } + + var ContinueStatement = exports.ContinueStatement = buildLabelStatement("continue"); + var ReturnStatement = exports.ReturnStatement = buildLabelStatement("return", "argument"); + var BreakStatement = exports.BreakStatement = buildLabelStatement("break"); + var ThrowStatement = exports.ThrowStatement = buildLabelStatement("throw", "argument"); + + function LabeledStatement(node) { + this.print(node.label, node); + this.token(":"); + this.space(); + this.print(node.body, node); + } + + function TryStatement(node) { + this.word("try"); + this.space(); + this.print(node.block, node); + this.space(); + + if (node.handlers) { + this.print(node.handlers[0], node); + } else { + this.print(node.handler, node); + } + + if (node.finalizer) { + this.space(); + this.word("finally"); + this.space(); + this.print(node.finalizer, node); + } + } + + function CatchClause(node) { + this.word("catch"); + this.space(); + this.token("("); + this.print(node.param, node); + this.token(")"); + this.space(); + this.print(node.body, node); + } + + function SwitchStatement(node) { + this.word("switch"); + this.space(); + this.token("("); + this.print(node.discriminant, node); + this.token(")"); + this.space(); + this.token("{"); + + this.printSequence(node.cases, node, { + indent: true, + addNewlines: function addNewlines(leading, cas) { + if (!leading && node.cases[node.cases.length - 1] === cas) return -1; + } + }); + + this.token("}"); + } + + function SwitchCase(node) { + if (node.test) { + this.word("case"); + this.space(); + this.print(node.test, node); + this.token(":"); + } else { + this.word("default"); + this.token(":"); + } + + if (node.consequent.length) { + this.newline(); + this.printSequence(node.consequent, node, { indent: true }); + } + } + + function DebuggerStatement() { + this.word("debugger"); + this.semicolon(); + } + + function variableDeclarationIdent() { + this.token(","); + this.newline(); + if (this.endsWith("\n")) for (var i = 0; i < 4; i++) { + this.space(true); + } + } + + function constDeclarationIdent() { + this.token(","); + this.newline(); + if (this.endsWith("\n")) for (var i = 0; i < 6; i++) { + this.space(true); + } + } + + function VariableDeclaration(node, parent) { + this.word(node.kind); + this.space(); + + var hasInits = false; + + if (!t.isFor(parent)) { + for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var declar = _ref; + + if (declar.init) { + hasInits = true; + } + } + } + + var separator = void 0; + if (hasInits) { + separator = node.kind === "const" ? constDeclarationIdent : variableDeclarationIdent; + } + + this.printList(node.declarations, node, { separator: separator }); + + if (t.isFor(parent)) { + if (parent.left === node || parent.init === node) return; + } + + this.semicolon(); + } + + function VariableDeclarator(node) { + this.print(node.id, node); + this.print(node.id.typeAnnotation, node); + if (node.init) { + this.space(); + this.token("="); + this.space(); + this.print(node.init, node); + } + } + +/***/ }), +/* 305 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports.TaggedTemplateExpression = TaggedTemplateExpression; + exports.TemplateElement = TemplateElement; + exports.TemplateLiteral = TemplateLiteral; + function TaggedTemplateExpression(node) { + this.print(node.tag, node); + this.print(node.quasi, node); + } + + function TemplateElement(node, parent) { + var isFirst = parent.quasis[0] === node; + var isLast = parent.quasis[parent.quasis.length - 1] === node; + + var value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); + + this.token(value); + } + + function TemplateLiteral(node) { + var quasis = node.quasis; + + for (var i = 0; i < quasis.length; i++) { + this.print(quasis[i], node); + + if (i + 1 < quasis.length) { + this.print(node.expressions[i], node); + } + } + } + +/***/ }), +/* 306 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.AwaitExpression = exports.FunctionTypeAnnotation = undefined; + exports.NullableTypeAnnotation = NullableTypeAnnotation; + exports.UpdateExpression = UpdateExpression; + exports.ObjectExpression = ObjectExpression; + exports.DoExpression = DoExpression; + exports.Binary = Binary; + exports.BinaryExpression = BinaryExpression; + exports.SequenceExpression = SequenceExpression; + exports.YieldExpression = YieldExpression; + exports.ClassExpression = ClassExpression; + exports.UnaryLike = UnaryLike; + exports.FunctionExpression = FunctionExpression; + exports.ArrowFunctionExpression = ArrowFunctionExpression; + exports.ConditionalExpression = ConditionalExpression; + exports.AssignmentExpression = AssignmentExpression; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var PRECEDENCE = { + "||": 0, + "&&": 1, + "|": 2, + "^": 3, + "&": 4, + "==": 5, + "===": 5, + "!=": 5, + "!==": 5, + "<": 6, + ">": 6, + "<=": 6, + ">=": 6, + in: 6, + instanceof: 6, + ">>": 7, + "<<": 7, + ">>>": 7, + "+": 8, + "-": 8, + "*": 9, + "/": 9, + "%": 9, + "**": 10 + }; + + function NullableTypeAnnotation(node, parent) { + return t.isArrayTypeAnnotation(parent); + } + + exports.FunctionTypeAnnotation = NullableTypeAnnotation; + function UpdateExpression(node, parent) { + return t.isMemberExpression(parent) && parent.object === node; + } + + function ObjectExpression(node, parent, printStack) { + return isFirstInStatement(printStack, { considerArrow: true }); + } + + function DoExpression(node, parent, printStack) { + return isFirstInStatement(printStack); + } + + function Binary(node, parent) { + if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isUnaryLike(parent) || t.isMemberExpression(parent) && parent.object === node || t.isAwaitExpression(parent)) { + return true; + } + + if (t.isBinary(parent)) { + var parentOp = parent.operator; + var parentPos = PRECEDENCE[parentOp]; + + var nodeOp = node.operator; + var nodePos = PRECEDENCE[nodeOp]; + + if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) { + return true; + } + } + + return false; + } + + function BinaryExpression(node, parent) { + return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent)); + } + + function SequenceExpression(node, parent) { + + if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) { + return false; + } + + return true; + } + + function YieldExpression(node, parent) { + return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isConditionalExpression(parent) && node === parent.test; + } + + exports.AwaitExpression = YieldExpression; + function ClassExpression(node, parent, printStack) { + return isFirstInStatement(printStack, { considerDefaultExports: true }); + } + + function UnaryLike(node, parent) { + return t.isMemberExpression(parent, { object: node }) || t.isCallExpression(parent, { callee: node }) || t.isNewExpression(parent, { callee: node }); + } + + function FunctionExpression(node, parent, printStack) { + return isFirstInStatement(printStack, { considerDefaultExports: true }); + } + + function ArrowFunctionExpression(node, parent) { + if (t.isExportDeclaration(parent) || t.isBinaryExpression(parent) || t.isLogicalExpression(parent) || t.isUnaryExpression(parent) || t.isTaggedTemplateExpression(parent)) { + return true; + } + + return UnaryLike(node, parent); + } + + function ConditionalExpression(node, parent) { + if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, { test: node }) || t.isAwaitExpression(parent)) { + return true; + } + + return UnaryLike(node, parent); + } + + function AssignmentExpression(node) { + if (t.isObjectPattern(node.left)) { + return true; + } else { + return ConditionalExpression.apply(undefined, arguments); + } + } + + function isFirstInStatement(printStack) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$considerArrow = _ref.considerArrow, + considerArrow = _ref$considerArrow === undefined ? false : _ref$considerArrow, + _ref$considerDefaultE = _ref.considerDefaultExports, + considerDefaultExports = _ref$considerDefaultE === undefined ? false : _ref$considerDefaultE; + + var i = printStack.length - 1; + var node = printStack[i]; + i--; + var parent = printStack[i]; + while (i > 0) { + if (t.isExpressionStatement(parent, { expression: node }) || t.isTaggedTemplateExpression(parent) || considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node }) || considerArrow && t.isArrowFunctionExpression(parent, { body: node })) { + return true; + } + + if (t.isCallExpression(parent, { callee: node }) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, { object: node }) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node })) { + node = parent; + i--; + parent = printStack[i]; + } else { + return false; + } + } + + return false; + } + +/***/ }), +/* 307 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _map = __webpack_require__(579); + + var _map2 = _interopRequireDefault(_map); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function crawl(node) { + var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (t.isMemberExpression(node)) { + crawl(node.object, state); + if (node.computed) crawl(node.property, state); + } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { + crawl(node.left, state); + crawl(node.right, state); + } else if (t.isCallExpression(node)) { + state.hasCall = true; + crawl(node.callee, state); + } else if (t.isFunction(node)) { + state.hasFunction = true; + } else if (t.isIdentifier(node)) { + state.hasHelper = state.hasHelper || isHelper(node.callee); + } + + return state; + } + + function isHelper(node) { + if (t.isMemberExpression(node)) { + return isHelper(node.object) || isHelper(node.property); + } else if (t.isIdentifier(node)) { + return node.name === "require" || node.name[0] === "_"; + } else if (t.isCallExpression(node)) { + return isHelper(node.callee); + } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { + return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right); + } else { + return false; + } + } + + function isType(node) { + return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node); + } + + exports.nodes = { + AssignmentExpression: function AssignmentExpression(node) { + var state = crawl(node.right); + if (state.hasCall && state.hasHelper || state.hasFunction) { + return { + before: state.hasFunction, + after: true + }; + } + }, + SwitchCase: function SwitchCase(node, parent) { + return { + before: node.consequent.length || parent.cases[0] === node + }; + }, + LogicalExpression: function LogicalExpression(node) { + if (t.isFunction(node.left) || t.isFunction(node.right)) { + return { + after: true + }; + } + }, + Literal: function Literal(node) { + if (node.value === "use strict") { + return { + after: true + }; + } + }, + CallExpression: function CallExpression(node) { + if (t.isFunction(node.callee) || isHelper(node)) { + return { + before: true, + after: true + }; + } + }, + VariableDeclaration: function VariableDeclaration(node) { + for (var i = 0; i < node.declarations.length; i++) { + var declar = node.declarations[i]; + + var enabled = isHelper(declar.id) && !isType(declar.init); + if (!enabled) { + var state = crawl(declar.init); + enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; + } + + if (enabled) { + return { + before: true, + after: true + }; + } + } + }, + IfStatement: function IfStatement(node) { + if (t.isBlockStatement(node.consequent)) { + return { + before: true, + after: true + }; + } + } + }; + + exports.nodes.ObjectProperty = exports.nodes.ObjectTypeProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node, parent) { + if (parent.properties[0] === node) { + return { + before: true + }; + } + }; + + exports.list = { + VariableDeclaration: function VariableDeclaration(node) { + return (0, _map2.default)(node.declarations, "init"); + }, + ArrayExpression: function ArrayExpression(node) { + return node.elements; + }, + ObjectExpression: function ObjectExpression(node) { + return node.properties; + } + }; + + [["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function (_ref) { + var type = _ref[0], + amounts = _ref[1]; + + if (typeof amounts === "boolean") { + amounts = { after: amounts, before: amounts }; + } + [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { + exports.nodes[type] = function () { + return amounts; + }; + }); + }); + +/***/ }), +/* 308 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _assign = __webpack_require__(85); + + var _assign2 = _interopRequireDefault(_assign); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _weakSet = __webpack_require__(361); + + var _weakSet2 = _interopRequireDefault(_weakSet); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _find = __webpack_require__(570); + + var _find2 = _interopRequireDefault(_find); + + var _findLast = __webpack_require__(572); + + var _findLast2 = _interopRequireDefault(_findLast); + + var _isInteger = __webpack_require__(577); + + var _isInteger2 = _interopRequireDefault(_isInteger); + + var _repeat = __webpack_require__(273); + + var _repeat2 = _interopRequireDefault(_repeat); + + var _buffer = __webpack_require__(296); + + var _buffer2 = _interopRequireDefault(_buffer); + + var _node = __webpack_require__(183); + + var n = _interopRequireWildcard(_node); + + var _whitespace = __webpack_require__(310); + + var _whitespace2 = _interopRequireDefault(_whitespace); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var SCIENTIFIC_NOTATION = /e/i; + var ZERO_DECIMAL_INTEGER = /\.0+$/; + var NON_DECIMAL_LITERAL = /^0[box]/; + + var Printer = function () { + function Printer(format, map, tokens) { + (0, _classCallCheck3.default)(this, Printer); + this.inForStatementInitCounter = 0; + this._printStack = []; + this._indent = 0; + this._insideAux = false; + this._printedCommentStarts = {}; + this._parenPushNewlineState = null; + this._printAuxAfterOnNextUserNode = false; + this._printedComments = new _weakSet2.default(); + this._endsWithInteger = false; + this._endsWithWord = false; + + this.format = format || {}; + this._buf = new _buffer2.default(map); + this._whitespace = tokens.length > 0 ? new _whitespace2.default(tokens) : null; + } + + Printer.prototype.generate = function generate(ast) { + this.print(ast); + this._maybeAddAuxComment(); + + return this._buf.get(); + }; + + Printer.prototype.indent = function indent() { + if (this.format.compact || this.format.concise) return; + + this._indent++; + }; + + Printer.prototype.dedent = function dedent() { + if (this.format.compact || this.format.concise) return; + + this._indent--; + }; + + Printer.prototype.semicolon = function semicolon() { + var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + this._maybeAddAuxComment(); + this._append(";", !force); + }; + + Printer.prototype.rightBrace = function rightBrace() { + if (this.format.minified) { + this._buf.removeLastSemicolon(); + } + this.token("}"); + }; + + Printer.prototype.space = function space() { + var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (this.format.compact) return; + + if (this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n") || force) { + this._space(); + } + }; + + Printer.prototype.word = function word(str) { + if (this._endsWithWord) this._space(); + + this._maybeAddAuxComment(); + this._append(str); + + this._endsWithWord = true; + }; + + Printer.prototype.number = function number(str) { + this.word(str); + + this._endsWithInteger = (0, _isInteger2.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== "."; + }; + + Printer.prototype.token = function token(str) { + if (str === "--" && this.endsWith("!") || str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") || str[0] === "." && this._endsWithInteger) { + this._space(); + } + + this._maybeAddAuxComment(); + this._append(str); + }; + + Printer.prototype.newline = function newline(i) { + if (this.format.retainLines || this.format.compact) return; + + if (this.format.concise) { + this.space(); + return; + } + + if (this.endsWith("\n\n")) return; + + if (typeof i !== "number") i = 1; + + i = Math.min(2, i); + if (this.endsWith("{\n") || this.endsWith(":\n")) i--; + if (i <= 0) return; + + for (var j = 0; j < i; j++) { + this._newline(); + } + }; + + Printer.prototype.endsWith = function endsWith(str) { + return this._buf.endsWith(str); + }; + + Printer.prototype.removeTrailingNewline = function removeTrailingNewline() { + this._buf.removeTrailingNewline(); + }; + + Printer.prototype.source = function source(prop, loc) { + this._catchUp(prop, loc); + + this._buf.source(prop, loc); + }; + + Printer.prototype.withSource = function withSource(prop, loc, cb) { + this._catchUp(prop, loc); + + this._buf.withSource(prop, loc, cb); + }; + + Printer.prototype._space = function _space() { + this._append(" ", true); + }; + + Printer.prototype._newline = function _newline() { + this._append("\n", true); + }; + + Printer.prototype._append = function _append(str) { + var queue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + this._maybeAddParen(str); + this._maybeIndent(str); + + if (queue) this._buf.queue(str);else this._buf.append(str); + + this._endsWithWord = false; + this._endsWithInteger = false; + }; + + Printer.prototype._maybeIndent = function _maybeIndent(str) { + if (this._indent && this.endsWith("\n") && str[0] !== "\n") { + this._buf.queue(this._getIndent()); + } + }; + + Printer.prototype._maybeAddParen = function _maybeAddParen(str) { + var parenPushNewlineState = this._parenPushNewlineState; + if (!parenPushNewlineState) return; + this._parenPushNewlineState = null; + + var i = void 0; + for (i = 0; i < str.length && str[i] === " "; i++) { + continue; + }if (i === str.length) return; + + var cha = str[i]; + if (cha === "\n" || cha === "/") { + this.token("("); + this.indent(); + parenPushNewlineState.printed = true; + } + }; + + Printer.prototype._catchUp = function _catchUp(prop, loc) { + if (!this.format.retainLines) return; + + var pos = loc ? loc[prop] : null; + if (pos && pos.line !== null) { + var count = pos.line - this._buf.getCurrentLine(); + + for (var i = 0; i < count; i++) { + this._newline(); + } + } + }; + + Printer.prototype._getIndent = function _getIndent() { + return (0, _repeat2.default)(this.format.indent.style, this._indent); + }; + + Printer.prototype.startTerminatorless = function startTerminatorless() { + return this._parenPushNewlineState = { + printed: false + }; + }; + + Printer.prototype.endTerminatorless = function endTerminatorless(state) { + if (state.printed) { + this.dedent(); + this.newline(); + this.token(")"); + } + }; + + Printer.prototype.print = function print(node, parent) { + var _this = this; + + if (!node) return; + + var oldConcise = this.format.concise; + if (node._compact) { + this.format.concise = true; + } + + var printMethod = this[node.type]; + if (!printMethod) { + throw new ReferenceError("unknown node of type " + (0, _stringify2.default)(node.type) + " with constructor " + (0, _stringify2.default)(node && node.constructor.name)); + } + + this._printStack.push(node); + + var oldInAux = this._insideAux; + this._insideAux = !node.loc; + this._maybeAddAuxComment(this._insideAux && !oldInAux); + + var needsParens = n.needsParens(node, parent, this._printStack); + if (this.format.retainFunctionParens && node.type === "FunctionExpression" && node.extra && node.extra.parenthesized) { + needsParens = true; + } + if (needsParens) this.token("("); + + this._printLeadingComments(node, parent); + + var loc = t.isProgram(node) || t.isFile(node) ? null : node.loc; + this.withSource("start", loc, function () { + _this[node.type](node, parent); + }); + + this._printTrailingComments(node, parent); + + if (needsParens) this.token(")"); + + this._printStack.pop(); + + this.format.concise = oldConcise; + this._insideAux = oldInAux; + }; + + Printer.prototype._maybeAddAuxComment = function _maybeAddAuxComment(enteredPositionlessNode) { + if (enteredPositionlessNode) this._printAuxBeforeComment(); + if (!this._insideAux) this._printAuxAfterComment(); + }; + + Printer.prototype._printAuxBeforeComment = function _printAuxBeforeComment() { + if (this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = true; + + var comment = this.format.auxiliaryCommentBefore; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }); + } + }; + + Printer.prototype._printAuxAfterComment = function _printAuxAfterComment() { + if (!this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = false; + + var comment = this.format.auxiliaryCommentAfter; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }); + } + }; + + Printer.prototype.getPossibleRaw = function getPossibleRaw(node) { + var extra = node.extra; + if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { + return extra.raw; + } + }; + + Printer.prototype.printJoin = function printJoin(nodes, parent) { + var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (!nodes || !nodes.length) return; + + if (opts.indent) this.indent(); + + var newlineOpts = { + addNewlines: opts.addNewlines + }; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (!node) continue; + + if (opts.statement) this._printNewline(true, node, parent, newlineOpts); + + this.print(node, parent); + + if (opts.iterator) { + opts.iterator(node, i); + } + + if (opts.separator && i < nodes.length - 1) { + opts.separator.call(this); + } + + if (opts.statement) this._printNewline(false, node, parent, newlineOpts); + } + + if (opts.indent) this.dedent(); + }; + + Printer.prototype.printAndIndentOnComments = function printAndIndentOnComments(node, parent) { + var indent = !!node.leadingComments; + if (indent) this.indent(); + this.print(node, parent); + if (indent) this.dedent(); + }; + + Printer.prototype.printBlock = function printBlock(parent) { + var node = parent.body; + + if (!t.isEmptyStatement(node)) { + this.space(); + } + + this.print(node, parent); + }; + + Printer.prototype._printTrailingComments = function _printTrailingComments(node, parent) { + this._printComments(this._getComments(false, node, parent)); + }; + + Printer.prototype._printLeadingComments = function _printLeadingComments(node, parent) { + this._printComments(this._getComments(true, node, parent)); + }; + + Printer.prototype.printInnerComments = function printInnerComments(node) { + var indent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + if (!node.innerComments) return; + if (indent) this.indent(); + this._printComments(node.innerComments); + if (indent) this.dedent(); + }; + + Printer.prototype.printSequence = function printSequence(nodes, parent) { + var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + opts.statement = true; + return this.printJoin(nodes, parent, opts); + }; + + Printer.prototype.printList = function printList(items, parent) { + var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (opts.separator == null) { + opts.separator = commaSeparator; + } + + return this.printJoin(items, parent, opts); + }; + + Printer.prototype._printNewline = function _printNewline(leading, node, parent, opts) { + var _this2 = this; + + if (this.format.retainLines || this.format.compact) return; + + if (this.format.concise) { + this.space(); + return; + } + + var lines = 0; + + if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) { + if (leading) { + var _comments = node.leadingComments; + var _comment = _comments && (0, _find2.default)(_comments, function (comment) { + return !!comment.loc && _this2.format.shouldPrintComment(comment.value); + }); + + lines = this._whitespace.getNewlinesBefore(_comment || node); + } else { + var _comments2 = node.trailingComments; + var _comment2 = _comments2 && (0, _findLast2.default)(_comments2, function (comment) { + return !!comment.loc && _this2.format.shouldPrintComment(comment.value); + }); + + lines = this._whitespace.getNewlinesAfter(_comment2 || node); + } + } else { + if (!leading) lines++; + if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; + + var needs = n.needsWhitespaceAfter; + if (leading) needs = n.needsWhitespaceBefore; + if (needs(node, parent)) lines++; + + if (!this._buf.hasContent()) lines = 0; + } + + this.newline(lines); + }; + + Printer.prototype._getComments = function _getComments(leading, node) { + return node && (leading ? node.leadingComments : node.trailingComments) || []; + }; + + Printer.prototype._printComment = function _printComment(comment) { + var _this3 = this; + + if (!this.format.shouldPrintComment(comment.value)) return; + + if (comment.ignore) return; + + if (this._printedComments.has(comment)) return; + this._printedComments.add(comment); + + if (comment.start != null) { + if (this._printedCommentStarts[comment.start]) return; + this._printedCommentStarts[comment.start] = true; + } + + this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0); + + if (!this.endsWith("[") && !this.endsWith("{")) this.space(); + + var val = comment.type === "CommentLine" ? "//" + comment.value + "\n" : "/*" + comment.value + "*/"; + + if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) { + var offset = comment.loc && comment.loc.start.column; + if (offset) { + var newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); + val = val.replace(newlineRegex, "\n"); + } + + var indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); + val = val.replace(/\n(?!$)/g, "\n" + (0, _repeat2.default)(" ", indentSize)); + } + + this.withSource("start", comment.loc, function () { + _this3._append(val); + }); + + this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + (comment.type === "CommentLine" ? -1 : 0)); + }; + + Printer.prototype._printComments = function _printComments(comments) { + if (!comments || !comments.length) return; + + for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var _comment3 = _ref; + + this._printComment(_comment3); + } + }; + + return Printer; + }(); + + exports.default = Printer; + + function commaSeparator() { + this.token(","); + this.space(); + } + + var _arr = [__webpack_require__(305), __webpack_require__(299), __webpack_require__(304), __webpack_require__(298), __webpack_require__(302), __webpack_require__(303), __webpack_require__(122), __webpack_require__(300), __webpack_require__(297), __webpack_require__(301)]; + for (var _i2 = 0; _i2 < _arr.length; _i2++) { + var generator = _arr[_i2]; + (0, _assign2.default)(Printer.prototype, generator); + } + module.exports = exports["default"]; + +/***/ }), +/* 309 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _sourceMap = __webpack_require__(284); + + var _sourceMap2 = _interopRequireDefault(_sourceMap); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var SourceMap = function () { + function SourceMap(opts, code) { + (0, _classCallCheck3.default)(this, SourceMap); + + this._cachedMap = null; + this._code = code; + this._opts = opts; + this._rawMappings = []; + } + + SourceMap.prototype.get = function get() { + if (!this._cachedMap) { + var map = this._cachedMap = new _sourceMap2.default.SourceMapGenerator({ + file: this._opts.sourceMapTarget, + sourceRoot: this._opts.sourceRoot + }); + + var code = this._code; + if (typeof code === "string") { + map.setSourceContent(this._opts.sourceFileName, code); + } else if ((typeof code === "undefined" ? "undefined" : (0, _typeof3.default)(code)) === "object") { + (0, _keys2.default)(code).forEach(function (sourceFileName) { + map.setSourceContent(sourceFileName, code[sourceFileName]); + }); + } + + this._rawMappings.forEach(map.addMapping, map); + } + + return this._cachedMap.toJSON(); + }; + + SourceMap.prototype.getRawMappings = function getRawMappings() { + return this._rawMappings.slice(); + }; + + SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, identifierName, filename) { + if (this._lastGenLine !== generatedLine && line === null) return; + + if (this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) { + return; + } + + this._cachedMap = null; + this._lastGenLine = generatedLine; + this._lastSourceLine = line; + this._lastSourceColumn = column; + + this._rawMappings.push({ + name: identifierName || undefined, + generated: { + line: generatedLine, + column: generatedColumn + }, + source: line == null ? undefined : filename || this._opts.sourceFileName, + original: line == null ? undefined : { + line: line, + column: column + } + }); + }; + + return SourceMap; + }(); + + exports.default = SourceMap; + module.exports = exports["default"]; + +/***/ }), +/* 310 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var Whitespace = function () { + function Whitespace(tokens) { + (0, _classCallCheck3.default)(this, Whitespace); + + this.tokens = tokens; + this.used = {}; + } + + Whitespace.prototype.getNewlinesBefore = function getNewlinesBefore(node) { + var startToken = void 0; + var endToken = void 0; + var tokens = this.tokens; + + var index = this._findToken(function (token) { + return token.start - node.start; + }, 0, tokens.length); + if (index >= 0) { + while (index && node.start === tokens[index - 1].start) { + --index; + }startToken = tokens[index - 1]; + endToken = tokens[index]; + } + + return this._getNewlinesBetween(startToken, endToken); + }; + + Whitespace.prototype.getNewlinesAfter = function getNewlinesAfter(node) { + var startToken = void 0; + var endToken = void 0; + var tokens = this.tokens; + + var index = this._findToken(function (token) { + return token.end - node.end; + }, 0, tokens.length); + if (index >= 0) { + while (index && node.end === tokens[index - 1].end) { + --index; + }startToken = tokens[index]; + endToken = tokens[index + 1]; + if (endToken.type.label === ",") endToken = tokens[index + 2]; + } + + if (endToken && endToken.type.label === "eof") { + return 1; + } else { + return this._getNewlinesBetween(startToken, endToken); + } + }; + + Whitespace.prototype._getNewlinesBetween = function _getNewlinesBetween(startToken, endToken) { + if (!endToken || !endToken.loc) return 0; + + var start = startToken ? startToken.loc.end.line : 1; + var end = endToken.loc.start.line; + var lines = 0; + + for (var line = start; line < end; line++) { + if (typeof this.used[line] === "undefined") { + this.used[line] = true; + lines++; + } + } + + return lines; + }; + + Whitespace.prototype._findToken = function _findToken(test, start, end) { + if (start >= end) return -1; + var middle = start + end >>> 1; + var match = test(this.tokens[middle]); + if (match < 0) { + return this._findToken(test, middle + 1, end); + } else if (match > 0) { + return this._findToken(test, start, middle); + } else if (match === 0) { + return middle; + } + return -1; + }; + + return Whitespace; + }(); + + exports.default = Whitespace; + module.exports = exports["default"]; + +/***/ }), +/* 311 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = bindifyDecorators; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function bindifyDecorators(decorators) { + for (var _iterator = decorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var decoratorPath = _ref; + + var decorator = decoratorPath.node; + var expression = decorator.expression; + if (!t.isMemberExpression(expression)) continue; + + var temp = decoratorPath.scope.maybeGenerateMemoised(expression.object); + var ref = void 0; + + var nodes = []; + + if (temp) { + ref = temp; + nodes.push(t.assignmentExpression("=", temp, expression.object)); + } else { + ref = expression.object; + } + + nodes.push(t.callExpression(t.memberExpression(t.memberExpression(ref, expression.property, expression.computed), t.identifier("bind")), [ref])); + + if (nodes.length === 1) { + decorator.expression = nodes[0]; + } else { + decorator.expression = t.sequenceExpression(nodes); + } + } + } + module.exports = exports["default"]; + +/***/ }), +/* 312 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (opts) { + var visitor = {}; + + function isAssignment(node) { + return node && node.operator === opts.operator + "="; + } + + function buildAssignment(left, right) { + return t.assignmentExpression("=", left, right); + } + + visitor.ExpressionStatement = function (path, file) { + if (path.isCompletionRecord()) return; + + var expr = path.node.expression; + if (!isAssignment(expr)) return; + + var nodes = []; + var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(expr.left, nodes, file, path.scope, true); + + nodes.push(t.expressionStatement(buildAssignment(exploded.ref, opts.build(exploded.uid, expr.right)))); + + path.replaceWithMultiple(nodes); + }; + + visitor.AssignmentExpression = function (path, file) { + var node = path.node, + scope = path.scope; + + if (!isAssignment(node)) return; + + var nodes = []; + var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(node.left, nodes, file, scope); + nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right))); + path.replaceWithMultiple(nodes); + }; + + visitor.BinaryExpression = function (path) { + var node = path.node; + + if (node.operator === opts.operator) { + path.replaceWith(opts.build(node.left, node.right)); + } + }; + + return visitor; + }; + + var _babelHelperExplodeAssignableExpression = __webpack_require__(314); + + var _babelHelperExplodeAssignableExpression2 = _interopRequireDefault(_babelHelperExplodeAssignableExpression); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 313 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (path) { + var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : path.scope; + var node = path.node; + + var container = t.functionExpression(null, [], node.body, node.generator, node.async); + + var callee = container; + var args = []; + + (0, _babelHelperHoistVariables2.default)(path, function (id) { + return scope.push({ id: id }); + }); + + var state = { + foundThis: false, + foundArguments: false + }; + + path.traverse(visitor, state); + + if (state.foundArguments) { + callee = t.memberExpression(container, t.identifier("apply")); + args = []; + + if (state.foundThis) { + args.push(t.thisExpression()); + } + + if (state.foundArguments) { + if (!state.foundThis) args.push(t.nullLiteral()); + args.push(t.identifier("arguments")); + } + } + + var call = t.callExpression(callee, args); + if (node.generator) call = t.yieldExpression(call, true); + + return t.returnStatement(call); + }; + + var _babelHelperHoistVariables = __webpack_require__(186); + + var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var visitor = { + enter: function enter(path, state) { + if (path.isThisExpression()) { + state.foundThis = true; + } + + if (path.isReferencedIdentifier({ name: "arguments" })) { + state.foundArguments = true; + } + }, + Function: function Function(path) { + path.skip(); + } + }; + + module.exports = exports["default"]; + +/***/ }), +/* 314 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (node, nodes, file, scope, allowedSingleIdent) { + var obj = void 0; + if (t.isIdentifier(node) && allowedSingleIdent) { + obj = node; + } else { + obj = getObjRef(node, nodes, file, scope); + } + + var ref = void 0, + uid = void 0; + + if (t.isIdentifier(node)) { + ref = node; + uid = obj; + } else { + var prop = getPropRef(node, nodes, file, scope); + var computed = node.computed || t.isLiteral(prop); + uid = ref = t.memberExpression(obj, prop, computed); + } + + return { + uid: uid, + ref: ref + }; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function getObjRef(node, nodes, file, scope) { + var ref = void 0; + if (t.isSuper(node)) { + return node; + } else if (t.isIdentifier(node)) { + if (scope.hasBinding(node.name)) { + return node; + } else { + ref = node; + } + } else if (t.isMemberExpression(node)) { + ref = node.object; + + if (t.isSuper(ref) || t.isIdentifier(ref) && scope.hasBinding(ref.name)) { + return ref; + } + } else { + throw new Error("We can't explode this node type " + node.type); + } + + var temp = scope.generateUidIdentifierBasedOnNode(ref); + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, ref)])); + return temp; + } + + function getPropRef(node, nodes, file, scope) { + var prop = node.property; + var key = t.toComputedKey(node, prop); + if (t.isLiteral(key) && t.isPureish(key)) return key; + + var temp = scope.generateUidIdentifierBasedOnNode(prop); + nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, prop)])); + return temp; + } + + module.exports = exports["default"]; + +/***/ }), +/* 315 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (classPath) { + classPath.assertClass(); + + var memoisedExpressions = []; + + function maybeMemoise(path) { + if (!path.node || path.isPure()) return; + + var uid = classPath.scope.generateDeclaredUidIdentifier(); + memoisedExpressions.push(t.assignmentExpression("=", uid, path.node)); + path.replaceWith(uid); + } + + function memoiseDecorators(paths) { + if (!Array.isArray(paths) || !paths.length) return; + + paths = paths.reverse(); + + (0, _babelHelperBindifyDecorators2.default)(paths); + + for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var path = _ref; + + maybeMemoise(path); + } + } + + maybeMemoise(classPath.get("superClass")); + memoiseDecorators(classPath.get("decorators"), true); + + var methods = classPath.get("body.body"); + for (var _iterator2 = methods, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var methodPath = _ref2; + + if (methodPath.is("computed")) { + maybeMemoise(methodPath.get("key")); + } + + if (methodPath.has("decorators")) { + memoiseDecorators(classPath.get("decorators")); + } + } + + if (memoisedExpressions) { + classPath.insertBefore(memoisedExpressions.map(function (expr) { + return t.expressionStatement(expr); + })); + } + }; + + var _babelHelperBindifyDecorators = __webpack_require__(311); + + var _babelHelperBindifyDecorators2 = _interopRequireDefault(_babelHelperBindifyDecorators); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 316 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (path, helpers) { + var node = path.node, + scope = path.scope, + parent = path.parent; + + var stepKey = scope.generateUidIdentifier("step"); + var stepValue = scope.generateUidIdentifier("value"); + var left = node.left; + var declar = void 0; + + if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { + declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue)); + } else if (t.isVariableDeclaration(left)) { + declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]); + } + + var template = buildForAwait(); + + (0, _babelTraverse2.default)(template, forAwaitVisitor, null, { + ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), + ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), + ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), + ITERATOR_KEY: scope.generateUidIdentifier("iterator"), + GET_ITERATOR: helpers.getAsyncIterator, + OBJECT: node.right, + STEP_VALUE: stepValue, + STEP_KEY: stepKey, + AWAIT: helpers.wrapAwait + }); + + template = template.body.body; + + var isLabeledParent = t.isLabeledStatement(parent); + var tryBody = template[3].block.body; + var loop = tryBody[0]; + + if (isLabeledParent) { + tryBody[0] = t.labeledStatement(parent.label, loop); + } + + return { + replaceParent: isLabeledParent, + node: template, + declar: declar, + loop: loop + }; + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTraverse = __webpack_require__(7); + + var _babelTraverse2 = _interopRequireDefault(_babelTraverse); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var buildForAwait = (0, _babelTemplate2.default)("\n function* wrapper() {\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;\n (\n STEP_KEY = yield AWAIT(ITERATOR_KEY.next()),\n ITERATOR_COMPLETION = STEP_KEY.done,\n STEP_VALUE = yield AWAIT(STEP_KEY.value),\n !ITERATOR_COMPLETION\n );\n ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n yield AWAIT(ITERATOR_KEY.return());\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n"); + + var forAwaitVisitor = { + noScope: true, + + Identifier: function Identifier(path, replacements) { + if (path.node.name in replacements) { + path.replaceInline(replacements[path.node.name]); + } + }, + CallExpression: function CallExpression(path, replacements) { + var callee = path.node.callee; + + if (t.isIdentifier(callee) && callee.name === "AWAIT" && !replacements.AWAIT) { + path.replaceWith(path.node.arguments[0]); + } + } + }; + + module.exports = exports["default"]; + +/***/ }), +/* 317 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var helpers = {}; + exports.default = helpers; + + helpers.typeof = (0, _babelTemplate2.default)("\n (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\")\n ? function (obj) { return typeof obj; }\n : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype\n ? \"symbol\"\n : typeof obj;\n };\n"); + + helpers.jsx = (0, _babelTemplate2.default)("\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === \"function\" && Symbol.for && Symbol.for(\"react.element\")) || 0xeac7;\n\n return function createRawReactElement (type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we're going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = {};\n }\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : '' + key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n"); + + helpers.asyncIterator = (0, _babelTemplate2.default)("\n (function (iterable) {\n if (typeof Symbol === \"function\") {\n if (Symbol.asyncIterator) {\n var method = iterable[Symbol.asyncIterator];\n if (method != null) return method.call(iterable);\n }\n if (Symbol.iterator) {\n return iterable[Symbol.iterator]();\n }\n }\n throw new TypeError(\"Object is not async iterable\");\n })\n"); + + helpers.asyncGenerator = (0, _babelTemplate2.default)("\n (function () {\n function AwaitValue(value) {\n this.value = value;\n }\n\n function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg)\n var value = result.value;\n if (value instanceof AwaitValue) {\n Promise.resolve(value.value).then(\n function (arg) { resume(\"next\", arg); },\n function (arg) { resume(\"throw\", arg); });\n } else {\n settle(result.done ? \"return\" : \"normal\", result.value);\n }\n } catch (err) {\n settle(\"throw\", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case \"return\":\n front.resolve({ value: value, done: true });\n break;\n case \"throw\":\n front.reject(value);\n break;\n default:\n front.resolve({ value: value, done: false });\n break;\n }\n\n front = front.next;\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n // Hide \"return\" method if generator return is not supported\n if (typeof gen.return !== \"function\") {\n this.return = undefined;\n }\n }\n\n if (typeof Symbol === \"function\" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; };\n }\n\n AsyncGenerator.prototype.next = function (arg) { return this._invoke(\"next\", arg); };\n AsyncGenerator.prototype.throw = function (arg) { return this._invoke(\"throw\", arg); };\n AsyncGenerator.prototype.return = function (arg) { return this._invoke(\"return\", arg); };\n\n return {\n wrap: function (fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n },\n await: function (value) {\n return new AwaitValue(value);\n }\n };\n\n })()\n"); + + helpers.asyncGeneratorDelegate = (0, _babelTemplate2.default)("\n (function (inner, awaitWrap) {\n var iter = {}, waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) { resolve(inner[key](value)); });\n return { done: false, value: awaitWrap(value) };\n };\n\n if (typeof Symbol === \"function\" && Symbol.iterator) {\n iter[Symbol.iterator] = function () { return this; };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n return pump(\"next\", value);\n };\n\n if (typeof inner.throw === \"function\") {\n iter.throw = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n return pump(\"throw\", value);\n };\n }\n\n if (typeof inner.return === \"function\") {\n iter.return = function (value) {\n return pump(\"return\", value);\n };\n }\n\n return iter;\n })\n"); + + helpers.asyncToGenerator = (0, _babelTemplate2.default)("\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n step(\"next\", value);\n }, function (err) {\n step(\"throw\", err);\n });\n }\n }\n\n return step(\"next\");\n });\n };\n })\n"); + + helpers.classCallCheck = (0, _babelTemplate2.default)("\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n });\n"); + + helpers.createClass = (0, _babelTemplate2.default)("\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n"); + + helpers.defineEnumerableProperties = (0, _babelTemplate2.default)("\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n"); + + helpers.defaults = (0, _babelTemplate2.default)("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n"); + + helpers.defineProperty = (0, _babelTemplate2.default)("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n"); + + helpers.extends = (0, _babelTemplate2.default)("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n"); + + helpers.get = (0, _babelTemplate2.default)("\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n"); + + helpers.inherits = (0, _babelTemplate2.default)("\n (function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n"); + + helpers.instanceof = (0, _babelTemplate2.default)("\n (function (left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n"); + + helpers.interopRequireDefault = (0, _babelTemplate2.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n"); + + helpers.interopRequireWildcard = (0, _babelTemplate2.default)("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n"); + + helpers.newArrowCheck = (0, _babelTemplate2.default)("\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n });\n"); + + helpers.objectDestructuringEmpty = (0, _babelTemplate2.default)("\n (function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n });\n"); + + helpers.objectWithoutProperties = (0, _babelTemplate2.default)("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n"); + + helpers.possibleConstructorReturn = (0, _babelTemplate2.default)("\n (function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n });\n"); + + helpers.selfGlobal = (0, _babelTemplate2.default)("\n typeof global === \"undefined\" ? self : global\n"); + + helpers.set = (0, _babelTemplate2.default)("\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if (\"value\" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n"); + + helpers.slicedToArray = (0, _babelTemplate2.default)("\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n })();\n"); + + helpers.slicedToArrayLoose = (0, _babelTemplate2.default)("\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n });\n"); + + helpers.taggedTemplateLiteral = (0, _babelTemplate2.default)("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n"); + + helpers.taggedTemplateLiteralLoose = (0, _babelTemplate2.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n"); + + helpers.temporalRef = (0, _babelTemplate2.default)("\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + \" is not defined - temporal dead zone\");\n } else {\n return val;\n }\n })\n"); + + helpers.temporalUndefined = (0, _babelTemplate2.default)("\n ({})\n"); + + helpers.toArray = (0, _babelTemplate2.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n"); + + helpers.toConsumableArray = (0, _babelTemplate2.default)("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n"); + module.exports = exports["default"]; + +/***/ }), +/* 318 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + pre: function pre(file) { + file.set("helpersNamespace", t.identifier("babelHelpers")); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 319 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Created at 16/5/18. + * @Author Ling. + * @Email i@zeroling.com + */ + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var babylon = __webpack_require__(87); + + module.exports = function (babel) { + var t = babel.types; + // cache for performance + var parseMap = {}; + + return { + visitor: { + Identifier: function Identifier(path, state) { + if (path.parent.type === 'MemberExpression') { + return; + } + if (path.parent.type === 'ClassMethod') { + return; + } + if (path.isPure()) { + return; + } + if (!state.opts.hasOwnProperty(path.node.name)) { + return; + } + var replacementDescriptor = state.opts[path.node.name]; + if (replacementDescriptor === undefined || replacementDescriptor === null) { + replacementDescriptor = t.identifier(String(replacementDescriptor)); + } + + var type = typeof replacementDescriptor === 'undefined' ? 'undefined' : _typeof(replacementDescriptor); + if (type === 'string' || type === 'boolean') { + replacementDescriptor = { + type: type, + replacement: replacementDescriptor + }; + } else if (t.isNode(replacementDescriptor)) { + replacementDescriptor = { + type: 'node', + replacement: replacementDescriptor + }; + } else if (type === 'object' && replacementDescriptor.type === 'node' && typeof replacementDescriptor.replacement === 'string') { + replacementDescriptor.replacement = parseMap[replacementDescriptor.replacement] ? parseMap[replacementDescriptor.replacement] : babylon.parseExpression(replacementDescriptor.replacement); + } + + var replacement = replacementDescriptor.replacement; + switch (replacementDescriptor.type) { + case 'boolean': + path.replaceWith(t.booleanLiteral(replacement)); + break; + case 'node': + if (t.isNode(replacement)) { + path.replaceWith(replacement); + } + break; + default: + // treat as string + var str = String(replacement); + path.replaceWith(t.stringLiteral(str)); + break; + } + } + } + }; + }; + +/***/ }), +/* 320 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("dynamicImport"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 321 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("functionSent"); + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 322 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + inherits: __webpack_require__(65) + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 323 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + var yieldStarVisitor = { + Function: function Function(path) { + path.skip(); + }, + YieldExpression: function YieldExpression(_ref2, state) { + var node = _ref2.node; + + if (!node.delegate) return; + var callee = state.addHelper("asyncGeneratorDelegate"); + node.argument = t.callExpression(callee, [t.callExpression(state.addHelper("asyncIterator"), [node.argument]), t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("await"))]); + } + }; + + return { + inherits: __webpack_require__(191), + visitor: { + Function: function Function(path, state) { + if (!path.node.async || !path.node.generator) return; + + path.traverse(yieldStarVisitor, state); + + (0, _babelHelperRemapAsyncToGenerator2.default)(path, state.file, { + wrapAsync: t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("wrap")), + wrapAwait: t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("await")) + }); + } + } + }; + }; + + var _babelHelperRemapAsyncToGenerator = __webpack_require__(123); + + var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 324 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + inherits: __webpack_require__(65), + + visitor: { + Function: function Function(path, state) { + if (!path.node.async || path.node.generator) return; + + (0, _babelHelperRemapAsyncToGenerator2.default)(path, state.file, { + wrapAsync: state.addImport(state.opts.module, state.opts.method) + }); + } + } + }; + }; + + var _babelHelperRemapAsyncToGenerator = __webpack_require__(123); + + var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 325 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.default = function (_ref) { + var t = _ref.types; + + /** + * Add a helper to take an initial descriptor, apply some decorators to it, and optionally + * define the property. + */ + function ensureApplyDecoratedDescriptorHelper(path, state) { + if (!state.applyDecoratedDescriptor) { + state.applyDecoratedDescriptor = path.scope.generateUidIdentifier('applyDecoratedDescriptor'); + var helper = buildApplyDecoratedDescriptor({ + NAME: state.applyDecoratedDescriptor + }); + path.scope.getProgramParent().path.unshiftContainer('body', helper); + } + + return state.applyDecoratedDescriptor; + } + + /** + * Add a helper to call as a replacement for class property definition. + */ + function ensureInitializerDefineProp(path, state) { + if (!state.initializerDefineProp) { + state.initializerDefineProp = path.scope.generateUidIdentifier('initDefineProp'); + var helper = buildInitializerDefineProperty({ + NAME: state.initializerDefineProp + }); + path.scope.getProgramParent().path.unshiftContainer('body', helper); + } + + return state.initializerDefineProp; + } + + /** + * Add a helper that will throw a useful error if the transform fails to detect the class + * property assignment, so users know something failed. + */ + function ensureInitializerWarning(path, state) { + if (!state.initializerWarningHelper) { + state.initializerWarningHelper = path.scope.generateUidIdentifier('initializerWarningHelper'); + var helper = buildInitializerWarningHelper({ + NAME: state.initializerWarningHelper + }); + path.scope.getProgramParent().path.unshiftContainer('body', helper); + } + + return state.initializerWarningHelper; + } + + /** + * If the decorator expressions are non-identifiers, hoist them to before the class so we can be sure + * that they are evaluated in order. + */ + function applyEnsureOrdering(path) { + // TODO: This should probably also hoist computed properties. + var decorators = (path.isClass() ? [path].concat(path.get('body.body')) : path.get('properties')).reduce(function (acc, prop) { + return acc.concat(prop.node.decorators || []); + }, []); + + var identDecorators = decorators.filter(function (decorator) { + return !t.isIdentifier(decorator.expression); + }); + if (identDecorators.length === 0) return; + + return t.sequenceExpression(identDecorators.map(function (decorator) { + var expression = decorator.expression; + var id = decorator.expression = path.scope.generateDeclaredUidIdentifier('dec'); + return t.assignmentExpression('=', id, expression); + }).concat([path.node])); + } + + /** + * Given a class expression with class-level decorators, create a new expression + * with the proper decorated behavior. + */ + function applyClassDecorators(classPath, state) { + var decorators = classPath.node.decorators || []; + classPath.node.decorators = null; + + if (decorators.length === 0) return; + + var name = classPath.scope.generateDeclaredUidIdentifier('class'); + + return decorators.map(function (dec) { + return dec.expression; + }).reverse().reduce(function (acc, decorator) { + return buildClassDecorator({ + CLASS_REF: name, + DECORATOR: decorator, + INNER: acc + }).expression; + }, classPath.node); + } + + /** + * Given a class expression with method-level decorators, create a new expression + * with the proper decorated behavior. + */ + function applyMethodDecorators(path, state) { + var hasMethodDecorators = path.node.body.body.some(function (node) { + return (node.decorators || []).length > 0; + }); + + if (!hasMethodDecorators) return; + + return applyTargetDecorators(path, state, path.node.body.body); + } + + /** + * Given an object expression with property decorators, create a new expression + * with the proper decorated behavior. + */ + function applyObjectDecorators(path, state) { + var hasMethodDecorators = path.node.properties.some(function (node) { + return (node.decorators || []).length > 0; + }); + + if (!hasMethodDecorators) return; + + return applyTargetDecorators(path, state, path.node.properties); + } + + /** + * A helper to pull out property decorators into a sequence expression. + */ + function applyTargetDecorators(path, state, decoratedProps) { + var descName = path.scope.generateDeclaredUidIdentifier('desc'); + var valueTemp = path.scope.generateDeclaredUidIdentifier('value'); + + var name = path.scope.generateDeclaredUidIdentifier(path.isClass() ? 'class' : 'obj'); + + var exprs = decoratedProps.reduce(function (acc, node) { + var decorators = node.decorators || []; + node.decorators = null; + + if (decorators.length === 0) return acc; + + if (node.computed) { + throw path.buildCodeFrameError('Computed method/property decorators are not yet supported.'); + } + + var property = t.isLiteral(node.key) ? node.key : t.stringLiteral(node.key.name); + + var target = path.isClass() && !node.static ? buildClassPrototype({ + CLASS_REF: name + }).expression : name; + + if (t.isClassProperty(node, { static: false })) { + var descriptor = path.scope.generateDeclaredUidIdentifier('descriptor'); + + var initializer = node.value ? t.functionExpression(null, [], t.blockStatement([t.returnStatement(node.value)])) : t.nullLiteral(); + node.value = t.callExpression(ensureInitializerWarning(path, state), [descriptor, t.thisExpression()]); + + acc = acc.concat([t.assignmentExpression('=', descriptor, t.callExpression(ensureApplyDecoratedDescriptorHelper(path, state), [target, property, t.arrayExpression(decorators.map(function (dec) { + return dec.expression; + })), t.objectExpression([t.objectProperty(t.identifier('enumerable'), t.booleanLiteral(true)), t.objectProperty(t.identifier('initializer'), initializer)])]))]); + } else { + acc = acc.concat(t.callExpression(ensureApplyDecoratedDescriptorHelper(path, state), [target, property, t.arrayExpression(decorators.map(function (dec) { + return dec.expression; + })), t.isObjectProperty(node) || t.isClassProperty(node, { static: true }) ? buildGetObjectInitializer({ + TEMP: path.scope.generateDeclaredUidIdentifier('init'), + TARGET: target, + PROPERTY: property + }).expression : buildGetDescriptor({ + TARGET: target, + PROPERTY: property + }).expression, target])); + } + + return acc; + }, []); + + return t.sequenceExpression([t.assignmentExpression('=', name, path.node), t.sequenceExpression(exprs), name]); + } + + return { + inherits: __webpack_require__(124), + + visitor: { + ExportDefaultDeclaration: function ExportDefaultDeclaration(path) { + if (!path.get("declaration").isClassDeclaration()) return; + + var node = path.node; + + var ref = node.declaration.id || path.scope.generateUidIdentifier("default"); + node.declaration.id = ref; + + // Split the class declaration and the export into two separate statements. + path.replaceWith(node.declaration); + path.insertAfter(t.exportNamedDeclaration(null, [t.exportSpecifier(ref, t.identifier('default'))])); + }, + ClassDeclaration: function ClassDeclaration(path) { + var node = path.node; + + var ref = node.id || path.scope.generateUidIdentifier("class"); + + path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(ref, t.toExpression(node))])); + }, + ClassExpression: function ClassExpression(path, state) { + // Create a replacement for the class node if there is one. We do one pass to replace classes with + // class decorators, and a second pass to process method decorators. + var decoratedClass = applyEnsureOrdering(path) || applyClassDecorators(path, state) || applyMethodDecorators(path, state); + + if (decoratedClass) path.replaceWith(decoratedClass); + }, + ObjectExpression: function ObjectExpression(path, state) { + var decoratedObject = applyEnsureOrdering(path) || applyObjectDecorators(path, state); + + if (decoratedObject) path.replaceWith(decoratedObject); + }, + AssignmentExpression: function AssignmentExpression(path, state) { + if (!state.initializerWarningHelper) return; + + if (!path.get('left').isMemberExpression()) return; + if (!path.get('left.property').isIdentifier()) return; + if (!path.get('right').isCallExpression()) return; + if (!path.get('right.callee').isIdentifier({ name: state.initializerWarningHelper.name })) return; + + path.replaceWith(t.callExpression(ensureInitializerDefineProp(path, state), [path.get('left.object').node, t.stringLiteral(path.get('left.property').node.name), path.get('right.arguments')[0].node, path.get('right.arguments')[1].node])); + } + } + }; + }; + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildClassDecorator = (0, _babelTemplate2.default)('\n DECORATOR(CLASS_REF = INNER) || CLASS_REF;\n'); + + var buildClassPrototype = (0, _babelTemplate2.default)('\n CLASS_REF.prototype;\n'); + + var buildGetDescriptor = (0, _babelTemplate2.default)('\n Object.getOwnPropertyDescriptor(TARGET, PROPERTY);\n'); + + var buildGetObjectInitializer = (0, _babelTemplate2.default)('\n (TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {\n enumerable: true,\n configurable: true,\n writable: true,\n initializer: function(){\n return TEMP;\n }\n })\n'); + + var buildInitializerWarningHelper = (0, _babelTemplate2.default)('\n function NAME(descriptor, context){\n throw new Error(\'Decorating class property failed. Please ensure that transform-class-properties is enabled.\');\n }\n'); + + var buildInitializerDefineProperty = (0, _babelTemplate2.default)('\n function NAME(target, property, descriptor, context){\n if (!descriptor) return;\n\n Object.defineProperty(target, property, {\n enumerable: descriptor.enumerable,\n configurable: descriptor.configurable,\n writable: descriptor.writable,\n value: descriptor.initializer ? descriptor.initializer.call(context) : void 0,\n });\n }\n'); + + var buildApplyDecoratedDescriptor = (0, _babelTemplate2.default)('\n function NAME(target, property, decorators, descriptor, context){\n var desc = {};\n Object[\'ke\' + \'ys\'](descriptor).forEach(function(key){\n desc[key] = descriptor[key];\n });\n desc.enumerable = !!desc.enumerable;\n desc.configurable = !!desc.configurable;\n if (\'value\' in desc || desc.initializer){\n desc.writable = true;\n }\n\n desc = decorators.slice().reverse().reduce(function(desc, decorator){\n return decorator(target, property, desc) || desc;\n }, desc);\n\n if (context && desc.initializer !== void 0){\n desc.value = desc.initializer ? desc.initializer.call(context) : void 0;\n desc.initializer = undefined;\n }\n\n if (desc.initializer === void 0){\n // This is a hack to avoid this being processed by \'transform-runtime\'.\n // See issue #9.\n Object[\'define\' + \'Property\'](target, property, desc);\n desc = null;\n }\n\n return desc;\n }\n'); + + ; + +/***/ }), +/* 326 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.visitor = undefined; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function getTDZStatus(refPath, bindingPath) { + var executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath); + + if (executionStatus === "before") { + return "inside"; + } else if (executionStatus === "after") { + return "outside"; + } else { + return "maybe"; + } + } + + function buildTDZAssert(node, file) { + return t.callExpression(file.addHelper("temporalRef"), [node, t.stringLiteral(node.name), file.addHelper("temporalUndefined")]); + } + + function isReference(node, scope, state) { + var declared = state.letReferences[node.name]; + if (!declared) return false; + + return scope.getBindingIdentifier(node.name) === declared; + } + + var visitor = exports.visitor = { + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + if (!this.file.opts.tdz) return; + + var node = path.node, + parent = path.parent, + scope = path.scope; + + if (path.parentPath.isFor({ left: node })) return; + if (!isReference(node, scope, state)) return; + + var bindingPath = scope.getBinding(node.name).path; + + var status = getTDZStatus(path, bindingPath); + if (status === "inside") return; + + if (status === "maybe") { + var assert = buildTDZAssert(node, state.file); + + bindingPath.parent._tdzThis = true; + + path.skip(); + + if (path.parentPath.isUpdateExpression()) { + if (parent._ignoreBlockScopingTDZ) return; + path.parentPath.replaceWith(t.sequenceExpression([assert, parent])); + } else { + path.replaceWith(assert); + } + } else if (status === "outside") { + path.replaceWith(t.throwStatement(t.inherits(t.newExpression(t.identifier("ReferenceError"), [t.stringLiteral(node.name + " is not defined - temporal dead zone")]), node))); + } + }, + + AssignmentExpression: { + exit: function exit(path, state) { + if (!this.file.opts.tdz) return; + + var node = path.node; + + if (node._ignoreBlockScopingTDZ) return; + + var nodes = []; + var ids = path.getBindingIdentifiers(); + + for (var name in ids) { + var id = ids[name]; + + if (isReference(id, path.scope, state)) { + nodes.push(buildTDZAssert(id, state.file)); + } + } + + if (nodes.length) { + node._ignoreBlockScopingTDZ = true; + nodes.push(node); + path.replaceWithMultiple(nodes.map(t.expressionStatement)); + } + } + } + }; + +/***/ }), +/* 327 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(42); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(41); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _babelHelperFunctionName = __webpack_require__(40); + + var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName); + + var _vanilla = __webpack_require__(203); + + var _vanilla2 = _interopRequireDefault(_vanilla); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var LooseClassTransformer = function (_VanillaTransformer) { + (0, _inherits3.default)(LooseClassTransformer, _VanillaTransformer); + + function LooseClassTransformer() { + (0, _classCallCheck3.default)(this, LooseClassTransformer); + + var _this = (0, _possibleConstructorReturn3.default)(this, _VanillaTransformer.apply(this, arguments)); + + _this.isLoose = true; + return _this; + } + + LooseClassTransformer.prototype._processMethod = function _processMethod(node, scope) { + if (!node.decorators) { + + var classRef = this.classRef; + if (!node.static) classRef = t.memberExpression(classRef, t.identifier("prototype")); + var methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key)); + + var func = t.functionExpression(null, node.params, node.body, node.generator, node.async); + func.returnType = node.returnType; + var key = t.toComputedKey(node, node.key); + if (t.isStringLiteral(key)) { + func = (0, _babelHelperFunctionName2.default)({ + node: func, + id: key, + scope: scope + }); + } + + var expr = t.expressionStatement(t.assignmentExpression("=", methodName, func)); + t.inheritsComments(expr, node); + this.body.push(expr); + return true; + } + }; + + return LooseClassTransformer; + }(_vanilla2.default); + + exports.default = LooseClassTransformer; + module.exports = exports["default"]; + +/***/ }), +/* 328 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + BinaryExpression: function BinaryExpression(path) { + var node = path.node; + + if (node.operator === "instanceof") { + path.replaceWith(t.callExpression(this.addHelper("instanceof"), [node.left, node.right])); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 329 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.visitor = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _babelHelperGetFunctionArity = __webpack_require__(185); + + var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity); + + var _babelHelperCallDelegate = __webpack_require__(313); + + var _babelHelperCallDelegate2 = _interopRequireDefault(_babelHelperCallDelegate); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildDefaultParam = (0, _babelTemplate2.default)("\n let VARIABLE_NAME =\n ARGUMENTS.length > ARGUMENT_KEY && ARGUMENTS[ARGUMENT_KEY] !== undefined ?\n ARGUMENTS[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n"); + + var buildCutOff = (0, _babelTemplate2.default)("\n let $0 = $1[$2];\n"); + + function hasDefaults(node) { + for (var _iterator = node.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var param = _ref; + + if (!t.isIdentifier(param)) return true; + } + return false; + } + + function isSafeBinding(scope, node) { + if (!scope.hasOwnBinding(node.name)) return true; + + var _scope$getOwnBinding = scope.getOwnBinding(node.name), + kind = _scope$getOwnBinding.kind; + + return kind === "param" || kind === "local"; + } + + var iifeVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + var scope = path.scope, + node = path.node; + + if (node.name === "eval" || !isSafeBinding(scope, node)) { + state.iife = true; + path.stop(); + } + }, + Scope: function Scope(path) { + path.skip(); + } + }; + + var visitor = exports.visitor = { + Function: function Function(path) { + var node = path.node, + scope = path.scope; + + if (!hasDefaults(node)) return; + + path.ensureBlock(); + + var state = { + iife: false, + scope: scope + }; + + var body = []; + + var argsIdentifier = t.identifier("arguments"); + argsIdentifier._shadowedFunctionLiteral = path; + + function pushDefNode(left, right, i) { + var defNode = buildDefaultParam({ + VARIABLE_NAME: left, + DEFAULT_VALUE: right, + ARGUMENT_KEY: t.numericLiteral(i), + ARGUMENTS: argsIdentifier + }); + defNode._blockHoist = node.params.length - i; + body.push(defNode); + } + + var lastNonDefaultParam = (0, _babelHelperGetFunctionArity2.default)(node); + + var params = path.get("params"); + for (var i = 0; i < params.length; i++) { + var param = params[i]; + + if (!param.isAssignmentPattern()) { + if (!state.iife && !param.isIdentifier()) { + param.traverse(iifeVisitor, state); + } + + continue; + } + + var left = param.get("left"); + var right = param.get("right"); + + if (i >= lastNonDefaultParam || left.isPattern()) { + var placeholder = scope.generateUidIdentifier("x"); + placeholder._isDefaultPlaceholder = true; + node.params[i] = placeholder; + } else { + node.params[i] = left.node; + } + + if (!state.iife) { + if (right.isIdentifier() && !isSafeBinding(scope, right.node)) { + state.iife = true; + } else { + right.traverse(iifeVisitor, state); + } + } + + pushDefNode(left.node, right.node, i); + } + + for (var _i2 = lastNonDefaultParam + 1; _i2 < node.params.length; _i2++) { + var _param = node.params[_i2]; + if (_param._isDefaultPlaceholder) continue; + + var declar = buildCutOff(_param, argsIdentifier, t.numericLiteral(_i2)); + declar._blockHoist = node.params.length - _i2; + body.push(declar); + } + + node.params = node.params.slice(0, lastNonDefaultParam); + + if (state.iife) { + body.push((0, _babelHelperCallDelegate2.default)(path, scope)); + path.set("body", t.blockStatement(body)); + } else { + path.get("body").unshiftContainer("body", body); + } + } + }; + +/***/ }), +/* 330 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.visitor = undefined; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var visitor = exports.visitor = { + Function: function Function(path) { + var params = path.get("params"); + + var hoistTweak = t.isRestElement(params[params.length - 1]) ? 1 : 0; + var outputParamsLength = params.length - hoistTweak; + + for (var i = 0; i < outputParamsLength; i++) { + var param = params[i]; + if (param.isArrayPattern() || param.isObjectPattern()) { + var uid = path.scope.generateUidIdentifier("ref"); + + var declar = t.variableDeclaration("let", [t.variableDeclarator(param.node, uid)]); + declar._blockHoist = outputParamsLength - i; + + path.ensureBlock(); + path.get("body").unshiftContainer("body", declar); + + param.replaceWith(uid); + } + } + } + }; + +/***/ }), +/* 331 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.visitor = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _babelTemplate = __webpack_require__(4); + + var _babelTemplate2 = _interopRequireDefault(_babelTemplate); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var buildRest = (0, _babelTemplate2.default)("\n for (var LEN = ARGUMENTS.length,\n ARRAY = Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n"); + + var restIndex = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= INDEX ? undefined : ARGUMENTS[INDEX]\n"); + + var restIndexImpure = (0, _babelTemplate2.default)("\n REF = INDEX, ARGUMENTS.length <= REF ? undefined : ARGUMENTS[REF]\n"); + + var restLength = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n"); + + var memberExpressionOptimisationVisitor = { + Scope: function Scope(path, state) { + if (!path.scope.bindingIdentifierEquals(state.name, state.outerBinding)) { + path.skip(); + } + }, + Flow: function Flow(path) { + if (path.isTypeCastExpression()) return; + + path.skip(); + }, + + "Function|ClassProperty": function FunctionClassProperty(path, state) { + var oldNoOptimise = state.noOptimise; + state.noOptimise = true; + path.traverse(memberExpressionOptimisationVisitor, state); + state.noOptimise = oldNoOptimise; + + path.skip(); + }, + + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + var node = path.node; + + if (node.name === "arguments") { + state.deopted = true; + } + + if (node.name !== state.name) return; + + if (state.noOptimise) { + state.deopted = true; + } else { + var parentPath = path.parentPath; + + if (parentPath.listKey === "params" && parentPath.key < state.offset) { + return; + } + + if (parentPath.isMemberExpression({ object: node })) { + var grandparentPath = parentPath.parentPath; + + var argsOptEligible = !state.deopted && !(grandparentPath.isAssignmentExpression() && parentPath.node === grandparentPath.node.left || grandparentPath.isLVal() || grandparentPath.isForXStatement() || grandparentPath.isUpdateExpression() || grandparentPath.isUnaryExpression({ operator: "delete" }) || (grandparentPath.isCallExpression() || grandparentPath.isNewExpression()) && parentPath.node === grandparentPath.node.callee); + + if (argsOptEligible) { + if (parentPath.node.computed) { + if (parentPath.get("property").isBaseType("number")) { + state.candidates.push({ cause: "indexGetter", path: path }); + return; + } + } else if (parentPath.node.property.name === "length") { + state.candidates.push({ cause: "lengthGetter", path: path }); + return; + } + } + } + + if (state.offset === 0 && parentPath.isSpreadElement()) { + var call = parentPath.parentPath; + if (call.isCallExpression() && call.node.arguments.length === 1) { + state.candidates.push({ cause: "argSpread", path: path }); + return; + } + } + + state.references.push(path); + } + }, + BindingIdentifier: function BindingIdentifier(_ref, state) { + var node = _ref.node; + + if (node.name === state.name) { + state.deopted = true; + } + } + }; + function hasRest(node) { + return t.isRestElement(node.params[node.params.length - 1]); + } + + function optimiseIndexGetter(path, argsId, offset) { + var index = void 0; + + if (t.isNumericLiteral(path.parent.property)) { + index = t.numericLiteral(path.parent.property.value + offset); + } else if (offset === 0) { + index = path.parent.property; + } else { + index = t.binaryExpression("+", path.parent.property, t.numericLiteral(offset)); + } + + var scope = path.scope; + + if (!scope.isPure(index)) { + var temp = scope.generateUidIdentifierBasedOnNode(index); + scope.push({ id: temp, kind: "var" }); + path.parentPath.replaceWith(restIndexImpure({ + ARGUMENTS: argsId, + INDEX: index, + REF: temp + })); + } else { + path.parentPath.replaceWith(restIndex({ + ARGUMENTS: argsId, + INDEX: index + })); + } + } + + function optimiseLengthGetter(path, argsId, offset) { + if (offset) { + path.parentPath.replaceWith(restLength({ + ARGUMENTS: argsId, + OFFSET: t.numericLiteral(offset) + })); + } else { + path.replaceWith(argsId); + } + } + + var visitor = exports.visitor = { + Function: function Function(path) { + var node = path.node, + scope = path.scope; + + if (!hasRest(node)) return; + + var rest = node.params.pop().argument; + + var argsId = t.identifier("arguments"); + + argsId._shadowedFunctionLiteral = path; + + var state = { + references: [], + offset: node.params.length, + + argumentsNode: argsId, + outerBinding: scope.getBindingIdentifier(rest.name), + + candidates: [], + + name: rest.name, + + deopted: false + }; + + path.traverse(memberExpressionOptimisationVisitor, state); + + if (!state.deopted && !state.references.length) { + for (var _iterator = state.candidates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var _ref4 = _ref3; + var _path = _ref4.path, + cause = _ref4.cause; + + switch (cause) { + case "indexGetter": + optimiseIndexGetter(_path, argsId, state.offset); + break; + case "lengthGetter": + optimiseLengthGetter(_path, argsId, state.offset); + break; + default: + _path.replaceWith(argsId); + } + } + return; + } + + state.references = state.references.concat(state.candidates.map(function (_ref5) { + var path = _ref5.path; + return path; + })); + + state.deopted = state.deopted || !!node.shadow; + + var start = t.numericLiteral(node.params.length); + var key = scope.generateUidIdentifier("key"); + var len = scope.generateUidIdentifier("len"); + + var arrKey = key; + var arrLen = len; + if (node.params.length) { + arrKey = t.binaryExpression("-", key, start); + + arrLen = t.conditionalExpression(t.binaryExpression(">", len, start), t.binaryExpression("-", len, start), t.numericLiteral(0)); + } + + var loop = buildRest({ + ARGUMENTS: argsId, + ARRAY_KEY: arrKey, + ARRAY_LEN: arrLen, + START: start, + ARRAY: rest, + KEY: key, + LEN: len + }); + + if (state.deopted) { + loop._blockHoist = node.params.length + 1; + node.body.body.unshift(loop); + } else { + loop._blockHoist = 1; + + var target = path.getEarliestCommonAncestorFrom(state.references).getStatementParent(); + + target.findParent(function (path) { + if (path.isLoop()) { + target = path; + } else { + return path.isFunction(); + } + }); + + target.insertBefore(loop); + } + } + }; + +/***/ }), +/* 332 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + MemberExpression: { + exit: function exit(_ref2) { + var node = _ref2.node; + + var prop = node.property; + if (!node.computed && t.isIdentifier(prop) && !t.isValidIdentifier(prop.name)) { + node.property = t.stringLiteral(prop.name); + node.computed = true; + } + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 333 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + ObjectProperty: { + exit: function exit(_ref2) { + var node = _ref2.node; + + var key = node.key; + if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) { + node.key = t.stringLiteral(key.name); + } + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 334 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + ObjectExpression: function ObjectExpression(path, file) { + var node = path.node; + + var hasAny = false; + for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var prop = _ref2; + + if (prop.kind === "get" || prop.kind === "set") { + hasAny = true; + break; + } + } + if (!hasAny) return; + + var mutatorMap = {}; + + node.properties = node.properties.filter(function (prop) { + if (!prop.computed && (prop.kind === "get" || prop.kind === "set")) { + defineMap.push(mutatorMap, prop, null, file); + return false; + } else { + return true; + } + }); + + path.replaceWith(t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("defineProperties")), [node, defineMap.toDefineObject(mutatorMap)])); + } + } + }; + }; + + var _babelHelperDefineMap = __webpack_require__(184); + + var defineMap = _interopRequireWildcard(_babelHelperDefineMap); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 335 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var parse = _ref.parse, + traverse = _ref.traverse; + + return { + visitor: { + CallExpression: function CallExpression(path) { + if (path.get("callee").isIdentifier({ name: "eval" }) && path.node.arguments.length === 1) { + var evaluate = path.get("arguments")[0].evaluate(); + if (!evaluate.confident) return; + + var code = evaluate.value; + if (typeof code !== "string") return; + + var ast = parse(code); + traverse.removeProperties(ast); + return ast.program; + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function wrapInFlowComment(path, parent) { + path.addComment("trailing", generateComment(path, parent)); + path.replaceWith(t.noop()); + } + + function generateComment(path, parent) { + var comment = path.getSource().replace(/\*-\//g, "*-ESCAPED/").replace(/\*\//g, "*-/"); + if (parent && parent.optional) comment = "?" + comment; + if (comment[0] !== ":") comment = ":: " + comment; + return comment; + } + + return { + inherits: __webpack_require__(125), + + visitor: { + TypeCastExpression: function TypeCastExpression(path) { + var node = path.node; + + path.get("expression").addComment("trailing", generateComment(path.get("typeAnnotation"))); + path.replaceWith(t.parenthesizedExpression(node.expression)); + }, + Identifier: function Identifier(path) { + var node = path.node; + + if (!node.optional || node.typeAnnotation) { + return; + } + path.addComment("trailing", ":: ?"); + }, + + AssignmentPattern: { + exit: function exit(_ref2) { + var node = _ref2.node; + + node.left.optional = false; + } + }, + + Function: { + exit: function exit(_ref3) { + var node = _ref3.node; + + node.params.forEach(function (param) { + return param.optional = false; + }); + } + }, + + ClassProperty: function ClassProperty(path) { + var node = path.node, + parent = path.parent; + + if (!node.value) wrapInFlowComment(path, parent); + }, + "ExportNamedDeclaration|Flow": function ExportNamedDeclarationFlow(path) { + var node = path.node, + parent = path.parent; + + if (t.isExportNamedDeclaration(node) && !t.isFlow(node.declaration)) { + return; + } + wrapInFlowComment(path, parent); + }, + ImportDeclaration: function ImportDeclaration(path) { + var node = path.node, + parent = path.parent; + + if (t.isImportDeclaration(node) && node.importKind !== "type" && node.importKind !== "typeof") { + return; + } + wrapInFlowComment(path, parent); + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 337 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + visitor: { + FunctionExpression: { + exit: function exit(path) { + var node = path.node; + + if (!node.id) return; + node._ignoreUserWhitespace = true; + + path.replaceWith(t.callExpression(t.functionExpression(null, [], t.blockStatement([t.toStatement(node), t.returnStatement(node.id)])), [])); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 338 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + CallExpression: function CallExpression(path, file) { + if (path.get("callee").matchesPattern("Object.assign")) { + path.node.callee = file.addHelper("extends"); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 339 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return { + visitor: { + CallExpression: function CallExpression(path, file) { + if (path.get("callee").matchesPattern("Object.setPrototypeOf")) { + path.node.callee = file.addHelper("defaults"); + } + } + } + }; + }; + + module.exports = exports["default"]; + +/***/ }), +/* 340 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function isProtoKey(node) { + return t.isLiteral(t.toComputedKey(node, node.key), { value: "__proto__" }); + } + + function isProtoAssignmentExpression(node) { + var left = node.left; + return t.isMemberExpression(left) && t.isLiteral(t.toComputedKey(left, left.property), { value: "__proto__" }); + } + + function buildDefaultsCallExpression(expr, ref, file) { + return t.expressionStatement(t.callExpression(file.addHelper("defaults"), [ref, expr.right])); + } + + return { + visitor: { + AssignmentExpression: function AssignmentExpression(path, file) { + if (!isProtoAssignmentExpression(path.node)) return; + + var nodes = []; + var left = path.node.left.object; + var temp = path.scope.maybeGenerateMemoised(left); + + if (temp) nodes.push(t.expressionStatement(t.assignmentExpression("=", temp, left))); + nodes.push(buildDefaultsCallExpression(path.node, temp || left, file)); + if (temp) nodes.push(temp); + + path.replaceWithMultiple(nodes); + }, + ExpressionStatement: function ExpressionStatement(path, file) { + var expr = path.node.expression; + if (!t.isAssignmentExpression(expr, { operator: "=" })) return; + + if (isProtoAssignmentExpression(expr)) { + path.replaceWith(buildDefaultsCallExpression(expr, expr.left.object, file)); + } + }, + ObjectExpression: function ObjectExpression(path, file) { + var proto = void 0; + var node = path.node; + + for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var prop = _ref2; + + if (isProtoKey(prop)) { + proto = prop.value; + (0, _pull2.default)(node.properties, prop); + } + } + + if (proto) { + var args = [t.objectExpression([]), proto]; + if (node.properties.length) args.push(node); + path.replaceWith(t.callExpression(file.addHelper("extends"), args)); + } + } + } + }; + }; + + var _pull = __webpack_require__(272); + + var _pull2 = _interopRequireDefault(_pull); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 341 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + exports.default = function (_ref) { + var t = _ref.types; + + var immutabilityVisitor = { + enter: function enter(path, state) { + var stop = function stop() { + state.isImmutable = false; + path.stop(); + }; + + if (path.isJSXClosingElement()) { + path.skip(); + return; + } + + if (path.isJSXIdentifier({ name: "ref" }) && path.parentPath.isJSXAttribute({ name: path.node })) { + return stop(); + } + + if (path.isJSXIdentifier() || path.isIdentifier() || path.isJSXMemberExpression()) { + return; + } + + if (!path.isImmutable()) { + if (path.isPure()) { + var expressionResult = path.evaluate(); + if (expressionResult.confident) { + var value = expressionResult.value; + + var isMutable = value && (typeof value === "undefined" ? "undefined" : (0, _typeof3.default)(value)) === "object" || typeof value === "function"; + if (!isMutable) { + return; + } + } else if (t.isIdentifier(expressionResult.deopt)) { + return; + } + } + stop(); + } + } + }; + + return { + visitor: { + JSXElement: function JSXElement(path) { + if (path.node._hoisted) return; + + var state = { isImmutable: true }; + path.traverse(immutabilityVisitor, state); + + if (state.isImmutable) { + path.hoist(); + } else { + path.node._hoisted = true; + } + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 342 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (_ref) { + var t = _ref.types; + + function hasRefOrSpread(attrs) { + for (var i = 0; i < attrs.length; i++) { + var attr = attrs[i]; + if (t.isJSXSpreadAttribute(attr)) return true; + if (isJSXAttributeOfName(attr, "ref")) return true; + } + return false; + } + + function isJSXAttributeOfName(attr, name) { + return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name, { name: name }); + } + + function getAttributeValue(attr) { + var value = attr.value; + if (!value) return t.identifier("true"); + if (t.isJSXExpressionContainer(value)) value = value.expression; + return value; + } + + return { + visitor: { + JSXElement: function JSXElement(path, file) { + var node = path.node; + + var open = node.openingElement; + if (hasRefOrSpread(open.attributes)) return; + + var props = t.objectExpression([]); + var key = null; + var type = open.name; + + if (t.isJSXIdentifier(type) && t.react.isCompatTag(type.name)) { + type = t.stringLiteral(type.name); + } + + function pushProp(objProps, key, value) { + objProps.push(t.objectProperty(key, value)); + } + + for (var _iterator = open.attributes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var attr = _ref2; + + if (isJSXAttributeOfName(attr, "key")) { + key = getAttributeValue(attr); + } else { + var name = attr.name.name; + var propertyKey = t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name); + pushProp(props.properties, propertyKey, getAttributeValue(attr)); + } + } + + var args = [type, props]; + if (key || node.children.length) { + var children = t.react.buildChildren(node); + args.push.apply(args, [key || t.unaryExpression("void", t.numericLiteral(0), true)].concat(children)); + } + + var el = t.callExpression(file.addHelper("jsx"), args); + path.replaceWith(el); + } + } + }; + }; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 343 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + return { + manipulateOptions: function manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("jsx"); + }, + + visitor: (0, _babelHelperBuilderReactJsx2.default)({ + pre: function pre(state) { + state.callee = state.tagExpr; + }, + post: function post(state) { + if (t.react.isCompatTag(state.tagName)) { + state.call = t.callExpression(t.memberExpression(t.memberExpression(t.identifier("React"), t.identifier("DOM")), state.tagExpr, t.isLiteral(state.tagExpr)), state.args); + } + } + }) + }; + }; + + var _babelHelperBuilderReactJsx = __webpack_require__(344); + + var _babelHelperBuilderReactJsx2 = _interopRequireDefault(_babelHelperBuilderReactJsx); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 344 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (opts) { + var visitor = {}; + + visitor.JSXNamespacedName = function (path) { + throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML."); + }; + + visitor.JSXElement = { + exit: function exit(path, file) { + var callExpr = buildElementCall(path.get("openingElement"), file); + + callExpr.arguments = callExpr.arguments.concat(path.node.children); + + if (callExpr.arguments.length >= 3) { + callExpr._prettyCall = true; + } + + path.replaceWith(t.inherits(callExpr, path.node)); + } + }; + + return visitor; + + function convertJSXIdentifier(node, parent) { + if (t.isJSXIdentifier(node)) { + if (node.name === "this" && t.isReferenced(node, parent)) { + return t.thisExpression(); + } else if (_esutils2.default.keyword.isIdentifierNameES6(node.name)) { + node.type = "Identifier"; + } else { + return t.stringLiteral(node.name); + } + } else if (t.isJSXMemberExpression(node)) { + return t.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node)); + } + + return node; + } + + function convertAttributeValue(node) { + if (t.isJSXExpressionContainer(node)) { + return node.expression; + } else { + return node; + } + } + + function convertAttribute(node) { + var value = convertAttributeValue(node.value || t.booleanLiteral(true)); + + if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { + value.value = value.value.replace(/\n\s+/g, " "); + } + + if (t.isValidIdentifier(node.name.name)) { + node.name.type = "Identifier"; + } else { + node.name = t.stringLiteral(node.name.name); + } + + return t.inherits(t.objectProperty(node.name, value), node); + } + + function buildElementCall(path, file) { + path.parent.children = t.react.buildChildren(path.parent); + + var tagExpr = convertJSXIdentifier(path.node.name, path.node); + var args = []; + + var tagName = void 0; + if (t.isIdentifier(tagExpr)) { + tagName = tagExpr.name; + } else if (t.isLiteral(tagExpr)) { + tagName = tagExpr.value; + } + + var state = { + tagExpr: tagExpr, + tagName: tagName, + args: args + }; + + if (opts.pre) { + opts.pre(state, file); + } + + var attribs = path.node.attributes; + if (attribs.length) { + attribs = buildOpeningElementAttributes(attribs, file); + } else { + attribs = t.nullLiteral(); + } + + args.push(attribs); + + if (opts.post) { + opts.post(state, file); + } + + return state.call || t.callExpression(state.callee, args); + } + + function buildOpeningElementAttributes(attribs, file) { + var _props = []; + var objs = []; + + var useBuiltIns = file.opts.useBuiltIns || false; + if (typeof useBuiltIns !== "boolean") { + throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useBuiltIns (defaults to false)"); + } + + function pushProps() { + if (!_props.length) return; + + objs.push(t.objectExpression(_props)); + _props = []; + } + + while (attribs.length) { + var prop = attribs.shift(); + if (t.isJSXSpreadAttribute(prop)) { + pushProps(); + objs.push(prop.argument); + } else { + _props.push(convertAttribute(prop)); + } + } + + pushProps(); + + if (objs.length === 1) { + attribs = objs[0]; + } else { + if (!t.isObjectExpression(objs[0])) { + objs.unshift(t.objectExpression([])); + } + + var helper = useBuiltIns ? t.memberExpression(t.identifier("Object"), t.identifier("assign")) : file.addHelper("extends"); + + attribs = t.callExpression(helper, objs); + } + + return attribs; + } + }; + + var _esutils = __webpack_require__(97); + + var _esutils2 = _interopRequireDefault(_esutils); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 345 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + var visitor = { + JSXOpeningElement: function JSXOpeningElement(_ref2) { + var node = _ref2.node; + + var id = t.jSXIdentifier(TRACE_ID); + var trace = t.thisExpression(); + + node.attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); + } + }; + + return { + visitor: visitor + }; + }; + + var TRACE_ID = "__self"; + + module.exports = exports["default"]; + +/***/ }), +/* 346 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var t = _ref.types; + + function makeTrace(fileNameIdentifier, lineNumber) { + var fileLineLiteral = lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral(); + var fileNameProperty = t.objectProperty(t.identifier("fileName"), fileNameIdentifier); + var lineNumberProperty = t.objectProperty(t.identifier("lineNumber"), fileLineLiteral); + return t.objectExpression([fileNameProperty, lineNumberProperty]); + } + + var visitor = { + JSXOpeningElement: function JSXOpeningElement(path, state) { + var id = t.jSXIdentifier(TRACE_ID); + var location = path.container.openingElement.loc; + if (!location) { + return; + } + + var attributes = path.container.openingElement.attributes; + for (var i = 0; i < attributes.length; i++) { + var name = attributes[i].name; + if (name && name.name === TRACE_ID) { + return; + } + } + + if (!state.fileNameIdentifier) { + var fileName = state.file.log.filename !== "unknown" ? state.file.log.filename : null; + + var fileNameIdentifier = path.scope.generateUidIdentifier(FILE_NAME_VAR); + path.hub.file.scope.push({ id: fileNameIdentifier, init: t.stringLiteral(fileName) }); + state.fileNameIdentifier = fileNameIdentifier; + } + + var trace = makeTrace(state.fileNameIdentifier, location.start.line); + attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); + } + }; + + return { + visitor: visitor + }; + }; + + var TRACE_ID = "__source"; + var FILE_NAME_VAR = "_jsxFileName"; + + module.exports = exports["default"]; + +/***/ }), +/* 347 */ +344, +/* 348 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = { + builtins: { + Symbol: "symbol", + Promise: "promise", + Map: "map", + WeakMap: "weak-map", + Set: "set", + WeakSet: "weak-set", + Observable: "observable", + setImmediate: "set-immediate", + clearImmediate: "clear-immediate", + asap: "asap" + }, + + methods: { + Array: { + concat: "array/concat", + copyWithin: "array/copy-within", + entries: "array/entries", + every: "array/every", + fill: "array/fill", + filter: "array/filter", + findIndex: "array/find-index", + find: "array/find", + forEach: "array/for-each", + from: "array/from", + includes: "array/includes", + indexOf: "array/index-of", + + join: "array/join", + keys: "array/keys", + lastIndexOf: "array/last-index-of", + map: "array/map", + of: "array/of", + pop: "array/pop", + push: "array/push", + reduceRight: "array/reduce-right", + reduce: "array/reduce", + reverse: "array/reverse", + shift: "array/shift", + slice: "array/slice", + some: "array/some", + sort: "array/sort", + splice: "array/splice", + unshift: "array/unshift", + values: "array/values" + }, + + JSON: { + stringify: "json/stringify" + }, + + Object: { + assign: "object/assign", + create: "object/create", + defineProperties: "object/define-properties", + defineProperty: "object/define-property", + entries: "object/entries", + freeze: "object/freeze", + getOwnPropertyDescriptor: "object/get-own-property-descriptor", + getOwnPropertyDescriptors: "object/get-own-property-descriptors", + getOwnPropertyNames: "object/get-own-property-names", + getOwnPropertySymbols: "object/get-own-property-symbols", + getPrototypeOf: "object/get-prototype-of", + isExtensible: "object/is-extensible", + isFrozen: "object/is-frozen", + isSealed: "object/is-sealed", + is: "object/is", + keys: "object/keys", + preventExtensions: "object/prevent-extensions", + seal: "object/seal", + setPrototypeOf: "object/set-prototype-of", + values: "object/values" + }, + + RegExp: { + escape: "regexp/escape" }, + + Math: { + acosh: "math/acosh", + asinh: "math/asinh", + atanh: "math/atanh", + cbrt: "math/cbrt", + clz32: "math/clz32", + cosh: "math/cosh", + expm1: "math/expm1", + fround: "math/fround", + hypot: "math/hypot", + imul: "math/imul", + log10: "math/log10", + log1p: "math/log1p", + log2: "math/log2", + sign: "math/sign", + sinh: "math/sinh", + tanh: "math/tanh", + trunc: "math/trunc", + iaddh: "math/iaddh", + isubh: "math/isubh", + imulh: "math/imulh", + umulh: "math/umulh" + }, + + Symbol: { + for: "symbol/for", + hasInstance: "symbol/has-instance", + isConcatSpreadable: "symbol/is-concat-spreadable", + iterator: "symbol/iterator", + keyFor: "symbol/key-for", + match: "symbol/match", + replace: "symbol/replace", + search: "symbol/search", + species: "symbol/species", + split: "symbol/split", + toPrimitive: "symbol/to-primitive", + toStringTag: "symbol/to-string-tag", + unscopables: "symbol/unscopables" + }, + + String: { + at: "string/at", + codePointAt: "string/code-point-at", + endsWith: "string/ends-with", + fromCodePoint: "string/from-code-point", + includes: "string/includes", + matchAll: "string/match-all", + padLeft: "string/pad-left", + padRight: "string/pad-right", + padStart: "string/pad-start", + padEnd: "string/pad-end", + raw: "string/raw", + repeat: "string/repeat", + startsWith: "string/starts-with", + trim: "string/trim", + trimLeft: "string/trim-left", + trimRight: "string/trim-right", + trimStart: "string/trim-start", + trimEnd: "string/trim-end" + }, + + Number: { + EPSILON: "number/epsilon", + isFinite: "number/is-finite", + isInteger: "number/is-integer", + isNaN: "number/is-nan", + isSafeInteger: "number/is-safe-integer", + MAX_SAFE_INTEGER: "number/max-safe-integer", + MIN_SAFE_INTEGER: "number/min-safe-integer", + parseFloat: "number/parse-float", + parseInt: "number/parse-int" + }, + + Reflect: { + apply: "reflect/apply", + construct: "reflect/construct", + defineProperty: "reflect/define-property", + deleteProperty: "reflect/delete-property", + enumerate: "reflect/enumerate", + getOwnPropertyDescriptor: "reflect/get-own-property-descriptor", + getPrototypeOf: "reflect/get-prototype-of", + get: "reflect/get", + has: "reflect/has", + isExtensible: "reflect/is-extensible", + ownKeys: "reflect/own-keys", + preventExtensions: "reflect/prevent-extensions", + setPrototypeOf: "reflect/set-prototype-of", + set: "reflect/set", + defineMetadata: "reflect/define-metadata", + deleteMetadata: "reflect/delete-metadata", + getMetadata: "reflect/get-metadata", + getMetadataKeys: "reflect/get-metadata-keys", + getOwnMetadata: "reflect/get-own-metadata", + getOwnMetadataKeys: "reflect/get-own-metadata-keys", + hasMetadata: "reflect/has-metadata", + hasOwnMetadata: "reflect/has-own-metadata", + metadata: "reflect/metadata" + }, + + System: { + global: "system/global" + }, + + Error: { + isError: "error/is-error" }, + + Date: {}, + + Function: {} + } + }; + +/***/ }), +/* 349 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.definitions = undefined; + + exports.default = function (_ref) { + var t = _ref.types; + + function getRuntimeModuleName(opts) { + return opts.moduleName || "babel-runtime"; + } + + function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); + } + + var HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; + + return { + pre: function pre(file) { + var moduleName = getRuntimeModuleName(this.opts); + + if (this.opts.helpers !== false) { + file.set("helperGenerator", function (name) { + if (HELPER_BLACKLIST.indexOf(name) < 0) { + return file.addImport(moduleName + "/helpers/" + name, "default", name); + } + }); + } + + this.setDynamic("regeneratorIdentifier", function () { + return file.addImport(moduleName + "/regenerator", "default", "regeneratorRuntime"); + }); + }, + + visitor: { + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + var node = path.node, + parent = path.parent, + scope = path.scope; + + if (node.name === "regeneratorRuntime" && state.opts.regenerator !== false) { + path.replaceWith(state.get("regeneratorIdentifier")); + return; + } + + if (state.opts.polyfill === false) return; + + if (t.isMemberExpression(parent)) return; + if (!has(_definitions2.default.builtins, node.name)) return; + if (scope.getBindingIdentifier(node.name)) return; + + var moduleName = getRuntimeModuleName(state.opts); + path.replaceWith(state.addImport(moduleName + "/core-js/" + _definitions2.default.builtins[node.name], "default", node.name)); + }, + CallExpression: function CallExpression(path, state) { + if (state.opts.polyfill === false) return; + + if (path.node.arguments.length) return; + + var callee = path.node.callee; + if (!t.isMemberExpression(callee)) return; + if (!callee.computed) return; + if (!path.get("callee.property").matchesPattern("Symbol.iterator")) return; + + var moduleName = getRuntimeModuleName(state.opts); + path.replaceWith(t.callExpression(state.addImport(moduleName + "/core-js/get-iterator", "default", "getIterator"), [callee.object])); + }, + BinaryExpression: function BinaryExpression(path, state) { + if (state.opts.polyfill === false) return; + + if (path.node.operator !== "in") return; + if (!path.get("left").matchesPattern("Symbol.iterator")) return; + + var moduleName = getRuntimeModuleName(state.opts); + path.replaceWith(t.callExpression(state.addImport(moduleName + "/core-js/is-iterable", "default", "isIterable"), [path.node.right])); + }, + + MemberExpression: { + enter: function enter(path, state) { + if (state.opts.polyfill === false) return; + if (!path.isReferenced()) return; + + var node = path.node; + + var obj = node.object; + var prop = node.property; + + if (!t.isReferenced(obj, node)) return; + if (node.computed) return; + if (!has(_definitions2.default.methods, obj.name)) return; + + var methods = _definitions2.default.methods[obj.name]; + if (!has(methods, prop.name)) return; + + if (path.scope.getBindingIdentifier(obj.name)) return; + + if (obj.name === "Object" && prop.name === "defineProperty" && path.parentPath.isCallExpression()) { + var call = path.parentPath.node; + if (call.arguments.length === 3 && t.isLiteral(call.arguments[1])) return; + } + + var moduleName = getRuntimeModuleName(state.opts); + path.replaceWith(state.addImport(moduleName + "/core-js/" + methods[prop.name], "default", obj.name + "$" + prop.name)); + }, + exit: function exit(path, state) { + if (state.opts.polyfill === false) return; + if (!path.isReferenced()) return; + + var node = path.node; + + var obj = node.object; + + if (!has(_definitions2.default.builtins, obj.name)) return; + if (path.scope.getBindingIdentifier(obj.name)) return; + + var moduleName = getRuntimeModuleName(state.opts); + path.replaceWith(t.memberExpression(state.addImport(moduleName + "/core-js/" + _definitions2.default.builtins[obj.name], "default", obj.name), node.property, node.computed)); + } + } + } + }; + }; + + var _definitions = __webpack_require__(348); + + var _definitions2 = _interopRequireDefault(_definitions); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.definitions = _definitions2.default; + +/***/ }), +/* 350 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (_ref) { + var messages = _ref.messages; + + return { + visitor: { + ReferencedIdentifier: function ReferencedIdentifier(path) { + var node = path.node, + scope = path.scope; + + var binding = scope.getBinding(node.name); + if (binding && binding.kind === "type" && !path.parentPath.isFlow()) { + throw path.buildCodeFrameError(messages.get("undeclaredVariableType", node.name), ReferenceError); + } + + if (scope.hasBinding(node.name)) return; + + var bindings = scope.getAllBindings(); + + var closest = void 0; + var shortest = -1; + + for (var name in bindings) { + var distance = (0, _leven2.default)(node.name, name); + if (distance <= 0 || distance > 3) continue; + if (distance <= shortest) continue; + + closest = name; + shortest = distance; + } + + var msg = void 0; + if (closest) { + msg = messages.get("undeclaredVariableSuggestion", node.name, closest); + } else { + msg = messages.get("undeclaredVariable", node.name); + } + + throw path.buildCodeFrameError(msg, ReferenceError); + } + } + }; + }; + + var _leven = __webpack_require__(462); + + var _leven2 = _interopRequireDefault(_leven); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 351 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPluginTransformFlowStripTypes = __webpack_require__(207); + + var _babelPluginTransformFlowStripTypes2 = _interopRequireDefault(_babelPluginTransformFlowStripTypes); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + plugins: [_babelPluginTransformFlowStripTypes2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 352 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (context) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + return { + presets: [opts.es2015 !== false && [_babelPresetEs2.default.buildPreset, opts.es2015], opts.es2016 !== false && _babelPresetEs4.default, opts.es2017 !== false && _babelPresetEs6.default].filter(Boolean) }; + }; + + var _babelPresetEs = __webpack_require__(213); + + var _babelPresetEs2 = _interopRequireDefault(_babelPresetEs); + + var _babelPresetEs3 = __webpack_require__(214); + + var _babelPresetEs4 = _interopRequireDefault(_babelPresetEs3); + + var _babelPresetEs5 = __webpack_require__(215); + + var _babelPresetEs6 = _interopRequireDefault(_babelPresetEs5); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 353 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPresetFlow = __webpack_require__(351); + + var _babelPresetFlow2 = _interopRequireDefault(_babelPresetFlow); + + var _babelPluginTransformReactJsx = __webpack_require__(211); + + var _babelPluginTransformReactJsx2 = _interopRequireDefault(_babelPluginTransformReactJsx); + + var _babelPluginSyntaxJsx = __webpack_require__(126); + + var _babelPluginSyntaxJsx2 = _interopRequireDefault(_babelPluginSyntaxJsx); + + var _babelPluginTransformReactDisplayName = __webpack_require__(210); + + var _babelPluginTransformReactDisplayName2 = _interopRequireDefault(_babelPluginTransformReactDisplayName); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + presets: [_babelPresetFlow2.default], + plugins: [_babelPluginTransformReactJsx2.default, _babelPluginSyntaxJsx2.default, _babelPluginTransformReactDisplayName2.default], + env: { + development: { + plugins: [] + } + } + }; + module.exports = exports["default"]; + +/***/ }), +/* 354 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _babelPresetStage = __webpack_require__(216); + + var _babelPresetStage2 = _interopRequireDefault(_babelPresetStage); + + var _babelPluginTransformDoExpressions = __webpack_require__(202); + + var _babelPluginTransformDoExpressions2 = _interopRequireDefault(_babelPluginTransformDoExpressions); + + var _babelPluginTransformFunctionBind = __webpack_require__(208); + + var _babelPluginTransformFunctionBind2 = _interopRequireDefault(_babelPluginTransformFunctionBind); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + exports.default = { + presets: [_babelPresetStage2.default], + plugins: [_babelPluginTransformDoExpressions2.default, _babelPluginTransformFunctionBind2.default] + }; + module.exports = exports["default"]; + +/***/ }), +/* 355 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(403), __esModule: true }; + +/***/ }), +/* 356 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(406), __esModule: true }; + +/***/ }), +/* 357 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(408), __esModule: true }; + +/***/ }), +/* 358 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(409), __esModule: true }; + +/***/ }), +/* 359 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(411), __esModule: true }; + +/***/ }), +/* 360 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(412), __esModule: true }; + +/***/ }), +/* 361 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = { "default": __webpack_require__(413), __esModule: true }; + +/***/ }), +/* 362 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (obj, keys) { + var target = {}; + + for (var i in obj) { + if (keys.indexOf(i) >= 0) continue; + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; + target[i] = obj[i]; + } + + return target; + }; + +/***/ }), +/* 363 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _path2 = __webpack_require__(35); + + var _path3 = _interopRequireDefault(_path2); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var testing = ("production") === "test"; + + var TraversalContext = function () { + function TraversalContext(scope, opts, state, parentPath) { + (0, _classCallCheck3.default)(this, TraversalContext); + this.queue = null; + + this.parentPath = parentPath; + this.scope = scope; + this.state = state; + this.opts = opts; + } + + TraversalContext.prototype.shouldVisit = function shouldVisit(node) { + var opts = this.opts; + if (opts.enter || opts.exit) return true; + + if (opts[node.type]) return true; + + var keys = t.VISITOR_KEYS[node.type]; + if (!keys || !keys.length) return false; + + for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var key = _ref; + + if (node[key]) return true; + } + + return false; + }; + + TraversalContext.prototype.create = function create(node, obj, key, listKey) { + return _path3.default.get({ + parentPath: this.parentPath, + parent: node, + container: obj, + key: key, + listKey: listKey + }); + }; + + TraversalContext.prototype.maybeQueue = function maybeQueue(path, notPriority) { + if (this.trap) { + throw new Error("Infinite cycle detected"); + } + + if (this.queue) { + if (notPriority) { + this.queue.push(path); + } else { + this.priorityQueue.push(path); + } + } + }; + + TraversalContext.prototype.visitMultiple = function visitMultiple(container, parent, listKey) { + if (container.length === 0) return false; + + var queue = []; + + for (var key = 0; key < container.length; key++) { + var node = container[key]; + if (node && this.shouldVisit(node)) { + queue.push(this.create(parent, container, key, listKey)); + } + } + + return this.visitQueue(queue); + }; + + TraversalContext.prototype.visitSingle = function visitSingle(node, key) { + if (this.shouldVisit(node[key])) { + return this.visitQueue([this.create(node, node, key)]); + } else { + return false; + } + }; + + TraversalContext.prototype.visitQueue = function visitQueue(queue) { + this.queue = queue; + this.priorityQueue = []; + + var visited = []; + var stop = false; + + for (var _iterator2 = queue, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var path = _ref2; + + path.resync(); + + if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { + path.pushContext(this); + } + + if (path.key === null) continue; + + if (testing && queue.length >= 10000) { + this.trap = true; + } + + if (visited.indexOf(path.node) >= 0) continue; + visited.push(path.node); + + if (path.visit()) { + stop = true; + break; + } + + if (this.priorityQueue.length) { + stop = this.visitQueue(this.priorityQueue); + this.priorityQueue = []; + this.queue = queue; + if (stop) break; + } + } + + for (var _iterator3 = queue, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var _path = _ref3; + + _path.popContext(); + } + + this.queue = null; + + return stop; + }; + + TraversalContext.prototype.visit = function visit(node, key) { + var nodes = node[key]; + if (!nodes) return false; + + if (Array.isArray(nodes)) { + return this.visitMultiple(nodes, node, key); + } else { + return this.visitSingle(node, key); + } + }; + + return TraversalContext; + }(); + + exports.default = TraversalContext; + module.exports = exports["default"]; + +/***/ }), +/* 364 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.findParent = findParent; + exports.find = find; + exports.getFunctionParent = getFunctionParent; + exports.getStatementParent = getStatementParent; + exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom; + exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom; + exports.getAncestry = getAncestry; + exports.isAncestor = isAncestor; + exports.isDescendant = isDescendant; + exports.inType = inType; + exports.inShadow = inShadow; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _index = __webpack_require__(35); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function findParent(callback) { + var path = this; + while (path = path.parentPath) { + if (callback(path)) return path; + } + return null; + } + + function find(callback) { + var path = this; + do { + if (callback(path)) return path; + } while (path = path.parentPath); + return null; + } + + function getFunctionParent() { + return this.findParent(function (path) { + return path.isFunction() || path.isProgram(); + }); + } + + function getStatementParent() { + var path = this; + do { + if (Array.isArray(path.container)) { + return path; + } + } while (path = path.parentPath); + } + + function getEarliestCommonAncestorFrom(paths) { + return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) { + var earliest = void 0; + var keys = t.VISITOR_KEYS[deepest.type]; + + for (var _iterator = ancestries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var ancestry = _ref; + + var path = ancestry[i + 1]; + + if (!earliest) { + earliest = path; + continue; + } + + if (path.listKey && earliest.listKey === path.listKey) { + if (path.key < earliest.key) { + earliest = path; + continue; + } + } + + var earliestKeyIndex = keys.indexOf(earliest.parentKey); + var currentKeyIndex = keys.indexOf(path.parentKey); + if (earliestKeyIndex > currentKeyIndex) { + earliest = path; + } + } + + return earliest; + }); + } + + function getDeepestCommonAncestorFrom(paths, filter) { + var _this = this; + + if (!paths.length) { + return this; + } + + if (paths.length === 1) { + return paths[0]; + } + + var minDepth = Infinity; + + var lastCommonIndex = void 0, + lastCommon = void 0; + + var ancestries = paths.map(function (path) { + var ancestry = []; + + do { + ancestry.unshift(path); + } while ((path = path.parentPath) && path !== _this); + + if (ancestry.length < minDepth) { + minDepth = ancestry.length; + } + + return ancestry; + }); + + var first = ancestries[0]; + + depthLoop: for (var i = 0; i < minDepth; i++) { + var shouldMatch = first[i]; + + for (var _iterator2 = ancestries, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var ancestry = _ref2; + + if (ancestry[i] !== shouldMatch) { + break depthLoop; + } + } + + lastCommonIndex = i; + lastCommon = shouldMatch; + } + + if (lastCommon) { + if (filter) { + return filter(lastCommon, lastCommonIndex, ancestries); + } else { + return lastCommon; + } + } else { + throw new Error("Couldn't find intersection"); + } + } + + function getAncestry() { + var path = this; + var paths = []; + do { + paths.push(path); + } while (path = path.parentPath); + return paths; + } + + function isAncestor(maybeDescendant) { + return maybeDescendant.isDescendant(this); + } + + function isDescendant(maybeAncestor) { + return !!this.findParent(function (parent) { + return parent === maybeAncestor; + }); + } + + function inType() { + var path = this; + while (path) { + for (var _iterator3 = arguments, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var type = _ref3; + + if (path.node.type === type) return true; + } + path = path.parentPath; + } + + return false; + } + + function inShadow(key) { + var parentFn = this.isFunction() ? this : this.findParent(function (p) { + return p.isFunction(); + }); + if (!parentFn) return; + + if (parentFn.isFunctionExpression() || parentFn.isFunctionDeclaration()) { + var shadow = parentFn.node.shadow; + + if (shadow && (!key || shadow[key] !== false)) { + return parentFn; + } + } else if (parentFn.isArrowFunctionExpression()) { + return parentFn; + } + + return null; + } + +/***/ }), +/* 365 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports.shareCommentsWithSiblings = shareCommentsWithSiblings; + exports.addComment = addComment; + exports.addComments = addComments; + function shareCommentsWithSiblings() { + if (typeof this.key === "string") return; + + var node = this.node; + if (!node) return; + + var trailing = node.trailingComments; + var leading = node.leadingComments; + if (!trailing && !leading) return; + + var prev = this.getSibling(this.key - 1); + var next = this.getSibling(this.key + 1); + + if (!prev.node) prev = next; + if (!next.node) next = prev; + + prev.addComments("trailing", leading); + next.addComments("leading", trailing); + } + + function addComment(type, content, line) { + this.addComments(type, [{ + type: line ? "CommentLine" : "CommentBlock", + value: content + }]); + } + + function addComments(type, comments) { + if (!comments) return; + + var node = this.node; + if (!node) return; + + var key = type + "Comments"; + + if (node[key]) { + node[key] = node[key].concat(comments); + } else { + node[key] = comments; + } + } + +/***/ }), +/* 366 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.call = call; + exports._call = _call; + exports.isBlacklisted = isBlacklisted; + exports.visit = visit; + exports.skip = skip; + exports.skipKey = skipKey; + exports.stop = stop; + exports.setScope = setScope; + exports.setContext = setContext; + exports.resync = resync; + exports._resyncParent = _resyncParent; + exports._resyncKey = _resyncKey; + exports._resyncList = _resyncList; + exports._resyncRemoved = _resyncRemoved; + exports.popContext = popContext; + exports.pushContext = pushContext; + exports.setup = setup; + exports.setKey = setKey; + exports.requeue = requeue; + exports._getQueueContexts = _getQueueContexts; + + var _index = __webpack_require__(7); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function call(key) { + var opts = this.opts; + + this.debug(function () { + return key; + }); + + if (this.node) { + if (this._call(opts[key])) return true; + } + + if (this.node) { + return this._call(opts[this.node.type] && opts[this.node.type][key]); + } + + return false; + } + + function _call(fns) { + if (!fns) return false; + + for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var fn = _ref; + + if (!fn) continue; + + var node = this.node; + if (!node) return true; + + var ret = fn.call(this.state, this, this.state); + if (ret) throw new Error("Unexpected return value from visitor method " + fn); + + if (this.node !== node) return true; + + if (this.shouldStop || this.shouldSkip || this.removed) return true; + } + + return false; + } + + function isBlacklisted() { + var blacklist = this.opts.blacklist; + return blacklist && blacklist.indexOf(this.node.type) > -1; + } + + function visit() { + if (!this.node) { + return false; + } + + if (this.isBlacklisted()) { + return false; + } + + if (this.opts.shouldSkip && this.opts.shouldSkip(this)) { + return false; + } + + if (this.call("enter") || this.shouldSkip) { + this.debug(function () { + return "Skip..."; + }); + return this.shouldStop; + } + + this.debug(function () { + return "Recursing into..."; + }); + _index2.default.node(this.node, this.opts, this.scope, this.state, this, this.skipKeys); + + this.call("exit"); + + return this.shouldStop; + } + + function skip() { + this.shouldSkip = true; + } + + function skipKey(key) { + this.skipKeys[key] = true; + } + + function stop() { + this.shouldStop = true; + this.shouldSkip = true; + } + + function setScope() { + if (this.opts && this.opts.noScope) return; + + var target = this.context && this.context.scope; + + if (!target) { + var path = this.parentPath; + while (path && !target) { + if (path.opts && path.opts.noScope) return; + + target = path.scope; + path = path.parentPath; + } + } + + this.scope = this.getScope(target); + if (this.scope) this.scope.init(); + } + + function setContext(context) { + this.shouldSkip = false; + this.shouldStop = false; + this.removed = false; + this.skipKeys = {}; + + if (context) { + this.context = context; + this.state = context.state; + this.opts = context.opts; + } + + this.setScope(); + + return this; + } + + function resync() { + if (this.removed) return; + + this._resyncParent(); + this._resyncList(); + this._resyncKey(); + } + + function _resyncParent() { + if (this.parentPath) { + this.parent = this.parentPath.node; + } + } + + function _resyncKey() { + if (!this.container) return; + + if (this.node === this.container[this.key]) return; + + if (Array.isArray(this.container)) { + for (var i = 0; i < this.container.length; i++) { + if (this.container[i] === this.node) { + return this.setKey(i); + } + } + } else { + for (var key in this.container) { + if (this.container[key] === this.node) { + return this.setKey(key); + } + } + } + + this.key = null; + } + + function _resyncList() { + if (!this.parent || !this.inList) return; + + var newContainer = this.parent[this.listKey]; + if (this.container === newContainer) return; + + this.container = newContainer || null; + } + + function _resyncRemoved() { + if (this.key == null || !this.container || this.container[this.key] !== this.node) { + this._markRemoved(); + } + } + + function popContext() { + this.contexts.pop(); + this.setContext(this.contexts[this.contexts.length - 1]); + } + + function pushContext(context) { + this.contexts.push(context); + this.setContext(context); + } + + function setup(parentPath, container, listKey, key) { + this.inList = !!listKey; + this.listKey = listKey; + this.parentKey = listKey || key; + this.container = container; + + this.parentPath = parentPath || this.parentPath; + this.setKey(key); + } + + function setKey(key) { + this.key = key; + this.node = this.container[this.key]; + this.type = this.node && this.node.type; + } + + function requeue() { + var pathToQueue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this; + + if (pathToQueue.removed) return; + + var contexts = this.contexts; + + for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var context = _ref2; + + context.maybeQueue(pathToQueue); + } + } + + function _getQueueContexts() { + var path = this; + var contexts = this.contexts; + while (!contexts.length) { + path = path.parentPath; + contexts = path.contexts; + } + return contexts; + } + +/***/ }), +/* 367 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.toComputedKey = toComputedKey; + exports.ensureBlock = ensureBlock; + exports.arrowFunctionToShadowed = arrowFunctionToShadowed; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function toComputedKey() { + var node = this.node; + + var key = void 0; + if (this.isMemberExpression()) { + key = node.property; + } else if (this.isProperty() || this.isMethod()) { + key = node.key; + } else { + throw new ReferenceError("todo"); + } + + if (!node.computed) { + if (t.isIdentifier(key)) key = t.stringLiteral(key.name); + } + + return key; + } + + function ensureBlock() { + return t.ensureBlock(this.node); + } + + function arrowFunctionToShadowed() { + if (!this.isArrowFunctionExpression()) return; + + this.ensureBlock(); + + var node = this.node; + + node.expression = false; + node.type = "FunctionExpression"; + node.shadow = node.shadow || true; + } + +/***/ }), +/* 368 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {"use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _map = __webpack_require__(132); + + var _map2 = _interopRequireDefault(_map); + + exports.evaluateTruthy = evaluateTruthy; + exports.evaluate = evaluate; + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var VALID_CALLEES = ["String", "Number", "Math"]; + var INVALID_METHODS = ["random"]; + + function evaluateTruthy() { + var res = this.evaluate(); + if (res.confident) return !!res.value; + } + + function evaluate() { + var confident = true; + var deoptPath = void 0; + var seen = new _map2.default(); + + function deopt(path) { + if (!confident) return; + deoptPath = path; + confident = false; + } + + var value = evaluate(this); + if (!confident) value = undefined; + return { + confident: confident, + deopt: deoptPath, + value: value + }; + + function evaluate(path) { + var node = path.node; + + if (seen.has(node)) { + var existing = seen.get(node); + if (existing.resolved) { + return existing.value; + } else { + deopt(path); + return; + } + } else { + var item = { resolved: false }; + seen.set(node, item); + + var val = _evaluate(path); + if (confident) { + item.resolved = true; + item.value = val; + } + return val; + } + } + + function _evaluate(path) { + if (!confident) return; + + var node = path.node; + + if (path.isSequenceExpression()) { + var exprs = path.get("expressions"); + return evaluate(exprs[exprs.length - 1]); + } + + if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) { + return node.value; + } + + if (path.isNullLiteral()) { + return null; + } + + if (path.isTemplateLiteral()) { + var str = ""; + + var i = 0; + var _exprs = path.get("expressions"); + + for (var _iterator = node.quasis, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var elem = _ref; + + if (!confident) break; + + str += elem.value.cooked; + + var expr = _exprs[i++]; + if (expr) str += String(evaluate(expr)); + } + + if (!confident) return; + return str; + } + + if (path.isConditionalExpression()) { + var testResult = evaluate(path.get("test")); + if (!confident) return; + if (testResult) { + return evaluate(path.get("consequent")); + } else { + return evaluate(path.get("alternate")); + } + } + + if (path.isExpressionWrapper()) { + return evaluate(path.get("expression")); + } + + if (path.isMemberExpression() && !path.parentPath.isCallExpression({ callee: node })) { + var property = path.get("property"); + var object = path.get("object"); + + if (object.isLiteral() && property.isIdentifier()) { + var _value = object.node.value; + var type = typeof _value === "undefined" ? "undefined" : (0, _typeof3.default)(_value); + if (type === "number" || type === "string") { + return _value[property.node.name]; + } + } + } + + if (path.isReferencedIdentifier()) { + var binding = path.scope.getBinding(node.name); + + if (binding && binding.constantViolations.length > 0) { + return deopt(binding.path); + } + + if (binding && path.node.start < binding.path.node.end) { + return deopt(binding.path); + } + + if (binding && binding.hasValue) { + return binding.value; + } else { + if (node.name === "undefined") { + return binding ? deopt(binding.path) : undefined; + } else if (node.name === "Infinity") { + return binding ? deopt(binding.path) : Infinity; + } else if (node.name === "NaN") { + return binding ? deopt(binding.path) : NaN; + } + + var resolved = path.resolve(); + if (resolved === path) { + return deopt(path); + } else { + return evaluate(resolved); + } + } + } + + if (path.isUnaryExpression({ prefix: true })) { + if (node.operator === "void") { + return undefined; + } + + var argument = path.get("argument"); + if (node.operator === "typeof" && (argument.isFunction() || argument.isClass())) { + return "function"; + } + + var arg = evaluate(argument); + if (!confident) return; + switch (node.operator) { + case "!": + return !arg; + case "+": + return +arg; + case "-": + return -arg; + case "~": + return ~arg; + case "typeof": + return typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg); + } + } + + if (path.isArrayExpression()) { + var arr = []; + var elems = path.get("elements"); + for (var _iterator2 = elems, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _elem = _ref2; + + _elem = _elem.evaluate(); + + if (_elem.confident) { + arr.push(_elem.value); + } else { + return deopt(_elem); + } + } + return arr; + } + + if (path.isObjectExpression()) { + var obj = {}; + var props = path.get("properties"); + for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var prop = _ref3; + + if (prop.isObjectMethod() || prop.isSpreadProperty()) { + return deopt(prop); + } + var keyPath = prop.get("key"); + var key = keyPath; + if (prop.node.computed) { + key = key.evaluate(); + if (!key.confident) { + return deopt(keyPath); + } + key = key.value; + } else if (key.isIdentifier()) { + key = key.node.name; + } else { + key = key.node.value; + } + var valuePath = prop.get("value"); + var _value2 = valuePath.evaluate(); + if (!_value2.confident) { + return deopt(valuePath); + } + _value2 = _value2.value; + obj[key] = _value2; + } + return obj; + } + + if (path.isLogicalExpression()) { + var wasConfident = confident; + var left = evaluate(path.get("left")); + var leftConfident = confident; + confident = wasConfident; + var right = evaluate(path.get("right")); + var rightConfident = confident; + confident = leftConfident && rightConfident; + + switch (node.operator) { + case "||": + if (left && leftConfident) { + confident = true; + return left; + } + + if (!confident) return; + + return left || right; + case "&&": + if (!left && leftConfident || !right && rightConfident) { + confident = true; + } + + if (!confident) return; + + return left && right; + } + } + + if (path.isBinaryExpression()) { + var _left = evaluate(path.get("left")); + if (!confident) return; + var _right = evaluate(path.get("right")); + if (!confident) return; + + switch (node.operator) { + case "-": + return _left - _right; + case "+": + return _left + _right; + case "/": + return _left / _right; + case "*": + return _left * _right; + case "%": + return _left % _right; + case "**": + return Math.pow(_left, _right); + case "<": + return _left < _right; + case ">": + return _left > _right; + case "<=": + return _left <= _right; + case ">=": + return _left >= _right; + case "==": + return _left == _right; + case "!=": + return _left != _right; + case "===": + return _left === _right; + case "!==": + return _left !== _right; + case "|": + return _left | _right; + case "&": + return _left & _right; + case "^": + return _left ^ _right; + case "<<": + return _left << _right; + case ">>": + return _left >> _right; + case ">>>": + return _left >>> _right; + } + } + + if (path.isCallExpression()) { + var callee = path.get("callee"); + var context = void 0; + var func = void 0; + + if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && VALID_CALLEES.indexOf(callee.node.name) >= 0) { + func = global[node.callee.name]; + } + + if (callee.isMemberExpression()) { + var _object = callee.get("object"); + var _property = callee.get("property"); + + if (_object.isIdentifier() && _property.isIdentifier() && VALID_CALLEES.indexOf(_object.node.name) >= 0 && INVALID_METHODS.indexOf(_property.node.name) < 0) { + context = global[_object.node.name]; + func = context[_property.node.name]; + } + + if (_object.isLiteral() && _property.isIdentifier()) { + var _type = (0, _typeof3.default)(_object.node.value); + if (_type === "string" || _type === "number") { + context = _object.node.value; + func = context[_property.node.name]; + } + } + } + + if (func) { + var args = path.get("arguments").map(evaluate); + if (!confident) return; + + return func.apply(context, args); + } + } + + deopt(path); + } + } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 369 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _create = __webpack_require__(9); + + var _create2 = _interopRequireDefault(_create); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.getStatementParent = getStatementParent; + exports.getOpposite = getOpposite; + exports.getCompletionRecords = getCompletionRecords; + exports.getSibling = getSibling; + exports.getPrevSibling = getPrevSibling; + exports.getNextSibling = getNextSibling; + exports.getAllNextSiblings = getAllNextSiblings; + exports.getAllPrevSiblings = getAllPrevSiblings; + exports.get = get; + exports._getKey = _getKey; + exports._getPattern = _getPattern; + exports.getBindingIdentifiers = getBindingIdentifiers; + exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers; + exports.getBindingIdentifierPaths = getBindingIdentifierPaths; + exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths; + + var _index = __webpack_require__(35); + + var _index2 = _interopRequireDefault(_index); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getStatementParent() { + var path = this; + + do { + if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) { + break; + } else { + path = path.parentPath; + } + } while (path); + + if (path && (path.isProgram() || path.isFile())) { + throw new Error("File/Program node, we can't possibly find a statement parent to this"); + } + + return path; + } + + function getOpposite() { + if (this.key === "left") { + return this.getSibling("right"); + } else if (this.key === "right") { + return this.getSibling("left"); + } + } + + function getCompletionRecords() { + var paths = []; + + var add = function add(path) { + if (path) paths = paths.concat(path.getCompletionRecords()); + }; + + if (this.isIfStatement()) { + add(this.get("consequent")); + add(this.get("alternate")); + } else if (this.isDoExpression() || this.isFor() || this.isWhile()) { + add(this.get("body")); + } else if (this.isProgram() || this.isBlockStatement()) { + add(this.get("body").pop()); + } else if (this.isFunction()) { + return this.get("body").getCompletionRecords(); + } else if (this.isTryStatement()) { + add(this.get("block")); + add(this.get("handler")); + add(this.get("finalizer")); + } else { + paths.push(this); + } + + return paths; + } + + function getSibling(key) { + return _index2.default.get({ + parentPath: this.parentPath, + parent: this.parent, + container: this.container, + listKey: this.listKey, + key: key + }); + } + + function getPrevSibling() { + return this.getSibling(this.key - 1); + } + + function getNextSibling() { + return this.getSibling(this.key + 1); + } + + function getAllNextSiblings() { + var _key = this.key; + var sibling = this.getSibling(++_key); + var siblings = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(++_key); + } + return siblings; + } + + function getAllPrevSiblings() { + var _key = this.key; + var sibling = this.getSibling(--_key); + var siblings = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(--_key); + } + return siblings; + } + + function get(key, context) { + if (context === true) context = this.context; + var parts = key.split("."); + if (parts.length === 1) { + return this._getKey(key, context); + } else { + return this._getPattern(parts, context); + } + } + + function _getKey(key, context) { + var _this = this; + + var node = this.node; + var container = node[key]; + + if (Array.isArray(container)) { + return container.map(function (_, i) { + return _index2.default.get({ + listKey: key, + parentPath: _this, + parent: node, + container: container, + key: i + }).setContext(context); + }); + } else { + return _index2.default.get({ + parentPath: this, + parent: node, + container: node, + key: key + }).setContext(context); + } + } + + function _getPattern(parts, context) { + var path = this; + for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var part = _ref; + + if (part === ".") { + path = path.parentPath; + } else { + if (Array.isArray(path)) { + path = path[part]; + } else { + path = path.get(part, context); + } + } + } + return path; + } + + function getBindingIdentifiers(duplicates) { + return t.getBindingIdentifiers(this.node, duplicates); + } + + function getOuterBindingIdentifiers(duplicates) { + return t.getOuterBindingIdentifiers(this.node, duplicates); + } + + function getBindingIdentifierPaths() { + var duplicates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var outerOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var path = this; + var search = [].concat(path); + var ids = (0, _create2.default)(null); + + while (search.length) { + var id = search.shift(); + if (!id) continue; + if (!id.node) continue; + + var keys = t.getBindingIdentifiers.keys[id.node.type]; + + if (id.isIdentifier()) { + if (duplicates) { + var _ids = ids[id.node.name] = ids[id.node.name] || []; + _ids.push(id); + } else { + ids[id.node.name] = id; + } + continue; + } + + if (id.isExportDeclaration()) { + var declaration = id.get("declaration"); + if (declaration.isDeclaration()) { + search.push(declaration); + } + continue; + } + + if (outerOnly) { + if (id.isFunctionDeclaration()) { + search.push(id.get("id")); + continue; + } + if (id.isFunctionExpression()) { + continue; + } + } + + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var child = id.get(key); + if (Array.isArray(child) || child.node) { + search = search.concat(child); + } + } + } + } + + return ids; + } + + function getOuterBindingIdentifierPaths(duplicates) { + return this.getBindingIdentifierPaths(duplicates, true); + } + +/***/ }), +/* 370 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.getTypeAnnotation = getTypeAnnotation; + exports._getTypeAnnotation = _getTypeAnnotation; + exports.isBaseType = isBaseType; + exports.couldBeBaseType = couldBeBaseType; + exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches; + exports.isGenericType = isGenericType; + + var _inferers = __webpack_require__(372); + + var inferers = _interopRequireWildcard(_inferers); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getTypeAnnotation() { + if (this.typeAnnotation) return this.typeAnnotation; + + var type = this._getTypeAnnotation() || t.anyTypeAnnotation(); + if (t.isTypeAnnotation(type)) type = type.typeAnnotation; + return this.typeAnnotation = type; + } + + function _getTypeAnnotation() { + var node = this.node; + + if (!node) { + if (this.key === "init" && this.parentPath.isVariableDeclarator()) { + var declar = this.parentPath.parentPath; + var declarParent = declar.parentPath; + + if (declar.key === "left" && declarParent.isForInStatement()) { + return t.stringTypeAnnotation(); + } + + if (declar.key === "left" && declarParent.isForOfStatement()) { + return t.anyTypeAnnotation(); + } + + return t.voidTypeAnnotation(); + } else { + return; + } + } + + if (node.typeAnnotation) { + return node.typeAnnotation; + } + + var inferer = inferers[node.type]; + if (inferer) { + return inferer.call(this, node); + } + + inferer = inferers[this.parentPath.type]; + if (inferer && inferer.validParent) { + return this.parentPath.getTypeAnnotation(); + } + } + + function isBaseType(baseName, soft) { + return _isBaseType(baseName, this.getTypeAnnotation(), soft); + } + + function _isBaseType(baseName, type, soft) { + if (baseName === "string") { + return t.isStringTypeAnnotation(type); + } else if (baseName === "number") { + return t.isNumberTypeAnnotation(type); + } else if (baseName === "boolean") { + return t.isBooleanTypeAnnotation(type); + } else if (baseName === "any") { + return t.isAnyTypeAnnotation(type); + } else if (baseName === "mixed") { + return t.isMixedTypeAnnotation(type); + } else if (baseName === "empty") { + return t.isEmptyTypeAnnotation(type); + } else if (baseName === "void") { + return t.isVoidTypeAnnotation(type); + } else { + if (soft) { + return false; + } else { + throw new Error("Unknown base type " + baseName); + } + } + } + + function couldBeBaseType(name) { + var type = this.getTypeAnnotation(); + if (t.isAnyTypeAnnotation(type)) return true; + + if (t.isUnionTypeAnnotation(type)) { + for (var _iterator = type.types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var type2 = _ref; + + if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) { + return true; + } + } + return false; + } else { + return _isBaseType(name, type, true); + } + } + + function baseTypeStrictlyMatches(right) { + var left = this.getTypeAnnotation(); + right = right.getTypeAnnotation(); + + if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) { + return right.type === left.type; + } + } + + function isGenericType(genericName) { + var type = this.getTypeAnnotation(); + return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName }); + } + +/***/ }), +/* 371 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.default = function (node) { + if (!this.isReferenced()) return; + + var binding = this.scope.getBinding(node.name); + if (binding) { + if (binding.identifier.typeAnnotation) { + return binding.identifier.typeAnnotation; + } else { + return getTypeAnnotationBindingConstantViolations(this, node.name); + } + } + + if (node.name === "undefined") { + return t.voidTypeAnnotation(); + } else if (node.name === "NaN" || node.name === "Infinity") { + return t.numberTypeAnnotation(); + } else if (node.name === "arguments") {} + }; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function getTypeAnnotationBindingConstantViolations(path, name) { + var binding = path.scope.getBinding(name); + + var types = []; + path.typeAnnotation = t.unionTypeAnnotation(types); + + var functionConstantViolations = []; + var constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations); + + var testType = getConditionalAnnotation(path, name); + if (testType) { + var testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement); + + constantViolations = constantViolations.filter(function (path) { + return testConstantViolations.indexOf(path) < 0; + }); + + types.push(testType.typeAnnotation); + } + + if (constantViolations.length) { + constantViolations = constantViolations.concat(functionConstantViolations); + + for (var _iterator = constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var violation = _ref; + + types.push(violation.getTypeAnnotation()); + } + } + + if (types.length) { + return t.createUnionTypeAnnotation(types); + } + } + + function getConstantViolationsBefore(binding, path, functions) { + var violations = binding.constantViolations.slice(); + violations.unshift(binding.path); + return violations.filter(function (violation) { + violation = violation.resolve(); + var status = violation._guessExecutionStatusRelativeTo(path); + if (functions && status === "function") functions.push(violation); + return status === "before"; + }); + } + + function inferAnnotationFromBinaryExpression(name, path) { + var operator = path.node.operator; + + var right = path.get("right").resolve(); + var left = path.get("left").resolve(); + + var target = void 0; + if (left.isIdentifier({ name: name })) { + target = right; + } else if (right.isIdentifier({ name: name })) { + target = left; + } + if (target) { + if (operator === "===") { + return target.getTypeAnnotation(); + } else if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { + return t.numberTypeAnnotation(); + } else { + return; + } + } else { + if (operator !== "===") return; + } + + var typeofPath = void 0; + var typePath = void 0; + if (left.isUnaryExpression({ operator: "typeof" })) { + typeofPath = left; + typePath = right; + } else if (right.isUnaryExpression({ operator: "typeof" })) { + typeofPath = right; + typePath = left; + } + if (!typePath && !typeofPath) return; + + typePath = typePath.resolve(); + if (!typePath.isLiteral()) return; + + var typeValue = typePath.node.value; + if (typeof typeValue !== "string") return; + + if (!typeofPath.get("argument").isIdentifier({ name: name })) return; + + return t.createTypeAnnotationBasedOnTypeof(typePath.node.value); + } + + function getParentConditionalPath(path) { + var parentPath = void 0; + while (parentPath = path.parentPath) { + if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) { + if (path.key === "test") { + return; + } else { + return parentPath; + } + } else { + path = parentPath; + } + } + } + + function getConditionalAnnotation(path, name) { + var ifStatement = getParentConditionalPath(path); + if (!ifStatement) return; + + var test = ifStatement.get("test"); + var paths = [test]; + var types = []; + + do { + var _path = paths.shift().resolve(); + + if (_path.isLogicalExpression()) { + paths.push(_path.get("left")); + paths.push(_path.get("right")); + } + + if (_path.isBinaryExpression()) { + var type = inferAnnotationFromBinaryExpression(name, _path); + if (type) types.push(type); + } + } while (paths.length); + + if (types.length) { + return { + typeAnnotation: t.createUnionTypeAnnotation(types), + ifStatement: ifStatement + }; + } else { + return getConditionalAnnotation(ifStatement, name); + } + } + module.exports = exports["default"]; + +/***/ }), +/* 372 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = exports.Identifier = undefined; + + var _infererReference = __webpack_require__(371); + + Object.defineProperty(exports, "Identifier", { + enumerable: true, + get: function get() { + return _interopRequireDefault(_infererReference).default; + } + }); + exports.VariableDeclarator = VariableDeclarator; + exports.TypeCastExpression = TypeCastExpression; + exports.NewExpression = NewExpression; + exports.TemplateLiteral = TemplateLiteral; + exports.UnaryExpression = UnaryExpression; + exports.BinaryExpression = BinaryExpression; + exports.LogicalExpression = LogicalExpression; + exports.ConditionalExpression = ConditionalExpression; + exports.SequenceExpression = SequenceExpression; + exports.AssignmentExpression = AssignmentExpression; + exports.UpdateExpression = UpdateExpression; + exports.StringLiteral = StringLiteral; + exports.NumericLiteral = NumericLiteral; + exports.BooleanLiteral = BooleanLiteral; + exports.NullLiteral = NullLiteral; + exports.RegExpLiteral = RegExpLiteral; + exports.ObjectExpression = ObjectExpression; + exports.ArrayExpression = ArrayExpression; + exports.RestElement = RestElement; + exports.CallExpression = CallExpression; + exports.TaggedTemplateExpression = TaggedTemplateExpression; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function VariableDeclarator() { + var id = this.get("id"); + + if (id.isIdentifier()) { + return this.get("init").getTypeAnnotation(); + } else { + return; + } + } + + function TypeCastExpression(node) { + return node.typeAnnotation; + } + + TypeCastExpression.validParent = true; + + function NewExpression(node) { + if (this.get("callee").isIdentifier()) { + return t.genericTypeAnnotation(node.callee); + } + } + + function TemplateLiteral() { + return t.stringTypeAnnotation(); + } + + function UnaryExpression(node) { + var operator = node.operator; + + if (operator === "void") { + return t.voidTypeAnnotation(); + } else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) { + return t.numberTypeAnnotation(); + } else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) { + return t.stringTypeAnnotation(); + } else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) { + return t.booleanTypeAnnotation(); + } + } + + function BinaryExpression(node) { + var operator = node.operator; + + if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { + return t.numberTypeAnnotation(); + } else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) { + return t.booleanTypeAnnotation(); + } else if (operator === "+") { + var right = this.get("right"); + var left = this.get("left"); + + if (left.isBaseType("number") && right.isBaseType("number")) { + return t.numberTypeAnnotation(); + } else if (left.isBaseType("string") || right.isBaseType("string")) { + return t.stringTypeAnnotation(); + } + + return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]); + } + } + + function LogicalExpression() { + return t.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]); + } + + function ConditionalExpression() { + return t.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]); + } + + function SequenceExpression() { + return this.get("expressions").pop().getTypeAnnotation(); + } + + function AssignmentExpression() { + return this.get("right").getTypeAnnotation(); + } + + function UpdateExpression(node) { + var operator = node.operator; + if (operator === "++" || operator === "--") { + return t.numberTypeAnnotation(); + } + } + + function StringLiteral() { + return t.stringTypeAnnotation(); + } + + function NumericLiteral() { + return t.numberTypeAnnotation(); + } + + function BooleanLiteral() { + return t.booleanTypeAnnotation(); + } + + function NullLiteral() { + return t.nullLiteralTypeAnnotation(); + } + + function RegExpLiteral() { + return t.genericTypeAnnotation(t.identifier("RegExp")); + } + + function ObjectExpression() { + return t.genericTypeAnnotation(t.identifier("Object")); + } + + function ArrayExpression() { + return t.genericTypeAnnotation(t.identifier("Array")); + } + + function RestElement() { + return ArrayExpression(); + } + + RestElement.validParent = true; + + function Func() { + return t.genericTypeAnnotation(t.identifier("Function")); + } + + exports.FunctionExpression = Func; + exports.ArrowFunctionExpression = Func; + exports.FunctionDeclaration = Func; + exports.ClassExpression = Func; + exports.ClassDeclaration = Func; + function CallExpression() { + return resolveCall(this.get("callee")); + } + + function TaggedTemplateExpression() { + return resolveCall(this.get("tag")); + } + + function resolveCall(callee) { + callee = callee.resolve(); + + if (callee.isFunction()) { + if (callee.is("async")) { + if (callee.is("generator")) { + return t.genericTypeAnnotation(t.identifier("AsyncIterator")); + } else { + return t.genericTypeAnnotation(t.identifier("Promise")); + } + } else { + if (callee.node.returnType) { + return callee.node.returnType; + } else {} + } + } + } + +/***/ }), +/* 373 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.is = undefined; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.matchesPattern = matchesPattern; + exports.has = has; + exports.isStatic = isStatic; + exports.isnt = isnt; + exports.equals = equals; + exports.isNodeType = isNodeType; + exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression; + exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement; + exports.isCompletionRecord = isCompletionRecord; + exports.isStatementOrBlock = isStatementOrBlock; + exports.referencesImport = referencesImport; + exports.getSource = getSource; + exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore; + exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo; + exports._guessExecutionStatusRelativeToDifferentFunctions = _guessExecutionStatusRelativeToDifferentFunctions; + exports.resolve = resolve; + exports._resolve = _resolve; + + var _includes = __webpack_require__(111); + + var _includes2 = _interopRequireDefault(_includes); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function matchesPattern(pattern, allowPartial) { + if (!this.isMemberExpression()) return false; + + var parts = pattern.split("."); + var search = [this.node]; + var i = 0; + + function matches(name) { + var part = parts[i]; + return part === "*" || name === part; + } + + while (search.length) { + var node = search.shift(); + + if (allowPartial && i === parts.length) { + return true; + } + + if (t.isIdentifier(node)) { + if (!matches(node.name)) return false; + } else if (t.isLiteral(node)) { + if (!matches(node.value)) return false; + } else if (t.isMemberExpression(node)) { + if (node.computed && !t.isLiteral(node.property)) { + return false; + } else { + search.unshift(node.property); + search.unshift(node.object); + continue; + } + } else if (t.isThisExpression(node)) { + if (!matches("this")) return false; + } else { + return false; + } + + if (++i > parts.length) { + return false; + } + } + + return i === parts.length; + } + + function has(key) { + var val = this.node && this.node[key]; + if (val && Array.isArray(val)) { + return !!val.length; + } else { + return !!val; + } + } + + function isStatic() { + return this.scope.isStatic(this.node); + } + + var is = exports.is = has; + + function isnt(key) { + return !this.has(key); + } + + function equals(key, value) { + return this.node[key] === value; + } + + function isNodeType(type) { + return t.isType(this.type, type); + } + + function canHaveVariableDeclarationOrExpression() { + return (this.key === "init" || this.key === "left") && this.parentPath.isFor(); + } + + function canSwapBetweenExpressionAndStatement(replacement) { + if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) { + return false; + } + + if (this.isExpression()) { + return t.isBlockStatement(replacement); + } else if (this.isBlockStatement()) { + return t.isExpression(replacement); + } + + return false; + } + + function isCompletionRecord(allowInsideFunction) { + var path = this; + var first = true; + + do { + var container = path.container; + + if (path.isFunction() && !first) { + return !!allowInsideFunction; + } + + first = false; + + if (Array.isArray(container) && path.key !== container.length - 1) { + return false; + } + } while ((path = path.parentPath) && !path.isProgram()); + + return true; + } + + function isStatementOrBlock() { + if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) { + return false; + } else { + return (0, _includes2.default)(t.STATEMENT_OR_BLOCK_KEYS, this.key); + } + } + + function referencesImport(moduleSource, importName) { + if (!this.isReferencedIdentifier()) return false; + + var binding = this.scope.getBinding(this.node.name); + if (!binding || binding.kind !== "module") return false; + + var path = binding.path; + var parent = path.parentPath; + if (!parent.isImportDeclaration()) return false; + + if (parent.node.source.value === moduleSource) { + if (!importName) return true; + } else { + return false; + } + + if (path.isImportDefaultSpecifier() && importName === "default") { + return true; + } + + if (path.isImportNamespaceSpecifier() && importName === "*") { + return true; + } + + if (path.isImportSpecifier() && path.node.imported.name === importName) { + return true; + } + + return false; + } + + function getSource() { + var node = this.node; + if (node.end) { + return this.hub.file.code.slice(node.start, node.end); + } else { + return ""; + } + } + + function willIMaybeExecuteBefore(target) { + return this._guessExecutionStatusRelativeTo(target) !== "after"; + } + + function _guessExecutionStatusRelativeTo(target) { + var targetFuncParent = target.scope.getFunctionParent(); + var selfFuncParent = this.scope.getFunctionParent(); + + if (targetFuncParent.node !== selfFuncParent.node) { + var status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent); + if (status) { + return status; + } else { + target = targetFuncParent.path; + } + } + + var targetPaths = target.getAncestry(); + if (targetPaths.indexOf(this) >= 0) return "after"; + + var selfPaths = this.getAncestry(); + + var commonPath = void 0; + var targetIndex = void 0; + var selfIndex = void 0; + for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) { + var selfPath = selfPaths[selfIndex]; + targetIndex = targetPaths.indexOf(selfPath); + if (targetIndex >= 0) { + commonPath = selfPath; + break; + } + } + if (!commonPath) { + return "before"; + } + + var targetRelationship = targetPaths[targetIndex - 1]; + var selfRelationship = selfPaths[selfIndex - 1]; + if (!targetRelationship || !selfRelationship) { + return "before"; + } + + if (targetRelationship.listKey && targetRelationship.container === selfRelationship.container) { + return targetRelationship.key > selfRelationship.key ? "before" : "after"; + } + + var targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key); + var selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); + return targetKeyPosition > selfKeyPosition ? "before" : "after"; + } + + function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) { + var targetFuncPath = targetFuncParent.path; + if (!targetFuncPath.isFunctionDeclaration()) return; + + var binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name); + + if (!binding.references) return "before"; + + var referencePaths = binding.referencePaths; + + for (var _iterator = referencePaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var path = _ref; + + if (path.key !== "callee" || !path.parentPath.isCallExpression()) { + return; + } + } + + var allStatus = void 0; + + for (var _iterator2 = referencePaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _path = _ref2; + + var childOfFunction = !!_path.find(function (path) { + return path.node === targetFuncPath.node; + }); + if (childOfFunction) continue; + + var status = this._guessExecutionStatusRelativeTo(_path); + + if (allStatus) { + if (allStatus !== status) return; + } else { + allStatus = status; + } + } + + return allStatus; + } + + function resolve(dangerous, resolved) { + return this._resolve(dangerous, resolved) || this; + } + + function _resolve(dangerous, resolved) { + if (resolved && resolved.indexOf(this) >= 0) return; + + resolved = resolved || []; + resolved.push(this); + + if (this.isVariableDeclarator()) { + if (this.get("id").isIdentifier()) { + return this.get("init").resolve(dangerous, resolved); + } else {} + } else if (this.isReferencedIdentifier()) { + var binding = this.scope.getBinding(this.node.name); + if (!binding) return; + + if (!binding.constant) return; + + if (binding.kind === "module") return; + + if (binding.path !== this) { + var ret = binding.path.resolve(dangerous, resolved); + + if (this.find(function (parent) { + return parent.node === ret.node; + })) return; + return ret; + } + } else if (this.isTypeCastExpression()) { + return this.get("expression").resolve(dangerous, resolved); + } else if (dangerous && this.isMemberExpression()) { + + var targetKey = this.toComputedKey(); + if (!t.isLiteral(targetKey)) return; + + var targetName = targetKey.value; + + var target = this.get("object").resolve(dangerous, resolved); + + if (target.isObjectExpression()) { + var props = target.get("properties"); + for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var prop = _ref3; + + if (!prop.isProperty()) continue; + + var key = prop.get("key"); + + var match = prop.isnt("computed") && key.isIdentifier({ name: targetName }); + + match = match || key.isLiteral({ value: targetName }); + + if (match) return prop.get("value").resolve(dangerous, resolved); + } + } else if (target.isArrayExpression() && !isNaN(+targetName)) { + var elems = target.get("elements"); + var elem = elems[targetName]; + if (elem) return elem.resolve(dangerous, resolved); + } + } + } + +/***/ }), +/* 374 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var referenceVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + if (path.isJSXIdentifier() && _babelTypes.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) { + return; + } + + if (path.node.name === "this") { + var scope = path.scope; + do { + if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) break; + } while (scope = scope.parent); + if (scope) state.breakOnScopePaths.push(scope.path); + } + + var binding = path.scope.getBinding(path.node.name); + if (!binding) return; + + if (binding !== state.scope.getBinding(path.node.name)) return; + + state.bindings[path.node.name] = binding; + } + }; + + var PathHoister = function () { + function PathHoister(path, scope) { + (0, _classCallCheck3.default)(this, PathHoister); + + this.breakOnScopePaths = []; + + this.bindings = {}; + + this.scopes = []; + + this.scope = scope; + this.path = path; + + this.attachAfter = false; + } + + PathHoister.prototype.isCompatibleScope = function isCompatibleScope(scope) { + for (var key in this.bindings) { + var binding = this.bindings[key]; + if (!scope.bindingIdentifierEquals(key, binding.identifier)) { + return false; + } + } + + return true; + }; + + PathHoister.prototype.getCompatibleScopes = function getCompatibleScopes() { + var scope = this.path.scope; + do { + if (this.isCompatibleScope(scope)) { + this.scopes.push(scope); + } else { + break; + } + + if (this.breakOnScopePaths.indexOf(scope.path) >= 0) { + break; + } + } while (scope = scope.parent); + }; + + PathHoister.prototype.getAttachmentPath = function getAttachmentPath() { + var path = this._getAttachmentPath(); + if (!path) return; + + var targetScope = path.scope; + + if (targetScope.path === path) { + targetScope = path.scope.parent; + } + + if (targetScope.path.isProgram() || targetScope.path.isFunction()) { + for (var name in this.bindings) { + if (!targetScope.hasOwnBinding(name)) continue; + + var binding = this.bindings[name]; + + if (binding.kind === "param") continue; + + if (this.getAttachmentParentForPath(binding.path).key > path.key) { + this.attachAfter = true; + path = binding.path; + + for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var violationPath = _ref; + + if (this.getAttachmentParentForPath(violationPath).key > path.key) { + path = violationPath; + } + } + } + } + } + + if (path.parentPath.isExportDeclaration()) { + path = path.parentPath; + } + + return path; + }; + + PathHoister.prototype._getAttachmentPath = function _getAttachmentPath() { + var scopes = this.scopes; + + var scope = scopes.pop(); + + if (!scope) return; + + if (scope.path.isFunction()) { + if (this.hasOwnParamBindings(scope)) { + if (this.scope === scope) return; + + return scope.path.get("body").get("body")[0]; + } else { + return this.getNextScopeAttachmentParent(); + } + } else if (scope.path.isProgram()) { + return this.getNextScopeAttachmentParent(); + } + }; + + PathHoister.prototype.getNextScopeAttachmentParent = function getNextScopeAttachmentParent() { + var scope = this.scopes.pop(); + if (scope) return this.getAttachmentParentForPath(scope.path); + }; + + PathHoister.prototype.getAttachmentParentForPath = function getAttachmentParentForPath(path) { + do { + if (!path.parentPath || Array.isArray(path.container) && path.isStatement() || path.isVariableDeclarator() && path.parentPath.node !== null && path.parentPath.node.declarations.length > 1) return path; + } while (path = path.parentPath); + }; + + PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) { + for (var name in this.bindings) { + if (!scope.hasOwnBinding(name)) continue; + + var binding = this.bindings[name]; + + if (binding.kind === "param" && binding.constant) return true; + } + return false; + }; + + PathHoister.prototype.run = function run() { + var node = this.path.node; + if (node._hoisted) return; + node._hoisted = true; + + this.path.traverse(referenceVisitor, this); + + this.getCompatibleScopes(); + + var attachTo = this.getAttachmentPath(); + if (!attachTo) return; + + if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return; + + var uid = attachTo.scope.generateUidIdentifier("ref"); + var declarator = t.variableDeclarator(uid, this.path.node); + + var insertFn = this.attachAfter ? "insertAfter" : "insertBefore"; + attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]); + + var parent = this.path.parentPath; + if (parent.isJSXElement() && this.path.container === parent.node.children) { + uid = t.JSXExpressionContainer(uid); + } + + this.path.replaceWith(uid); + }; + + return PathHoister; + }(); + + exports.default = PathHoister; + module.exports = exports["default"]; + +/***/ }), +/* 375 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + var hooks = exports.hooks = [function (self, parent) { + var removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement(); + + if (removeParent) { + parent.remove(); + return true; + } + }, function (self, parent) { + if (parent.isSequenceExpression() && parent.node.expressions.length === 1) { + parent.replaceWith(parent.node.expressions[0]); + return true; + } + }, function (self, parent) { + if (parent.isBinary()) { + if (self.key === "left") { + parent.replaceWith(parent.node.right); + } else { + parent.replaceWith(parent.node.left); + } + return true; + } + }, function (self, parent) { + if (parent.isIfStatement() && (self.key === "consequent" || self.key === "alternate") || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) { + self.replaceWith({ + type: "BlockStatement", + body: [] + }); + return true; + } + }]; + +/***/ }), +/* 376 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.insertBefore = insertBefore; + exports._containerInsert = _containerInsert; + exports._containerInsertBefore = _containerInsertBefore; + exports._containerInsertAfter = _containerInsertAfter; + exports._maybePopFromStatements = _maybePopFromStatements; + exports.insertAfter = insertAfter; + exports.updateSiblingKeys = updateSiblingKeys; + exports._verifyNodeList = _verifyNodeList; + exports.unshiftContainer = unshiftContainer; + exports.pushContainer = pushContainer; + exports.hoist = hoist; + + var _cache = __webpack_require__(86); + + var _hoister = __webpack_require__(374); + + var _hoister2 = _interopRequireDefault(_hoister); + + var _index = __webpack_require__(35); + + var _index2 = _interopRequireDefault(_index); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function insertBefore(nodes) { + this._assertUnremoved(); + + nodes = this._verifyNodeList(nodes); + + if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { + return this.parentPath.insertBefore(nodes); + } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") { + if (this.node) nodes.push(this.node); + this.replaceExpressionWithStatements(nodes); + } else { + this._maybePopFromStatements(nodes); + if (Array.isArray(this.container)) { + return this._containerInsertBefore(nodes); + } else if (this.isStatementOrBlock()) { + if (this.node) nodes.push(this.node); + this._replaceWith(t.blockStatement(nodes)); + } else { + throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?"); + } + } + + return [this]; + } + + function _containerInsert(from, nodes) { + this.updateSiblingKeys(from, nodes.length); + + var paths = []; + + for (var i = 0; i < nodes.length; i++) { + var to = from + i; + var node = nodes[i]; + this.container.splice(to, 0, node); + + if (this.context) { + var path = this.context.create(this.parent, this.container, to, this.listKey); + + if (this.context.queue) path.pushContext(this.context); + paths.push(path); + } else { + paths.push(_index2.default.get({ + parentPath: this.parentPath, + parent: this.parent, + container: this.container, + listKey: this.listKey, + key: to + })); + } + } + + var contexts = this._getQueueContexts(); + + for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var _path = _ref; + + _path.setScope(); + _path.debug(function () { + return "Inserted."; + }); + + for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var context = _ref2; + + context.maybeQueue(_path, true); + } + } + + return paths; + } + + function _containerInsertBefore(nodes) { + return this._containerInsert(this.key, nodes); + } + + function _containerInsertAfter(nodes) { + return this._containerInsert(this.key + 1, nodes); + } + + function _maybePopFromStatements(nodes) { + var last = nodes[nodes.length - 1]; + var isIdentifier = t.isIdentifier(last) || t.isExpressionStatement(last) && t.isIdentifier(last.expression); + + if (isIdentifier && !this.isCompletionRecord()) { + nodes.pop(); + } + } + + function insertAfter(nodes) { + this._assertUnremoved(); + + nodes = this._verifyNodeList(nodes); + + if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { + return this.parentPath.insertAfter(nodes); + } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") { + if (this.node) { + var temp = this.scope.generateDeclaredUidIdentifier(); + nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node))); + nodes.push(t.expressionStatement(temp)); + } + this.replaceExpressionWithStatements(nodes); + } else { + this._maybePopFromStatements(nodes); + if (Array.isArray(this.container)) { + return this._containerInsertAfter(nodes); + } else if (this.isStatementOrBlock()) { + if (this.node) nodes.unshift(this.node); + this._replaceWith(t.blockStatement(nodes)); + } else { + throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?"); + } + } + + return [this]; + } + + function updateSiblingKeys(fromIndex, incrementBy) { + if (!this.parent) return; + + var paths = _cache.path.get(this.parent); + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (path.key >= fromIndex) { + path.key += incrementBy; + } + } + } + + function _verifyNodeList(nodes) { + if (!nodes) { + return []; + } + + if (nodes.constructor !== Array) { + nodes = [nodes]; + } + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var msg = void 0; + + if (!node) { + msg = "has falsy node"; + } else if ((typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node)) !== "object") { + msg = "contains a non-object node"; + } else if (!node.type) { + msg = "without a type"; + } else if (node instanceof _index2.default) { + msg = "has a NodePath when it expected a raw object"; + } + + if (msg) { + var type = Array.isArray(node) ? "array" : typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node); + throw new Error("Node list " + msg + " with the index of " + i + " and type of " + type); + } + } + + return nodes; + } + + function unshiftContainer(listKey, nodes) { + this._assertUnremoved(); + + nodes = this._verifyNodeList(nodes); + + var path = _index2.default.get({ + parentPath: this, + parent: this.node, + container: this.node[listKey], + listKey: listKey, + key: 0 + }); + + return path.insertBefore(nodes); + } + + function pushContainer(listKey, nodes) { + this._assertUnremoved(); + + nodes = this._verifyNodeList(nodes); + + var container = this.node[listKey]; + var path = _index2.default.get({ + parentPath: this, + parent: this.node, + container: container, + listKey: listKey, + key: container.length + }); + + return path.replaceWithMultiple(nodes); + } + + function hoist() { + var scope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.scope; + + var hoister = new _hoister2.default(this, scope); + return hoister.run(); + } + +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.remove = remove; + exports._callRemovalHooks = _callRemovalHooks; + exports._remove = _remove; + exports._markRemoved = _markRemoved; + exports._assertUnremoved = _assertUnremoved; + + var _removalHooks = __webpack_require__(375); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function remove() { + this._assertUnremoved(); + + this.resync(); + + if (this._callRemovalHooks()) { + this._markRemoved(); + return; + } + + this.shareCommentsWithSiblings(); + this._remove(); + this._markRemoved(); + } + + function _callRemovalHooks() { + for (var _iterator = _removalHooks.hooks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var fn = _ref; + + if (fn(this, this.parentPath)) return true; + } + } + + function _remove() { + if (Array.isArray(this.container)) { + this.container.splice(this.key, 1); + this.updateSiblingKeys(this.key, -1); + } else { + this._replaceWith(null); + } + } + + function _markRemoved() { + this.shouldSkip = true; + this.removed = true; + this.node = null; + } + + function _assertUnremoved() { + if (this.removed) { + throw this.buildCodeFrameError("NodePath has been removed so is read-only."); + } + } + +/***/ }), +/* 378 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.replaceWithMultiple = replaceWithMultiple; + exports.replaceWithSourceString = replaceWithSourceString; + exports.replaceWith = replaceWith; + exports._replaceWith = _replaceWith; + exports.replaceExpressionWithStatements = replaceExpressionWithStatements; + exports.replaceInline = replaceInline; + + var _babelCodeFrame = __webpack_require__(177); + + var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame); + + var _index = __webpack_require__(7); + + var _index2 = _interopRequireDefault(_index); + + var _index3 = __webpack_require__(35); + + var _index4 = _interopRequireDefault(_index3); + + var _babylon = __webpack_require__(87); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var hoistVariablesVisitor = { + Function: function Function(path) { + path.skip(); + }, + VariableDeclaration: function VariableDeclaration(path) { + if (path.node.kind !== "var") return; + + var bindings = path.getBindingIdentifiers(); + for (var key in bindings) { + path.scope.push({ id: bindings[key] }); + } + + var exprs = []; + + for (var _iterator = path.node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var declar = _ref; + + if (declar.init) { + exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init))); + } + } + + path.replaceWithMultiple(exprs); + } + }; + + function replaceWithMultiple(nodes) { + this.resync(); + + nodes = this._verifyNodeList(nodes); + t.inheritLeadingComments(nodes[0], this.node); + t.inheritTrailingComments(nodes[nodes.length - 1], this.node); + this.node = this.container[this.key] = null; + this.insertAfter(nodes); + + if (this.node) { + this.requeue(); + } else { + this.remove(); + } + } + + function replaceWithSourceString(replacement) { + this.resync(); + + try { + replacement = "(" + replacement + ")"; + replacement = (0, _babylon.parse)(replacement); + } catch (err) { + var loc = err.loc; + if (loc) { + err.message += " - make sure this is an expression."; + err.message += "\n" + (0, _babelCodeFrame2.default)(replacement, loc.line, loc.column + 1); + } + throw err; + } + + replacement = replacement.program.body[0].expression; + _index2.default.removeProperties(replacement); + return this.replaceWith(replacement); + } + + function replaceWith(replacement) { + this.resync(); + + if (this.removed) { + throw new Error("You can't replace this node, we've already removed it"); + } + + if (replacement instanceof _index4.default) { + replacement = replacement.node; + } + + if (!replacement) { + throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead"); + } + + if (this.node === replacement) { + return; + } + + if (this.isProgram() && !t.isProgram(replacement)) { + throw new Error("You can only replace a Program root node with another Program node"); + } + + if (Array.isArray(replacement)) { + throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`"); + } + + if (typeof replacement === "string") { + throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`"); + } + + if (this.isNodeType("Statement") && t.isExpression(replacement)) { + if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + replacement = t.expressionStatement(replacement); + } + } + + if (this.isNodeType("Expression") && t.isStatement(replacement)) { + if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + return this.replaceExpressionWithStatements([replacement]); + } + } + + var oldNode = this.node; + if (oldNode) { + t.inheritsComments(replacement, oldNode); + t.removeComments(oldNode); + } + + this._replaceWith(replacement); + this.type = replacement.type; + + this.setScope(); + + this.requeue(); + } + + function _replaceWith(node) { + if (!this.container) { + throw new ReferenceError("Container is falsy"); + } + + if (this.inList) { + t.validate(this.parent, this.key, [node]); + } else { + t.validate(this.parent, this.key, node); + } + + this.debug(function () { + return "Replace with " + (node && node.type); + }); + + this.node = this.container[this.key] = node; + } + + function replaceExpressionWithStatements(nodes) { + this.resync(); + + var toSequenceExpression = t.toSequenceExpression(nodes, this.scope); + + if (t.isSequenceExpression(toSequenceExpression)) { + var exprs = toSequenceExpression.expressions; + + if (exprs.length >= 2 && this.parentPath.isExpressionStatement()) { + this._maybePopFromStatements(exprs); + } + + if (exprs.length === 1) { + this.replaceWith(exprs[0]); + } else { + this.replaceWith(toSequenceExpression); + } + } else if (toSequenceExpression) { + this.replaceWith(toSequenceExpression); + } else { + var container = t.functionExpression(null, [], t.blockStatement(nodes)); + container.shadow = true; + + this.replaceWith(t.callExpression(container, [])); + this.traverse(hoistVariablesVisitor); + + var completionRecords = this.get("callee").getCompletionRecords(); + for (var _iterator2 = completionRecords, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var path = _ref2; + + if (!path.isExpressionStatement()) continue; + + var loop = path.findParent(function (path) { + return path.isLoop(); + }); + if (loop) { + var uid = loop.getData("expressionReplacementReturnUid"); + + if (!uid) { + var callee = this.get("callee"); + uid = callee.scope.generateDeclaredUidIdentifier("ret"); + callee.get("body").pushContainer("body", t.returnStatement(uid)); + loop.setData("expressionReplacementReturnUid", uid); + } else { + uid = t.identifier(uid.name); + } + + path.get("expression").replaceWith(t.assignmentExpression("=", uid, path.node.expression)); + } else { + path.replaceWith(t.returnStatement(path.node.expression)); + } + } + + return this.node; + } + } + + function replaceInline(nodes) { + this.resync(); + + if (Array.isArray(nodes)) { + if (Array.isArray(this.container)) { + nodes = this._verifyNodeList(nodes); + this._containerInsertAfter(nodes); + return this.remove(); + } else { + return this.replaceWithMultiple(nodes); + } + } else { + return this.replaceWith(nodes); + } + } + +/***/ }), +/* 379 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _classCallCheck2 = __webpack_require__(3); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _binding = __webpack_require__(221); + + var _binding2 = _interopRequireDefault(_binding); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var renameVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(_ref, state) { + var node = _ref.node; + + if (node.name === state.oldName) { + node.name = state.newName; + } + }, + Scope: function Scope(path, state) { + if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) { + path.skip(); + } + }, + "AssignmentExpression|Declaration": function AssignmentExpressionDeclaration(path, state) { + var ids = path.getOuterBindingIdentifiers(); + + for (var name in ids) { + if (name === state.oldName) ids[name].name = state.newName; + } + } + }; + + var Renamer = function () { + function Renamer(binding, oldName, newName) { + (0, _classCallCheck3.default)(this, Renamer); + + this.newName = newName; + this.oldName = oldName; + this.binding = binding; + } + + Renamer.prototype.maybeConvertFromExportDeclaration = function maybeConvertFromExportDeclaration(parentDeclar) { + var exportDeclar = parentDeclar.parentPath.isExportDeclaration() && parentDeclar.parentPath; + if (!exportDeclar) return; + + var isDefault = exportDeclar.isExportDefaultDeclaration(); + + if (isDefault && (parentDeclar.isFunctionDeclaration() || parentDeclar.isClassDeclaration()) && !parentDeclar.node.id) { + parentDeclar.node.id = parentDeclar.scope.generateUidIdentifier("default"); + } + + var bindingIdentifiers = parentDeclar.getOuterBindingIdentifiers(); + var specifiers = []; + + for (var name in bindingIdentifiers) { + var localName = name === this.oldName ? this.newName : name; + var exportedName = isDefault ? "default" : name; + specifiers.push(t.exportSpecifier(t.identifier(localName), t.identifier(exportedName))); + } + + if (specifiers.length) { + var aliasDeclar = t.exportNamedDeclaration(null, specifiers); + + if (parentDeclar.isFunctionDeclaration()) { + aliasDeclar._blockHoist = 3; + } + + exportDeclar.insertAfter(aliasDeclar); + exportDeclar.replaceWith(parentDeclar.node); + } + }; + + Renamer.prototype.maybeConvertFromClassFunctionDeclaration = function maybeConvertFromClassFunctionDeclaration(path) { + return; + + if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return; + if (this.binding.kind !== "hoisted") return; + + path.node.id = t.identifier(this.oldName); + path.node._blockHoist = 3; + + path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))])); + }; + + Renamer.prototype.maybeConvertFromClassFunctionExpression = function maybeConvertFromClassFunctionExpression(path) { + return; + + if (!path.isFunctionExpression() && !path.isClassExpression()) return; + if (this.binding.kind !== "local") return; + + path.node.id = t.identifier(this.oldName); + + this.binding.scope.parent.push({ + id: t.identifier(this.newName) + }); + + path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node)); + }; + + Renamer.prototype.rename = function rename(block) { + var binding = this.binding, + oldName = this.oldName, + newName = this.newName; + var scope = binding.scope, + path = binding.path; + + var parentDeclar = path.find(function (path) { + return path.isDeclaration() || path.isFunctionExpression(); + }); + if (parentDeclar) { + this.maybeConvertFromExportDeclaration(parentDeclar); + } + + scope.traverse(block || scope.block, renameVisitor, this); + + if (!block) { + scope.removeOwnBinding(oldName); + scope.bindings[newName] = binding; + this.binding.identifier.name = newName; + } + + if (binding.type === "hoisted") {} + + if (parentDeclar) { + this.maybeConvertFromClassFunctionDeclaration(parentDeclar); + this.maybeConvertFromClassFunctionExpression(parentDeclar); + } + }; + + return Renamer; + }(); + + exports.default = Renamer; + module.exports = exports["default"]; + +/***/ }), +/* 380 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.explode = explode; + exports.verify = verify; + exports.merge = merge; + + var _virtualTypes = __webpack_require__(220); + + var virtualTypes = _interopRequireWildcard(_virtualTypes); + + var _babelMessages = __webpack_require__(18); + + var messages = _interopRequireWildcard(_babelMessages); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _clone = __webpack_require__(109); + + var _clone2 = _interopRequireDefault(_clone); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function explode(visitor) { + if (visitor._exploded) return visitor; + visitor._exploded = true; + + for (var nodeType in visitor) { + if (shouldIgnoreKey(nodeType)) continue; + + var parts = nodeType.split("|"); + if (parts.length === 1) continue; + + var fns = visitor[nodeType]; + delete visitor[nodeType]; + + for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var part = _ref; + + visitor[part] = fns; + } + } + + verify(visitor); + + delete visitor.__esModule; + + ensureEntranceObjects(visitor); + + ensureCallbackArrays(visitor); + + for (var _iterator2 = (0, _keys2.default)(visitor), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _nodeType3 = _ref2; + + if (shouldIgnoreKey(_nodeType3)) continue; + + var wrapper = virtualTypes[_nodeType3]; + if (!wrapper) continue; + + var _fns2 = visitor[_nodeType3]; + for (var type in _fns2) { + _fns2[type] = wrapCheck(wrapper, _fns2[type]); + } + + delete visitor[_nodeType3]; + + if (wrapper.types) { + for (var _iterator4 = wrapper.types, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var _type = _ref4; + + if (visitor[_type]) { + mergePair(visitor[_type], _fns2); + } else { + visitor[_type] = _fns2; + } + } + } else { + mergePair(visitor, _fns2); + } + } + + for (var _nodeType in visitor) { + if (shouldIgnoreKey(_nodeType)) continue; + + var _fns = visitor[_nodeType]; + + var aliases = t.FLIPPED_ALIAS_KEYS[_nodeType]; + + var deprecratedKey = t.DEPRECATED_KEYS[_nodeType]; + if (deprecratedKey) { + console.trace("Visitor defined for " + _nodeType + " but it has been renamed to " + deprecratedKey); + aliases = [deprecratedKey]; + } + + if (!aliases) continue; + + delete visitor[_nodeType]; + + for (var _iterator3 = aliases, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var alias = _ref3; + + var existing = visitor[alias]; + if (existing) { + mergePair(existing, _fns); + } else { + visitor[alias] = (0, _clone2.default)(_fns); + } + } + } + + for (var _nodeType2 in visitor) { + if (shouldIgnoreKey(_nodeType2)) continue; + + ensureCallbackArrays(visitor[_nodeType2]); + } + + return visitor; + } + + function verify(visitor) { + if (visitor._verified) return; + + if (typeof visitor === "function") { + throw new Error(messages.get("traverseVerifyRootFunction")); + } + + for (var nodeType in visitor) { + if (nodeType === "enter" || nodeType === "exit") { + validateVisitorMethods(nodeType, visitor[nodeType]); + } + + if (shouldIgnoreKey(nodeType)) continue; + + if (t.TYPES.indexOf(nodeType) < 0) { + throw new Error(messages.get("traverseVerifyNodeType", nodeType)); + } + + var visitors = visitor[nodeType]; + if ((typeof visitors === "undefined" ? "undefined" : (0, _typeof3.default)(visitors)) === "object") { + for (var visitorKey in visitors) { + if (visitorKey === "enter" || visitorKey === "exit") { + validateVisitorMethods(nodeType + "." + visitorKey, visitors[visitorKey]); + } else { + throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey)); + } + } + } + } + + visitor._verified = true; + } + + function validateVisitorMethods(path, val) { + var fns = [].concat(val); + for (var _iterator5 = fns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var fn = _ref5; + + if (typeof fn !== "function") { + throw new TypeError("Non-function found defined in " + path + " with type " + (typeof fn === "undefined" ? "undefined" : (0, _typeof3.default)(fn))); + } + } + } + + function merge(visitors) { + var states = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var wrapper = arguments[2]; + + var rootVisitor = {}; + + for (var i = 0; i < visitors.length; i++) { + var visitor = visitors[i]; + var state = states[i]; + + explode(visitor); + + for (var type in visitor) { + var visitorType = visitor[type]; + + if (state || wrapper) { + visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper); + } + + var nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; + mergePair(nodeVisitor, visitorType); + } + } + + return rootVisitor; + } + + function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { + var newVisitor = {}; + + var _loop = function _loop(key) { + var fns = oldVisitor[key]; + + if (!Array.isArray(fns)) return "continue"; + + fns = fns.map(function (fn) { + var newFn = fn; + + if (state) { + newFn = function newFn(path) { + return fn.call(state, path, state); + }; + } + + if (wrapper) { + newFn = wrapper(state.key, key, newFn); + } + + return newFn; + }); + + newVisitor[key] = fns; + }; + + for (var key in oldVisitor) { + var _ret = _loop(key); + + if (_ret === "continue") continue; + } + + return newVisitor; + } + + function ensureEntranceObjects(obj) { + for (var key in obj) { + if (shouldIgnoreKey(key)) continue; + + var fns = obj[key]; + if (typeof fns === "function") { + obj[key] = { enter: fns }; + } + } + } + + function ensureCallbackArrays(obj) { + if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; + if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; + } + + function wrapCheck(wrapper, fn) { + var newFn = function newFn(path) { + if (wrapper.checkPath(path)) { + return fn.apply(this, arguments); + } + }; + newFn.toString = function () { + return fn.toString(); + }; + return newFn; + } + + function shouldIgnoreKey(key) { + if (key[0] === "_") return true; + + if (key === "enter" || key === "exit" || key === "shouldSkip") return true; + + if (key === "blacklist" || key === "noScope" || key === "skipKeys") return true; + + return false; + } + + function mergePair(dest, src) { + for (var key in src) { + dest[key] = [].concat(dest[key] || [], src[key]); + } + } + +/***/ }), +/* 381 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _maxSafeInteger = __webpack_require__(355); + + var _maxSafeInteger2 = _interopRequireDefault(_maxSafeInteger); + + var _stringify = __webpack_require__(34); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.toComputedKey = toComputedKey; + exports.toSequenceExpression = toSequenceExpression; + exports.toKeyAlias = toKeyAlias; + exports.toIdentifier = toIdentifier; + exports.toBindingIdentifierName = toBindingIdentifierName; + exports.toStatement = toStatement; + exports.toExpression = toExpression; + exports.toBlock = toBlock; + exports.valueToNode = valueToNode; + + var _isPlainObject = __webpack_require__(270); + + var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + + var _isRegExp = __webpack_require__(271); + + var _isRegExp2 = _interopRequireDefault(_isRegExp); + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function toComputedKey(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key || node.property; + + if (!node.computed) { + if (t.isIdentifier(key)) key = t.stringLiteral(key.name); + } + return key; + } + + function toSequenceExpression(nodes, scope) { + if (!nodes || !nodes.length) return; + + var declars = []; + var bailed = false; + + var result = convert(nodes); + if (bailed) return; + + for (var i = 0; i < declars.length; i++) { + scope.push(declars[i]); + } + + return result; + + function convert(nodes) { + var ensureLastUndefined = false; + var exprs = []; + + for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var node = _ref; + + if (t.isExpression(node)) { + exprs.push(node); + } else if (t.isExpressionStatement(node)) { + exprs.push(node.expression); + } else if (t.isVariableDeclaration(node)) { + if (node.kind !== "var") return bailed = true; + + for (var _iterator2 = node.declarations, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var declar = _ref2; + + var bindings = t.getBindingIdentifiers(declar); + for (var key in bindings) { + declars.push({ + kind: node.kind, + id: bindings[key] + }); + } + + if (declar.init) { + exprs.push(t.assignmentExpression("=", declar.id, declar.init)); + } + } + + ensureLastUndefined = true; + continue; + } else if (t.isIfStatement(node)) { + var consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode(); + var alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode(); + if (!consequent || !alternate) return bailed = true; + + exprs.push(t.conditionalExpression(node.test, consequent, alternate)); + } else if (t.isBlockStatement(node)) { + exprs.push(convert(node.body)); + } else if (t.isEmptyStatement(node)) { + ensureLastUndefined = true; + continue; + } else { + return bailed = true; + } + + ensureLastUndefined = false; + } + + if (ensureLastUndefined || exprs.length === 0) { + exprs.push(scope.buildUndefinedNode()); + } + + if (exprs.length === 1) { + return exprs[0]; + } else { + return t.sequenceExpression(exprs); + } + } + } + + function toKeyAlias(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key; + + var alias = void 0; + + if (node.kind === "method") { + return toKeyAlias.increment() + ""; + } else if (t.isIdentifier(key)) { + alias = key.name; + } else if (t.isStringLiteral(key)) { + alias = (0, _stringify2.default)(key.value); + } else { + alias = (0, _stringify2.default)(t.removePropertiesDeep(t.cloneDeep(key))); + } + + if (node.computed) { + alias = "[" + alias + "]"; + } + + if (node.static) { + alias = "static:" + alias; + } + + return alias; + } + + toKeyAlias.uid = 0; + + toKeyAlias.increment = function () { + if (toKeyAlias.uid >= _maxSafeInteger2.default) { + return toKeyAlias.uid = 0; + } else { + return toKeyAlias.uid++; + } + }; + + function toIdentifier(name) { + name = name + ""; + + name = name.replace(/[^a-zA-Z0-9$_]/g, "-"); + + name = name.replace(/^[-0-9]+/, ""); + + name = name.replace(/[-\s]+(.)?/g, function (match, c) { + return c ? c.toUpperCase() : ""; + }); + + if (!t.isValidIdentifier(name)) { + name = "_" + name; + } + + return name || "_"; + } + + function toBindingIdentifierName(name) { + name = toIdentifier(name); + if (name === "eval" || name === "arguments") name = "_" + name; + return name; + } + + function toStatement(node, ignore) { + if (t.isStatement(node)) { + return node; + } + + var mustHaveId = false; + var newType = void 0; + + if (t.isClass(node)) { + mustHaveId = true; + newType = "ClassDeclaration"; + } else if (t.isFunction(node)) { + mustHaveId = true; + newType = "FunctionDeclaration"; + } else if (t.isAssignmentExpression(node)) { + return t.expressionStatement(node); + } + + if (mustHaveId && !node.id) { + newType = false; + } + + if (!newType) { + if (ignore) { + return false; + } else { + throw new Error("cannot turn " + node.type + " to a statement"); + } + } + + node.type = newType; + + return node; + } + + function toExpression(node) { + if (t.isExpressionStatement(node)) { + node = node.expression; + } + + if (t.isExpression(node)) { + return node; + } + + if (t.isClass(node)) { + node.type = "ClassExpression"; + } else if (t.isFunction(node)) { + node.type = "FunctionExpression"; + } + + if (!t.isExpression(node)) { + throw new Error("cannot turn " + node.type + " to an expression"); + } + + return node; + } + + function toBlock(node, parent) { + if (t.isBlockStatement(node)) { + return node; + } + + if (t.isEmptyStatement(node)) { + node = []; + } + + if (!Array.isArray(node)) { + if (!t.isStatement(node)) { + if (t.isFunction(parent)) { + node = t.returnStatement(node); + } else { + node = t.expressionStatement(node); + } + } + + node = [node]; + } + + return t.blockStatement(node); + } + + function valueToNode(value) { + if (value === undefined) { + return t.identifier("undefined"); + } + + if (value === true || value === false) { + return t.booleanLiteral(value); + } + + if (value === null) { + return t.nullLiteral(); + } + + if (typeof value === "string") { + return t.stringLiteral(value); + } + + if (typeof value === "number") { + return t.numericLiteral(value); + } + + if ((0, _isRegExp2.default)(value)) { + var pattern = value.source; + var flags = value.toString().match(/\/([a-z]+|)$/)[1]; + return t.regExpLiteral(pattern, flags); + } + + if (Array.isArray(value)) { + return t.arrayExpression(value.map(t.valueToNode)); + } + + if ((0, _isPlainObject2.default)(value)) { + var props = []; + for (var key in value) { + var nodeKey = void 0; + if (t.isValidIdentifier(key)) { + nodeKey = t.identifier(key); + } else { + nodeKey = t.stringLiteral(key); + } + props.push(t.objectProperty(nodeKey, t.valueToNode(value[key]))); + } + return t.objectExpression(props); + } + + throw new Error("don't know how to turn this value into a node"); + } + +/***/ }), +/* 382 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + var _constants = __webpack_require__(134); + + var _index2 = __webpack_require__(26); + + var _index3 = _interopRequireDefault(_index2); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + (0, _index3.default)("ArrayExpression", { + fields: { + elements: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeOrValueType)("null", "Expression", "SpreadElement"))), + default: [] + } + }, + visitor: ["elements"], + aliases: ["Expression"] + }); + + (0, _index3.default)("AssignmentExpression", { + fields: { + operator: { + validate: (0, _index2.assertValueType)("string") + }, + left: { + validate: (0, _index2.assertNodeType)("LVal") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Expression"] + }); + + (0, _index3.default)("BinaryExpression", { + builder: ["operator", "left", "right"], + fields: { + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.BINARY_OPERATORS) + }, + left: { + validate: (0, _index2.assertNodeType)("Expression") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + visitor: ["left", "right"], + aliases: ["Binary", "Expression"] + }); + + (0, _index3.default)("Directive", { + visitor: ["value"], + fields: { + value: { + validate: (0, _index2.assertNodeType)("DirectiveLiteral") + } + } + }); + + (0, _index3.default)("DirectiveLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("string") + } + } + }); + + (0, _index3.default)("BlockStatement", { + builder: ["body", "directives"], + visitor: ["directives", "body"], + fields: { + directives: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "Statement"] + }); + + (0, _index3.default)("BreakStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] + }); + + (0, _index3.default)("CallExpression", { + visitor: ["callee", "arguments"], + fields: { + callee: { + validate: (0, _index2.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) + } + }, + aliases: ["Expression"] + }); + + (0, _index3.default)("CatchClause", { + visitor: ["param", "body"], + fields: { + param: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + } + }, + aliases: ["Scopable"] + }); + + (0, _index3.default)("ConditionalExpression", { + visitor: ["test", "consequent", "alternate"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _index2.assertNodeType)("Expression") + }, + alternate: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + aliases: ["Expression", "Conditional"] + }); + + (0, _index3.default)("ContinueStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] + }); + + (0, _index3.default)("DebuggerStatement", { + aliases: ["Statement"] + }); + + (0, _index3.default)("DoWhileStatement", { + visitor: ["test", "body"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + }, + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] + }); + + (0, _index3.default)("EmptyStatement", { + aliases: ["Statement"] + }); + + (0, _index3.default)("ExpressionStatement", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + aliases: ["Statement", "ExpressionWrapper"] + }); + + (0, _index3.default)("File", { + builder: ["program", "comments", "tokens"], + visitor: ["program"], + fields: { + program: { + validate: (0, _index2.assertNodeType)("Program") + } + } + }); + + (0, _index3.default)("ForInStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index2.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } + }); + + (0, _index3.default)("ForStatement", { + visitor: ["init", "test", "update", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], + fields: { + init: { + validate: (0, _index2.assertNodeType)("VariableDeclaration", "Expression"), + optional: true + }, + test: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + update: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } + }); + + (0, _index3.default)("FunctionDeclaration", { + builder: ["id", "params", "body", "generator", "async"], + visitor: ["id", "params", "body", "returnType", "typeParameters"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + params: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + }, + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"] + }); + + (0, _index3.default)("FunctionExpression", { + inherits: "FunctionDeclaration", + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + }, + params: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + } + }); + + (0, _index3.default)("Identifier", { + builder: ["name"], + visitor: ["typeAnnotation"], + aliases: ["Expression", "LVal"], + fields: { + name: { + validate: function validate(node, key, val) { + if (!t.isValidIdentifier(val)) {} + } + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index3.default)("IfStatement", { + visitor: ["test", "consequent", "alternate"], + aliases: ["Statement", "Conditional"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _index2.assertNodeType)("Statement") + }, + alternate: { + optional: true, + validate: (0, _index2.assertNodeType)("Statement") + } + } + }); + + (0, _index3.default)("LabeledStatement", { + visitor: ["label", "body"], + aliases: ["Statement"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } + }); + + (0, _index3.default)("StringLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + + (0, _index3.default)("NumericLiteral", { + builder: ["value"], + deprecatedAlias: "NumberLiteral", + fields: { + value: { + validate: (0, _index2.assertValueType)("number") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + + (0, _index3.default)("NullLiteral", { + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + + (0, _index3.default)("BooleanLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("boolean") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + + (0, _index3.default)("RegExpLiteral", { + builder: ["pattern", "flags"], + deprecatedAlias: "RegexLiteral", + aliases: ["Expression", "Literal"], + fields: { + pattern: { + validate: (0, _index2.assertValueType)("string") + }, + flags: { + validate: (0, _index2.assertValueType)("string"), + default: "" + } + } + }); + + (0, _index3.default)("LogicalExpression", { + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Binary", "Expression"], + fields: { + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.LOGICAL_OPERATORS) + }, + left: { + validate: (0, _index2.assertNodeType)("Expression") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + } + }); + + (0, _index3.default)("MemberExpression", { + builder: ["object", "property", "computed"], + visitor: ["object", "property"], + aliases: ["Expression", "LVal"], + fields: { + object: { + validate: (0, _index2.assertNodeType)("Expression") + }, + property: { + validate: function validate(node, key, val) { + var expectedType = node.computed ? "Expression" : "Identifier"; + (0, _index2.assertNodeType)(expectedType)(node, key, val); + } + }, + computed: { + default: false + } + } + }); + + (0, _index3.default)("NewExpression", { + visitor: ["callee", "arguments"], + aliases: ["Expression"], + fields: { + callee: { + validate: (0, _index2.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) + } + } + }); + + (0, _index3.default)("Program", { + visitor: ["directives", "body"], + builder: ["body", "directives"], + fields: { + directives: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"] + }); + + (0, _index3.default)("ObjectExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadProperty"))) + } + } + }); + + (0, _index3.default)("ObjectMethod", { + builder: ["kind", "key", "params", "body", "computed"], + fields: { + kind: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")), + default: "method" + }, + computed: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + }, + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] + }); + + (0, _index3.default)("ObjectProperty", { + builder: ["key", "value", "computed", "shorthand", "decorators"], + fields: { + computed: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + value: { + validate: (0, _index2.assertNodeType)("Expression", "Pattern", "RestElement") + }, + shorthand: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))), + optional: true + } + }, + visitor: ["key", "value", "decorators"], + aliases: ["UserWhitespacable", "Property", "ObjectMember"] + }); + + (0, _index3.default)("RestElement", { + visitor: ["argument", "typeAnnotation"], + aliases: ["LVal"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("LVal") + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index3.default)("ReturnStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + } + } + }); + + (0, _index3.default)("SequenceExpression", { + visitor: ["expressions"], + fields: { + expressions: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression"))) + } + }, + aliases: ["Expression"] + }); + + (0, _index3.default)("SwitchCase", { + visitor: ["test", "consequent"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + consequent: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + } + }); + + (0, _index3.default)("SwitchStatement", { + visitor: ["discriminant", "cases"], + aliases: ["Statement", "BlockParent", "Scopable"], + fields: { + discriminant: { + validate: (0, _index2.assertNodeType)("Expression") + }, + cases: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("SwitchCase"))) + } + } + }); + + (0, _index3.default)("ThisExpression", { + aliases: ["Expression"] + }); + + (0, _index3.default)("ThrowStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("Expression") + } + } + }); + + (0, _index3.default)("TryStatement", { + visitor: ["block", "handler", "finalizer"], + aliases: ["Statement"], + fields: { + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + handler: { + optional: true, + handler: (0, _index2.assertNodeType)("BlockStatement") + }, + finalizer: { + optional: true, + validate: (0, _index2.assertNodeType)("BlockStatement") + } + } + }); + + (0, _index3.default)("UnaryExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: true + }, + argument: { + validate: (0, _index2.assertNodeType)("Expression") + }, + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.UNARY_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["UnaryLike", "Expression"] + }); + + (0, _index3.default)("UpdateExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: false + }, + argument: { + validate: (0, _index2.assertNodeType)("Expression") + }, + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.UPDATE_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["Expression"] + }); + + (0, _index3.default)("VariableDeclaration", { + builder: ["kind", "declarations"], + visitor: ["declarations"], + aliases: ["Statement", "Declaration"], + fields: { + kind: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("var", "let", "const")) + }, + declarations: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("VariableDeclarator"))) + } + } + }); + + (0, _index3.default)("VariableDeclarator", { + visitor: ["id", "init"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("LVal") + }, + init: { + optional: true, + validate: (0, _index2.assertNodeType)("Expression") + } + } + }); + + (0, _index3.default)("WhileStatement", { + visitor: ["test", "body"], + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") + } + } + }); + + (0, _index3.default)("WithStatement", { + visitor: ["object", "body"], + aliases: ["Statement"], + fields: { + object: { + object: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") + } + } + }); + +/***/ }), +/* 383 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(26); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + (0, _index2.default)("AssignmentPattern", { + visitor: ["left", "right"], + aliases: ["Pattern", "LVal"], + fields: { + left: { + validate: (0, _index.assertNodeType)("Identifier") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index2.default)("ArrayPattern", { + visitor: ["elements", "typeAnnotation"], + aliases: ["Pattern", "LVal"], + fields: { + elements: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Identifier", "Pattern", "RestElement"))) + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index2.default)("ArrowFunctionExpression", { + builder: ["params", "body", "async"], + visitor: ["params", "body", "returnType", "typeParameters"], + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: { + params: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index.assertNodeType)("BlockStatement", "Expression") + }, + async: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } + }); + + (0, _index2.default)("ClassBody", { + visitor: ["body"], + fields: { + body: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty"))) + } + } + }); + + (0, _index2.default)("ClassDeclaration", { + builder: ["id", "superClass", "body", "decorators"], + visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], + aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], + fields: { + id: { + validate: (0, _index.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index2.default)("ClassExpression", { + inherits: "ClassDeclaration", + aliases: ["Scopable", "Class", "Expression", "Pureish"], + fields: { + id: { + optional: true, + validate: (0, _index.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index2.default)("ExportAllDeclaration", { + visitor: ["source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + source: { + validate: (0, _index.assertNodeType)("StringLiteral") + } + } + }); + + (0, _index2.default)("ExportDefaultDeclaration", { + visitor: ["declaration"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression") + } + } + }); + + (0, _index2.default)("ExportNamedDeclaration", { + visitor: ["declaration", "specifiers", "source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: (0, _index.assertNodeType)("Declaration"), + optional: true + }, + specifiers: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier"))) + }, + source: { + validate: (0, _index.assertNodeType)("StringLiteral"), + optional: true + } + } + }); + + (0, _index2.default)("ExportSpecifier", { + visitor: ["local", "exported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + }, + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } + }); + + (0, _index2.default)("ForOfStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + body: { + validate: (0, _index.assertNodeType)("Statement") + } + } + }); + + (0, _index2.default)("ImportDeclaration", { + visitor: ["specifiers", "source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration"], + fields: { + specifiers: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) + }, + source: { + validate: (0, _index.assertNodeType)("StringLiteral") + } + } + }); + + (0, _index2.default)("ImportDefaultSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + } + } + }); + + (0, _index2.default)("ImportNamespaceSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + } + } + }); + + (0, _index2.default)("ImportSpecifier", { + visitor: ["local", "imported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + }, + imported: { + validate: (0, _index.assertNodeType)("Identifier") + }, + importKind: { + validate: (0, _index.assertOneOf)(null, "type", "typeof") + } + } + }); + + (0, _index2.default)("MetaProperty", { + visitor: ["meta", "property"], + aliases: ["Expression"], + fields: { + meta: { + validate: (0, _index.assertValueType)("string") + }, + property: { + validate: (0, _index.assertValueType)("string") + } + } + }); + + (0, _index2.default)("ClassMethod", { + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], + builder: ["kind", "key", "params", "body", "computed", "static"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + fields: { + kind: { + validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")), + default: "method" + }, + computed: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + static: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + params: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index.assertValueType)("boolean") + } + } + }); + + (0, _index2.default)("ObjectPattern", { + visitor: ["properties", "typeAnnotation"], + aliases: ["Pattern", "LVal"], + fields: { + properties: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property"))) + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } + }); + + (0, _index2.default)("SpreadElement", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("Super", { + aliases: ["Expression"] + }); + + (0, _index2.default)("TaggedTemplateExpression", { + visitor: ["tag", "quasi"], + aliases: ["Expression"], + fields: { + tag: { + validate: (0, _index.assertNodeType)("Expression") + }, + quasi: { + validate: (0, _index.assertNodeType)("TemplateLiteral") + } + } + }); + + (0, _index2.default)("TemplateElement", { + builder: ["value", "tail"], + fields: { + value: {}, + tail: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } + }); + + (0, _index2.default)("TemplateLiteral", { + visitor: ["quasis", "expressions"], + aliases: ["Expression", "Literal"], + fields: { + quasis: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement"))) + }, + expressions: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression"))) + } + } + }); + + (0, _index2.default)("YieldExpression", { + builder: ["argument", "delegate"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + delegate: { + validate: (0, _index.assertValueType)("boolean"), + default: false + }, + argument: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + +/***/ }), +/* 384 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(26); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + (0, _index2.default)("AwaitExpression", { + builder: ["argument"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("ForAwaitStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + body: { + validate: (0, _index.assertNodeType)("Statement") + } + } + }); + + (0, _index2.default)("BindExpression", { + visitor: ["object", "callee"], + aliases: ["Expression"], + fields: {} + }); + + (0, _index2.default)("Import", { + aliases: ["Expression"] + }); + + (0, _index2.default)("Decorator", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("DoExpression", { + visitor: ["body"], + aliases: ["Expression"], + fields: { + body: { + validate: (0, _index.assertNodeType)("BlockStatement") + } + } + }); + + (0, _index2.default)("ExportDefaultSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } + }); + + (0, _index2.default)("ExportNamespaceSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } + }); + + (0, _index2.default)("RestProperty", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("LVal") + } + } + }); + + (0, _index2.default)("SpreadProperty", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + +/***/ }), +/* 385 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(26); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + (0, _index2.default)("AnyTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("ArrayTypeAnnotation", { + visitor: ["elementType"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("BooleanTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("BooleanLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("NullLiteralTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("ClassImplements", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("ClassProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed"], + aliases: ["Property"], + fields: { + computed: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } + }); + + (0, _index2.default)("DeclareClass", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareFunction", { + visitor: ["id"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareInterface", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareModule", { + visitor: ["id", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareModuleExports", { + visitor: ["typeAnnotation"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareTypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("DeclareVariable", { + visitor: ["id"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("ExistentialTypeParam", { + aliases: ["Flow"] + }); + + (0, _index2.default)("FunctionTypeAnnotation", { + visitor: ["typeParameters", "params", "rest", "returnType"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("FunctionTypeParam", { + visitor: ["name", "typeAnnotation"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("GenericTypeAnnotation", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("InterfaceExtends", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("InterfaceDeclaration", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("IntersectionTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("MixedTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"] + }); + + (0, _index2.default)("EmptyTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"] + }); + + (0, _index2.default)("NullableTypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("NumericLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("NumberTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("StringLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("StringTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("ThisTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + + (0, _index2.default)("TupleTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("TypeofTypeAnnotation", { + visitor: ["argument"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("TypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} + }); + + (0, _index2.default)("TypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("TypeCastExpression", { + visitor: ["expression", "typeAnnotation"], + aliases: ["Flow", "ExpressionWrapper", "Expression"], + fields: {} + }); + + (0, _index2.default)("TypeParameter", { + visitor: ["bound"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("TypeParameterDeclaration", { + visitor: ["params"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("TypeParameterInstantiation", { + visitor: ["params"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("ObjectTypeAnnotation", { + visitor: ["properties", "indexers", "callProperties"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("ObjectTypeCallProperty", { + visitor: ["value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} + }); + + (0, _index2.default)("ObjectTypeIndexer", { + visitor: ["id", "key", "value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} + }); + + (0, _index2.default)("ObjectTypeProperty", { + visitor: ["key", "value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} + }); + + (0, _index2.default)("ObjectTypeSpreadProperty", { + visitor: ["argument"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} + }); + + (0, _index2.default)("QualifiedTypeIdentifier", { + visitor: ["id", "qualification"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("UnionTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} + }); + + (0, _index2.default)("VoidTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} + }); + +/***/ }), +/* 386 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + __webpack_require__(26); + + __webpack_require__(382); + + __webpack_require__(383); + + __webpack_require__(385); + + __webpack_require__(387); + + __webpack_require__(388); + + __webpack_require__(384); + +/***/ }), +/* 387 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(26); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + (0, _index2.default)("JSXAttribute", { + visitor: ["name", "value"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXNamespacedName") + }, + value: { + optional: true, + validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer") + } + } + }); + + (0, _index2.default)("JSXClosingElement", { + visitor: ["name"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") + } + } + }); + + (0, _index2.default)("JSXElement", { + builder: ["openingElement", "closingElement", "children", "selfClosing"], + visitor: ["openingElement", "children", "closingElement"], + aliases: ["JSX", "Immutable", "Expression"], + fields: { + openingElement: { + validate: (0, _index.assertNodeType)("JSXOpeningElement") + }, + closingElement: { + optional: true, + validate: (0, _index.assertNodeType)("JSXClosingElement") + }, + children: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement"))) + } + } + }); + + (0, _index2.default)("JSXEmptyExpression", { + aliases: ["JSX", "Expression"] + }); + + (0, _index2.default)("JSXExpressionContainer", { + visitor: ["expression"], + aliases: ["JSX", "Immutable"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("JSXSpreadChild", { + visitor: ["expression"], + aliases: ["JSX", "Immutable"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("JSXIdentifier", { + builder: ["name"], + aliases: ["JSX", "Expression"], + fields: { + name: { + validate: (0, _index.assertValueType)("string") + } + } + }); + + (0, _index2.default)("JSXMemberExpression", { + visitor: ["object", "property"], + aliases: ["JSX", "Expression"], + fields: { + object: { + validate: (0, _index.assertNodeType)("JSXMemberExpression", "JSXIdentifier") + }, + property: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + } + } + }); + + (0, _index2.default)("JSXNamespacedName", { + visitor: ["namespace", "name"], + aliases: ["JSX"], + fields: { + namespace: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + }, + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + } + } + }); + + (0, _index2.default)("JSXOpeningElement", { + builder: ["name", "attributes", "selfClosing"], + visitor: ["name", "attributes"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") + }, + selfClosing: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + attributes: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXAttribute", "JSXSpreadAttribute"))) + } + } + }); + + (0, _index2.default)("JSXSpreadAttribute", { + visitor: ["argument"], + aliases: ["JSX"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + + (0, _index2.default)("JSXText", { + aliases: ["JSX", "Immutable"], + builder: ["value"], + fields: { + value: { + validate: (0, _index.assertValueType)("string") + } + } + }); + +/***/ }), +/* 388 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _index = __webpack_require__(26); + + var _index2 = _interopRequireDefault(_index); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + (0, _index2.default)("Noop", { + visitor: [] + }); + + (0, _index2.default)("ParenthesizedExpression", { + visitor: ["expression"], + aliases: ["Expression", "ExpressionWrapper"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } + }); + +/***/ }), +/* 389 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.createUnionTypeAnnotation = createUnionTypeAnnotation; + exports.removeTypeDuplicates = removeTypeDuplicates; + exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof; + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function createUnionTypeAnnotation(types) { + var flattened = removeTypeDuplicates(types); + + if (flattened.length === 1) { + return flattened[0]; + } else { + return t.unionTypeAnnotation(flattened); + } + } + + function removeTypeDuplicates(nodes) { + var generics = {}; + var bases = {}; + + var typeGroups = []; + + var types = []; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (!node) continue; + + if (types.indexOf(node) >= 0) { + continue; + } + + if (t.isAnyTypeAnnotation(node)) { + return [node]; + } + + if (t.isFlowBaseAnnotation(node)) { + bases[node.type] = node; + continue; + } + + if (t.isUnionTypeAnnotation(node)) { + if (typeGroups.indexOf(node.types) < 0) { + nodes = nodes.concat(node.types); + typeGroups.push(node.types); + } + continue; + } + + if (t.isGenericTypeAnnotation(node)) { + var name = node.id.name; + + if (generics[name]) { + var existing = generics[name]; + if (existing.typeParameters) { + if (node.typeParameters) { + existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); + } + } else { + existing = node.typeParameters; + } + } else { + generics[name] = node; + } + + continue; + } + + types.push(node); + } + + for (var type in bases) { + types.push(bases[type]); + } + + for (var _name in generics) { + types.push(generics[_name]); + } + + return types; + } + + function createTypeAnnotationBasedOnTypeof(type) { + if (type === "string") { + return t.stringTypeAnnotation(); + } else if (type === "number") { + return t.numberTypeAnnotation(); + } else if (type === "undefined") { + return t.voidTypeAnnotation(); + } else if (type === "boolean") { + return t.booleanTypeAnnotation(); + } else if (type === "function") { + return t.genericTypeAnnotation(t.identifier("Function")); + } else if (type === "object") { + return t.genericTypeAnnotation(t.identifier("Object")); + } else if (type === "symbol") { + return t.genericTypeAnnotation(t.identifier("Symbol")); + } else { + throw new Error("Invalid typeof value"); + } + } + +/***/ }), +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.isReactComponent = undefined; + exports.isCompatTag = isCompatTag; + exports.buildChildren = buildChildren; + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component"); + + function isCompatTag(tagName) { + return !!tagName && /^[a-z]|\-/.test(tagName); + } + + function cleanJSXElementLiteralChild(child, args) { + var lines = child.value.split(/\r\n|\n|\r/); + + var lastNonEmptyLine = 0; + + for (var i = 0; i < lines.length; i++) { + if (lines[i].match(/[^ \t]/)) { + lastNonEmptyLine = i; + } + } + + var str = ""; + + for (var _i = 0; _i < lines.length; _i++) { + var line = lines[_i]; + + var isFirstLine = _i === 0; + var isLastLine = _i === lines.length - 1; + var isLastNonEmptyLine = _i === lastNonEmptyLine; + + var trimmedLine = line.replace(/\t/g, " "); + + if (!isFirstLine) { + trimmedLine = trimmedLine.replace(/^[ ]+/, ""); + } + + if (!isLastLine) { + trimmedLine = trimmedLine.replace(/[ ]+$/, ""); + } + + if (trimmedLine) { + if (!isLastNonEmptyLine) { + trimmedLine += " "; + } + + str += trimmedLine; + } + } + + if (str) args.push(t.stringLiteral(str)); + } + + function buildChildren(node) { + var elems = []; + + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + + if (t.isJSXText(child)) { + cleanJSXElementLiteralChild(child, elems); + continue; + } + + if (t.isJSXExpressionContainer(child)) child = child.expression; + if (t.isJSXEmptyExpression(child)) continue; + + elems.push(child); + } + + return elems; + } + +/***/ }), +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _typeof2 = __webpack_require__(11); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _getIterator2 = __webpack_require__(2); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + exports.isBinding = isBinding; + exports.isReferenced = isReferenced; + exports.isValidIdentifier = isValidIdentifier; + exports.isLet = isLet; + exports.isBlockScoped = isBlockScoped; + exports.isVar = isVar; + exports.isSpecifierDefault = isSpecifierDefault; + exports.isScope = isScope; + exports.isImmutable = isImmutable; + exports.isNodesEquivalent = isNodesEquivalent; + + var _retrievers = __webpack_require__(222); + + var _esutils = __webpack_require__(97); + + var _esutils2 = _interopRequireDefault(_esutils); + + var _index = __webpack_require__(1); + + var t = _interopRequireWildcard(_index); + + var _constants = __webpack_require__(134); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function isBinding(node, parent) { + var keys = _retrievers.getBindingIdentifiers.keys[parent.type]; + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = parent[key]; + if (Array.isArray(val)) { + if (val.indexOf(node) >= 0) return true; + } else { + if (val === node) return true; + } + } + } + + return false; + } + + function isReferenced(node, parent) { + switch (parent.type) { + case "BindExpression": + return parent.object === node || parent.callee === node; + + case "MemberExpression": + case "JSXMemberExpression": + if (parent.property === node && parent.computed) { + return true; + } else if (parent.object === node) { + return true; + } else { + return false; + } + + case "MetaProperty": + return false; + + case "ObjectProperty": + if (parent.key === node) { + return parent.computed; + } + + case "VariableDeclarator": + return parent.id !== node; + + case "ArrowFunctionExpression": + case "FunctionDeclaration": + case "FunctionExpression": + for (var _iterator = parent.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var param = _ref; + + if (param === node) return false; + } + + return parent.id !== node; + + case "ExportSpecifier": + if (parent.source) { + return false; + } else { + return parent.local === node; + } + + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return false; + + case "JSXAttribute": + return parent.name !== node; + + case "ClassProperty": + if (parent.key === node) { + return parent.computed; + } else { + return parent.value === node; + } + + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + + case "ClassDeclaration": + case "ClassExpression": + return parent.id !== node; + + case "ClassMethod": + case "ObjectMethod": + return parent.key === node && parent.computed; + + case "LabeledStatement": + return false; + + case "CatchClause": + return parent.param !== node; + + case "RestElement": + return false; + + case "AssignmentExpression": + return parent.right === node; + + case "AssignmentPattern": + return parent.right === node; + + case "ObjectPattern": + case "ArrayPattern": + return false; + } + + return true; + } + + function isValidIdentifier(name) { + if (typeof name !== "string" || _esutils2.default.keyword.isReservedWordES6(name, true)) { + return false; + } else if (name === "await") { + return false; + } else { + return _esutils2.default.keyword.isIdentifierNameES6(name); + } + } + + function isLet(node) { + return t.isVariableDeclaration(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]); + } + + function isBlockScoped(node) { + return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node); + } + + function isVar(node) { + return t.isVariableDeclaration(node, { kind: "var" }) && !node[_constants.BLOCK_SCOPED_SYMBOL]; + } + + function isSpecifierDefault(specifier) { + return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" }); + } + + function isScope(node, parent) { + if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) { + return false; + } + + return t.isScopable(node); + } + + function isImmutable(node) { + if (t.isType(node.type, "Immutable")) return true; + + if (t.isIdentifier(node)) { + if (node.name === "undefined") { + return true; + } else { + return false; + } + } + + return false; + } + + function isNodesEquivalent(a, b) { + if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || a == null || b == null) { + return a === b; + } + + if (a.type !== b.type) { + return false; + } + + var fields = (0, _keys2.default)(t.NODE_FIELDS[a.type] || a.type); + + for (var _iterator2 = fields, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var field = _ref2; + + if ((0, _typeof3.default)(a[field]) !== (0, _typeof3.default)(b[field])) { + return false; + } + + if (Array.isArray(a[field])) { + if (!Array.isArray(b[field])) { + return false; + } + if (a[field].length !== b[field].length) { + return false; + } + + for (var i = 0; i < a[field].length; i++) { + if (!isNodesEquivalent(a[field][i], b[field][i])) { + return false; + } + } + continue; + } + + if (!isNodesEquivalent(a[field], b[field])) { + return false; + } + } + + return true; + } + +/***/ }), +/* 392 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = balanced; + function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; + } + + function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; + } + + balanced.range = range; + function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [begs.pop(), bi]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [left, right]; + } + } + + return result; + } + +/***/ }), +/* 393 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.byteLength = byteLength; + exports.toByteArray = toByteArray; + exports.fromByteArray = fromByteArray; + + var lookup = []; + var revLookup = []; + var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; + + var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; + } + + revLookup['-'.charCodeAt(0)] = 62; + revLookup['_'.charCodeAt(0)] = 63; + + function placeHoldersCount(b64) { + var len = b64.length; + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4'); + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; + } + + function byteLength(b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64); + } + + function toByteArray(b64) { + var i, j, l, tmp, placeHolders, arr; + var len = b64.length; + placeHolders = placeHoldersCount(b64); + + arr = new Arr(len * 3 / 4 - placeHolders); + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len; + + var L = 0; + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; + arr[L++] = tmp >> 16 & 0xFF; + arr[L++] = tmp >> 8 & 0xFF; + arr[L++] = tmp & 0xFF; + } + + if (placeHolders === 2) { + tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; + arr[L++] = tmp & 0xFF; + } else if (placeHolders === 1) { + tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; + arr[L++] = tmp >> 8 & 0xFF; + arr[L++] = tmp & 0xFF; + } + + return arr; + } + + function tripletToBase64(num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; + } + + function encodeChunk(uint8, start, end) { + var tmp; + var output = []; + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; + output.push(tripletToBase64(tmp)); + } + return output.join(''); + } + + function fromByteArray(uint8) { + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + var output = ''; + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1]; + output += lookup[tmp >> 2]; + output += lookup[tmp << 4 & 0x3F]; + output += '=='; + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + output += lookup[tmp >> 10]; + output += lookup[tmp >> 4 & 0x3F]; + output += lookup[tmp << 2 & 0x3F]; + output += '='; + } + + parts.push(output); + + return parts.join(''); + } + +/***/ }), +/* 394 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var concatMap = __webpack_require__(398); + var balanced = __webpack_require__(392); + + module.exports = expandTop; + + var escSlash = '\0SLASH' + Math.random() + '\0'; + var escOpen = '\0OPEN' + Math.random() + '\0'; + var escClose = '\0CLOSE' + Math.random() + '\0'; + var escComma = '\0COMMA' + Math.random() + '\0'; + var escPeriod = '\0PERIOD' + Math.random() + '\0'; + + function numeric(str) { + return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); + } + + function escapeBraces(str) { + return str.split('\\\\').join(escSlash).split('\\{').join(escOpen).split('\\}').join(escClose).split('\\,').join(escComma).split('\\.').join(escPeriod); + } + + function unescapeBraces(str) { + return str.split(escSlash).join('\\').split(escOpen).join('{').split(escClose).join('}').split(escComma).join(',').split(escPeriod).join('.'); + } + + // Basically just str.split(","), but handling cases + // where we have nested braced sections, which should be + // treated as individual members, like {a,{b,c},d} + function parseCommaParts(str) { + if (!str) return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length - 1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length - 1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; + } + + function expandTop(str) { + if (!str) return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); + } + + function identity(e) { + return e; + } + + function embrace(str) { + return '{' + str + '}'; + } + function isPadded(el) { + return (/^-?0\d/.test(el) + ); + } + + function lte(i, y) { + return i <= y; + } + function gte(i, y) { + return i >= y; + } + + function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length ? expand(m.post, false) : ['']; + return post.map(function (p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length ? expand(m.post, false) : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length); + var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) c = '-' + z + c.slice(1);else c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function (el) { + return expand(el, false); + }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) expansions.push(expansion); + } + } + + return expansions; + } + +/***/ }), +/* 395 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> + * @license MIT + */ + /* eslint-disable no-proto */ + + 'use strict'; + + var base64 = __webpack_require__(393); + var ieee754 = __webpack_require__(456); + var isArray = __webpack_require__(396); + + exports.Buffer = Buffer; + exports.SlowBuffer = SlowBuffer; + exports.INSPECT_MAX_BYTES = 50; + + /** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ + Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport + + /* + * Export kMaxLength after typed array support is determined. + */ + ();exports.kMaxLength = kMaxLength(); + + function typedArraySupport() { + try { + var arr = new Uint8Array(1); + arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function foo() { + return 42; + } }; + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray` + } catch (e) { + return false; + } + } + + function kMaxLength() { + return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff; + } + + function createBuffer(that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length'); + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length); + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length); + } + that.length = length; + } + + return that; + } + + /** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + + function Buffer(arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length); + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error('If encoding is specified then the first argument must be a string'); + } + return allocUnsafe(this, arg); + } + return from(this, arg, encodingOrOffset, length); + } + + Buffer.poolSize = 8192; // not used by this implementation + + // TODO: Legacy, not needed anymore. Remove in next major version. + Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype; + return arr; + }; + + function from(that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length); + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset); + } + + return fromObject(that, value); + } + + /** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ + Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length); + }; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype; + Buffer.__proto__ = Uint8Array; + if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }); + } + } + + function assertSize(size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number'); + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative'); + } + } + + function alloc(that, size, fill, encoding) { + assertSize(size); + if (size <= 0) { + return createBuffer(that, size); + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill); + } + return createBuffer(that, size); + } + + /** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ + Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding); + }; + + function allocUnsafe(that, size) { + assertSize(size); + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0; + } + } + return that; + } + + /** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ + Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size); + }; + /** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ + Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size); + }; + + function fromString(that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding'); + } + + var length = byteLength(string, encoding) | 0; + that = createBuffer(that, length); + + var actual = that.write(string, encoding); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual); + } + + return that; + } + + function fromArrayLike(that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + that = createBuffer(that, length); + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255; + } + return that; + } + + function fromArrayBuffer(that, array, byteOffset, length) { + array.byteLength; // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds'); + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds'); + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array); + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset); + } else { + array = new Uint8Array(array, byteOffset, length); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array; + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array); + } + return that; + } + + function fromObject(that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0; + that = createBuffer(that, len); + + if (that.length === 0) { + return that; + } + + obj.copy(that, 0, 0, len); + return that; + } + + if (obj) { + if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0); + } + return fromArrayLike(that, obj); + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.'); + } + + function checked(length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes'); + } + return length | 0; + } + + function SlowBuffer(length) { + if (+length != length) { + // eslint-disable-line eqeqeq + length = 0; + } + return Buffer.alloc(+length); + } + + Buffer.isBuffer = function isBuffer(b) { + return !!(b != null && b._isBuffer); + }; + + Buffer.compare = function compare(a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers'); + } + + if (a === b) return 0; + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + + Buffer.isEncoding = function isEncoding(encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true; + default: + return false; + } + }; + + Buffer.concat = function concat(list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + if (list.length === 0) { + return Buffer.alloc(0); + } + + var i; + if (length === undefined) { + length = 0; + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = Buffer.allocUnsafe(length); + var pos = 0; + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + buf.copy(buffer, pos); + pos += buf.length; + } + return buffer; + }; + + function byteLength(string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length; + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength; + } + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0; + + // Use a for loop to avoid recursion + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len; + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2; + case 'hex': + return len >>> 1; + case 'base64': + return base64ToBytes(string).length; + default: + if (loweredCase) return utf8ToBytes(string).length; // assume utf8 + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + } + Buffer.byteLength = byteLength; + + function slowToString(encoding, start, end) { + var loweredCase = false; + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0; + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return ''; + } + + if (end === undefined || end > this.length) { + end = this.length; + } + + if (end <= 0) { + return ''; + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0; + start >>>= 0; + + if (end <= start) { + return ''; + } + + if (!encoding) encoding = 'utf8'; + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end); + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end); + + case 'ascii': + return asciiSlice(this, start, end); + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end); + + case 'base64': + return base64Slice(this, start, end); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = (encoding + '').toLowerCase(); + loweredCase = true; + } + } + } + + // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect + // Buffer instances. + Buffer.prototype._isBuffer = true; + + function swap(b, n, m) { + var i = b[n]; + b[n] = b[m]; + b[m] = i; + } + + Buffer.prototype.swap16 = function swap16() { + var len = this.length; + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits'); + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + return this; + }; + + Buffer.prototype.swap32 = function swap32() { + var len = this.length; + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits'); + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + return this; + }; + + Buffer.prototype.swap64 = function swap64() { + var len = this.length; + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits'); + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + return this; + }; + + Buffer.prototype.toString = function toString() { + var length = this.length | 0; + if (length === 0) return ''; + if (arguments.length === 0) return utf8Slice(this, 0, length); + return slowToString.apply(this, arguments); + }; + + Buffer.prototype.equals = function equals(b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); + if (this === b) return true; + return Buffer.compare(this, b) === 0; + }; + + Buffer.prototype.inspect = function inspect() { + var str = ''; + var max = exports.INSPECT_MAX_BYTES; + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' '); + if (this.length > max) str += ' ... '; + } + return '<Buffer ' + str + '>'; + }; + + Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer'); + } + + if (start === undefined) { + start = 0; + } + if (end === undefined) { + end = target ? target.length : 0; + } + if (thisStart === undefined) { + thisStart = 0; + } + if (thisEnd === undefined) { + thisEnd = this.length; + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index'); + } + + if (thisStart >= thisEnd && start >= end) { + return 0; + } + if (thisStart >= thisEnd) { + return -1; + } + if (start >= end) { + return 1; + } + + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + + if (this === target) return 0; + + var x = thisEnd - thisStart; + var y = end - start; + var len = Math.min(x, y); + + var thisCopy = this.slice(thisStart, thisEnd); + var targetCopy = target.slice(start, end); + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + + // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, + // OR the last index of `val` in `buffer` at offset <= `byteOffset`. + // + // Arguments: + // - buffer - a Buffer to search + // - val - a string, Buffer, or number + // - byteOffset - an index into `buffer`; will be clamped to an int32 + // - encoding - an optional encoding, relevant is val is a string + // - dir - true for indexOf, false for lastIndexOf + function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1; + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff; + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000; + } + byteOffset = +byteOffset; // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : buffer.length - 1; + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset; + if (byteOffset >= buffer.length) { + if (dir) return -1;else byteOffset = buffer.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0;else return -1; + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding); + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1; + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir); + } else if (typeof val === 'number') { + val = val & 0xFF; // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); + } + + throw new TypeError('val must be string, number or Buffer'); + } + + function arrayIndexOf(arr, val, byteOffset, encoding, dir) { + var indexSize = 1; + var arrLength = arr.length; + var valLength = val.length; + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase(); + if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1; + } + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + + function read(buf, i) { + if (indexSize === 1) { + return buf[i]; + } else { + return buf.readUInt16BE(i * indexSize); + } + } + + var i; + if (dir) { + var foundIndex = -1; + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; + for (i = byteOffset; i >= 0; i--) { + var found = true; + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break; + } + } + if (found) return i; + } + } + + return -1; + } + + Buffer.prototype.includes = function includes(val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1; + }; + + Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true); + }; + + Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false); + }; + + function hexWrite(buf, string, offset, length) { + offset = Number(offset) || 0; + var remaining = buf.length - offset; + if (!length) { + length = remaining; + } else { + length = Number(length); + if (length > remaining) { + length = remaining; + } + } + + // must be an even number of digits + var strLen = string.length; + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string'); + + if (length > strLen / 2) { + length = strLen / 2; + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(parsed)) return i; + buf[offset + i] = parsed; + } + return i; + } + + function utf8Write(buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); + } + + function asciiWrite(buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length); + } + + function latin1Write(buf, string, offset, length) { + return asciiWrite(buf, string, offset, length); + } + + function base64Write(buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length); + } + + function ucs2Write(buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); + } + + Buffer.prototype.write = function write(string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8'; + length = this.length; + offset = 0; + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset; + length = this.length; + offset = 0; + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0; + if (isFinite(length)) { + length = length | 0; + if (encoding === undefined) encoding = 'utf8'; + } else { + encoding = length; + length = undefined; + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds'); + } + + if (!encoding) encoding = 'utf8'; + + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length); + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length); + + case 'ascii': + return asciiWrite(this, string, offset, length); + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length); + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + }; + + Buffer.prototype.toJSON = function toJSON() { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }; + + function base64Slice(buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf); + } else { + return base64.fromByteArray(buf.slice(start, end)); + } + } + + function utf8Slice(buf, start, end) { + end = Math.min(buf.length, end); + var res = []; + + var i = start; + while (i < end) { + var firstByte = buf[i]; + var codePoint = null; + var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint; + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte; + } + break; + case 2: + secondByte = buf[i + 1]; + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint; + } + } + break; + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint; + } + } + break; + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint; + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD; + bytesPerSequence = 1; + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000; + res.push(codePoint >>> 10 & 0x3FF | 0xD800); + codePoint = 0xDC00 | codePoint & 0x3FF; + } + + res.push(codePoint); + i += bytesPerSequence; + } + + return decodeCodePointsArray(res); + } + + // Based on http://stackoverflow.com/a/22747272/680742, the browser with + // the lowest limit is Chrome, with 0x10000 args. + // We go 1 magnitude less, for safety + var MAX_ARGUMENTS_LENGTH = 0x1000; + + function decodeCodePointsArray(codePoints) { + var len = codePoints.length; + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints // avoid extra slice() + ); + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = ''; + var i = 0; + while (i < len) { + res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); + } + return res; + } + + function asciiSlice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F); + } + return ret; + } + + function latin1Slice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); + } + return ret; + } + + function hexSlice(buf, start, end) { + var len = buf.length; + + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + + var out = ''; + for (var i = start; i < end; ++i) { + out += toHex(buf[i]); + } + return out; + } + + function utf16leSlice(buf, start, end) { + var bytes = buf.slice(start, end); + var res = ''; + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + } + return res; + } + + Buffer.prototype.slice = function slice(start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + + var newBuf; + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); + newBuf.__proto__ = Buffer.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer(sliceLen, undefined); + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf; + }; + + /* + * Need to make sure that buffer isn't trying to write out of bounds. + */ + function checkOffset(offset, ext, length) { + if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); + } + + Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + return val; + }; + + Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + checkOffset(offset, byteLength, this.length); + } + + var val = this[offset + --byteLength]; + var mul = 1; + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul; + } + + return val; + }; + + Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset]; + }; + + Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | this[offset + 1] << 8; + }; + + Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] << 8 | this[offset + 1]; + }; + + Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; + }; + + Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); + }; + + Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; + }; + + Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var i = byteLength; + var mul = 1; + var val = this[offset + --i]; + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; + }; + + Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 0x80)) return this[offset]; + return (0xff - this[offset] + 1) * -1; + }; + + Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset] | this[offset + 1] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; + }; + + Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset + 1] | this[offset] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; + }; + + Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; + }; + + Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; + }; + + Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, true, 23, 4); + }; + + Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, false, 23, 4); + }; + + Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, true, 52, 8); + }; + + Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, false, 52, 8); + }; + + function checkInt(buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + } + + Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var mul = 1; + var i = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var i = byteLength - 1; + var mul = 1; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + this[offset] = value & 0xff; + return offset + 1; + }; + + function objectWriteUInt16(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8; + } + } + + Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; + }; + + Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; + }; + + function objectWriteUInt32(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff; + } + } + + Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = value >>> 24; + this[offset + 2] = value >>> 16; + this[offset + 1] = value >>> 8; + this[offset] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; + }; + + Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; + }; + + Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = 0; + var mul = 1; + var sub = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = byteLength - 1; + var mul = 1; + var sub = 0; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + if (value < 0) value = 0xff + value + 1; + this[offset] = value & 0xff; + return offset + 1; + }; + + Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; + }; + + Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; + }; + + Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + this[offset + 2] = value >>> 16; + this[offset + 3] = value >>> 24; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; + }; + + Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (value < 0) value = 0xffffffff + value + 1; + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; + }; + + function checkIEEE754(buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + if (offset < 0) throw new RangeError('Index out of range'); + } + + function writeFloat(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38); + } + ieee754.write(buf, value, offset, littleEndian, 23, 4); + return offset + 4; + } + + Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert); + }; + + Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert); + }; + + function writeDouble(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308); + } + ieee754.write(buf, value, offset, littleEndian, 52, 8); + return offset + 8; + } + + Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert); + }; + + Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert); + }; + + // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) + Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; + + // Copy 0 bytes; we're done + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds'); + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds'); + if (end < 0) throw new RangeError('sourceEnd out of bounds'); + + // Are we oob? + if (end > this.length) end = this.length; + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); + } + + return len; + }; + + // Usage: + // buffer.fill(number[, offset[, end]]) + // buffer.fill(buffer[, offset[, end]]) + // buffer.fill(string[, offset[, end]][, encoding]) + Buffer.prototype.fill = function fill(val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === 'string') { + encoding = end; + end = this.length; + } + if (val.length === 1) { + var code = val.charCodeAt(0); + if (code < 256) { + val = code; + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string'); + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding); + } + } else if (typeof val === 'number') { + val = val & 255; + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index'); + } + + if (end <= start) { + return this; + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + + if (!val) val = 0; + + var i; + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()); + var len = bytes.length; + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this; + }; + + // HELPER FUNCTIONS + // ================ + + var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; + + function base64clean(str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, '' + // Node converts strings with length < 2 to '' + );if (str.length < 2) return ''; + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '='; + } + return str; + } + + function stringtrim(str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); + } + + function toHex(n) { + if (n < 16) return '0' + n.toString(16); + return n.toString(16); + } + + function utf8ToBytes(string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i + + // is surrogate component + );if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } + + // valid lead + leadSurrogate = codePoint; + + continue; + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + leadSurrogate = codePoint; + continue; + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + } + + leadSurrogate = null; + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else { + throw new Error('Invalid code point'); + } + } + + return bytes; + } + + function asciiToBytes(str) { + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF); + } + return byteArray; + } + + function utf16leToBytes(str, units) { + var c, hi, lo; + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break; + + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + + return byteArray; + } + + function base64ToBytes(str) { + return base64.toByteArray(base64clean(str)); + } + + function blitBuffer(src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + return i; + } + + function isnan(val) { + return val !== val; // eslint-disable-line no-self-compare + } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 396 */ +/***/ (function(module, exports) { + + 'use strict'; + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + +/***/ }), +/* 397 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var escapeStringRegexp = __webpack_require__(451); + var ansiStyles = __webpack_require__(285); + var stripAnsi = __webpack_require__(613); + var hasAnsi = __webpack_require__(455); + var supportsColor = __webpack_require__(614); + var defineProps = Object.defineProperties; + var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM); + + function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; + } + + // use bright blue on Windows as the normal blue color is illegible + if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\x1B[94m'; + } + + var styles = function () { + var ret = {}; + + Object.keys(ansiStyles).forEach(function (key) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + ret[key] = { + get: function get() { + return build.call(this, this._styles.concat(key)); + } + }; + }); + + return ret; + }(); + + var proto = defineProps(function chalk() {}, styles); + + function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder.enabled = this.enabled; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + /* eslint-disable no-proto */ + builder.__proto__ = proto; + + return builder; + } + + function applyStyle() { + // support varags, but simply cast to string in case there's only one arg + var args = arguments; + var argsLen = args.length; + var str = argsLen !== 0 && String(arguments[0]); + + if (argsLen > 1) { + // don't slice `arguments`, it prevents v8 optimizations + for (var a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || !str) { + return str; + } + + var nestedStyles = this._styles; + var i = nestedStyles.length; + + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + var originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { + ansiStyles.dim.open = ''; + } + + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + } + + // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. + ansiStyles.dim.open = originalDim; + + return str; + } + + function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function get() { + return build.call(this, [name]); + } + }; + }); + + return ret; + } + + defineProps(Chalk.prototype, init()); + + module.exports = new Chalk(); + module.exports.styles = ansiStyles; + module.exports.hasColor = hasAnsi; + module.exports.stripColor = stripAnsi; + module.exports.supportsColor = supportsColor; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 398 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x);else res.push(x); + } + return res; + }; + + var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; + }; + +/***/ }), +/* 399 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict'; + + var fs = __webpack_require__(115); + var path = __webpack_require__(17); + + Object.defineProperty(exports, 'commentRegex', { + get: function getCommentRegex() { + return (/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg + ); + } + }); + + Object.defineProperty(exports, 'mapFileCommentRegex', { + get: function getMapFileCommentRegex() { + //Example (Extra space between slashes added to solve Safari bug. Exclude space in production): + // / /# sourceMappingURL=foo.js.map /*# sourceMappingURL=foo.js.map */ + return (/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg + ); + } + }); + + function decodeBase64(base64) { + return new Buffer(base64, 'base64').toString(); + } + + function stripComment(sm) { + return sm.split(',').pop(); + } + + function readFromFileMap(sm, dir) { + // NOTE: this will only work on the server since it attempts to read the map file + + var r = exports.mapFileCommentRegex.exec(sm); + + // for some odd reason //# .. captures in 1 and /* .. */ in 2 + var filename = r[1] || r[2]; + var filepath = path.resolve(dir, filename); + + try { + return fs.readFileSync(filepath, 'utf8'); + } catch (e) { + throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e); + } + } + + function Converter(sm, opts) { + opts = opts || {}; + + if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir); + if (opts.hasComment) sm = stripComment(sm); + if (opts.isEncoded) sm = decodeBase64(sm); + if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm); + + this.sourcemap = sm; + } + + Converter.prototype.toJSON = function (space) { + return JSON.stringify(this.sourcemap, null, space); + }; + + Converter.prototype.toBase64 = function () { + var json = this.toJSON(); + return new Buffer(json).toString('base64'); + }; + + Converter.prototype.toComment = function (options) { + var base64 = this.toBase64(); + var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; + return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; + }; + + // returns copy instead of original + Converter.prototype.toObject = function () { + return JSON.parse(this.toJSON()); + }; + + Converter.prototype.addProperty = function (key, value) { + if (this.sourcemap.hasOwnProperty(key)) throw new Error('property %s already exists on the sourcemap, use set property instead'); + return this.setProperty(key, value); + }; + + Converter.prototype.setProperty = function (key, value) { + this.sourcemap[key] = value; + return this; + }; + + Converter.prototype.getProperty = function (key) { + return this.sourcemap[key]; + }; + + exports.fromObject = function (obj) { + return new Converter(obj); + }; + + exports.fromJSON = function (json) { + return new Converter(json, { isJSON: true }); + }; + + exports.fromBase64 = function (base64) { + return new Converter(base64, { isEncoded: true }); + }; + + exports.fromComment = function (comment) { + comment = comment.replace(/^\/\*/g, '//').replace(/\*\/$/g, ''); + + return new Converter(comment, { isEncoded: true, hasComment: true }); + }; + + exports.fromMapFileComment = function (comment, dir) { + return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true }); + }; + + // Finds last sourcemap comment in file or returns null if none was found + exports.fromSource = function (content) { + var m = content.match(exports.commentRegex); + return m ? exports.fromComment(m.pop()) : null; + }; + + // Finds last sourcemap comment in file or returns null if none was found + exports.fromMapFileSource = function (content, dir) { + var m = content.match(exports.mapFileCommentRegex); + return m ? exports.fromMapFileComment(m.pop(), dir) : null; + }; + + exports.removeComments = function (src) { + return src.replace(exports.commentRegex, ''); + }; + + exports.removeMapFileComments = function (src) { + return src.replace(exports.mapFileCommentRegex, ''); + }; + + exports.generateMapFileComment = function (file, options) { + var data = 'sourceMappingURL=' + file; + return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(395).Buffer)) + +/***/ }), +/* 400 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(57); + __webpack_require__(153); + module.exports = __webpack_require__(436); + +/***/ }), +/* 401 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var core = __webpack_require__(5), + $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify }); + module.exports = function stringify(it) { + // eslint-disable-line no-unused-vars + return $JSON.stringify.apply($JSON, arguments); + }; + +/***/ }), +/* 402 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(96); + __webpack_require__(153); + __webpack_require__(57); + __webpack_require__(438); + __webpack_require__(446); + module.exports = __webpack_require__(5).Map; + +/***/ }), +/* 403 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(439); + module.exports = 0x1fffffffffffff; + +/***/ }), +/* 404 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(440); + module.exports = __webpack_require__(5).Object.assign; + +/***/ }), +/* 405 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(441); + var $Object = __webpack_require__(5).Object; + module.exports = function create(P, D) { + return $Object.create(P, D); + }; + +/***/ }), +/* 406 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(154); + module.exports = __webpack_require__(5).Object.getOwnPropertySymbols; + +/***/ }), +/* 407 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(442); + module.exports = __webpack_require__(5).Object.keys; + +/***/ }), +/* 408 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(443); + module.exports = __webpack_require__(5).Object.setPrototypeOf; + +/***/ }), +/* 409 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(154); + module.exports = __webpack_require__(5).Symbol['for']; + +/***/ }), +/* 410 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(154); + __webpack_require__(96); + __webpack_require__(447); + __webpack_require__(448); + module.exports = __webpack_require__(5).Symbol; + +/***/ }), +/* 411 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(153); + __webpack_require__(57); + module.exports = __webpack_require__(152).f('iterator'); + +/***/ }), +/* 412 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(96); + __webpack_require__(57); + __webpack_require__(444); + module.exports = __webpack_require__(5).WeakMap; + +/***/ }), +/* 413 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(96); + __webpack_require__(57); + __webpack_require__(445); + module.exports = __webpack_require__(5).WeakSet; + +/***/ }), +/* 414 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }), +/* 415 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function () {/* empty */}; + +/***/ }), +/* 416 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var forOf = __webpack_require__(89); + + module.exports = function (iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; + }; + +/***/ }), +/* 417 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // false -> Array#indexOf + // true -> Array#includes + var toIObject = __webpack_require__(37), + toLength = __webpack_require__(149), + toIndex = __webpack_require__(435); + module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this), + length = toLength(O.length), + index = toIndex(fromIndex, length), + value; + // Array#includes uses SameValueZero equality algorithm + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + if (value != value) return true; + // Array#toIndex ignores holes, Array#includes - not + } else for (; length > index; index++) { + if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } + }return !IS_INCLUDES && -1; + }; + }; + +/***/ }), +/* 418 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(22), + isArray = __webpack_require__(227), + SPECIES = __webpack_require__(12)('species'); + + module.exports = function (original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + }return C === undefined ? Array : C; + }; + +/***/ }), +/* 419 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 9.4.2.3 ArraySpeciesCreate(originalArray, length) + var speciesConstructor = __webpack_require__(418); + + module.exports = function (original, length) { + return new (speciesConstructor(original))(length); + }; + +/***/ }), +/* 420 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var dP = __webpack_require__(23).f, + create = __webpack_require__(90), + redefineAll = __webpack_require__(144), + ctx = __webpack_require__(54), + anInstance = __webpack_require__(135), + defined = __webpack_require__(88), + forOf = __webpack_require__(89), + $iterDefine = __webpack_require__(141), + step = __webpack_require__(228), + setSpecies = __webpack_require__(433), + DESCRIPTORS = __webpack_require__(20), + fastKey = __webpack_require__(56).fastKey, + SIZE = DESCRIPTORS ? '_s' : 'size'; + + var getEntry = function getEntry(that, key) { + // fast case + var index = fastKey(key), + entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } + }; + + module.exports = { + getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = this, data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function _delete(key) { + var that = this, + entry = getEntry(that, key); + if (entry) { + var next = entry.n, + prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + that[SIZE]--; + }return !!entry; + }, + // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) + // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) + forEach: function forEach(callbackfn /*, that = undefined */) { + anInstance(this, C, 'forEach'); + var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3), + entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) { + entry = entry.p; + } + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(this, key); + } + }); + if (DESCRIPTORS) dP(C.prototype, 'size', { + get: function get() { + return defined(this[SIZE]); + } + }); + return C; + }, + def: function def(that, key, value) { + var entry = getEntry(that, key), + prev, + index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + }return that; + }, + getEntry: getEntry, + setStrong: function setStrong(C, NAME, IS_MAP) { + // add .keys, .values, .entries, [@@iterator] + // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 + $iterDefine(C, NAME, function (iterated, kind) { + this._t = iterated; // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this, + kind = that._k, + entry = that._l; + // revert to the last existing entry + while (entry && entry.r) { + entry = entry.p; + } // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } + }; + +/***/ }), +/* 421 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // https://github.com/DavidBruant/Map-Set.prototype.toJSON + var classof = __webpack_require__(223), + from = __webpack_require__(416); + module.exports = function (NAME) { + return function toJSON() { + if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); + return from(this); + }; + }; + +/***/ }), +/* 422 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // all enumerable object keys, includes symbols + var getKeys = __webpack_require__(43), + gOPS = __webpack_require__(143), + pIE = __webpack_require__(91); + module.exports = function (it) { + var result = getKeys(it), + getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it), + isEnum = pIE.f, + i = 0, + key; + while (symbols.length > i) { + if (isEnum.call(it, key = symbols[i++])) result.push(key); + } + }return result; + }; + +/***/ }), +/* 423 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(14).document && document.documentElement; + +/***/ }), +/* 424 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // check on default Array iterator + var Iterators = __webpack_require__(55), + ITERATOR = __webpack_require__(12)('iterator'), + ArrayProto = Array.prototype; + + module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); + }; + +/***/ }), +/* 425 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // call something on iterator step with safe closing on error + var anObject = __webpack_require__(19); + module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } + }; + +/***/ }), +/* 426 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var create = __webpack_require__(90), + descriptor = __webpack_require__(92), + setToStringTag = __webpack_require__(93), + IteratorPrototype = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(28)(IteratorPrototype, __webpack_require__(12)('iterator'), function () { + return this; + }); + + module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); + }; + +/***/ }), +/* 427 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getKeys = __webpack_require__(43), + toIObject = __webpack_require__(37); + module.exports = function (object, el) { + var O = toIObject(object), + keys = getKeys(O), + length = keys.length, + index = 0, + key; + while (length > index) { + if (O[key = keys[index++]] === el) return key; + } + }; + +/***/ }), +/* 428 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var dP = __webpack_require__(23), + anObject = __webpack_require__(19), + getKeys = __webpack_require__(43); + + module.exports = __webpack_require__(20) ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties), + length = keys.length, + i = 0, + P; + while (length > i) { + dP.f(O, P = keys[i++], Properties[P]); + }return O; + }; + +/***/ }), +/* 429 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + var toIObject = __webpack_require__(37), + gOPN = __webpack_require__(231).f, + toString = {}.toString; + + var windowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; + + var getWindowNames = function getWindowNames(it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } + }; + + module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); + }; + +/***/ }), +/* 430 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + var has = __webpack_require__(27), + toObject = __webpack_require__(94), + IE_PROTO = __webpack_require__(146)('IE_PROTO'), + ObjectProto = Object.prototype; + + module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + }return O instanceof Object ? ObjectProto : null; + }; + +/***/ }), +/* 431 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(21), + core = __webpack_require__(5), + fails = __webpack_require__(36); + module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY], + exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { + fn(1); + }), 'Object', exp); + }; + +/***/ }), +/* 432 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // Works with __proto__ only. Old v8 can't work with null proto objects. + /* eslint-disable no-proto */ + var isObject = __webpack_require__(22), + anObject = __webpack_require__(19); + var check = function check(O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); + }; + module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = __webpack_require__(54)(Function.call, __webpack_require__(230).f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { + buggy = true; + } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto;else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check + }; + +/***/ }), +/* 433 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var global = __webpack_require__(14), + core = __webpack_require__(5), + dP = __webpack_require__(23), + DESCRIPTORS = __webpack_require__(20), + SPECIES = __webpack_require__(12)('species'); + + module.exports = function (KEY) { + var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function get() { + return this; + } + }); + }; + +/***/ }), +/* 434 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toInteger = __webpack_require__(148), + defined = __webpack_require__(88); + // true -> String#at + // false -> String#codePointAt + module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)), + i = toInteger(pos), + l = s.length, + a, + b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; + }; + +/***/ }), +/* 435 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toInteger = __webpack_require__(148), + max = Math.max, + min = Math.min; + module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + +/***/ }), +/* 436 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var anObject = __webpack_require__(19), + get = __webpack_require__(233); + module.exports = __webpack_require__(5).getIterator = function (it) { + var iterFn = get(it); + if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); + }; + +/***/ }), +/* 437 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var addToUnscopables = __webpack_require__(415), + step = __webpack_require__(228), + Iterators = __webpack_require__(55), + toIObject = __webpack_require__(37); + + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(141)(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function () { + var O = this._t, + kind = this._k, + index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); + }, 'values'); + + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; + + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + +/***/ }), +/* 438 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var strong = __webpack_require__(420); + + // 23.1 Map Objects + module.exports = __webpack_require__(138)('Map', function (get) { + return function Map() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(this, key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(this, key === 0 ? 0 : key, value); + } + }, strong, true); + +/***/ }), +/* 439 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 20.1.2.6 Number.MAX_SAFE_INTEGER + var $export = __webpack_require__(21); + + $export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + +/***/ }), +/* 440 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.3.1 Object.assign(target, source) + var $export = __webpack_require__(21); + + $export($export.S + $export.F, 'Object', { assign: __webpack_require__(229) }); + +/***/ }), +/* 441 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var $export = __webpack_require__(21 + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + );$export($export.S, 'Object', { create: __webpack_require__(90) }); + +/***/ }), +/* 442 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(94), + $keys = __webpack_require__(43); + + __webpack_require__(431)('keys', function () { + return function keys(it) { + return $keys(toObject(it)); + }; + }); + +/***/ }), +/* 443 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // 19.1.3.19 Object.setPrototypeOf(O, proto) + var $export = __webpack_require__(21); + $export($export.S, 'Object', { setPrototypeOf: __webpack_require__(432).set }); + +/***/ }), +/* 444 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var each = __webpack_require__(136)(0), + redefine = __webpack_require__(145), + meta = __webpack_require__(56), + assign = __webpack_require__(229), + weak = __webpack_require__(224), + isObject = __webpack_require__(22), + getWeak = meta.getWeak, + isExtensible = Object.isExtensible, + uncaughtFrozenStore = weak.ufstore, + tmp = {}, + InternalMap; + + var wrapper = function wrapper(get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }; + + var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(this, key, value); + } + }; + + // 23.3 WeakMap Objects + var $WeakMap = module.exports = __webpack_require__(138)('WeakMap', wrapper, methods, weak, true, true); + + // IE11 WeakMap frozen keys fix + if (new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7) { + InternalMap = weak.getConstructor(wrapper); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function (key) { + var proto = $WeakMap.prototype, + method = proto[key]; + redefine(proto, key, function (a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + }return method.call(this, a, b); + }); + }); + } + +/***/ }), +/* 445 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var weak = __webpack_require__(224); + + // 23.4 WeakSet Objects + __webpack_require__(138)('WeakSet', function (get) { + return function WeakSet() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }, { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value) { + return weak.def(this, value, true); + } + }, weak, false, true); + +/***/ }), +/* 446 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // https://github.com/DavidBruant/Map-Set.prototype.toJSON + var $export = __webpack_require__(21); + + $export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(421)('Map') }); + +/***/ }), +/* 447 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(151)('asyncIterator'); + +/***/ }), +/* 448 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(151)('observable'); + +/***/ }), +/* 449 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = __webpack_require__(593); + + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + exports.formatters = {}; + + /** + * Previous log timestamp. + */ + + var prevTime; + + /** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + + function selectColor(namespace) { + var hash = 0, + i; + + for (i in namespace) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; + } + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + return debug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @api public + */ + + function disable() { + exports.enable(''); + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + +/***/ }), +/* 450 */ +/***/ (function(module, exports, __webpack_require__) { + + /* eslint-disable guard-for-in */ + 'use strict'; + + var repeating = __webpack_require__(606); + + // detect either spaces or tabs but not both to properly handle tabs + // for indentation and spaces for alignment + var INDENT_RE = /^(?:( )+|\t+)/; + + function getMostUsed(indents) { + var result = 0; + var maxUsed = 0; + var maxWeight = 0; + + for (var n in indents) { + var indent = indents[n]; + var u = indent[0]; + var w = indent[1]; + + if (u > maxUsed || u === maxUsed && w > maxWeight) { + maxUsed = u; + maxWeight = w; + result = Number(n); + } + } + + return result; + } + + module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + // used to see if tabs or spaces are the most used + var tabs = 0; + var spaces = 0; + + // remember the size of previous line's indentation + var prev = 0; + + // remember how many indents/unindents as occurred for a given size + // and how much lines follow a given indentation + // + // indents = { + // 3: [1, 0], + // 4: [1, 5], + // 5: [1, 0], + // 12: [1, 0], + // } + var indents = {}; + + // pointer to the array of last used indent + var current; + + // whether the last action was an indent (opposed to an unindent) + var isIndent; + + str.split(/\n/g).forEach(function (line) { + if (!line) { + // ignore empty lines + return; + } + + var indent; + var matches = line.match(INDENT_RE); + + if (!matches) { + indent = 0; + } else { + indent = matches[0].length; + + if (matches[1]) { + spaces++; + } else { + tabs++; + } + } + + var diff = indent - prev; + prev = indent; + + if (diff) { + // an indent or unindent has been detected + + isIndent = diff > 0; + + current = indents[isIndent ? diff : -diff]; + + if (current) { + current[0]++; + } else { + current = indents[diff] = [1, 0]; + } + } else if (current) { + // if the last action was an indent, increment the weight + current[1] += Number(isIndent); + } + }); + + var amount = getMostUsed(indents); + + var type; + var actual; + if (!amount) { + type = null; + actual = ''; + } else if (spaces >= tabs) { + type = 'space'; + actual = repeating(' ', amount); + } else { + type = 'tab'; + actual = repeating('\t', amount); + } + return { - 'loneHighSurrogates': loneHighSurrogates, - 'loneLowSurrogates': loneLowSurrogates, - 'bmp': bmp, - 'astral': astral + amount: amount, + type: type, + indent: actual }; }; - var optimizeSurrogateMappings = function(surrogateMappings) { - var result = []; - var tmpLow = []; - var addLow = false; - var mapping; - var nextMapping; - var highSurrogates; - var lowSurrogates; - var nextHighSurrogates; - var nextLowSurrogates; - var index = -1; - var length = surrogateMappings.length; - while (++index < length) { - mapping = surrogateMappings[index]; - nextMapping = surrogateMappings[index + 1]; - if (!nextMapping) { - result.push(mapping); +/***/ }), +/* 451 */ +/***/ (function(module, exports) { + + 'use strict'; + + var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + + module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); + }; + +/***/ }), +/* 452 */ +/***/ (function(module, exports) { + + 'use strict'; + + /* + Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + (function () { + 'use strict'; + + function isExpression(node) { + if (node == null) { + return false; + } + switch (node.type) { + case 'ArrayExpression': + case 'AssignmentExpression': + case 'BinaryExpression': + case 'CallExpression': + case 'ConditionalExpression': + case 'FunctionExpression': + case 'Identifier': + case 'Literal': + case 'LogicalExpression': + case 'MemberExpression': + case 'NewExpression': + case 'ObjectExpression': + case 'SequenceExpression': + case 'ThisExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return true; + } + return false; + } + + function isIterationStatement(node) { + if (node == null) { + return false; + } + switch (node.type) { + case 'DoWhileStatement': + case 'ForInStatement': + case 'ForStatement': + case 'WhileStatement': + return true; + } + return false; + } + + function isStatement(node) { + if (node == null) { + return false; + } + switch (node.type) { + case 'BlockStatement': + case 'BreakStatement': + case 'ContinueStatement': + case 'DebuggerStatement': + case 'DoWhileStatement': + case 'EmptyStatement': + case 'ExpressionStatement': + case 'ForInStatement': + case 'ForStatement': + case 'IfStatement': + case 'LabeledStatement': + case 'ReturnStatement': + case 'SwitchStatement': + case 'ThrowStatement': + case 'TryStatement': + case 'VariableDeclaration': + case 'WhileStatement': + case 'WithStatement': + return true; + } + return false; + } + + function isSourceElement(node) { + return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; + } + + function trailingStatement(node) { + switch (node.type) { + case 'IfStatement': + if (node.alternate != null) { + return node.alternate; + } + return node.consequent; + + case 'LabeledStatement': + case 'ForStatement': + case 'ForInStatement': + case 'WhileStatement': + case 'WithStatement': + return node.body; + } + return null; + } + + function isProblematicIfStatement(node) { + var current; + + if (node.type !== 'IfStatement') { + return false; + } + if (node.alternate == null) { + return false; + } + current = node.consequent; + do { + if (current.type === 'IfStatement') { + if (current.alternate == null) { + return true; + } + } + current = trailingStatement(current); + } while (current); + + return false; + } + + module.exports = { + isExpression: isExpression, + isStatement: isStatement, + isIterationStatement: isIterationStatement, + isSourceElement: isSourceElement, + isProblematicIfStatement: isProblematicIfStatement, + + trailingStatement: trailingStatement + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +/***/ }), +/* 453 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* + Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + (function () { + 'use strict'; + + var code = __webpack_require__(235); + + function isStrictModeReservedWordES6(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'let': + return true; + default: + return false; + } + } + + function isKeywordES5(id, strict) { + // yield should not be treated as keyword under non-strict mode. + if (!strict && id === 'yield') { + return false; + } + return isKeywordES6(id, strict); + } + + function isKeywordES6(id, strict) { + if (strict && isStrictModeReservedWordES6(id)) { + return true; + } + + switch (id.length) { + case 2: + return id === 'if' || id === 'in' || id === 'do'; + case 3: + return id === 'var' || id === 'for' || id === 'new' || id === 'try'; + case 4: + return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum'; + case 5: + return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super'; + case 6: + return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import'; + case 7: + return id === 'default' || id === 'finally' || id === 'extends'; + case 8: + return id === 'function' || id === 'continue' || id === 'debugger'; + case 10: + return id === 'instanceof'; + default: + return false; + } + } + + function isReservedWordES5(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); + } + + function isReservedWordES6(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + function isIdentifierNameES5(id) { + var i, iz, ch; + + if (id.length === 0) { + return false; + } + + ch = id.charCodeAt(0); + if (!code.isIdentifierStartES5(ch)) { + return false; + } + + for (i = 1, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (!code.isIdentifierPartES5(ch)) { + return false; + } + } + return true; + } + + function decodeUtf16(lead, trail) { + return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + } + + function isIdentifierNameES6(id) { + var i, iz, ch, lowCh, check; + + if (id.length === 0) { + return false; + } + + check = code.isIdentifierStartES6; + for (i = 0, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (0xD800 <= ch && ch <= 0xDBFF) { + ++i; + if (i >= iz) { + return false; + } + lowCh = id.charCodeAt(i); + if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { + return false; + } + ch = decodeUtf16(ch, lowCh); + } + if (!check(ch)) { + return false; + } + check = code.isIdentifierPartES6; + } + return true; + } + + function isIdentifierES5(id, strict) { + return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); + } + + function isIdentifierES6(id, strict) { + return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); + } + + module.exports = { + isKeywordES5: isKeywordES5, + isKeywordES6: isKeywordES6, + isReservedWordES5: isReservedWordES5, + isReservedWordES6: isReservedWordES6, + isRestrictedWord: isRestrictedWord, + isIdentifierNameES5: isIdentifierNameES5, + isIdentifierNameES6: isIdentifierNameES6, + isIdentifierES5: isIdentifierES5, + isIdentifierES6: isIdentifierES6 + }; + })(); + /* vim: set sw=4 ts=4 et tw=80 : */ + +/***/ }), +/* 454 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(621); + +/***/ }), +/* 455 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ansiRegex = __webpack_require__(176); + var re = new RegExp(ansiRegex().source); // remove the `g` flag + module.exports = re.test.bind(re); + +/***/ }), +/* 456 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? nBytes - 1 : 0; + var d = isLE ? -1 : 1; + var s = buffer[offset + i]; + + i += d; + + e = s & (1 << -nBits) - 1; + s >>= -nBits; + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); + }; + + exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; + var i = isLE ? 0 : nBytes - 1; + var d = isLE ? 1 : -1; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128; + }; + +/***/ }), +/* 457 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var invariant = function invariant(condition, format, a, b, c, d, e, f) { + if (false) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + }; + + module.exports = invariant; + +/***/ }), +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var numberIsNan = __webpack_require__(594); + + module.exports = Number.isFinite || function (val) { + return !(typeof val !== 'number' || numberIsNan(val) || val === Infinity || val === -Infinity); + }; + +/***/ }), +/* 459 */ +/***/ (function(module, exports) { + + "use strict"; + + // Copyright 2014, 2015, 2016, 2017 Simon Lydell + // License: MIT. (See LICENSE.) + + Object.defineProperty(exports, "__esModule", { + value: true + } + + // This regex comes from regex.coffee, and is inserted here by generate-index.js + // (run `npm run build`). + );exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g; + + exports.matchToToken = function (match) { + var token = { type: "invalid", value: match[0] }; + if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace"; + return token; + }; + +/***/ }), +/* 460 */ +/***/ (function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /*! https://mths.be/jsesc v1.3.0 by @mathias */ + ;(function (root) { + + // Detect free variables `exports` + var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports; + + // Detect free variable `module` + var freeModule = ( false ? 'undefined' : _typeof(module)) == 'object' && module && module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root` + var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + var forOwn = function forOwn(object, callback) { + var key; + for (key in object) { + if (hasOwnProperty.call(object, key)) { + callback(key, object[key]); + } + } + }; + + var extend = function extend(destination, source) { + if (!source) { + return destination; + } + forOwn(source, function (key, value) { + destination[key] = value; + }); + return destination; + }; + + var forEach = function forEach(array, callback) { + var length = array.length; + var index = -1; + while (++index < length) { + callback(array[index]); + } + }; + + var toString = object.toString; + var isArray = function isArray(value) { + return toString.call(value) == '[object Array]'; + }; + var isObject = function isObject(value) { + // This is a very simple check, but it’s good enough for what we need. + return toString.call(value) == '[object Object]'; + }; + var isString = function isString(value) { + return typeof value == 'string' || toString.call(value) == '[object String]'; + }; + var isNumber = function isNumber(value) { + return typeof value == 'number' || toString.call(value) == '[object Number]'; + }; + var isFunction = function isFunction(value) { + // In a perfect world, the `typeof` check would be sufficient. However, + // in Chrome 1–12, `typeof /x/ == 'object'`, and in IE 6–8 + // `typeof alert == 'object'` and similar for other host objects. + return typeof value == 'function' || toString.call(value) == '[object Function]'; + }; + var isMap = function isMap(value) { + return toString.call(value) == '[object Map]'; + }; + var isSet = function isSet(value) { + return toString.call(value) == '[object Set]'; + }; + + /*--------------------------------------------------------------------------*/ + + // https://mathiasbynens.be/notes/javascript-escapes#single + var singleEscapes = { + '"': '\\"', + '\'': '\\\'', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t' + // `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'. + // '\v': '\\x0B' + }; + var regexSingleEscape = /["'\\\b\f\n\r\t]/; + + var regexDigit = /[0-9]/; + var regexWhitelist = /[ !#-&\(-\[\]-~]/; + + var jsesc = function jsesc(argument, options) { + // Handle options + var defaults = { + 'escapeEverything': false, + 'escapeEtago': false, + 'quotes': 'single', + 'wrap': false, + 'es6': false, + 'json': false, + 'compact': true, + 'lowercaseHex': false, + 'numbers': 'decimal', + 'indent': '\t', + '__indent__': '', + '__inline1__': false, + '__inline2__': false + }; + var json = options && options.json; + if (json) { + defaults.quotes = 'double'; + defaults.wrap = true; + } + options = extend(defaults, options); + if (options.quotes != 'single' && options.quotes != 'double') { + options.quotes = 'single'; + } + var quote = options.quotes == 'double' ? '"' : '\''; + var compact = options.compact; + var indent = options.indent; + var lowercaseHex = options.lowercaseHex; + var oldIndent = ''; + var inline1 = options.__inline1__; + var inline2 = options.__inline2__; + var newLine = compact ? '' : '\n'; + var result; + var isEmpty = true; + var useBinNumbers = options.numbers == 'binary'; + var useOctNumbers = options.numbers == 'octal'; + var useDecNumbers = options.numbers == 'decimal'; + var useHexNumbers = options.numbers == 'hexadecimal'; + + if (json && argument && isFunction(argument.toJSON)) { + argument = argument.toJSON(); + } + + if (!isString(argument)) { + if (isMap(argument)) { + if (argument.size == 0) { + return 'new Map()'; + } + if (!compact) { + options.__inline1__ = true; + } + return 'new Map(' + jsesc(Array.from(argument), options) + ')'; + } + if (isSet(argument)) { + if (argument.size == 0) { + return 'new Set()'; + } + return 'new Set(' + jsesc(Array.from(argument), options) + ')'; + } + if (isArray(argument)) { + result = []; + options.wrap = true; + if (inline1) { + options.__inline1__ = false; + options.__inline2__ = true; + } else { + oldIndent = options.__indent__; + indent += oldIndent; + options.__indent__ = indent; + } + forEach(argument, function (value) { + isEmpty = false; + if (inline2) { + options.__inline2__ = false; + } + result.push((compact || inline2 ? '' : indent) + jsesc(value, options)); + }); + if (isEmpty) { + return '[]'; + } + if (inline2) { + return '[' + result.join(', ') + ']'; + } + return '[' + newLine + result.join(',' + newLine) + newLine + (compact ? '' : oldIndent) + ']'; + } else if (isNumber(argument)) { + if (json) { + // Some number values (e.g. `Infinity`) cannot be represented in JSON. + return JSON.stringify(argument); + } + if (useDecNumbers) { + return String(argument); + } + if (useHexNumbers) { + var tmp = argument.toString(16); + if (!lowercaseHex) { + tmp = tmp.toUpperCase(); + } + return '0x' + tmp; + } + if (useBinNumbers) { + return '0b' + argument.toString(2); + } + if (useOctNumbers) { + return '0o' + argument.toString(8); + } + } else if (!isObject(argument)) { + if (json) { + // For some values (e.g. `undefined`, `function` objects), + // `JSON.stringify(value)` returns `undefined` (which isn’t valid + // JSON) instead of `'null'`. + return JSON.stringify(argument) || 'null'; + } + return String(argument); + } else { + // it’s an object + result = []; + options.wrap = true; + oldIndent = options.__indent__; + indent += oldIndent; + options.__indent__ = indent; + forOwn(argument, function (key, value) { + isEmpty = false; + result.push((compact ? '' : indent) + jsesc(key, options) + ':' + (compact ? '' : ' ') + jsesc(value, options)); + }); + if (isEmpty) { + return '{}'; + } + return '{' + newLine + result.join(',' + newLine) + newLine + (compact ? '' : oldIndent) + '}'; + } + } + + var string = argument; + // Loop over each code unit in the string and escape it + var index = -1; + var length = string.length; + var first; + var second; + var codePoint; + result = ''; + while (++index < length) { + var character = string.charAt(index); + if (options.es6) { + first = string.charCodeAt(index); + if ( // check if it’s the start of a surrogate pair + first >= 0xD800 && first <= 0xDBFF && // high surrogate + length > index + 1 // there is a next code unit + ) { + second = string.charCodeAt(index + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // low surrogate + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + var hexadecimal = codePoint.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + result += '\\u{' + hexadecimal + '}'; + index++; + continue; + } + } + } + if (!options.escapeEverything) { + if (regexWhitelist.test(character)) { + // It’s a printable ASCII character that is not `"`, `'` or `\`, + // so don’t escape it. + result += character; + continue; + } + if (character == '"') { + result += quote == character ? '\\"' : character; + continue; + } + if (character == '\'') { + result += quote == character ? '\\\'' : character; + continue; + } + } + if (character == '\0' && !json && !regexDigit.test(string.charAt(index + 1))) { + result += '\\0'; + continue; + } + if (regexSingleEscape.test(character)) { + // no need for a `hasOwnProperty` check here + result += singleEscapes[character]; + continue; + } + var charCode = character.charCodeAt(0); + var hexadecimal = charCode.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + var longhand = hexadecimal.length > 2 || json; + var escaped = '\\' + (longhand ? 'u' : 'x') + ('0000' + hexadecimal).slice(longhand ? -4 : -2); + result += escaped; continue; } - highSurrogates = mapping[0]; - lowSurrogates = mapping[1]; - nextHighSurrogates = nextMapping[0]; - nextLowSurrogates = nextMapping[1]; - - // Check for identical high surrogate ranges. - tmpLow = lowSurrogates; - while ( - nextHighSurrogates && - highSurrogates[0] == nextHighSurrogates[0] && - highSurrogates[1] == nextHighSurrogates[1] - ) { - // Merge with the next item. - if (dataIsSingleton(nextLowSurrogates)) { - tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]); - } else { - tmpLow = dataAddRange( - tmpLow, - nextLowSurrogates[0], - nextLowSurrogates[1] - 1 - ); - } - ++index; - mapping = surrogateMappings[index]; - highSurrogates = mapping[0]; - lowSurrogates = mapping[1]; - nextMapping = surrogateMappings[index + 1]; - nextHighSurrogates = nextMapping && nextMapping[0]; - nextLowSurrogates = nextMapping && nextMapping[1]; - addLow = true; + if (options.wrap) { + result = quote + result + quote; } - result.push([ - highSurrogates, - addLow ? tmpLow : lowSurrogates - ]); - addLow = false; - } - return optimizeByLowSurrogates(result); - }; - - var optimizeByLowSurrogates = function(surrogateMappings) { - if (surrogateMappings.length == 1) { - return surrogateMappings; - } - var index = -1; - var innerIndex = -1; - while (++index < surrogateMappings.length) { - var mapping = surrogateMappings[index]; - var lowSurrogates = mapping[1]; - var lowSurrogateStart = lowSurrogates[0]; - var lowSurrogateEnd = lowSurrogates[1]; - innerIndex = index; // Note: the loop starts at the next index. - while (++innerIndex < surrogateMappings.length) { - var otherMapping = surrogateMappings[innerIndex]; - var otherLowSurrogates = otherMapping[1]; - var otherLowSurrogateStart = otherLowSurrogates[0]; - var otherLowSurrogateEnd = otherLowSurrogates[1]; - if ( - lowSurrogateStart == otherLowSurrogateStart && - lowSurrogateEnd == otherLowSurrogateEnd - ) { - // Add the code points in the other item to this one. - if (dataIsSingleton(otherMapping[0])) { - mapping[0] = dataAdd(mapping[0], otherMapping[0][0]); - } else { - mapping[0] = dataAddRange( - mapping[0], - otherMapping[0][0], - otherMapping[0][1] - 1 - ); - } - // Remove the other, now redundant, item. - surrogateMappings.splice(innerIndex, 1); - --innerIndex; - } + if (options.escapeEtago) { + // https://mathiasbynens.be/notes/etago + return result.replace(/<\/(script|style)/gi, '<\\/$1'); } - } - return surrogateMappings; - }; + return result; + }; - var surrogateSet = function(data) { - // Exit early if `data` is an empty set. - if (!data.length) { - return []; - } + jsesc.version = '1.3.0'; - // Iterate over the data per `(start, end)` pair. - var index = 0; - var start; - var end; - var startHigh; - var startLow; - var prevStartHigh = 0; - var prevEndHigh = 0; - var tmpLow = []; - var endHigh; - var endLow; - var surrogateMappings = []; - var length = data.length; - var dataHigh = []; - while (index < length) { - start = data[index]; - end = data[index + 1] - 1; + /*--------------------------------------------------------------------------*/ - startHigh = highSurrogate(start); - startLow = lowSurrogate(start); - endHigh = highSurrogate(end); - endLow = lowSurrogate(end); - - var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN; - var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX; - var complete = false; - - // Append the previous high-surrogate-to-low-surrogate mappings. - // Step 1: `(startHigh, startLow)` to `(startHigh, LOW_SURROGATE_MAX)`. - if ( - startHigh == endHigh || - startsWithLowestLowSurrogate && endsWithHighestLowSurrogate - ) { - surrogateMappings.push([ - [startHigh, endHigh + 1], - [startLow, endLow + 1] - ]); - complete = true; + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ("function" == 'function' && _typeof(__webpack_require__(48)) == 'object' && __webpack_require__(48)) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { + return jsesc; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { + // in Node.js or RingoJS v0.8.0+ + freeModule.exports = jsesc; } else { - surrogateMappings.push([ - [startHigh, startHigh + 1], - [startLow, LOW_SURROGATE_MAX + 1] - ]); + // in Narwhal or RingoJS v0.7.0- + freeExports.jsesc = jsesc; } - - // Step 2: `(startHigh + 1, LOW_SURROGATE_MIN)` to - // `(endHigh - 1, LOW_SURROGATE_MAX)`. - if (!complete && startHigh + 1 < endHigh) { - if (endsWithHighestLowSurrogate) { - // Combine step 2 and step 3. - surrogateMappings.push([ - [startHigh + 1, endHigh + 1], - [LOW_SURROGATE_MIN, endLow + 1] - ]); - complete = true; - } else { - surrogateMappings.push([ - [startHigh + 1, endHigh], - [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1] - ]); - } - } - - // Step 3. `(endHigh, LOW_SURROGATE_MIN)` to `(endHigh, endLow)`. - if (!complete) { - surrogateMappings.push([ - [endHigh, endHigh + 1], - [LOW_SURROGATE_MIN, endLow + 1] - ]); - } - - prevStartHigh = startHigh; - prevEndHigh = endHigh; - - index += 2; + } else { + // in Rhino or a web browser + root.jsesc = jsesc; } + })(undefined); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module), (function() { return this; }()))) - // The format of `surrogateMappings` is as follows: - // - // [ surrogateMapping1, surrogateMapping2 ] - // - // i.e.: - // - // [ - // [ highSurrogates1, lowSurrogates1 ], - // [ highSurrogates2, lowSurrogates2 ] - // ] - return optimizeSurrogateMappings(surrogateMappings); +/***/ }), +/* 461 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + // json5.js + // Modern JSON. See README.md for details. + // + // This file is based directly off of Douglas Crockford's json_parse.js: + // https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js + + var JSON5 = ( false ? "undefined" : _typeof(exports)) === 'object' ? exports : {}; + + JSON5.parse = function () { + "use strict"; + + // This is a function that can parse a JSON5 text, producing a JavaScript + // data structure. It is a simple, recursive descent parser. It does not use + // eval or regular expressions, so it can be used as a model for implementing + // a JSON5 parser in other languages. + + // We are defining the function inside of another function to avoid creating + // global variables. + + var at, + // The index of the current character + lineNumber, + // The current line number + columnNumber, + // The current column number + ch, + // The current character + escapee = { + "'": "'", + '"': '"', + '\\': '\\', + '/': '/', + '\n': '', // Replace escaped newlines in strings w/ empty string + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t' + }, + ws = [' ', '\t', '\r', '\n', '\v', '\f', '\xA0', "\uFEFF"], + text, + renderChar = function renderChar(chr) { + return chr === '' ? 'EOF' : "'" + chr + "'"; + }, + error = function error(m) { + + // Call error when something is wrong. + + var error = new SyntaxError(); + // beginning of message suffix to agree with that provided by Gecko - see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse + error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19)); + error.at = at; + // These two property names have been chosen to agree with the ones in Gecko, the only popular + // environment which seems to supply this info on JSON.parse + error.lineNumber = lineNumber; + error.columnNumber = columnNumber; + throw error; + }, + next = function next(c) { + + // If a c parameter is provided, verify that it matches the current character. + + if (c && c !== ch) { + error("Expected " + renderChar(c) + " instead of " + renderChar(ch)); + } + + // Get the next character. When there are no more characters, + // return the empty string. + + ch = text.charAt(at); + at++; + columnNumber++; + if (ch === '\n' || ch === '\r' && peek() !== '\n') { + lineNumber++; + columnNumber = 0; + } + return ch; + }, + peek = function peek() { + + // Get the next character without consuming it or + // assigning it to the ch varaible. + + return text.charAt(at); + }, + identifier = function identifier() { + + // Parse an identifier. Normally, reserved words are disallowed here, but we + // only use this for unquoted object keys, where reserved words are allowed, + // so we don't check for those here. References: + // - http://es5.github.com/#x7.6 + // - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables + // - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm + // TODO Identifiers can have Unicode "letters" in them; add support for those. + + var key = ch; + + // Identifiers must start with a letter, _ or $. + if (ch !== '_' && ch !== '$' && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z')) { + error("Bad identifier as unquoted key"); + } + + // Subsequent characters can contain digits. + while (next() && (ch === '_' || ch === '$' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9')) { + key += ch; + } + + return key; + }, + number = function number() { + + // Parse a number value. + + var number, + sign = '', + string = '', + base = 10; + + if (ch === '-' || ch === '+') { + sign = ch; + next(ch); + } + + // support for Infinity (could tweak to allow other words): + if (ch === 'I') { + number = word(); + if (typeof number !== 'number' || isNaN(number)) { + error('Unexpected word for number'); + } + return sign === '-' ? -number : number; + } + + // support for NaN + if (ch === 'N') { + number = word(); + if (!isNaN(number)) { + error('expected word to be NaN'); + } + // ignore sign as -NaN also is NaN + return number; + } + + if (ch === '0') { + string += ch; + next(); + if (ch === 'x' || ch === 'X') { + string += ch; + next(); + base = 16; + } else if (ch >= '0' && ch <= '9') { + error('Octal literal'); + } + } + + switch (base) { + case 10: + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + if (ch === '.') { + string += '.'; + while (next() && ch >= '0' && ch <= '9') { + string += ch; + } + } + if (ch === 'e' || ch === 'E') { + string += ch; + next(); + if (ch === '-' || ch === '+') { + string += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + } + break; + case 16: + while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') { + string += ch; + next(); + } + break; + } + + if (sign === '-') { + number = -string; + } else { + number = +string; + } + + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + string = function string() { + + // Parse a string value. + + var hex, + i, + string = '', + delim, + // double quote or single quote + uffff; + + // When parsing for string values, we must look for ' or " and \ characters. + + if (ch === '"' || ch === "'") { + delim = ch; + while (next()) { + if (ch === delim) { + next(); + return string; + } else if (ch === '\\') { + next(); + if (ch === 'u') { + uffff = 0; + for (i = 0; i < 4; i += 1) { + hex = parseInt(next(), 16); + if (!isFinite(hex)) { + break; + } + uffff = uffff * 16 + hex; + } + string += String.fromCharCode(uffff); + } else if (ch === '\r') { + if (peek() === '\n') { + next(); + } + } else if (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else if (ch === '\n') { + // unescaped newlines are invalid; see: + // https://github.com/aseemk/json5/issues/24 + // TODO this feels special-cased; are there other + // invalid unescaped chars? + break; + } else { + string += ch; + } + } + } + error("Bad string"); + }, + inlineComment = function inlineComment() { + + // Skip an inline comment, assuming this is one. The current character should + // be the second / character in the // pair that begins this inline comment. + // To finish the inline comment, we look for a newline or the end of the text. + + if (ch !== '/') { + error("Not an inline comment"); + } + + do { + next(); + if (ch === '\n' || ch === '\r') { + next(); + return; + } + } while (ch); + }, + blockComment = function blockComment() { + + // Skip a block comment, assuming this is one. The current character should be + // the * character in the /* pair that begins this block comment. + // To finish the block comment, we look for an ending */ pair of characters, + // but we also watch for the end of text before the comment is terminated. + + if (ch !== '*') { + error("Not a block comment"); + } + + do { + next(); + while (ch === '*') { + next('*'); + if (ch === '/') { + next('/'); + return; + } + } + } while (ch); + + error("Unterminated block comment"); + }, + comment = function comment() { + + // Skip a comment, whether inline or block-level, assuming this is one. + // Comments always begin with a / character. + + if (ch !== '/') { + error("Not a comment"); + } + + next('/'); + + if (ch === '/') { + inlineComment(); + } else if (ch === '*') { + blockComment(); + } else { + error("Unrecognized comment"); + } + }, + white = function white() { + + // Skip whitespace and comments. + // Note that we're detecting comments by only a single / character. + // This works since regular expressions are not valid JSON(5), but this will + // break if there are other valid values that begin with a / character! + + while (ch) { + if (ch === '/') { + comment(); + } else if (ws.indexOf(ch) >= 0) { + next(); + } else { + return; + } + } + }, + word = function word() { + + // true, false, or null. + + switch (ch) { + case 't': + next('t'); + next('r'); + next('u'); + next('e'); + return true; + case 'f': + next('f'); + next('a'); + next('l'); + next('s'); + next('e'); + return false; + case 'n': + next('n'); + next('u'); + next('l'); + next('l'); + return null; + case 'I': + next('I'); + next('n'); + next('f'); + next('i'); + next('n'); + next('i'); + next('t'); + next('y'); + return Infinity; + case 'N': + next('N'); + next('a'); + next('N'); + return NaN; + } + error("Unexpected " + renderChar(ch)); + }, + value, + // Place holder for the value function. + + array = function array() { + + // Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + while (ch) { + if (ch === ']') { + next(']'); + return array; // Potentially empty array + } + // ES5 allows omitting elements in arrays, e.g. [,] and + // [,null]. We don't allow this in JSON5. + if (ch === ',') { + error("Missing array element"); + } else { + array.push(value()); + } + white(); + // If there's no comma after this value, this needs to + // be the end of the array. + if (ch !== ',') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + object = function object() { + + // Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + while (ch) { + if (ch === '}') { + next('}'); + return object; // Potentially empty object + } + + // Keys can be unquoted. If they are, they need to be + // valid JS identifiers. + if (ch === '"' || ch === "'") { + key = string(); + } else { + key = identifier(); + } + + white(); + next(':'); + object[key] = value(); + white(); + // If there's no comma after this pair, this needs to be + // the end of the object. + if (ch !== ',') { + next('}'); + return object; + } + next(','); + white(); + } + } + error("Bad object"); + }; + + value = function value() { + + // Parse a JSON value. It could be an object, an array, a string, a number, + // or a word. + + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + case "'": + return string(); + case '-': + case '+': + case '.': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } + }; + + // Return the json_parse function. It will have access to all of the above + // functions and variables. + + return function (source, reviver) { + var result; + + text = String(source); + at = 0; + lineNumber = 1; + columnNumber = 1; + ch = ' '; + result = value(); + white(); + if (ch) { + error("Syntax error"); + } + + // If there is a reviver function, we recursively walk the new structure, + // passing each name/value pair to the reviver function for possible + // transformation, starting with a temporary root object that holds the result + // in an empty key. If there is not a reviver function, we simply return the + // result. + + return typeof reviver === 'function' ? function walk(holder, key) { + var k, + v, + value = holder[key]; + if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + }({ '': result }, '') : result; + }; + }(); + + // JSON5 stringify will not quote keys where appropriate + JSON5.stringify = function (obj, replacer, space) { + if (replacer && typeof replacer !== "function" && !isArray(replacer)) { + throw new Error('Replacer must be a function or an array'); + } + var getReplacedValueOrUndefined = function getReplacedValueOrUndefined(holder, key, isTopLevel) { + var value = holder[key]; + + // Replace the value with its toJSON value first, if possible + if (value && value.toJSON && typeof value.toJSON === "function") { + value = value.toJSON(); + } + + // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for + // presence in the array (removing the key/value pair from the resulting JSON if the key is missing). + if (typeof replacer === "function") { + return replacer.call(holder, key, value); + } else if (replacer) { + if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) { + return value; + } else { + return undefined; + } + } else { + return value; + } + }; + + function isWordChar(c) { + return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c === '_' || c === '$'; + } + + function isWordStart(c) { + return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c === '_' || c === '$'; + } + + function isWord(key) { + if (typeof key !== 'string') { + return false; + } + if (!isWordStart(key[0])) { + return false; + } + var i = 1, + length = key.length; + while (i < length) { + if (!isWordChar(key[i])) { + return false; + } + i++; + } + return true; + } + + // export for use in tests + JSON5.isWord = isWord; + + // polyfills + function isArray(obj) { + if (Array.isArray) { + return Array.isArray(obj); + } else { + return Object.prototype.toString.call(obj) === '[object Array]'; + } + } + + function isDate(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; + } + + var objStack = []; + function checkForCircular(obj) { + for (var i = 0; i < objStack.length; i++) { + if (objStack[i] === obj) { + throw new TypeError("Converting circular structure to JSON"); + } + } + } + + function makeIndent(str, num, noNewLine) { + if (!str) { + return ""; + } + // indentation no more than 10 chars + if (str.length > 10) { + str = str.substring(0, 10); + } + + var indent = noNewLine ? "" : "\n"; + for (var i = 0; i < num; i++) { + indent += str; + } + + return indent; + } + + var indentStr; + if (space) { + if (typeof space === "string") { + indentStr = space; + } else if (typeof space === "number" && space >= 0) { + indentStr = makeIndent(" ", space, true); + } else { + // ignore space parameter + } + } + + // Copied from Crokford's implementation of JSON + // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195 + // Begin + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"': '\\"', + '\\': '\\\\' + }; + function escapeString(string) { + + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : "\\u" + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + // End + + function internalStringify(holder, key, isTopLevel) { + var buffer, res; + + // Replace the value, if necessary + var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel); + + if (obj_part && !isDate(obj_part)) { + // unbox objects + // don't unbox dates, since will turn it into number + obj_part = obj_part.valueOf(); + } + switch (typeof obj_part === "undefined" ? "undefined" : _typeof(obj_part)) { + case "boolean": + return obj_part.toString(); + + case "number": + if (isNaN(obj_part) || !isFinite(obj_part)) { + return "null"; + } + return obj_part.toString(); + + case "string": + return escapeString(obj_part.toString()); + + case "object": + if (obj_part === null) { + return "null"; + } else if (isArray(obj_part)) { + checkForCircular(obj_part); + buffer = "["; + objStack.push(obj_part); + + for (var i = 0; i < obj_part.length; i++) { + res = internalStringify(obj_part, i, false); + buffer += makeIndent(indentStr, objStack.length); + if (res === null || typeof res === "undefined") { + buffer += "null"; + } else { + buffer += res; + } + if (i < obj_part.length - 1) { + buffer += ","; + } else if (indentStr) { + buffer += "\n"; + } + } + objStack.pop(); + if (obj_part.length) { + buffer += makeIndent(indentStr, objStack.length, true); + } + buffer += "]"; + } else { + checkForCircular(obj_part); + buffer = "{"; + var nonEmpty = false; + objStack.push(obj_part); + for (var prop in obj_part) { + if (obj_part.hasOwnProperty(prop)) { + var value = internalStringify(obj_part, prop, false); + isTopLevel = false; + if (typeof value !== "undefined" && value !== null) { + buffer += makeIndent(indentStr, objStack.length); + nonEmpty = true; + key = isWord(prop) ? prop : escapeString(prop); + buffer += key + ":" + (indentStr ? ' ' : '') + value + ","; + } + } + } + objStack.pop(); + if (nonEmpty) { + buffer = buffer.substring(0, buffer.length - 1) + makeIndent(indentStr, objStack.length) + "}"; + } else { + buffer = '{}'; + } + } + return buffer; + default: + // functions and undefined should be ignored + return undefined; + } + } + + // special case...when undefined is used inside of + // a compound object/array, return null. + // but when top-level, return undefined + var topLevelHolder = { "": obj }; + if (obj === undefined) { + return getReplacedValueOrUndefined(topLevelHolder, '', true); + } + return internalStringify(topLevelHolder, '', true); }; - var createSurrogateCharacterClasses = function(surrogateMappings) { - var result = []; - forEach(surrogateMappings, function(surrogateMapping) { - var highSurrogates = surrogateMapping[0]; - var lowSurrogates = surrogateMapping[1]; - result.push( - createBMPCharacterClasses(highSurrogates) + - createBMPCharacterClasses(lowSurrogates) - ); - }); - return result.join('|'); +/***/ }), +/* 462 */ +/***/ (function(module, exports) { + + 'use strict'; + + var arr = []; + var charCodeCache = []; + + module.exports = function (a, b) { + if (a === b) { + return 0; + } + + var aLen = a.length; + var bLen = b.length; + + if (aLen === 0) { + return bLen; + } + + if (bLen === 0) { + return aLen; + } + + var bCharCode; + var ret; + var tmp; + var tmp2; + var i = 0; + var j = 0; + + while (i < aLen) { + charCodeCache[i] = a.charCodeAt(i); + arr[i] = ++i; + } + + while (j < bLen) { + bCharCode = b.charCodeAt(j); + tmp = j++; + ret = j; + + for (i = 0; i < aLen; i++) { + tmp2 = bCharCode === charCodeCache[i] ? tmp : tmp + 1; + tmp = arr[i]; + ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2; + } + } + + return ret; }; - var createCharacterClassesFromData = function(data, bmpOnly) { - var result = []; +/***/ }), +/* 463 */ +/***/ (function(module, exports, __webpack_require__) { - var parts = splitAtBMP(data); - var loneHighSurrogates = parts.loneHighSurrogates; - var loneLowSurrogates = parts.loneLowSurrogates; - var bmp = parts.bmp; - var astral = parts.astral; - var hasAstral = !dataIsEmpty(parts.astral); - var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates); - var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates); + 'use strict'; - var surrogateMappings = surrogateSet(astral); + var getNative = __webpack_require__(38), + root = __webpack_require__(15); - if (bmpOnly) { - bmp = dataAddData(bmp, loneHighSurrogates); - hasLoneHighSurrogates = false; - bmp = dataAddData(bmp, loneLowSurrogates); - hasLoneLowSurrogates = false; - } + /* Built-in method references that are verified to be native. */ + var DataView = getNative(root, 'DataView'); - if (!dataIsEmpty(bmp)) { - // The data set contains BMP code points that are not high surrogates - // needed for astral code points in the set. - result.push(createBMPCharacterClasses(bmp)); - } - if (surrogateMappings.length) { - // The data set contains astral code points; append character classes - // based on their surrogate pairs. - result.push(createSurrogateCharacterClasses(surrogateMappings)); - } - // https://gist.github.com/mathiasbynens/bbe7f870208abcfec860 - if (hasLoneHighSurrogates) { - result.push( - createBMPCharacterClasses(loneHighSurrogates) + - // Make sure the high surrogates aren’t part of a surrogate pair. - '(?![\\uDC00-\\uDFFF])' - ); - } - if (hasLoneLowSurrogates) { - result.push( - // Make sure the low surrogates aren’t part of a surrogate pair. - '(?:[^\\uD800-\\uDBFF]|^)' + - createBMPCharacterClasses(loneLowSurrogates) - ); - } - return result.join('|'); + module.exports = DataView; + +/***/ }), +/* 464 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var hashClear = __webpack_require__(527), + hashDelete = __webpack_require__(528), + hashGet = __webpack_require__(529), + hashHas = __webpack_require__(530), + hashSet = __webpack_require__(531); + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + module.exports = Hash; + +/***/ }), +/* 465 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38), + root = __webpack_require__(15); + + /* Built-in method references that are verified to be native. */ + var Promise = getNative(root, 'Promise'); + + module.exports = Promise; + +/***/ }), +/* 466 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(38), + root = __webpack_require__(15); + + /* Built-in method references that are verified to be native. */ + var WeakMap = getNative(root, 'WeakMap'); + + module.exports = WeakMap; + +/***/ }), +/* 467 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Adds the key-value `pair` to `map`. + * + * @private + * @param {Object} map The map to modify. + * @param {Array} pair The key-value pair to add. + * @returns {Object} Returns `map`. + */ + function addMapEntry(map, pair) { + // Don't return `map.set` because it's not chainable in IE 11. + map.set(pair[0], pair[1]); + return map; + } + + module.exports = addMapEntry; + +/***/ }), +/* 468 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Adds `value` to `set`. + * + * @private + * @param {Object} set The set to modify. + * @param {*} value The value to add. + * @returns {Object} Returns `set`. + */ + function addSetEntry(set, value) { + // Don't return `set.add` because it's not chainable in IE 11. + set.add(value); + return set; + } + + module.exports = addSetEntry; + +/***/ }), +/* 469 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + module.exports = arrayEach; + +/***/ }), +/* 470 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + module.exports = arrayFilter; + +/***/ }), +/* 471 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIndexOf = __webpack_require__(162); + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + module.exports = arrayIncludes; + +/***/ }), +/* 472 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + module.exports = arrayIncludesWith; + +/***/ }), +/* 473 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + module.exports = arraySome; + +/***/ }), +/* 474 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + keys = __webpack_require__(31); + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + + module.exports = baseAssign; + +/***/ }), +/* 475 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + keysIn = __webpack_require__(46); + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + + module.exports = baseAssignIn; + +/***/ }), +/* 476 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; + } + + module.exports = baseClamp; + +/***/ }), +/* 477 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(16); + + /** Built-in value references. */ + var objectCreate = Object.create; + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = function () { + function object() {} + return function (proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object(); + object.prototype = undefined; + return result; + }; + }(); + + module.exports = baseCreate; + +/***/ }), +/* 478 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseForOwn = __webpack_require__(480), + createBaseEach = __webpack_require__(517); + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + module.exports = baseEach; + +/***/ }), +/* 479 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayPush = __webpack_require__(157), + isFlattenable = __webpack_require__(534); + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + module.exports = baseFlatten; + +/***/ }), +/* 480 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseFor = __webpack_require__(243), + keys = __webpack_require__(31); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + module.exports = baseForOwn; + +/***/ }), +/* 481 */ +/***/ (function(module, exports) { + + "use strict"; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + module.exports = baseHas; + +/***/ }), +/* 482 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + module.exports = baseHasIn; + +/***/ }), +/* 483 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + module.exports = baseIndexOfWith; + +/***/ }), +/* 484 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]'; + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + + module.exports = baseIsArguments; + +/***/ }), +/* 485 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Stack = __webpack_require__(99), + equalArrays = __webpack_require__(255), + equalByTag = __webpack_require__(521), + equalObjects = __webpack_require__(522), + getTag = __webpack_require__(259), + isArray = __webpack_require__(6), + isBuffer = __webpack_require__(113), + isTypedArray = __webpack_require__(173); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + objectTag = '[object Object]'; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + + module.exports = baseIsEqualDeep; + +/***/ }), +/* 486 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Stack = __webpack_require__(99), + baseIsEqual = __webpack_require__(246); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) { + return false; + } + } + } + return true; + } + + module.exports = baseIsMatch; + +/***/ }), +/* 487 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + module.exports = baseIsNaN; + +/***/ }), +/* 488 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isFunction = __webpack_require__(171), + isMasked = __webpack_require__(536), + isObject = __webpack_require__(16), + toSource = __webpack_require__(267); + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used for built-in method references. */ + var funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + module.exports = baseIsNative; + +/***/ }), +/* 489 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var regexpTag = '[object RegExp]'; + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + module.exports = baseIsRegExp; + +/***/ }), +/* 490 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + isLength = __webpack_require__(172), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + + /** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + + module.exports = baseIsTypedArray; + +/***/ }), +/* 491 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isPrototype = __webpack_require__(105), + nativeKeys = __webpack_require__(548); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + module.exports = baseKeys; + +/***/ }), +/* 492 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(16), + isPrototype = __webpack_require__(105), + nativeKeysIn = __webpack_require__(549); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + module.exports = baseKeysIn; + +/***/ }), +/* 493 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsMatch = __webpack_require__(486), + getMatchData = __webpack_require__(524), + matchesStrictComparable = __webpack_require__(264); + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function (object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + module.exports = baseMatches; + +/***/ }), +/* 494 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseIsEqual = __webpack_require__(246), + get = __webpack_require__(574), + hasIn = __webpack_require__(575), + isKey = __webpack_require__(169), + isStrictComparable = __webpack_require__(262), + matchesStrictComparable = __webpack_require__(264), + toKey = __webpack_require__(108); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function (object) { + var objValue = get(object, path); + return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + module.exports = baseMatchesProperty; + +/***/ }), +/* 495 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Stack = __webpack_require__(99), + assignMergeValue = __webpack_require__(242), + baseFor = __webpack_require__(243), + baseMergeDeep = __webpack_require__(496), + isObject = __webpack_require__(16), + keysIn = __webpack_require__(46); + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function (srcValue, key) { + if (isObject(srcValue)) { + stack || (stack = new Stack()); + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } else { + var newValue = customizer ? customizer(object[key], srcValue, key + '', object, source, stack) : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + module.exports = baseMerge; + +/***/ }), +/* 496 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assignMergeValue = __webpack_require__(242), + cloneBuffer = __webpack_require__(251), + cloneTypedArray = __webpack_require__(252), + copyArray = __webpack_require__(164), + initCloneObject = __webpack_require__(261), + isArguments = __webpack_require__(112), + isArray = __webpack_require__(6), + isArrayLikeObject = __webpack_require__(576), + isBuffer = __webpack_require__(113), + isFunction = __webpack_require__(171), + isObject = __webpack_require__(16), + isPlainObject = __webpack_require__(270), + isTypedArray = __webpack_require__(173), + toPlainObject = __webpack_require__(590); + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = object[key], + srcValue = source[key], + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer ? customizer(objValue, srcValue, key + '', object, source, stack) : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } else { + newValue = []; + } + } else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } else if (!isObject(objValue) || srcIndex && isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + module.exports = baseMergeDeep; + +/***/ }), +/* 497 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayMap = __webpack_require__(58), + baseIteratee = __webpack_require__(59), + baseMap = __webpack_require__(247), + baseSortBy = __webpack_require__(503), + baseUnary = __webpack_require__(102), + compareMultiple = __webpack_require__(513), + identity = __webpack_require__(110); + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + var index = -1; + iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); + + var result = baseMap(collection, function (value, key, collection) { + var criteria = arrayMap(iteratees, function (iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function (object, other) { + return compareMultiple(object, other, orders); + }); + } + + module.exports = baseOrderBy; + +/***/ }), +/* 498 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function (object) { + return object == null ? undefined : object[key]; + }; + } + + module.exports = baseProperty; + +/***/ }), +/* 499 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGet = __webpack_require__(244); + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function (object) { + return baseGet(object, path); + }; + } + + module.exports = basePropertyDeep; + +/***/ }), +/* 500 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayMap = __webpack_require__(58), + baseIndexOf = __webpack_require__(162), + baseIndexOfWith = __webpack_require__(483), + baseUnary = __webpack_require__(102), + copyArray = __webpack_require__(164); + + /** Used for built-in method references. */ + var arrayProto = Array.prototype; + + /** Built-in value references. */ + var splice = arrayProto.splice; + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + module.exports = basePullAll; + +/***/ }), +/* 501 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeFloor = Math.floor; + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + module.exports = baseRepeat; + +/***/ }), +/* 502 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var constant = __webpack_require__(567), + defineProperty = __webpack_require__(254), + identity = __webpack_require__(110); + + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function (func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); }; - /*--------------------------------------------------------------------------*/ + module.exports = baseSetToString; - // `regenerate` can be used as a constructor (and new methods can be added to - // its prototype) but also as a regular function, the latter of which is the - // documented and most common usage. For that reason, it’s not capitalized. - var regenerate = function(value) { - if (arguments.length > 1) { - value = slice.call(arguments); - } - if (this instanceof regenerate) { - this.data = []; - return value ? this.add(value) : this; - } - return (new regenerate).add(value); +/***/ }), +/* 503 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + module.exports = baseSortBy; + +/***/ }), +/* 504 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + module.exports = baseTimes; + +/***/ }), +/* 505 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var SetCache = __webpack_require__(237), + arrayIncludes = __webpack_require__(471), + arrayIncludesWith = __webpack_require__(472), + cacheHas = __webpack_require__(249), + createSet = __webpack_require__(519), + setToArray = __webpack_require__(107); + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache(); + } else { + seen = iteratee ? [] : result; + } + outer: while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = comparator || value !== 0 ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + module.exports = baseUniq; + +/***/ }), +/* 506 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayMap = __webpack_require__(58); + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function (key) { + return object[key]; + }); + } + + module.exports = baseValues; + +/***/ }), +/* 507 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var cloneArrayBuffer = __webpack_require__(163); + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + module.exports = cloneDataView; + +/***/ }), +/* 508 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var addMapEntry = __webpack_require__(467), + arrayReduce = __webpack_require__(241), + mapToArray = __webpack_require__(263); + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1; + + /** + * Creates a clone of `map`. + * + * @private + * @param {Object} map The map to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned map. + */ + function cloneMap(map, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); + return arrayReduce(array, addMapEntry, new map.constructor()); + } + + module.exports = cloneMap; + +/***/ }), +/* 509 */ +/***/ (function(module, exports) { + + "use strict"; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + module.exports = cloneRegExp; + +/***/ }), +/* 510 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var addSetEntry = __webpack_require__(468), + arrayReduce = __webpack_require__(241), + setToArray = __webpack_require__(107); + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1; + + /** + * Creates a clone of `set`. + * + * @private + * @param {Object} set The set to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned set. + */ + function cloneSet(set, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); + return arrayReduce(array, addSetEntry, new set.constructor()); + } + + module.exports = cloneSet; + +/***/ }), +/* 511 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + module.exports = cloneSymbol; + +/***/ }), +/* 512 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isSymbol = __webpack_require__(60); + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { + return 1; + } + if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { + return -1; + } + } + return 0; + } + + module.exports = compareAscending; + +/***/ }), +/* 513 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var compareAscending = __webpack_require__(512); + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + module.exports = compareMultiple; + +/***/ }), +/* 514 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + getSymbols = __webpack_require__(166); + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + + module.exports = copySymbols; + +/***/ }), +/* 515 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + getSymbolsIn = __webpack_require__(258); + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + + module.exports = copySymbolsIn; + +/***/ }), +/* 516 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var root = __webpack_require__(15); + + /** Used to detect overreaching core-js shims. */ + var coreJsData = root['__core-js_shared__']; + + module.exports = coreJsData; + +/***/ }), +/* 517 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isArrayLike = __webpack_require__(24); + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function (collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while (fromRight ? index-- : ++index < length) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + module.exports = createBaseEach; + +/***/ }), +/* 518 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function (object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + module.exports = createBaseFor; + +/***/ }), +/* 519 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Set = __webpack_require__(236), + noop = __webpack_require__(582), + setToArray = __webpack_require__(107); + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0; + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function (values) { + return new Set(values); }; - regenerate.version = '1.2.0'; + module.exports = createSet; - var proto = regenerate.prototype; - extend(proto, { - 'add': function(value) { - var $this = this; - if (value == null) { - return $this; - } - if (value instanceof regenerate) { - // Allow passing other Regenerate instances. - $this.data = dataAddData($this.data, value.data); - return $this; - } - if (arguments.length > 1) { - value = slice.call(arguments); - } - if (isArray(value)) { - forEach(value, function(item) { - $this.add(item); - }); - return $this; - } - $this.data = dataAdd( - $this.data, - isNumber(value) ? value : symbolToCodePoint(value) - ); - return $this; - }, - 'remove': function(value) { - var $this = this; - if (value == null) { - return $this; - } - if (value instanceof regenerate) { - // Allow passing other Regenerate instances. - $this.data = dataRemoveData($this.data, value.data); - return $this; - } - if (arguments.length > 1) { - value = slice.call(arguments); - } - if (isArray(value)) { - forEach(value, function(item) { - $this.remove(item); - }); - return $this; - } - $this.data = dataRemove( - $this.data, - isNumber(value) ? value : symbolToCodePoint(value) - ); - return $this; - }, - 'addRange': function(start, end) { - var $this = this; - $this.data = dataAddRange($this.data, - isNumber(start) ? start : symbolToCodePoint(start), - isNumber(end) ? end : symbolToCodePoint(end) - ); - return $this; - }, - 'removeRange': function(start, end) { - var $this = this; - var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start); - var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end); - $this.data = dataRemoveRange( - $this.data, - startCodePoint, - endCodePoint - ); - return $this; - }, - 'intersection': function(argument) { - var $this = this; - // Allow passing other Regenerate instances. - // TODO: Optimize this by writing and using `dataIntersectionData()`. - var array = argument instanceof regenerate ? - dataToArray(argument.data) : - argument; - $this.data = dataIntersection($this.data, array); - return $this; - }, - 'contains': function(codePoint) { - return dataContains( - this.data, - isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint) - ); - }, - 'clone': function() { - var set = new regenerate; - set.data = this.data.slice(0); - return set; - }, - 'toString': function(options) { - var result = createCharacterClassesFromData( - this.data, - options ? options.bmpOnly : false - ); - // Use `\0` instead of `\x00` where possible. - return result.replace(regexNull, '\\0$1'); - }, - 'toRegExp': function(flags) { - return RegExp(this.toString(), flags || ''); - }, - 'valueOf': function() { // Note: `valueOf` is aliased as `toArray`. - return dataToArray(this.data); - } +/***/ }), +/* 520 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var eq = __webpack_require__(45); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) { + return srcValue; + } + return objValue; + } + + module.exports = customDefaultsAssignIn; + +/***/ }), +/* 521 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44), + Uint8Array = __webpack_require__(238), + eq = __webpack_require__(45), + equalArrays = __webpack_require__(255), + mapToArray = __webpack_require__(263), + setToArray = __webpack_require__(107); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** `Object#toString` result references. */ + var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]'; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ''; + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + + module.exports = equalByTag; + +/***/ }), +/* 522 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getAllKeys = __webpack_require__(257); + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; + } + + module.exports = equalObjects; + +/***/ }), +/* 523 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetAllKeys = __webpack_require__(245), + getSymbolsIn = __webpack_require__(258), + keysIn = __webpack_require__(46); + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + + module.exports = getAllKeysIn; + +/***/ }), +/* 524 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isStrictComparable = __webpack_require__(262), + keys = __webpack_require__(31); + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + module.exports = getMatchData; + +/***/ }), +/* 525 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Built-in value references. */ + var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + module.exports = getRawTag; + +/***/ }), +/* 526 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + + module.exports = getValue; + +/***/ }), +/* 527 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var nativeCreate = __webpack_require__(106); + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + module.exports = hashClear; + +/***/ }), +/* 528 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + module.exports = hashDelete; + +/***/ }), +/* 529 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var nativeCreate = __webpack_require__(106); + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + module.exports = hashGet; + +/***/ }), +/* 530 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var nativeCreate = __webpack_require__(106); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); + } + + module.exports = hashHas; + +/***/ }), +/* 531 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var nativeCreate = __webpack_require__(106); + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; + } + + module.exports = hashSet; + +/***/ }), +/* 532 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + module.exports = initCloneArray; + +/***/ }), +/* 533 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var cloneArrayBuffer = __webpack_require__(163), + cloneDataView = __webpack_require__(507), + cloneMap = __webpack_require__(508), + cloneRegExp = __webpack_require__(509), + cloneSet = __webpack_require__(510), + cloneSymbol = __webpack_require__(511), + cloneTypedArray = __webpack_require__(252); + + /** `Object#toString` result references. */ + var boolTag = '[object Boolean]', + dateTag = '[object Date]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, cloneFunc, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag:case float64Tag: + case int8Tag:case int16Tag:case int32Tag: + case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return cloneMap(object, isDeep, cloneFunc); + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return cloneSet(object, isDeep, cloneFunc); + + case symbolTag: + return cloneSymbol(object); + } + } + + module.exports = initCloneByTag; + +/***/ }), +/* 534 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Symbol = __webpack_require__(44), + isArguments = __webpack_require__(112), + isArray = __webpack_require__(6); + + /** Built-in value references. */ + var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined; + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + module.exports = isFlattenable; + +/***/ }), +/* 535 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); + return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; + } + + module.exports = isKeyable; + +/***/ }), +/* 536 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var coreJsData = __webpack_require__(516); + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = function () { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? 'Symbol(src)_1.' + uid : ''; + }(); + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; + } + + module.exports = isMasked; + +/***/ }), +/* 537 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + module.exports = listCacheClear; + +/***/ }), +/* 538 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assocIndexOf = __webpack_require__(100); + + /** Used for built-in method references. */ + var arrayProto = Array.prototype; + + /** Built-in value references. */ + var splice = arrayProto.splice; + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + module.exports = listCacheDelete; + +/***/ }), +/* 539 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assocIndexOf = __webpack_require__(100); + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + module.exports = listCacheGet; + +/***/ }), +/* 540 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assocIndexOf = __webpack_require__(100); + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + module.exports = listCacheHas; + +/***/ }), +/* 541 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var assocIndexOf = __webpack_require__(100); + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + module.exports = listCacheSet; + +/***/ }), +/* 542 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Hash = __webpack_require__(464), + ListCache = __webpack_require__(98), + Map = __webpack_require__(155); + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash(), + 'map': new (Map || ListCache)(), + 'string': new Hash() + }; + } + + module.exports = mapCacheClear; + +/***/ }), +/* 543 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getMapData = __webpack_require__(104); + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + module.exports = mapCacheDelete; + +/***/ }), +/* 544 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getMapData = __webpack_require__(104); + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + module.exports = mapCacheGet; + +/***/ }), +/* 545 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getMapData = __webpack_require__(104); + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + module.exports = mapCacheHas; + +/***/ }), +/* 546 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getMapData = __webpack_require__(104); + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + module.exports = mapCacheSet; + +/***/ }), +/* 547 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var memoize = __webpack_require__(580); + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function (key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + module.exports = memoizeCapped; + +/***/ }), +/* 548 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var overArg = __webpack_require__(266); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeKeys = overArg(Object.keys, Object); + + module.exports = nativeKeys; + +/***/ }), +/* 549 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + + module.exports = nativeKeysIn; + +/***/ }), +/* 550 */ +/***/ (function(module, exports) { + + "use strict"; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + module.exports = objectToString; + +/***/ }), +/* 551 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var apply = __webpack_require__(239); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max; + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? func.length - 1 : start, 0); + return function () { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + module.exports = overRest; + +/***/ }), +/* 552 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + + module.exports = setCacheAdd; + +/***/ }), +/* 553 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ + function setCacheHas(value) { + return this.__data__.has(value); + } + + module.exports = setCacheHas; + +/***/ }), +/* 554 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseSetToString = __webpack_require__(502), + shortOut = __webpack_require__(555); + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + module.exports = setToString; + +/***/ }), +/* 555 */ +/***/ (function(module, exports) { + + "use strict"; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeNow = Date.now; + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function () { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + module.exports = shortOut; + +/***/ }), +/* 556 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ListCache = __webpack_require__(98); + + /** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + function stackClear() { + this.__data__ = new ListCache(); + this.size = 0; + } + + module.exports = stackClear; + +/***/ }), +/* 557 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; + } + + module.exports = stackDelete; + +/***/ }), +/* 558 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function stackGet(key) { + return this.__data__.get(key); + } + + module.exports = stackGet; + +/***/ }), +/* 559 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function stackHas(key) { + return this.__data__.has(key); + } + + module.exports = stackHas; + +/***/ }), +/* 560 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ListCache = __webpack_require__(98), + Map = __webpack_require__(155), + MapCache = __webpack_require__(156); + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + + module.exports = stackSet; + +/***/ }), +/* 561 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + module.exports = strictIndexOf; + +/***/ }), +/* 562 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var memoizeCapped = __webpack_require__(547); + + /** Used to match property names within property paths. */ + var reLeadingDot = /^\./, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function (string) { + var result = []; + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function (match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : number || match); + }); + return result; }); - proto.toArray = proto.valueOf; + module.exports = stringToPath; - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define(function() { - return regenerate; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = regenerate; - } else { // in Narwhal or RingoJS v0.7.0- - freeExports.regenerate = regenerate; - } - } else { // in Rhino or a web browser - root.regenerate = regenerate; +/***/ }), +/* 563 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + createAssigner = __webpack_require__(103), + keysIn = __webpack_require__(46); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function (object, source) { + copyObject(source, keysIn(source), object); + }); + + module.exports = assignIn; + +/***/ }), +/* 564 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + createAssigner = __webpack_require__(103), + keysIn = __webpack_require__(46); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function (object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + module.exports = assignInWith; + +/***/ }), +/* 565 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseClone = __webpack_require__(160); + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_SYMBOLS_FLAG = 4; + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } -}(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],589:[function(_dereq_,module,exports){ -(function (global){ -/*! - * RegJSGen - * Copyright 2014 Benjamin Tan <https://d10.github.io/> - * Available under MIT license <http://d10.mit-license.org/> - */ -;(function() { - 'use strict'; - - /** Used to determine if values are of the language type `Object` */ - var objectTypes = { - 'function': true, - 'object': true - }; - - /** Used as a reference to the global object */ - var root = (objectTypes[typeof window] && window) || this; - - /** Backup possible global object */ - var oldRoot = root; - - /** Detect free variable `exports` */ - var freeExports = objectTypes[typeof exports] && exports; - - /** Detect free variable `module` */ - var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; - - /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ - var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - /*! Based on https://mths.be/fromcodepoint v0.2.0 by @mathias */ - - var stringFromCharCode = String.fromCharCode; - var floor = Math.floor; - function fromCodePoint() { - var MAX_SIZE = 0x4000; - var codeUnits = []; - var highSurrogate; - var lowSurrogate; - var index = -1; - var length = arguments.length; - if (!length) { - return ''; - } - var result = ''; - while (++index < length) { - var codePoint = Number(arguments[index]); - if ( - !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` - codePoint < 0 || // not a valid Unicode code point - codePoint > 0x10FFFF || // not a valid Unicode code point - floor(codePoint) != codePoint // not an integer - ) { - throw RangeError('Invalid code point: ' + codePoint); - } - if (codePoint <= 0xFFFF) { - // BMP code point - codeUnits.push(codePoint); - } else { - // Astral code point; split in surrogate halves - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - codePoint -= 0x10000; - highSurrogate = (codePoint >> 10) + 0xD800; - lowSurrogate = (codePoint % 0x400) + 0xDC00; - codeUnits.push(highSurrogate, lowSurrogate); - } - if (index + 1 == length || codeUnits.length > MAX_SIZE) { - result += stringFromCharCode.apply(null, codeUnits); - codeUnits.length = 0; - } - } - return result; - } - - function assertType(type, expected) { - if (expected.indexOf('|') == -1) { - if (type == expected) { - return; - } - - throw Error('Invalid node type: ' + type); - } - - expected = assertType.hasOwnProperty(expected) - ? assertType[expected] - : (assertType[expected] = RegExp('^(?:' + expected + ')$')); - - if (expected.test(type)) { - return; - } - - throw Error('Invalid node type: ' + type); - } - - /*--------------------------------------------------------------------------*/ - - function generate(node) { - var type = node.type; - - if (generate.hasOwnProperty(type) && typeof generate[type] == 'function') { - return generate[type](node); - } - - throw Error('Invalid node type: ' + type); - } - - /*--------------------------------------------------------------------------*/ - - function generateAlternative(node) { - assertType(node.type, 'alternative'); - - var terms = node.body, - length = terms ? terms.length : 0; - - if (length == 1) { - return generateTerm(terms[0]); - } else { - var i = -1, - result = ''; - - while (++i < length) { - result += generateTerm(terms[i]); - } - - return result; - } - } - - function generateAnchor(node) { - assertType(node.type, 'anchor'); - - switch (node.kind) { - case 'start': - return '^'; - case 'end': - return '$'; - case 'boundary': - return '\\b'; - case 'not-boundary': - return '\\B'; - default: - throw Error('Invalid assertion'); - } - } - - function generateAtom(node) { - assertType(node.type, 'anchor|characterClass|characterClassEscape|dot|group|reference|value'); - - return generate(node); - } - - function generateCharacterClass(node) { - assertType(node.type, 'characterClass'); - - var classRanges = node.body, - length = classRanges ? classRanges.length : 0; - - var i = -1, - result = '['; - - if (node.negative) { - result += '^'; - } - - while (++i < length) { - result += generateClassAtom(classRanges[i]); - } - - result += ']'; - - return result; - } - - function generateCharacterClassEscape(node) { - assertType(node.type, 'characterClassEscape'); - - return '\\' + node.value; - } - - function generateCharacterClassRange(node) { - assertType(node.type, 'characterClassRange'); - - var min = node.min, - max = node.max; - - if (min.type == 'characterClassRange' || max.type == 'characterClassRange') { - throw Error('Invalid character class range'); - } - - return generateClassAtom(min) + '-' + generateClassAtom(max); - } - - function generateClassAtom(node) { - assertType(node.type, 'anchor|characterClassEscape|characterClassRange|dot|value'); - - return generate(node); - } - - function generateDisjunction(node) { - assertType(node.type, 'disjunction'); - - var body = node.body, - length = body ? body.length : 0; - - if (length == 0) { - throw Error('No body'); - } else if (length == 1) { - return generate(body[0]); - } else { - var i = -1, - result = ''; - - while (++i < length) { - if (i != 0) { - result += '|'; - } - result += generate(body[i]); - } - - return result; - } - } - - function generateDot(node) { - assertType(node.type, 'dot'); - - return '.'; - } - - function generateGroup(node) { - assertType(node.type, 'group'); - - var result = '('; - - switch (node.behavior) { - case 'normal': - break; - case 'ignore': - result += '?:'; - break; - case 'lookahead': - result += '?='; - break; - case 'negativeLookahead': - result += '?!'; - break; - default: - throw Error('Invalid behaviour: ' + node.behaviour); - } - - var body = node.body, - length = body ? body.length : 0; - - if (length == 1) { - result += generate(body[0]); - } else { - var i = -1; - - while (++i < length) { - result += generate(body[i]); - } - } - - result += ')'; - - return result; - } - - function generateQuantifier(node) { - assertType(node.type, 'quantifier'); - - var quantifier = '', - min = node.min, - max = node.max; - - switch (max) { - case undefined: - case null: - switch (min) { - case 0: - quantifier = '*' - break; - case 1: - quantifier = '+'; - break; - default: - quantifier = '{' + min + ',}'; - break; - } - break; - default: - if (min == max) { - quantifier = '{' + min + '}'; - } - else if (min == 0 && max == 1) { - quantifier = '?'; - } else { - quantifier = '{' + min + ',' + max + '}'; - } - break; - } - - if (!node.greedy) { - quantifier += '?'; - } - - return generateAtom(node.body[0]) + quantifier; - } - - function generateReference(node) { - assertType(node.type, 'reference'); - - return '\\' + node.matchIndex; - } - - function generateTerm(node) { - assertType(node.type, 'anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value'); - - return generate(node); - } - - function generateValue(node) { - assertType(node.type, 'value'); - - var kind = node.kind, - codePoint = node.codePoint; - - switch (kind) { - case 'controlLetter': - return '\\c' + fromCodePoint(codePoint + 64); - case 'hexadecimalEscape': - return '\\x' + ('00' + codePoint.toString(16).toUpperCase()).slice(-2); - case 'identifier': - return '\\' + fromCodePoint(codePoint); - case 'null': - return '\\' + codePoint; - case 'octal': - return '\\' + codePoint.toString(8); - case 'singleEscape': - switch (codePoint) { - case 0x0008: - return '\\b'; - case 0x009: - return '\\t'; - case 0x00A: - return '\\n'; - case 0x00B: - return '\\v'; - case 0x00C: - return '\\f'; - case 0x00D: - return '\\r'; - default: - throw Error('Invalid codepoint: ' + codePoint); - } - case 'symbol': - return fromCodePoint(codePoint); - case 'unicodeEscape': - return '\\u' + ('0000' + codePoint.toString(16).toUpperCase()).slice(-4); - case 'unicodeCodePointEscape': - return '\\u{' + codePoint.toString(16).toUpperCase() + '}'; - default: - throw Error('Unsupported node kind: ' + kind); - } - } - - /*--------------------------------------------------------------------------*/ - - generate.alternative = generateAlternative; - generate.anchor = generateAnchor; - generate.characterClass = generateCharacterClass; - generate.characterClassEscape = generateCharacterClassEscape; - generate.characterClassRange = generateCharacterClassRange; - generate.disjunction = generateDisjunction; - generate.dot = generateDot; - generate.group = generateGroup; - generate.quantifier = generateQuantifier; - generate.reference = generateReference; - generate.value = generateValue; - - /*--------------------------------------------------------------------------*/ - - // export regjsgen - // some AMD build optimizers, like r.js, check for condition patterns like the following: - if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { - // define as an anonymous module so, through path mapping, it can be aliased - define(function() { - return { - 'generate': generate - }; - }); - } - // check for `exports` after `define` in case a build optimizer adds an `exports` object - else if (freeExports && freeModule) { - // in Narwhal, Node.js, Rhino -require, or RingoJS - freeExports.generate = generate; - } - // in a browser or Rhino - else { - root.regjsgen = { - 'generate': generate - }; - } -}.call(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],590:[function(_dereq_,module,exports){ -// regjsparser -// -// ================================================================== -// -// See ECMA-262 Standard: 15.10.1 -// -// NOTE: The ECMA-262 standard uses the term "Assertion" for /^/. Here the -// term "Anchor" is used. -// -// Pattern :: -// Disjunction -// -// Disjunction :: -// Alternative -// Alternative | Disjunction -// -// Alternative :: -// [empty] -// Alternative Term -// -// Term :: -// Anchor -// Atom -// Atom Quantifier -// -// Anchor :: -// ^ -// $ -// \ b -// \ B -// ( ? = Disjunction ) -// ( ? ! Disjunction ) -// -// Quantifier :: -// QuantifierPrefix -// QuantifierPrefix ? -// -// QuantifierPrefix :: -// * -// + -// ? -// { DecimalDigits } -// { DecimalDigits , } -// { DecimalDigits , DecimalDigits } -// -// Atom :: -// PatternCharacter -// . -// \ AtomEscape -// CharacterClass -// ( Disjunction ) -// ( ? : Disjunction ) -// -// PatternCharacter :: -// SourceCharacter but not any of: ^ $ \ . * + ? ( ) [ ] { } | -// -// AtomEscape :: -// DecimalEscape -// CharacterEscape -// CharacterClassEscape -// -// CharacterEscape[U] :: -// ControlEscape -// c ControlLetter -// HexEscapeSequence -// RegExpUnicodeEscapeSequence[?U] (ES6) -// IdentityEscape[?U] -// -// ControlEscape :: -// one of f n r t v -// ControlLetter :: -// one of -// a b c d e f g h i j k l m n o p q r s t u v w x y z -// A B C D E F G H I J K L M N O P Q R S T U V W X Y Z -// -// IdentityEscape :: -// SourceCharacter but not IdentifierPart -// <ZWJ> -// <ZWNJ> -// -// DecimalEscape :: -// DecimalIntegerLiteral [lookahead ∉ DecimalDigit] -// -// CharacterClassEscape :: -// one of d D s S w W -// -// CharacterClass :: -// [ [lookahead ∉ {^}] ClassRanges ] -// [ ^ ClassRanges ] -// -// ClassRanges :: -// [empty] -// NonemptyClassRanges -// -// NonemptyClassRanges :: -// ClassAtom -// ClassAtom NonemptyClassRangesNoDash -// ClassAtom - ClassAtom ClassRanges -// -// NonemptyClassRangesNoDash :: -// ClassAtom -// ClassAtomNoDash NonemptyClassRangesNoDash -// ClassAtomNoDash - ClassAtom ClassRanges -// -// ClassAtom :: -// - -// ClassAtomNoDash -// -// ClassAtomNoDash :: -// SourceCharacter but not one of \ or ] or - -// \ ClassEscape -// -// ClassEscape :: -// DecimalEscape -// b -// CharacterEscape -// CharacterClassEscape - -(function() { - - function parse(str, flags) { - function addRaw(node) { - node.raw = str.substring(node.range[0], node.range[1]); - return node; - } - - function updateRawStart(node, start) { - node.range[0] = start; - return addRaw(node); - } - - function createAnchor(kind, rawLength) { - return addRaw({ - type: 'anchor', - kind: kind, - range: [ - pos - rawLength, - pos - ] - }); - } - - function createValue(kind, codePoint, from, to) { - return addRaw({ - type: 'value', - kind: kind, - codePoint: codePoint, - range: [from, to] - }); - } - - function createEscaped(kind, codePoint, value, fromOffset) { - fromOffset = fromOffset || 0; - return createValue(kind, codePoint, pos - (value.length + fromOffset), pos); - } - - function createCharacter(matches) { - var _char = matches[0]; - var first = _char.charCodeAt(0); - if (hasUnicodeFlag) { - var second; - if (_char.length === 1 && first >= 0xD800 && first <= 0xDBFF) { - second = lookahead().charCodeAt(0); - if (second >= 0xDC00 && second <= 0xDFFF) { - // Unicode surrogate pair - pos++; - return createValue( - 'symbol', - (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000, - pos - 2, pos); - } - } - } - return createValue('symbol', first, pos - 1, pos); - } - - function createDisjunction(alternatives, from, to) { - return addRaw({ - type: 'disjunction', - body: alternatives, - range: [ - from, - to - ] - }); - } - - function createDot() { - return addRaw({ - type: 'dot', - range: [ - pos - 1, - pos - ] - }); - } - - function createCharacterClassEscape(value) { - return addRaw({ - type: 'characterClassEscape', - value: value, - range: [ - pos - 2, - pos - ] - }); - } - - function createReference(matchIndex) { - return addRaw({ - type: 'reference', - matchIndex: parseInt(matchIndex, 10), - range: [ - pos - 1 - matchIndex.length, - pos - ] - }); - } - - function createGroup(behavior, disjunction, from, to) { - return addRaw({ - type: 'group', - behavior: behavior, - body: disjunction, - range: [ - from, - to - ] - }); - } - - function createQuantifier(min, max, from, to) { - if (to == null) { - from = pos - 1; - to = pos; - } - - return addRaw({ - type: 'quantifier', - min: min, - max: max, - greedy: true, - body: null, // set later on - range: [ - from, - to - ] - }); - } - - function createAlternative(terms, from, to) { - return addRaw({ - type: 'alternative', - body: terms, - range: [ - from, - to - ] - }); - } - - function createCharacterClass(classRanges, negative, from, to) { - return addRaw({ - type: 'characterClass', - body: classRanges, - negative: negative, - range: [ - from, - to - ] - }); - } - - function createClassRange(min, max, from, to) { - // See 15.10.2.15: - if (min.codePoint > max.codePoint) { - bail('invalid range in character class', min.raw + '-' + max.raw, from, to); - } - - return addRaw({ - type: 'characterClassRange', - min: min, - max: max, - range: [ - from, - to - ] - }); - } - - function flattenBody(body) { - if (body.type === 'alternative') { - return body.body; - } else { - return [body]; - } - } - - function isEmpty(obj) { - return obj.type === 'empty'; - } - - function incr(amount) { - amount = (amount || 1); - var res = str.substring(pos, pos + amount); - pos += (amount || 1); - return res; - } - - function skip(value) { - if (!match(value)) { - bail('character', value); - } - } - - function match(value) { - if (str.indexOf(value, pos) === pos) { - return incr(value.length); - } - } - - function lookahead() { - return str[pos]; - } - - function current(value) { - return str.indexOf(value, pos) === pos; - } - - function next(value) { - return str[pos + 1] === value; - } - - function matchReg(regExp) { - var subStr = str.substring(pos); - var res = subStr.match(regExp); - if (res) { - res.range = []; - res.range[0] = pos; - incr(res[0].length); - res.range[1] = pos; - } - return res; - } - - function parseDisjunction() { - // Disjunction :: - // Alternative - // Alternative | Disjunction - var res = [], from = pos; - res.push(parseAlternative()); - - while (match('|')) { - res.push(parseAlternative()); - } - - if (res.length === 1) { - return res[0]; - } - - return createDisjunction(res, from, pos); - } - - function parseAlternative() { - var res = [], from = pos; - var term; - - // Alternative :: - // [empty] - // Alternative Term - while (term = parseTerm()) { - res.push(term); - } - - if (res.length === 1) { - return res[0]; - } - - return createAlternative(res, from, pos); - } - - function parseTerm() { - // Term :: - // Anchor - // Atom - // Atom Quantifier - - if (pos >= str.length || current('|') || current(')')) { - return null; /* Means: The term is empty */ - } - - var anchor = parseAnchor(); - - if (anchor) { - return anchor; - } - - var atom = parseAtom(); - if (!atom) { - bail('Expected atom'); - } - var quantifier = parseQuantifier() || false; - if (quantifier) { - quantifier.body = flattenBody(atom); - // The quantifier contains the atom. Therefore, the beginning of the - // quantifier range is given by the beginning of the atom. - updateRawStart(quantifier, atom.range[0]); - return quantifier; - } - return atom; - } - - function parseGroup(matchA, typeA, matchB, typeB) { - var type = null, from = pos; - - if (match(matchA)) { - type = typeA; - } else if (match(matchB)) { - type = typeB; - } else { - return false; - } - - var body = parseDisjunction(); - if (!body) { - bail('Expected disjunction'); - } - skip(')'); - var group = createGroup(type, flattenBody(body), from, pos); - - if (type == 'normal') { - // Keep track of the number of closed groups. This is required for - // parseDecimalEscape(). In case the string is parsed a second time the - // value already holds the total count and no incrementation is required. - if (firstIteration) { - closedCaptureCounter++; - } - } - return group; - } - - function parseAnchor() { - // Anchor :: - // ^ - // $ - // \ b - // \ B - // ( ? = Disjunction ) - // ( ? ! Disjunction ) - var res, from = pos; - - if (match('^')) { - return createAnchor('start', 1 /* rawLength */); - } else if (match('$')) { - return createAnchor('end', 1 /* rawLength */); - } else if (match('\\b')) { - return createAnchor('boundary', 2 /* rawLength */); - } else if (match('\\B')) { - return createAnchor('not-boundary', 2 /* rawLength */); - } else { - return parseGroup('(?=', 'lookahead', '(?!', 'negativeLookahead'); - } - } - - function parseQuantifier() { - // Quantifier :: - // QuantifierPrefix - // QuantifierPrefix ? - // - // QuantifierPrefix :: - // * - // + - // ? - // { DecimalDigits } - // { DecimalDigits , } - // { DecimalDigits , DecimalDigits } - - var res, from = pos; - var quantifier; - var min, max; - - if (match('*')) { - quantifier = createQuantifier(0); - } - else if (match('+')) { - quantifier = createQuantifier(1); - } - else if (match('?')) { - quantifier = createQuantifier(0, 1); - } - else if (res = matchReg(/^\{([0-9]+)\}/)) { - min = parseInt(res[1], 10); - quantifier = createQuantifier(min, min, res.range[0], res.range[1]); - } - else if (res = matchReg(/^\{([0-9]+),\}/)) { - min = parseInt(res[1], 10); - quantifier = createQuantifier(min, undefined, res.range[0], res.range[1]); - } - else if (res = matchReg(/^\{([0-9]+),([0-9]+)\}/)) { - min = parseInt(res[1], 10); - max = parseInt(res[2], 10); - if (min > max) { - bail('numbers out of order in {} quantifier', '', from, pos); - } - quantifier = createQuantifier(min, max, res.range[0], res.range[1]); - } - - if (quantifier) { - if (match('?')) { - quantifier.greedy = false; - quantifier.range[1] += 1; - } - } - - return quantifier; - } - - function parseAtom() { - // Atom :: - // PatternCharacter - // . - // \ AtomEscape - // CharacterClass - // ( Disjunction ) - // ( ? : Disjunction ) - - var res; - - // jviereck: allow ']', '}' here as well to be compatible with browser's - // implementations: ']'.match(/]/); - // if (res = matchReg(/^[^^$\\.*+?()[\]{}|]/)) { - if (res = matchReg(/^[^^$\\.*+?(){[|]/)) { - // PatternCharacter - return createCharacter(res); - } - else if (match('.')) { - // . - return createDot(); - } - else if (match('\\')) { - // \ AtomEscape - res = parseAtomEscape(); - if (!res) { - bail('atomEscape'); - } - return res; - } - else if (res = parseCharacterClass()) { - return res; - } - else { - // ( Disjunction ) - // ( ? : Disjunction ) - return parseGroup('(?:', 'ignore', '(', 'normal'); - } - } - - function parseUnicodeSurrogatePairEscape(firstEscape) { - if (hasUnicodeFlag) { - var first, second; - if (firstEscape.kind == 'unicodeEscape' && - (first = firstEscape.codePoint) >= 0xD800 && first <= 0xDBFF && - current('\\') && next('u') ) { - var prevPos = pos; - pos++; - var secondEscape = parseClassEscape(); - if (secondEscape.kind == 'unicodeEscape' && - (second = secondEscape.codePoint) >= 0xDC00 && second <= 0xDFFF) { - // Unicode surrogate pair - firstEscape.range[1] = secondEscape.range[1]; - firstEscape.codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - firstEscape.type = 'value'; - firstEscape.kind = 'unicodeCodePointEscape'; - addRaw(firstEscape); - } - else { - pos = prevPos; - } - } - } - return firstEscape; - } - - function parseClassEscape() { - return parseAtomEscape(true); - } - - function parseAtomEscape(insideCharacterClass) { - // AtomEscape :: - // DecimalEscape - // CharacterEscape - // CharacterClassEscape - - var res, from = pos; - - res = parseDecimalEscape(); - if (res) { - return res; - } - - // For ClassEscape - if (insideCharacterClass) { - if (match('b')) { - // 15.10.2.19 - // The production ClassEscape :: b evaluates by returning the - // CharSet containing the one character <BS> (Unicode value 0008). - return createEscaped('singleEscape', 0x0008, '\\b'); - } else if (match('B')) { - bail('\\B not possible inside of CharacterClass', '', from); - } - } - - res = parseCharacterEscape(); - - return res; - } - - - function parseDecimalEscape() { - // DecimalEscape :: - // DecimalIntegerLiteral [lookahead ∉ DecimalDigit] - // CharacterClassEscape :: one of d D s S w W - - var res, match; - - if (res = matchReg(/^(?!0)\d+/)) { - match = res[0]; - var refIdx = parseInt(res[0], 10); - if (refIdx <= closedCaptureCounter) { - // If the number is smaller than the normal-groups found so - // far, then it is a reference... - return createReference(res[0]); - } else { - // ... otherwise it needs to be interpreted as a octal (if the - // number is in an octal format). If it is NOT octal format, - // then the slash is ignored and the number is matched later - // as normal characters. - - // Recall the negative decision to decide if the input must be parsed - // a second time with the total normal-groups. - backrefDenied.push(refIdx); - - // Reset the position again, as maybe only parts of the previous - // matched numbers are actual octal numbers. E.g. in '019' only - // the '01' should be matched. - incr(-res[0].length); - if (res = matchReg(/^[0-7]{1,3}/)) { - return createEscaped('octal', parseInt(res[0], 8), res[0], 1); - } else { - // If we end up here, we have a case like /\91/. Then the - // first slash is to be ignored and the 9 & 1 to be treated - // like ordinary characters. Create a character for the - // first number only here - other number-characters - // (if available) will be matched later. - res = createCharacter(matchReg(/^[89]/)); - return updateRawStart(res, res.range[0] - 1); - } - } - } - // Only allow octal numbers in the following. All matched numbers start - // with a zero (if the do not, the previous if-branch is executed). - // If the number is not octal format and starts with zero (e.g. `091`) - // then only the zeros `0` is treated here and the `91` are ordinary - // characters. - // Example: - // /\091/.exec('\091')[0].length === 3 - else if (res = matchReg(/^[0-7]{1,3}/)) { - match = res[0]; - if (/^0{1,3}$/.test(match)) { - // If they are all zeros, then only take the first one. - return createEscaped('null', 0x0000, '0', match.length + 1); - } else { - return createEscaped('octal', parseInt(match, 8), match, 1); - } - } else if (res = matchReg(/^[dDsSwW]/)) { - return createCharacterClassEscape(res[0]); - } - return false; - } - - function parseCharacterEscape() { - // CharacterEscape :: - // ControlEscape - // c ControlLetter - // HexEscapeSequence - // UnicodeEscapeSequence - // IdentityEscape - - var res; - if (res = matchReg(/^[fnrtv]/)) { - // ControlEscape - var codePoint = 0; - switch (res[0]) { - case 't': codePoint = 0x009; break; - case 'n': codePoint = 0x00A; break; - case 'v': codePoint = 0x00B; break; - case 'f': codePoint = 0x00C; break; - case 'r': codePoint = 0x00D; break; - } - return createEscaped('singleEscape', codePoint, '\\' + res[0]); - } else if (res = matchReg(/^c([a-zA-Z])/)) { - // c ControlLetter - return createEscaped('controlLetter', res[1].charCodeAt(0) % 32, res[1], 2); - } else if (res = matchReg(/^x([0-9a-fA-F]{2})/)) { - // HexEscapeSequence - return createEscaped('hexadecimalEscape', parseInt(res[1], 16), res[1], 2); - } else if (res = matchReg(/^u([0-9a-fA-F]{4})/)) { - // UnicodeEscapeSequence - return parseUnicodeSurrogatePairEscape( - createEscaped('unicodeEscape', parseInt(res[1], 16), res[1], 2) - ); - } else if (hasUnicodeFlag && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) { - // RegExpUnicodeEscapeSequence (ES6 Unicode code point escape) - return createEscaped('unicodeCodePointEscape', parseInt(res[1], 16), res[1], 4); - } else { - // IdentityEscape - return parseIdentityEscape(); - } - } - - // Taken from the Esprima parser. - function isIdentifierPart(ch) { - // Generated by `tools/generate-identifier-regex.js`. - var NonAsciiIdentifierPart = new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'); - - return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) - (ch >= 65 && ch <= 90) || // A..Z - (ch >= 97 && ch <= 122) || // a..z - (ch >= 48 && ch <= 57) || // 0..9 - (ch === 92) || // \ (backslash) - ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch))); - } - - function parseIdentityEscape() { - // IdentityEscape :: - // SourceCharacter but not IdentifierPart - // <ZWJ> - // <ZWNJ> - - var ZWJ = '\u200C'; - var ZWNJ = '\u200D'; - - var tmp; - - if (!isIdentifierPart(lookahead())) { - tmp = incr(); - return createEscaped('identifier', tmp.charCodeAt(0), tmp, 1); - } - - if (match(ZWJ)) { - // <ZWJ> - return createEscaped('identifier', 0x200C, ZWJ); - } else if (match(ZWNJ)) { - // <ZWNJ> - return createEscaped('identifier', 0x200D, ZWNJ); - } - - return null; - } - - function parseCharacterClass() { - // CharacterClass :: - // [ [lookahead ∉ {^}] ClassRanges ] - // [ ^ ClassRanges ] - - var res, from = pos; - if (res = matchReg(/^\[\^/)) { - res = parseClassRanges(); - skip(']'); - return createCharacterClass(res, true, from, pos); - } else if (match('[')) { - res = parseClassRanges(); - skip(']'); - return createCharacterClass(res, false, from, pos); - } - - return null; - } - - function parseClassRanges() { - // ClassRanges :: - // [empty] - // NonemptyClassRanges - - var res; - if (current(']')) { - // Empty array means nothing insinde of the ClassRange. - return []; - } else { - res = parseNonemptyClassRanges(); - if (!res) { - bail('nonEmptyClassRanges'); - } - return res; - } - } - - function parseHelperClassRanges(atom) { - var from, to, res; - if (current('-') && !next(']')) { - // ClassAtom - ClassAtom ClassRanges - skip('-'); - - res = parseClassAtom(); - if (!res) { - bail('classAtom'); - } - to = pos; - var classRanges = parseClassRanges(); - if (!classRanges) { - bail('classRanges'); - } - from = atom.range[0]; - if (classRanges.type === 'empty') { - return [createClassRange(atom, res, from, to)]; - } - return [createClassRange(atom, res, from, to)].concat(classRanges); - } - - res = parseNonemptyClassRangesNoDash(); - if (!res) { - bail('nonEmptyClassRangesNoDash'); - } - - return [atom].concat(res); - } - - function parseNonemptyClassRanges() { - // NonemptyClassRanges :: - // ClassAtom - // ClassAtom NonemptyClassRangesNoDash - // ClassAtom - ClassAtom ClassRanges - - var atom = parseClassAtom(); - if (!atom) { - bail('classAtom'); - } - - if (current(']')) { - // ClassAtom - return [atom]; - } - - // ClassAtom NonemptyClassRangesNoDash - // ClassAtom - ClassAtom ClassRanges - return parseHelperClassRanges(atom); - } - - function parseNonemptyClassRangesNoDash() { - // NonemptyClassRangesNoDash :: - // ClassAtom - // ClassAtomNoDash NonemptyClassRangesNoDash - // ClassAtomNoDash - ClassAtom ClassRanges - - var res = parseClassAtom(); - if (!res) { - bail('classAtom'); - } - if (current(']')) { - // ClassAtom - return res; - } - - // ClassAtomNoDash NonemptyClassRangesNoDash - // ClassAtomNoDash - ClassAtom ClassRanges - return parseHelperClassRanges(res); - } - - function parseClassAtom() { - // ClassAtom :: - // - - // ClassAtomNoDash - if (match('-')) { - return createCharacter('-'); - } else { - return parseClassAtomNoDash(); - } - } - - function parseClassAtomNoDash() { - // ClassAtomNoDash :: - // SourceCharacter but not one of \ or ] or - - // \ ClassEscape - - var res; - if (res = matchReg(/^[^\\\]-]/)) { - return createCharacter(res[0]); - } else if (match('\\')) { - res = parseClassEscape(); - if (!res) { - bail('classEscape'); - } - - return parseUnicodeSurrogatePairEscape(res); - } - } - - function bail(message, details, from, to) { - from = from == null ? pos : from; - to = to == null ? from : to; - - var contextStart = Math.max(0, from - 10); - var contextEnd = Math.min(to + 10, str.length); - - // Output a bit of context and a line pointing to where our error is. - // - // We are assuming that there are no actual newlines in the content as this is a regular expression. - var context = ' ' + str.substring(contextStart, contextEnd); - var pointer = ' ' + new Array(from - contextStart + 1).join(' ') + '^'; - - throw SyntaxError(message + ' at position ' + from + (details ? ': ' + details : '') + '\n' + context + '\n' + pointer); - } - - var backrefDenied = []; - var closedCaptureCounter = 0; - var firstIteration = true; - var hasUnicodeFlag = (flags || "").indexOf("u") !== -1; - var pos = 0; - - // Convert the input to a string and treat the empty string special. - str = String(str); - if (str === '') { - str = '(?:)'; - } - - var result = parseDisjunction(); - - if (result.range[1] !== str.length) { - bail('Could not parse entire input - got stuck', '', result.range[1]); - } - - // The spec requires to interpret the `\2` in `/\2()()/` as backreference. - // As the parser collects the number of capture groups as the string is - // parsed it is impossible to make these decisions at the point when the - // `\2` is handled. In case the local decision turns out to be wrong after - // the parsing has finished, the input string is parsed a second time with - // the total number of capture groups set. - // - // SEE: https://github.com/jviereck/regjsparser/issues/70 - for (var i = 0; i < backrefDenied.length; i++) { - if (backrefDenied[i] <= closedCaptureCounter) { - // Parse the input a second time. - pos = 0; - firstIteration = false; - return parseDisjunction(); - } - } - - return result; - } - - var regjsparser = { - parse: parse - }; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = regjsparser; - } else { - window.regjsparser = regjsparser; - } - -}()); - -},{}],591:[function(_dereq_,module,exports){ -var generate = _dereq_(589).generate; -var parse = _dereq_(590).parse; -var regenerate = _dereq_(588); -var iuMappings = _dereq_(587); -var ESCAPE_SETS = _dereq_(586); - -function getCharacterClassEscapeSet(character) { - if (unicode) { - if (ignoreCase) { - return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]; - } - return ESCAPE_SETS.UNICODE[character]; + module.exports = cloneDeep; + +/***/ }), +/* 566 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseClone = __webpack_require__(160); + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_SYMBOLS_FLAG = 4; + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } - return ESCAPE_SETS.REGULAR[character]; -} -var object = {}; -var hasOwnProperty = object.hasOwnProperty; -function has(object, property) { - return hasOwnProperty.call(object, property); -} + module.exports = cloneDeepWith; -// Prepare a Regenerate set containing all code points, used for negative -// character classes (if any). -var UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF); -// Without the `u` flag, the range stops at 0xFFFF. -// https://mths.be/es6#sec-pattern-semantics -var BMP_SET = regenerate().addRange(0x0, 0xFFFF); +/***/ }), +/* 567 */ +/***/ (function(module, exports) { -// Prepare a Regenerate set containing all code points that are supposed to be -// matched by `/./u`. https://mths.be/es6#sec-atom -var DOT_SET_UNICODE = UNICODE_SET.clone() // all Unicode code points - .remove( - // minus `LineTerminator`s (https://mths.be/es6#sec-line-terminators): - 0x000A, // Line Feed <LF> - 0x000D, // Carriage Return <CR> - 0x2028, // Line Separator <LS> - 0x2029 // Paragraph Separator <PS> - ); -// Prepare a Regenerate set containing all code points that are supposed to be -// matched by `/./` (only BMP code points). -var DOT_SET = DOT_SET_UNICODE.clone() - .intersection(BMP_SET); + "use strict"; -// Add a range of code points + any case-folded code points in that range to a -// set. -regenerate.prototype.iuAddRange = function(min, max) { - var $this = this; - do { - var folded = caseFold(min); - if (folded) { - $this.add(folded); - } - } while (++min <= max); - return $this; -}; - -function assign(target, source) { - for (var key in source) { - // Note: `hasOwnProperty` is not needed here. - target[key] = source[key]; + /** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ + function constant(value) { + return function () { + return value; + }; } -} -function update(item, pattern) { - // TODO: Test if memoizing `pattern` here is worth the effort. - if (!pattern) { - return; - } - var tree = parse(pattern, ''); - switch (tree.type) { - case 'characterClass': - case 'group': - case 'value': - // No wrapping needed. - break; - default: - // Wrap the pattern in a non-capturing group. - tree = wrap(tree, pattern); - } - assign(item, tree); -} + module.exports = constant; -function wrap(tree, pattern) { - // Wrap the pattern in a non-capturing group. - return { - 'type': 'group', - 'behavior': 'ignore', - 'body': [tree], - 'raw': '(?:' + pattern + ')' +/***/ }), +/* 568 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toString = __webpack_require__(114); + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ + function escapeRegExp(string) { + string = toString(string); + return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string; + } + + module.exports = escapeRegExp; + +/***/ }), +/* 569 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(563); + +/***/ }), +/* 570 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var createFind = __webpack_require__(253), + findIndex = __webpack_require__(571); + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + module.exports = find; + +/***/ }), +/* 571 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseFindIndex = __webpack_require__(161), + baseIteratee = __webpack_require__(59), + toInteger = __webpack_require__(47); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max; + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index); + } + + module.exports = findIndex; + +/***/ }), +/* 572 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var createFind = __webpack_require__(253), + findLastIndex = __webpack_require__(573); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + module.exports = findLast; + +/***/ }), +/* 573 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseFindIndex = __webpack_require__(161), + baseIteratee = __webpack_require__(59), + toInteger = __webpack_require__(47); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max, + nativeMin = Math.min; + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index, true); + } + + module.exports = findLastIndex; + +/***/ }), +/* 574 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGet = __webpack_require__(244); + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + module.exports = get; + +/***/ }), +/* 575 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseHasIn = __webpack_require__(482), + hasPath = __webpack_require__(260); + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + module.exports = hasIn; + +/***/ }), +/* 576 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isArrayLike = __webpack_require__(24), + isObjectLike = __webpack_require__(25); + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + module.exports = isArrayLikeObject; + +/***/ }), +/* 577 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toInteger = __webpack_require__(47); + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + module.exports = isInteger; + +/***/ }), +/* 578 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGetTag = __webpack_require__(29), + isArray = __webpack_require__(6), + isObjectLike = __webpack_require__(25); + + /** `Object#toString` result references. */ + var stringTag = '[object String]'; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; + } + + module.exports = isString; + +/***/ }), +/* 579 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var arrayMap = __webpack_require__(58), + baseIteratee = __webpack_require__(59), + baseMap = __webpack_require__(247), + isArray = __webpack_require__(6); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, baseIteratee(iteratee, 3)); + } + + module.exports = map; + +/***/ }), +/* 580 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var MapCache = __webpack_require__(156); + + /** Error message constants. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || resolver != null && typeof resolver != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function memoized() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache)(); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + module.exports = memoize; + +/***/ }), +/* 581 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseMerge = __webpack_require__(495), + createAssigner = __webpack_require__(103); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined`, merging is handled by the + * method instead. The `customizer` is invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function (object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + module.exports = mergeWith; + +/***/ }), +/* 582 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ + function noop() { + // No operation performed. + } + + module.exports = noop; + +/***/ }), +/* 583 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseProperty = __webpack_require__(498), + basePropertyDeep = __webpack_require__(499), + isKey = __webpack_require__(169), + toKey = __webpack_require__(108); + + /** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ + function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); + } + + module.exports = property; + +/***/ }), +/* 584 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var basePullAll = __webpack_require__(500); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return array && array.length && values && values.length ? basePullAll(array, values) : array; + } + + module.exports = pullAll; + +/***/ }), +/* 585 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseFlatten = __webpack_require__(479), + baseOrderBy = __webpack_require__(497), + baseRest = __webpack_require__(101), + isIterateeCall = __webpack_require__(168); + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + */ + var sortBy = baseRest(function (collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + module.exports = sortBy; + +/***/ }), +/* 586 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseClamp = __webpack_require__(476), + baseToString = __webpack_require__(248), + toInteger = __webpack_require__(47), + toString = __webpack_require__(114); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = toString(string); + position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + module.exports = startsWith; + +/***/ }), +/* 587 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ + function stubFalse() { + return false; + } + + module.exports = stubFalse; + +/***/ }), +/* 588 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toNumber = __webpack_require__(589); + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308; + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = value < 0 ? -1 : 1; + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + module.exports = toFinite; + +/***/ }), +/* 589 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(16), + isSymbol = __webpack_require__(60); + + /** Used as references for various `Number` constants. */ + var NAN = 0 / 0; + + /** Used to match leading and trailing whitespace. */ + var reTrim = /^\s+|\s+$/g; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Built-in method references without a dependency on `root`. */ + var freeParseInt = parseInt; + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? other + '' : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; + } + + module.exports = toNumber; + +/***/ }), +/* 590 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var copyObject = __webpack_require__(30), + keysIn = __webpack_require__(46); + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + + module.exports = toPlainObject; + +/***/ }), +/* 591 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseUniq = __webpack_require__(505); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return array && array.length ? baseUniq(array) : []; + } + + module.exports = uniq; + +/***/ }), +/* 592 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = minimatch; + minimatch.Minimatch = Minimatch; + + var path = { sep: '/' }; + try { + path = __webpack_require__(17); + } catch (er) {} + + var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + var expand = __webpack_require__(394); + + var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)' }, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } + + // any single thing other than / + // don't need to escape / when using new RegExp() + };var qmark = '[^/]'; + + // * => any number of characters + var star = qmark + '*?'; + + // ** when dots are allowed. Anything goes, except .. and . + // not (^ or / followed by one or two dots followed by $ or /), + // followed by anything, any number of times. + var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'; + + // not a ^ or / followed by a dot, + // followed by anything, any number of times. + var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'; + + // characters that need to be escaped in RegExp. + var reSpecials = charSet('().*{}+?[]^$\\!' + + // "abc" -> { a:true, b:true, c:true } + );function charSet(s) { + return s.split('').reduce(function (set, c) { + set[c] = true; + return set; + }, {}); + } + + // normalizes slashes. + var slashSplit = /\/+/; + + minimatch.filter = filter; + function filter(pattern, options) { + options = options || {}; + return function (p, i, list) { + return minimatch(p, pattern, options); + }; + } + + function ext(a, b) { + a = a || {}; + b = b || {}; + var t = {}; + Object.keys(b).forEach(function (k) { + t[k] = b[k]; + }); + Object.keys(a).forEach(function (k) { + t[k] = a[k]; + }); + return t; + } + + minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch; + + var orig = minimatch; + + var m = function minimatch(p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)); + }; + + m.Minimatch = function Minimatch(pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)); + }; + + return m; }; -} -function caseFold(codePoint) { - return has(iuMappings, codePoint) ? iuMappings[codePoint] : false; -} + Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch; + return minimatch.defaults(def).Minimatch; + }; -var ignoreCase = false; -var unicode = false; -function processCharacterClass(characterClassItem) { - var set = regenerate(); - var body = characterClassItem.body.forEach(function(item) { - switch (item.type) { + function minimatch(p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false; + } + + // "" only matches "" + if (pattern.trim() === '') return p === ''; + + return new Minimatch(pattern, options).match(p); + } + + function Minimatch(pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options); + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; + pattern = pattern.trim + + // windows support: need to use /, not \ + ();if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/'); + } + + this.options = options; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; + + // make the set of regexps etc. + this.make(); + } + + Minimatch.prototype.debug = function () {}; + + Minimatch.prototype.make = make; + function make() { + // don't do it more than once. + if (this._made) return; + + var pattern = this.pattern; + var options = this.options; + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true; + return; + } + if (!pattern) { + this.empty = true; + return; + } + + // step 1: figure out negation, etc. + this.parseNegate + + // step 2: expand braces + ();var set = this.globSet = this.braceExpand(); + + if (options.debug) this.debug = console.error; + + this.debug(this.pattern, set + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + );set = this.globParts = set.map(function (s) { + return s.split(slashSplit); + }); + + this.debug(this.pattern, set + + // glob --> regexps + );set = set.map(function (s, si, set) { + return s.map(this.parse, this); + }, this); + + this.debug(this.pattern, set + + // filter out everything that didn't compile properly. + );set = set.filter(function (s) { + return s.indexOf(false) === -1; + }); + + this.debug(this.pattern, set); + + this.set = set; + } + + Minimatch.prototype.parseNegate = parseNegate; + function parseNegate() { + var pattern = this.pattern; + var negate = false; + var options = this.options; + var negateOffset = 0; + + if (options.nonegate) return; + + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === '!'; i++) { + negate = !negate; + negateOffset++; + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset); + this.negate = negate; + } + + // Brace expansion: + // a{b,c}d -> abd acd + // a{b,}c -> abc ac + // a{0..3}d -> a0d a1d a2d a3d + // a{b,c{d,e}f}g -> abg acdfg acefg + // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg + // + // Invalid sets are not expanded. + // a{2..}b -> a{2..}b + // a{b}c -> a{b}c + minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options); + }; + + Minimatch.prototype.braceExpand = braceExpand; + + function braceExpand(pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options; + } else { + options = {}; + } + } + + pattern = typeof pattern === 'undefined' ? this.pattern : pattern; + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern'); + } + + if (options.nobrace || !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern]; + } + + return expand(pattern); + } + + // parse a component of the expanded set. + // At this point, no pattern may contain "/" in it + // so we're going to return a 2d array, where each entry is the full + // pattern, split on '/', and then turned into a regular expression. + // A regexp is made at the end which joins each array with an + // escaped /, and another full one which joins each regexp with |. + // + // Following the lead of Bash 4.1, note that "**" only has special meaning + // when it is the *only* thing in a path portion. Otherwise, any series + // of * is equivalent to a single *. Globstar behavior is enabled by + // default, and can be disabled by setting options.noglobstar. + Minimatch.prototype.parse = parse; + var SUBPARSE = {}; + function parse(pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long'); + } + + var options = this.options; + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR; + if (pattern === '') return ''; + + var re = ''; + var hasMagic = !!options.nocase; + var escaping = false; + // ? => one single character + var patternListStack = []; + var negativeLists = []; + var stateChar; + var inClass = false; + var reClassStart = -1; + var classStart = -1; + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' : '(?!\\.)'; + var self = this; + + function clearStateChar() { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star; + hasMagic = true; + break; + case '?': + re += qmark; + hasMagic = true; + break; + default: + re += '\\' + stateChar; + break; + } + self.debug('clearStateChar %j %j', stateChar, re); + stateChar = false; + } + } + + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c + + // skip over any that are escaped. + );if (escaping && reSpecials[c]) { + re += '\\' + c; + escaping = false; + continue; + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false; + + case '\\': + clearStateChar(); + escaping = true; + continue; + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + );if (inClass) { + this.debug(' in class'); + if (c === '!' && i === classStart + 1) c = '^'; + re += c; + continue; + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar); + clearStateChar(); + stateChar = c; + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar(); + continue; + + case '(': + if (inClass) { + re += '('; + continue; + } + + if (!stateChar) { + re += '\\('; + continue; + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + } + // negation is (?:(?!js)[^/]*) + );re += stateChar === '!' ? '(?:(?!(?:' : '(?:'; + this.debug('plType %j %j', stateChar, re); + stateChar = false; + continue; + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)'; + continue; + } + + clearStateChar(); + hasMagic = true; + var pl = patternListStack.pop + // negation is (?:(?!js)[^/]*) + // The others are (?:<pattern>)<type> + ();re += pl.close; + if (pl.type === '!') { + negativeLists.push(pl); + } + pl.reEnd = re.length; + continue; + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|'; + escaping = false; + continue; + } + + clearStateChar(); + re += '|'; + continue; + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar(); + + if (inClass) { + re += '\\' + c; + continue; + } + + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c; + escaping = false; + continue; + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i); + try { + RegExp('[' + cs + ']'); + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'; + hasMagic = hasMagic || sp[1]; + inClass = false; + continue; + } + } + + // finish up the class. + hasMagic = true; + inClass = false; + re += c; + continue; + + default: + // swallow any state char that wasn't consumed + clearStateChar(); + + if (escaping) { + // no need + escaping = false; + } else if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\'; + } + + re += c; + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1); + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0]; + hasMagic = hasMagic || sp[1]; + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length); + this.debug('setting tail', re, pl + // maybe some even number of \, then maybe 1 \, followed by a | + );tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\'; + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|'; + }); + + this.debug('tail=%j\n %s', tail, tail, pl, re); + var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type; + + hasMagic = true; + re = re.slice(0, pl.reStart) + t + '\\(' + tail; + } + + // handle trailing things that only matter at the very end. + clearStateChar(); + if (escaping) { + // trailing \\ + re += '\\\\'; + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false; + switch (re.charAt(0)) { + case '.': + case '[': + case '(': + addPatternStart = true; + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n]; + + var nlBefore = re.slice(0, nl.reStart); + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re.slice(nl.reEnd); + + nlLast += nlAfter; + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1; + var cleanAfter = nlAfter; + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, ''); + } + nlAfter = cleanAfter; + + var dollar = ''; + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$'; + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re; + } + + if (addPatternStart) { + re = patternStart + re; + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern); + } + + var flags = options.nocase ? 'i' : ''; + try { + var regExp = new RegExp('^' + re + '$', flags); + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.'); + } + + regExp._glob = pattern; + regExp._src = re; + + return regExp; + } + + minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe(); + }; + + Minimatch.prototype.makeRe = makeRe; + function makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set; + + if (!set.length) { + this.regexp = false; + return this.regexp; + } + var options = this.options; + + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; + var flags = options.nocase ? 'i' : ''; + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return p === GLOBSTAR ? twoStar : typeof p === 'string' ? regExpEscape(p) : p._src; + }).join('\\\/'); + }).join('|' + + // must match entire pattern + // ending in a * or ** will make it less strict. + );re = '^(?:' + re + ')$'; + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$'; + + try { + this.regexp = new RegExp(re, flags); + } catch (ex) { + this.regexp = false; + } + return this.regexp; + } + + minimatch.match = function (list, pattern, options) { + options = options || {}; + var mm = new Minimatch(pattern, options); + list = list.filter(function (f) { + return mm.match(f); + }); + if (mm.options.nonull && !list.length) { + list.push(pattern); + } + return list; + }; + + Minimatch.prototype.match = match; + function match(f, partial) { + this.debug('match', f, this.pattern + // short-circuit in the case of busted things. + // comments, etc. + );if (this.comment) return false; + if (this.empty) return f === ''; + + if (f === '/' && partial) return true; + + var options = this.options; + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/'); + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit); + this.debug(this.pattern, 'split', f + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + );var set = this.set; + this.debug(this.pattern, 'set', set + + // Find the basename of the path by looking for the last non-empty segment + );var filename; + var i; + for (i = f.length - 1; i >= 0; i--) { + filename = f[i]; + if (filename) break; + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i]; + var file = f; + if (options.matchBase && pattern.length === 1) { + file = [filename]; + } + var hit = this.matchOne(file, pattern, partial); + if (hit) { + if (options.flipNegate) return true; + return !this.negate; + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false; + return this.negate; + } + + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options; + + this.debug('matchOne', { 'this': this, file: file, pattern: pattern }); + + this.debug('matchOne', file.length, pattern.length); + + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug('matchOne loop'); + var p = pattern[pi]; + var f = file[fi]; + + this.debug(pattern, p, f + + // should be impossible. + // some invalid regexp stuff in the set. + );if (p === false) return false; + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f] + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + );var fr = fi; + var pr = pi + 1; + if (pr === pl) { + this.debug('** at the end' + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + );for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || !options.dot && file[fi].charAt(0) === '.') return false; + } + return true; + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr]; + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee + + // XXX remove this slice. Just pass the start index. + );if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee + // found a match. + );return true; + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || !options.dot && swallowee.charAt(0) === '.') { + this.debug('dot detected!', file, fr, pattern, pr); + break; + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue'); + fr++; + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr); + if (fr === fl) return true; + } + return false; + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit; + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase(); + } else { + hit = f === p; + } + this.debug('string match', p, f, hit); + } else { + hit = f.match(p); + this.debug('pattern match', p, f, hit); + } + + if (!hit) return false; + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true; + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial; + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = fi === fl - 1 && file[fi] === ''; + return emptyFileEnd; + } + + // should be unreachable. + throw new Error('wtf?'); + }; + + // replace stuff like \* with * + function globUnescape(s) { + return s.replace(/\\(.)/g, '$1'); + } + + function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + } + +/***/ }), +/* 593 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Helpers. + */ + + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + var type = typeof val === 'undefined' ? 'undefined' : _typeof(val); + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; + } + +/***/ }), +/* 594 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = Number.isNaN || function (x) { + return x !== x; + }; + +/***/ }), +/* 595 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + function posix(path) { + return path.charAt(0) === '/'; + } + + function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); + } + + module.exports = process.platform === 'win32' ? win32 : posix; + module.exports.posix = posix; + module.exports.win32 = win32; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 596 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _keys = __webpack_require__(13); + + var _keys2 = _interopRequireDefault(_keys); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var hasOwn = Object.prototype.hasOwnProperty; + + // The hoist function takes a FunctionExpression or FunctionDeclaration + // and replaces any Declaration nodes in its body with assignments, then + // returns a VariableDeclaration containing just the names of the removed + // declarations. + /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + exports.hoist = function (funPath) { + t.assertFunction(funPath.node); + + var vars = {}; + + function varDeclToExpr(vdec, includeIdentifiers) { + t.assertVariableDeclaration(vdec); + // TODO assert.equal(vdec.kind, "var"); + var exprs = []; + + vdec.declarations.forEach(function (dec) { + // Note: We duplicate 'dec.id' here to ensure that the variable declaration IDs don't + // have the same 'loc' value, since that can make sourcemaps and retainLines behave poorly. + vars[dec.id.name] = t.identifier(dec.id.name); + + if (dec.init) { + exprs.push(t.assignmentExpression("=", dec.id, dec.init)); + } else if (includeIdentifiers) { + exprs.push(dec.id); + } + }); + + if (exprs.length === 0) return null; + + if (exprs.length === 1) return exprs[0]; + + return t.sequenceExpression(exprs); + } + + funPath.get("body").traverse({ + VariableDeclaration: { + exit: function exit(path) { + var expr = varDeclToExpr(path.node, false); + if (expr === null) { + path.remove(); + } else { + // We don't need to traverse this expression any further because + // there can't be any new declarations inside an expression. + path.replaceWith(t.expressionStatement(expr)); + } + + // Since the original node has been either removed or replaced, + // avoid traversing it any further. + path.skip(); + } + }, + + ForStatement: function ForStatement(path) { + var init = path.node.init; + if (t.isVariableDeclaration(init)) { + path.get("init").replaceWith(varDeclToExpr(init, false)); + } + }, + + ForXStatement: function ForXStatement(path) { + var left = path.get("left"); + if (left.isVariableDeclaration()) { + left.replaceWith(varDeclToExpr(left.node, true)); + } + }, + + FunctionDeclaration: function FunctionDeclaration(path) { + var node = path.node; + vars[node.id.name] = node.id; + + var assignment = t.expressionStatement(t.assignmentExpression("=", node.id, t.functionExpression(node.id, node.params, node.body, node.generator, node.expression))); + + if (path.parentPath.isBlockStatement()) { + // Insert the assignment form before the first statement in the + // enclosing block. + path.parentPath.unshiftContainer("body", assignment); + + // Remove the function declaration now that we've inserted the + // equivalent assignment form at the beginning of the block. + path.remove(); + } else { + // If the parent node is not a block statement, then we can just + // replace the declaration with the equivalent assignment form + // without worrying about hoisting it. + path.replaceWith(assignment); + } + + // Don't hoist variables out of inner functions. + path.skip(); + }, + + FunctionExpression: function FunctionExpression(path) { + // Don't descend into nested function expressions. + path.skip(); + } + }); + + var paramNames = {}; + funPath.get("params").forEach(function (paramPath) { + var param = paramPath.node; + if (t.isIdentifier(param)) { + paramNames[param.name] = param; + } else { + // Variables declared by destructuring parameter patterns will be + // harmlessly re-declared. + } + }); + + var declarations = []; + + (0, _keys2.default)(vars).forEach(function (name) { + if (!hasOwn.call(paramNames, name)) { + declarations.push(t.variableDeclarator(vars[name], null)); + } + }); + + if (declarations.length === 0) { + return null; // Be sure to handle this case! + } + + return t.variableDeclaration("var", declarations); + }; + +/***/ }), +/* 597 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function () { + return __webpack_require__(601); + }; + +/***/ }), +/* 598 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _assert = __webpack_require__(62); + + var _assert2 = _interopRequireDefault(_assert); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _util = __webpack_require__(116); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + function Entry() { + _assert2.default.ok(this instanceof Entry); + } /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + function FunctionEntry(returnLoc) { + Entry.call(this); + t.assertLiteral(returnLoc); + this.returnLoc = returnLoc; + } + + (0, _util.inherits)(FunctionEntry, Entry); + exports.FunctionEntry = FunctionEntry; + + function LoopEntry(breakLoc, continueLoc, label) { + Entry.call(this); + + t.assertLiteral(breakLoc); + t.assertLiteral(continueLoc); + + if (label) { + t.assertIdentifier(label); + } else { + label = null; + } + + this.breakLoc = breakLoc; + this.continueLoc = continueLoc; + this.label = label; + } + + (0, _util.inherits)(LoopEntry, Entry); + exports.LoopEntry = LoopEntry; + + function SwitchEntry(breakLoc) { + Entry.call(this); + t.assertLiteral(breakLoc); + this.breakLoc = breakLoc; + } + + (0, _util.inherits)(SwitchEntry, Entry); + exports.SwitchEntry = SwitchEntry; + + function TryEntry(firstLoc, catchEntry, finallyEntry) { + Entry.call(this); + + t.assertLiteral(firstLoc); + + if (catchEntry) { + _assert2.default.ok(catchEntry instanceof CatchEntry); + } else { + catchEntry = null; + } + + if (finallyEntry) { + _assert2.default.ok(finallyEntry instanceof FinallyEntry); + } else { + finallyEntry = null; + } + + // Have to have one or the other (or both). + _assert2.default.ok(catchEntry || finallyEntry); + + this.firstLoc = firstLoc; + this.catchEntry = catchEntry; + this.finallyEntry = finallyEntry; + } + + (0, _util.inherits)(TryEntry, Entry); + exports.TryEntry = TryEntry; + + function CatchEntry(firstLoc, paramId) { + Entry.call(this); + + t.assertLiteral(firstLoc); + t.assertIdentifier(paramId); + + this.firstLoc = firstLoc; + this.paramId = paramId; + } + + (0, _util.inherits)(CatchEntry, Entry); + exports.CatchEntry = CatchEntry; + + function FinallyEntry(firstLoc, afterLoc) { + Entry.call(this); + t.assertLiteral(firstLoc); + t.assertLiteral(afterLoc); + this.firstLoc = firstLoc; + this.afterLoc = afterLoc; + } + + (0, _util.inherits)(FinallyEntry, Entry); + exports.FinallyEntry = FinallyEntry; + + function LabeledEntry(breakLoc, label) { + Entry.call(this); + + t.assertLiteral(breakLoc); + t.assertIdentifier(label); + + this.breakLoc = breakLoc; + this.label = label; + } + + (0, _util.inherits)(LabeledEntry, Entry); + exports.LabeledEntry = LabeledEntry; + + function LeapManager(emitter) { + _assert2.default.ok(this instanceof LeapManager); + + var Emitter = __webpack_require__(278).Emitter; + _assert2.default.ok(emitter instanceof Emitter); + + this.emitter = emitter; + this.entryStack = [new FunctionEntry(emitter.finalLoc)]; + } + + var LMp = LeapManager.prototype; + exports.LeapManager = LeapManager; + + LMp.withEntry = function (entry, callback) { + _assert2.default.ok(entry instanceof Entry); + this.entryStack.push(entry); + try { + callback.call(this.emitter); + } finally { + var popped = this.entryStack.pop(); + _assert2.default.strictEqual(popped, entry); + } + }; + + LMp._findLeapLocation = function (property, label) { + for (var i = this.entryStack.length - 1; i >= 0; --i) { + var entry = this.entryStack[i]; + var loc = entry[property]; + if (loc) { + if (label) { + if (entry.label && entry.label.name === label.name) { + return loc; + } + } else if (entry instanceof LabeledEntry) { + // Ignore LabeledEntry entries unless we are actually breaking to + // a label. + } else { + return loc; + } + } + } + + return null; + }; + + LMp.getBreakLoc = function (label) { + return this._findLeapLocation("breakLoc", label); + }; + + LMp.getContinueLoc = function (label) { + return this._findLeapLocation("continueLoc", label); + }; + +/***/ }), +/* 599 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _assert = __webpack_require__(62); + + var _assert2 = _interopRequireDefault(_assert); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + var m = __webpack_require__(276).makeAccessor(); /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + var hasOwn = Object.prototype.hasOwnProperty; + + function makePredicate(propertyName, knownTypes) { + function onlyChildren(node) { + t.assertNode(node); + + // Assume no side effects until we find out otherwise. + var result = false; + + function check(child) { + if (result) { + // Do nothing. + } else if (Array.isArray(child)) { + child.some(check); + } else if (t.isNode(child)) { + _assert2.default.strictEqual(result, false); + result = predicate(child); + } + return result; + } + + var keys = t.VISITOR_KEYS[node.type]; + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var child = node[key]; + check(child); + } + } + + return result; + } + + function predicate(node) { + t.assertNode(node); + + var meta = m(node); + if (hasOwn.call(meta, propertyName)) return meta[propertyName]; + + // Certain types are "opaque," which means they have no side + // effects or leaps and we don't care about their subexpressions. + if (hasOwn.call(opaqueTypes, node.type)) return meta[propertyName] = false; + + if (hasOwn.call(knownTypes, node.type)) return meta[propertyName] = true; + + return meta[propertyName] = onlyChildren(node); + } + + predicate.onlyChildren = onlyChildren; + + return predicate; + } + + var opaqueTypes = { + FunctionExpression: true, + ArrowFunctionExpression: true + }; + + // These types potentially have side effects regardless of what side + // effects their subexpressions have. + var sideEffectTypes = { + CallExpression: true, // Anything could happen! + ForInStatement: true, // Modifies the key variable. + UnaryExpression: true, // Think delete. + BinaryExpression: true, // Might invoke .toString() or .valueOf(). + AssignmentExpression: true, // Side-effecting by definition. + UpdateExpression: true, // Updates are essentially assignments. + NewExpression: true // Similar to CallExpression. + }; + + // These types are the direct cause of all leaps in control flow. + var leapTypes = { + YieldExpression: true, + BreakStatement: true, + ContinueStatement: true, + ReturnStatement: true, + ThrowStatement: true + }; + + // All leap types are also side effect types. + for (var type in leapTypes) { + if (hasOwn.call(leapTypes, type)) { + sideEffectTypes[type] = leapTypes[type]; + } + } + + exports.hasSideEffects = makePredicate("hasSideEffects", sideEffectTypes); + exports.containsLeap = makePredicate("containsLeap", leapTypes); + +/***/ }), +/* 600 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + exports.default = replaceShorthandObjectMethod; + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + // this function converts a shorthand object generator method into a normal + // (non-shorthand) object property which is a generator function expression. for + // example, this: + // + // var foo = { + // *bar(baz) { return 5; } + // } + // + // should be replaced with: + // + // var foo = { + // bar: function*(baz) { return 5; } + // } + // + // to do this, it clones the parameter array and the body of the object generator + // method into a new FunctionExpression. + // + // this method can be passed any Function AST node path, and it will return + // either: + // a) the path that was passed in (iff the path did not need to be replaced) or + // b) the path of the new FunctionExpression that was created as a replacement + // (iff the path did need to be replaced) + // + // In either case, though, the caller can count on the fact that the return value + // is a Function AST node path. + // + // If this function is called with an AST node path that is not a Function (or with an + // argument that isn't an AST node path), it will throw an error. + function replaceShorthandObjectMethod(path) { + if (!path.node || !t.isFunction(path.node)) { + throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths."); + } + + // this function only replaces shorthand object methods (called ObjectMethod + // in Babel-speak). + if (!t.isObjectMethod(path.node)) { + return path; + } + + // this function only replaces generators. + if (!path.node.generator) { + return path; + } + + var parameters = path.node.params.map(function (param) { + return t.cloneDeep(param); + }); + + var functionExpression = t.functionExpression(null, // id + parameters, // params + t.cloneDeep(path.node.body), // body + path.node.generator, path.node.async); + + path.replaceWith(t.objectProperty(t.cloneDeep(path.node.key), // key + functionExpression, //value + path.node.computed, // computed + false // shorthand + )); + + // path now refers to the ObjectProperty AST node path, but we want to return a + // Function AST node path for the function expression we created. we know that + // the FunctionExpression we just created is the value of the ObjectProperty, + // so return the "value" path off of this path. + return path.get("value"); + } + +/***/ }), +/* 601 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _assert = __webpack_require__(62); + + var _assert2 = _interopRequireDefault(_assert); + + var _babelTypes = __webpack_require__(1); + + var t = _interopRequireWildcard(_babelTypes); + + var _hoist = __webpack_require__(596); + + var _emit = __webpack_require__(278); + + var _replaceShorthandObjectMethod = __webpack_require__(600); + + var _replaceShorthandObjectMethod2 = _interopRequireDefault(_replaceShorthandObjectMethod); + + var _util = __webpack_require__(279); + + var util = _interopRequireWildcard(_util); + + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {};if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + } + }newObj.default = obj;return newObj; + } + } + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + + /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + var getMarkInfo = __webpack_require__(276).makeAccessor(); + + exports.visitor = { + Function: { + exit: function exit(path, state) { + var node = path.node; + + if (node.generator) { + if (node.async) { + // Async generator + if (state.opts.asyncGenerators === false) return; + } else { + // Plain generator + if (state.opts.generators === false) return; + } + } else if (node.async) { + // Async function + if (state.opts.async === false) return; + } else { + // Not a generator or async function. + return; + } + + // if this is an ObjectMethod, we need to convert it to an ObjectProperty + path = (0, _replaceShorthandObjectMethod2.default)(path); + node = path.node; + + var contextId = path.scope.generateUidIdentifier("context"); + var argsId = path.scope.generateUidIdentifier("args"); + + path.ensureBlock(); + var bodyBlockPath = path.get("body"); + + if (node.async) { + bodyBlockPath.traverse(awaitVisitor); + } + + bodyBlockPath.traverse(functionSentVisitor, { + context: contextId + }); + + var outerBody = []; + var innerBody = []; + + bodyBlockPath.get("body").forEach(function (childPath) { + var node = childPath.node; + if (t.isExpressionStatement(node) && t.isStringLiteral(node.expression)) { + // Babylon represents directives like "use strict" as elements + // of a bodyBlockPath.node.directives array, but they could just + // as easily be represented (by other parsers) as traditional + // string-literal-valued expression statements, so we need to + // handle that here. (#248) + outerBody.push(node); + } else if (node && node._blockHoist != null) { + outerBody.push(node); + } else { + innerBody.push(node); + } + }); + + if (outerBody.length > 0) { + // Only replace the inner body if we actually hoisted any statements + // to the outer body. + bodyBlockPath.node.body = innerBody; + } + + var outerFnExpr = getOuterFnExpr(path); + // Note that getOuterFnExpr has the side-effect of ensuring that the + // function has a name (so node.id will always be an Identifier), even + // if a temporary name has to be synthesized. + t.assertIdentifier(node.id); + var innerFnId = t.identifier(node.id.name + "$"); + + // Turn all declarations into vars, and replace the original + // declarations with equivalent assignment expressions. + var vars = (0, _hoist.hoist)(path); + + var didRenameArguments = renameArguments(path, argsId); + if (didRenameArguments) { + vars = vars || t.variableDeclaration("var", []); + var argumentIdentifier = t.identifier("arguments"); + // we need to do this as otherwise arguments in arrow functions gets hoisted + argumentIdentifier._shadowedFunctionLiteral = path; + vars.declarations.push(t.variableDeclarator(argsId, argumentIdentifier)); + } + + var emitter = new _emit.Emitter(contextId); + emitter.explode(path.get("body")); + + if (vars && vars.declarations.length > 0) { + outerBody.push(vars); + } + + var wrapArgs = [emitter.getContextFunction(innerFnId), + // Async functions that are not generators don't care about the + // outer function because they don't need it to be marked and don't + // inherit from its .prototype. + node.generator ? outerFnExpr : t.nullLiteral(), t.thisExpression()]; + + var tryLocsList = emitter.getTryLocsList(); + if (tryLocsList) { + wrapArgs.push(tryLocsList); + } + + var wrapCall = t.callExpression(util.runtimeProperty(node.async ? "async" : "wrap"), wrapArgs); + + outerBody.push(t.returnStatement(wrapCall)); + node.body = t.blockStatement(outerBody); + + var oldDirectives = bodyBlockPath.node.directives; + if (oldDirectives) { + // Babylon represents directives like "use strict" as elements of + // a bodyBlockPath.node.directives array. (#248) + node.body.directives = oldDirectives; + } + + var wasGeneratorFunction = node.generator; + if (wasGeneratorFunction) { + node.generator = false; + } + + if (node.async) { + node.async = false; + } + + if (wasGeneratorFunction && t.isExpression(node)) { + path.replaceWith(t.callExpression(util.runtimeProperty("mark"), [node])); + } + + // Generators are processed in 'exit' handlers so that regenerator only has to run on + // an ES5 AST, but that means traversal will not pick up newly inserted references + // to things like 'regeneratorRuntime'. To avoid this, we explicitly requeue. + path.requeue(); + } + } + }; + + // Given a NodePath for a Function, return an Expression node that can be + // used to refer reliably to the function object from inside the function. + // This expression is essentially a replacement for arguments.callee, with + // the key advantage that it works in strict mode. + function getOuterFnExpr(funPath) { + var node = funPath.node; + t.assertFunction(node); + + if (!node.id) { + // Default-exported function declarations, and function expressions may not + // have a name to reference, so we explicitly add one. + node.id = funPath.scope.parent.generateUidIdentifier("callee"); + } + + if (node.generator && // Non-generator functions don't need to be marked. + t.isFunctionDeclaration(node)) { + var pp = funPath.findParent(function (path) { + return path.isProgram() || path.isBlockStatement(); + }); + + if (!pp) { + return node.id; + } + + var markDecl = getRuntimeMarkDecl(pp); + var markedArray = markDecl.declarations[0].id; + var funDeclIdArray = markDecl.declarations[0].init.callee.object; + t.assertArrayExpression(funDeclIdArray); + + var index = funDeclIdArray.elements.length; + funDeclIdArray.elements.push(node.id); + + return t.memberExpression(markedArray, t.numericLiteral(index), true); + } + + return node.id; + } + + function getRuntimeMarkDecl(blockPath) { + var block = blockPath.node; + _assert2.default.ok(Array.isArray(block.body)); + + var info = getMarkInfo(block); + if (info.decl) { + return info.decl; + } + + info.decl = t.variableDeclaration("var", [t.variableDeclarator(blockPath.scope.generateUidIdentifier("marked"), t.callExpression(t.memberExpression(t.arrayExpression([]), t.identifier("map"), false), [util.runtimeProperty("mark")]))]); + + blockPath.unshiftContainer("body", info.decl); + + return info.decl; + } + + function renameArguments(funcPath, argsId) { + var state = { + didRenameArguments: false, + argsId: argsId + }; + + funcPath.traverse(argumentsVisitor, state); + + // If the traversal replaced any arguments references, then we need to + // alias the outer function's arguments binding (be it the implicit + // arguments object or some other parameter or variable) to the variable + // named by argsId. + return state.didRenameArguments; + } + + var argumentsVisitor = { + "FunctionExpression|FunctionDeclaration": function FunctionExpressionFunctionDeclaration(path) { + path.skip(); + }, + + Identifier: function Identifier(path, state) { + if (path.node.name === "arguments" && util.isReference(path)) { + path.replaceWith(state.argsId); + state.didRenameArguments = true; + } + } + }; + + var functionSentVisitor = { + MetaProperty: function MetaProperty(path) { + var node = path.node; + + if (node.meta.name === "function" && node.property.name === "sent") { + path.replaceWith(t.memberExpression(this.context, t.identifier("_sent"))); + } + } + }; + + var awaitVisitor = { + Function: function Function(path) { + path.skip(); // Don't descend into nested function scopes. + }, + + AwaitExpression: function AwaitExpression(path) { + // Convert await expressions to yield expressions. + var argument = path.node.argument; + + // Transforming `await x` to `yield regeneratorRuntime.awrap(x)` + // causes the argument to be wrapped in such a way that the runtime + // can distinguish between awaited and merely yielded values. + path.replaceWith(t.yieldExpression(t.callExpression(util.runtimeProperty("awrap"), [argument]), false)); + } + }; + +/***/ }), +/* 602 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + // Generated by `/scripts/character-class-escape-sets.js`. Do not edit. + var regenerate = __webpack_require__(277); + + exports.REGULAR = { + 'd': regenerate().addRange(0x30, 0x39), + 'D': regenerate().addRange(0x0, 0x2F).addRange(0x3A, 0xFFFF), + 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF).addRange(0x9, 0xD).addRange(0x2000, 0x200A).addRange(0x2028, 0x2029), + 'S': regenerate().addRange(0x0, 0x8).addRange(0xE, 0x1F).addRange(0x21, 0x9F).addRange(0xA1, 0x167F).addRange(0x1681, 0x1FFF).addRange(0x200B, 0x2027).addRange(0x202A, 0x202E).addRange(0x2030, 0x205E).addRange(0x2060, 0x2FFF).addRange(0x3001, 0xFEFE).addRange(0xFF00, 0xFFFF), + 'w': regenerate(0x5F).addRange(0x30, 0x39).addRange(0x41, 0x5A).addRange(0x61, 0x7A), + 'W': regenerate(0x60).addRange(0x0, 0x2F).addRange(0x3A, 0x40).addRange(0x5B, 0x5E).addRange(0x7B, 0xFFFF) + }; + + exports.UNICODE = { + 'd': regenerate().addRange(0x30, 0x39), + 'D': regenerate().addRange(0x0, 0x2F).addRange(0x3A, 0x10FFFF), + 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF).addRange(0x9, 0xD).addRange(0x2000, 0x200A).addRange(0x2028, 0x2029), + 'S': regenerate().addRange(0x0, 0x8).addRange(0xE, 0x1F).addRange(0x21, 0x9F).addRange(0xA1, 0x167F).addRange(0x1681, 0x1FFF).addRange(0x200B, 0x2027).addRange(0x202A, 0x202E).addRange(0x2030, 0x205E).addRange(0x2060, 0x2FFF).addRange(0x3001, 0xFEFE).addRange(0xFF00, 0x10FFFF), + 'w': regenerate(0x5F).addRange(0x30, 0x39).addRange(0x41, 0x5A).addRange(0x61, 0x7A), + 'W': regenerate(0x60).addRange(0x0, 0x2F).addRange(0x3A, 0x40).addRange(0x5B, 0x5E).addRange(0x7B, 0x10FFFF) + }; + + exports.UNICODE_IGNORE_CASE = { + 'd': regenerate().addRange(0x30, 0x39), + 'D': regenerate().addRange(0x0, 0x2F).addRange(0x3A, 0x10FFFF), + 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF).addRange(0x9, 0xD).addRange(0x2000, 0x200A).addRange(0x2028, 0x2029), + 'S': regenerate().addRange(0x0, 0x8).addRange(0xE, 0x1F).addRange(0x21, 0x9F).addRange(0xA1, 0x167F).addRange(0x1681, 0x1FFF).addRange(0x200B, 0x2027).addRange(0x202A, 0x202E).addRange(0x2030, 0x205E).addRange(0x2060, 0x2FFF).addRange(0x3001, 0xFEFE).addRange(0xFF00, 0x10FFFF), + 'w': regenerate(0x5F, 0x17F, 0x212A).addRange(0x30, 0x39).addRange(0x41, 0x5A).addRange(0x61, 0x7A), + 'W': regenerate(0x4B, 0x53, 0x60).addRange(0x0, 0x2F).addRange(0x3A, 0x40).addRange(0x5B, 0x5E).addRange(0x7B, 0x10FFFF) + }; + +/***/ }), +/* 603 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var generate = __webpack_require__(604).generate; + var parse = __webpack_require__(605).parse; + var regenerate = __webpack_require__(277); + var iuMappings = __webpack_require__(622); + var ESCAPE_SETS = __webpack_require__(602); + + function getCharacterClassEscapeSet(character) { + if (unicode) { + if (ignoreCase) { + return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]; + } + return ESCAPE_SETS.UNICODE[character]; + } + return ESCAPE_SETS.REGULAR[character]; + } + + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + function has(object, property) { + return hasOwnProperty.call(object, property); + } + + // Prepare a Regenerate set containing all code points, used for negative + // character classes (if any). + var UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF); + // Without the `u` flag, the range stops at 0xFFFF. + // https://mths.be/es6#sec-pattern-semantics + var BMP_SET = regenerate().addRange(0x0, 0xFFFF); + + // Prepare a Regenerate set containing all code points that are supposed to be + // matched by `/./u`. https://mths.be/es6#sec-atom + var DOT_SET_UNICODE = UNICODE_SET.clone // all Unicode code points + ().remove( + // minus `LineTerminator`s (https://mths.be/es6#sec-line-terminators): + 0x000A, // Line Feed <LF> + 0x000D, // Carriage Return <CR> + 0x2028, // Line Separator <LS> + 0x2029 // Paragraph Separator <PS> + ); + // Prepare a Regenerate set containing all code points that are supposed to be + // matched by `/./` (only BMP code points). + var DOT_SET = DOT_SET_UNICODE.clone().intersection(BMP_SET); + + // Add a range of code points + any case-folded code points in that range to a + // set. + regenerate.prototype.iuAddRange = function (min, max) { + var $this = this; + do { + var folded = caseFold(min); + if (folded) { + $this.add(folded); + } + } while (++min <= max); + return $this; + }; + + function assign(target, source) { + for (var key in source) { + // Note: `hasOwnProperty` is not needed here. + target[key] = source[key]; + } + } + + function update(item, pattern) { + // TODO: Test if memoizing `pattern` here is worth the effort. + if (!pattern) { + return; + } + var tree = parse(pattern, ''); + switch (tree.type) { + case 'characterClass': + case 'group': case 'value': - set.add(item.codePoint); + // No wrapping needed. + break; + default: + // Wrap the pattern in a non-capturing group. + tree = wrap(tree, pattern); + } + assign(item, tree); + } + + function wrap(tree, pattern) { + // Wrap the pattern in a non-capturing group. + return { + 'type': 'group', + 'behavior': 'ignore', + 'body': [tree], + 'raw': '(?:' + pattern + ')' + }; + } + + function caseFold(codePoint) { + return has(iuMappings, codePoint) ? iuMappings[codePoint] : false; + } + + var ignoreCase = false; + var unicode = false; + function processCharacterClass(characterClassItem) { + var set = regenerate(); + var body = characterClassItem.body.forEach(function (item) { + switch (item.type) { + case 'value': + set.add(item.codePoint); + if (ignoreCase && unicode) { + var folded = caseFold(item.codePoint); + if (folded) { + set.add(folded); + } + } + break; + case 'characterClassRange': + var min = item.min.codePoint; + var max = item.max.codePoint; + set.addRange(min, max); + if (ignoreCase && unicode) { + set.iuAddRange(min, max); + } + break; + case 'characterClassEscape': + set.add(getCharacterClassEscapeSet(item.value)); + break; + // The `default` clause is only here as a safeguard; it should never be + // reached. Code coverage tools should ignore it. + /* istanbul ignore next */ + default: + throw Error('Unknown term type: ' + item.type); + } + }); + if (characterClassItem.negative) { + set = (unicode ? UNICODE_SET : BMP_SET).clone().remove(set); + } + update(characterClassItem, set.toString()); + return characterClassItem; + } + + function processTerm(item) { + switch (item.type) { + case 'dot': + update(item, (unicode ? DOT_SET_UNICODE : DOT_SET).toString()); + break; + case 'characterClass': + item = processCharacterClass(item); + break; + case 'characterClassEscape': + update(item, getCharacterClassEscapeSet(item.value).toString()); + break; + case 'alternative': + case 'disjunction': + case 'group': + case 'quantifier': + item.body = item.body.map(processTerm); + break; + case 'value': + var codePoint = item.codePoint; + var set = regenerate(codePoint); if (ignoreCase && unicode) { - var folded = caseFold(item.codePoint); + var folded = caseFold(codePoint); if (folded) { set.add(folded); } } + update(item, set.toString()); break; - case 'characterClassRange': - var min = item.min.codePoint; - var max = item.max.codePoint; - set.addRange(min, max); - if (ignoreCase && unicode) { - set.iuAddRange(min, max); - } - break; - case 'characterClassEscape': - set.add(getCharacterClassEscapeSet(item.value)); + case 'anchor': + case 'empty': + case 'group': + case 'reference': + // Nothing to do here. break; // The `default` clause is only here as a safeguard; it should never be // reached. Code coverage tools should ignore it. @@ -58701,8723 +57686,5161 @@ function processCharacterClass(characterClassItem) { default: throw Error('Unknown term type: ' + item.type); } - }); - if (characterClassItem.negative) { - set = (unicode ? UNICODE_SET : BMP_SET).clone().remove(set); - } - update(characterClassItem, set.toString()); - return characterClassItem; -} + return item; + }; -function processTerm(item) { - switch (item.type) { - case 'dot': - update( - item, - (unicode ? DOT_SET_UNICODE : DOT_SET).toString() - ); - break; - case 'characterClass': - item = processCharacterClass(item); - break; - case 'characterClassEscape': - update( - item, - getCharacterClassEscapeSet(item.value).toString() - ); - break; - case 'alternative': - case 'disjunction': - case 'group': - case 'quantifier': - item.body = item.body.map(processTerm); - break; - case 'value': - var codePoint = item.codePoint; - var set = regenerate(codePoint); - if (ignoreCase && unicode) { - var folded = caseFold(codePoint); - if (folded) { - set.add(folded); - } - } - update(item, set.toString()); - break; - case 'anchor': - case 'empty': - case 'group': - case 'reference': - // Nothing to do here. - break; - // The `default` clause is only here as a safeguard; it should never be - // reached. Code coverage tools should ignore it. - /* istanbul ignore next */ - default: - throw Error('Unknown term type: ' + item.type); - } - return item; -}; + module.exports = function (pattern, flags) { + var tree = parse(pattern, flags); + ignoreCase = flags ? flags.indexOf('i') > -1 : false; + unicode = flags ? flags.indexOf('u') > -1 : false; + assign(tree, processTerm(tree)); + return generate(tree); + }; -module.exports = function(pattern, flags) { - var tree = parse(pattern, flags); - ignoreCase = flags ? flags.indexOf('i') > -1 : false; - unicode = flags ? flags.indexOf('u') > -1 : false; - assign(tree, processTerm(tree)); - return generate(tree); -}; +/***/ }), +/* 604 */ +/***/ (function(module, exports, __webpack_require__) { -},{"586":586,"587":587,"588":588,"589":589,"590":590}],592:[function(_dereq_,module,exports){ -'use strict'; -var isFinite = _dereq_(593); + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {'use strict'; -module.exports = function (str, n) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string as the first argument'); - } + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - if (n < 0 || !isFinite(n)) { - throw new TypeError('Expected a finite positive number'); - } + /*! + * RegJSGen + * Copyright 2014 Benjamin Tan <https://d10.github.io/> + * Available under MIT license <http://d10.mit-license.org/> + */ + ;(function () { + 'use strict'; - var ret = ''; + /** Used to determine if values are of the language type `Object` */ - do { - if (n & 1) { - ret += str; + var objectTypes = { + 'function': true, + 'object': true + }; + + /** Used as a reference to the global object */ + var root = objectTypes[typeof window === 'undefined' ? 'undefined' : _typeof(window)] && window || this; + + /** Backup possible global object */ + var oldRoot = root; + + /** Detect free variable `exports` */ + var freeExports = objectTypes[ false ? 'undefined' : _typeof(exports)] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[ false ? 'undefined' : _typeof(module)] && module && !module.nodeType && module; + + /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ + var freeGlobal = freeExports && freeModule && (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + /*! Based on https://mths.be/fromcodepoint v0.2.0 by @mathias */ + + var stringFromCharCode = String.fromCharCode; + var floor = Math.floor; + function fromCodePoint() { + var MAX_SIZE = 0x4000; + var codeUnits = []; + var highSurrogate; + var lowSurrogate; + var index = -1; + var length = arguments.length; + if (!length) { + return ''; + } + var result = ''; + while (++index < length) { + var codePoint = Number(arguments[index]); + if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` + codePoint < 0 || // not a valid Unicode code point + codePoint > 0x10FFFF || // not a valid Unicode code point + floor(codePoint) != codePoint // not an integer + ) { + throw RangeError('Invalid code point: ' + codePoint); + } + if (codePoint <= 0xFFFF) { + // BMP code point + codeUnits.push(codePoint); + } else { + // Astral code point; split in surrogate halves + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + codePoint -= 0x10000; + highSurrogate = (codePoint >> 10) + 0xD800; + lowSurrogate = codePoint % 0x400 + 0xDC00; + codeUnits.push(highSurrogate, lowSurrogate); + } + if (index + 1 == length || codeUnits.length > MAX_SIZE) { + result += stringFromCharCode.apply(null, codeUnits); + codeUnits.length = 0; + } + } + return result; + } + + function assertType(type, expected) { + if (expected.indexOf('|') == -1) { + if (type == expected) { + return; + } + + throw Error('Invalid node type: ' + type); + } + + expected = assertType.hasOwnProperty(expected) ? assertType[expected] : assertType[expected] = RegExp('^(?:' + expected + ')$'); + + if (expected.test(type)) { + return; + } + + throw Error('Invalid node type: ' + type); + } + + /*--------------------------------------------------------------------------*/ + + function generate(node) { + var type = node.type; + + if (generate.hasOwnProperty(type) && typeof generate[type] == 'function') { + return generate[type](node); + } + + throw Error('Invalid node type: ' + type); + } + + /*--------------------------------------------------------------------------*/ + + function generateAlternative(node) { + assertType(node.type, 'alternative'); + + var terms = node.body, + length = terms ? terms.length : 0; + + if (length == 1) { + return generateTerm(terms[0]); + } else { + var i = -1, + result = ''; + + while (++i < length) { + result += generateTerm(terms[i]); + } + + return result; + } + } + + function generateAnchor(node) { + assertType(node.type, 'anchor'); + + switch (node.kind) { + case 'start': + return '^'; + case 'end': + return '$'; + case 'boundary': + return '\\b'; + case 'not-boundary': + return '\\B'; + default: + throw Error('Invalid assertion'); + } + } + + function generateAtom(node) { + assertType(node.type, 'anchor|characterClass|characterClassEscape|dot|group|reference|value'); + + return generate(node); + } + + function generateCharacterClass(node) { + assertType(node.type, 'characterClass'); + + var classRanges = node.body, + length = classRanges ? classRanges.length : 0; + + var i = -1, + result = '['; + + if (node.negative) { + result += '^'; + } + + while (++i < length) { + result += generateClassAtom(classRanges[i]); + } + + result += ']'; + + return result; + } + + function generateCharacterClassEscape(node) { + assertType(node.type, 'characterClassEscape'); + + return '\\' + node.value; + } + + function generateCharacterClassRange(node) { + assertType(node.type, 'characterClassRange'); + + var min = node.min, + max = node.max; + + if (min.type == 'characterClassRange' || max.type == 'characterClassRange') { + throw Error('Invalid character class range'); + } + + return generateClassAtom(min) + '-' + generateClassAtom(max); + } + + function generateClassAtom(node) { + assertType(node.type, 'anchor|characterClassEscape|characterClassRange|dot|value'); + + return generate(node); + } + + function generateDisjunction(node) { + assertType(node.type, 'disjunction'); + + var body = node.body, + length = body ? body.length : 0; + + if (length == 0) { + throw Error('No body'); + } else if (length == 1) { + return generate(body[0]); + } else { + var i = -1, + result = ''; + + while (++i < length) { + if (i != 0) { + result += '|'; + } + result += generate(body[i]); + } + + return result; + } + } + + function generateDot(node) { + assertType(node.type, 'dot'); + + return '.'; + } + + function generateGroup(node) { + assertType(node.type, 'group'); + + var result = '('; + + switch (node.behavior) { + case 'normal': + break; + case 'ignore': + result += '?:'; + break; + case 'lookahead': + result += '?='; + break; + case 'negativeLookahead': + result += '?!'; + break; + default: + throw Error('Invalid behaviour: ' + node.behaviour); + } + + var body = node.body, + length = body ? body.length : 0; + + if (length == 1) { + result += generate(body[0]); + } else { + var i = -1; + + while (++i < length) { + result += generate(body[i]); + } + } + + result += ')'; + + return result; + } + + function generateQuantifier(node) { + assertType(node.type, 'quantifier'); + + var quantifier = '', + min = node.min, + max = node.max; + + switch (max) { + case undefined: + case null: + switch (min) { + case 0: + quantifier = '*'; + break; + case 1: + quantifier = '+'; + break; + default: + quantifier = '{' + min + ',}'; + break; + } + break; + default: + if (min == max) { + quantifier = '{' + min + '}'; + } else if (min == 0 && max == 1) { + quantifier = '?'; + } else { + quantifier = '{' + min + ',' + max + '}'; + } + break; + } + + if (!node.greedy) { + quantifier += '?'; + } + + return generateAtom(node.body[0]) + quantifier; + } + + function generateReference(node) { + assertType(node.type, 'reference'); + + return '\\' + node.matchIndex; + } + + function generateTerm(node) { + assertType(node.type, 'anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value'); + + return generate(node); + } + + function generateValue(node) { + assertType(node.type, 'value'); + + var kind = node.kind, + codePoint = node.codePoint; + + switch (kind) { + case 'controlLetter': + return '\\c' + fromCodePoint(codePoint + 64); + case 'hexadecimalEscape': + return '\\x' + ('00' + codePoint.toString(16).toUpperCase()).slice(-2); + case 'identifier': + return '\\' + fromCodePoint(codePoint); + case 'null': + return '\\' + codePoint; + case 'octal': + return '\\' + codePoint.toString(8); + case 'singleEscape': + switch (codePoint) { + case 0x0008: + return '\\b'; + case 0x009: + return '\\t'; + case 0x00A: + return '\\n'; + case 0x00B: + return '\\v'; + case 0x00C: + return '\\f'; + case 0x00D: + return '\\r'; + default: + throw Error('Invalid codepoint: ' + codePoint); + } + case 'symbol': + return fromCodePoint(codePoint); + case 'unicodeEscape': + return '\\u' + ('0000' + codePoint.toString(16).toUpperCase()).slice(-4); + case 'unicodeCodePointEscape': + return '\\u{' + codePoint.toString(16).toUpperCase() + '}'; + default: + throw Error('Unsupported node kind: ' + kind); + } + } + + /*--------------------------------------------------------------------------*/ + + generate.alternative = generateAlternative; + generate.anchor = generateAnchor; + generate.characterClass = generateCharacterClass; + generate.characterClassEscape = generateCharacterClassEscape; + generate.characterClassRange = generateCharacterClassRange; + generate.disjunction = generateDisjunction; + generate.dot = generateDot; + generate.group = generateGroup; + generate.quantifier = generateQuantifier; + generate.reference = generateReference; + generate.value = generateValue; + + /*--------------------------------------------------------------------------*/ + + // export regjsgen + // some AMD build optimizers, like r.js, check for condition patterns like the following: + if ("function" == 'function' && _typeof(__webpack_require__(48)) == 'object' && __webpack_require__(48)) { + // define as an anonymous module so, through path mapping, it can be aliased + !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { + return { + 'generate': generate + }; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + // check for `exports` after `define` in case a build optimizer adds an `exports` object + else if (freeExports && freeModule) { + // in Narwhal, Node.js, Rhino -require, or RingoJS + freeExports.generate = generate; + } + // in a browser or Rhino + else { + root.regjsgen = { + 'generate': generate + }; + } + }).call(undefined); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module), (function() { return this; }()))) + +/***/ }), +/* 605 */ +/***/ (function(module, exports) { + + 'use strict'; + + // regjsparser + // + // ================================================================== + // + // See ECMA-262 Standard: 15.10.1 + // + // NOTE: The ECMA-262 standard uses the term "Assertion" for /^/. Here the + // term "Anchor" is used. + // + // Pattern :: + // Disjunction + // + // Disjunction :: + // Alternative + // Alternative | Disjunction + // + // Alternative :: + // [empty] + // Alternative Term + // + // Term :: + // Anchor + // Atom + // Atom Quantifier + // + // Anchor :: + // ^ + // $ + // \ b + // \ B + // ( ? = Disjunction ) + // ( ? ! Disjunction ) + // + // Quantifier :: + // QuantifierPrefix + // QuantifierPrefix ? + // + // QuantifierPrefix :: + // * + // + + // ? + // { DecimalDigits } + // { DecimalDigits , } + // { DecimalDigits , DecimalDigits } + // + // Atom :: + // PatternCharacter + // . + // \ AtomEscape + // CharacterClass + // ( Disjunction ) + // ( ? : Disjunction ) + // + // PatternCharacter :: + // SourceCharacter but not any of: ^ $ \ . * + ? ( ) [ ] { } | + // + // AtomEscape :: + // DecimalEscape + // CharacterEscape + // CharacterClassEscape + // + // CharacterEscape[U] :: + // ControlEscape + // c ControlLetter + // HexEscapeSequence + // RegExpUnicodeEscapeSequence[?U] (ES6) + // IdentityEscape[?U] + // + // ControlEscape :: + // one of f n r t v + // ControlLetter :: + // one of + // a b c d e f g h i j k l m n o p q r s t u v w x y z + // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + // + // IdentityEscape :: + // SourceCharacter but not IdentifierPart + // <ZWJ> + // <ZWNJ> + // + // DecimalEscape :: + // DecimalIntegerLiteral [lookahead ∉ DecimalDigit] + // + // CharacterClassEscape :: + // one of d D s S w W + // + // CharacterClass :: + // [ [lookahead ∉ {^}] ClassRanges ] + // [ ^ ClassRanges ] + // + // ClassRanges :: + // [empty] + // NonemptyClassRanges + // + // NonemptyClassRanges :: + // ClassAtom + // ClassAtom NonemptyClassRangesNoDash + // ClassAtom - ClassAtom ClassRanges + // + // NonemptyClassRangesNoDash :: + // ClassAtom + // ClassAtomNoDash NonemptyClassRangesNoDash + // ClassAtomNoDash - ClassAtom ClassRanges + // + // ClassAtom :: + // - + // ClassAtomNoDash + // + // ClassAtomNoDash :: + // SourceCharacter but not one of \ or ] or - + // \ ClassEscape + // + // ClassEscape :: + // DecimalEscape + // b + // CharacterEscape + // CharacterClassEscape + + (function () { + + function parse(str, flags) { + function addRaw(node) { + node.raw = str.substring(node.range[0], node.range[1]); + return node; + } + + function updateRawStart(node, start) { + node.range[0] = start; + return addRaw(node); + } + + function createAnchor(kind, rawLength) { + return addRaw({ + type: 'anchor', + kind: kind, + range: [pos - rawLength, pos] + }); + } + + function createValue(kind, codePoint, from, to) { + return addRaw({ + type: 'value', + kind: kind, + codePoint: codePoint, + range: [from, to] + }); + } + + function createEscaped(kind, codePoint, value, fromOffset) { + fromOffset = fromOffset || 0; + return createValue(kind, codePoint, pos - (value.length + fromOffset), pos); + } + + function createCharacter(matches) { + var _char = matches[0]; + var first = _char.charCodeAt(0); + if (hasUnicodeFlag) { + var second; + if (_char.length === 1 && first >= 0xD800 && first <= 0xDBFF) { + second = lookahead().charCodeAt(0); + if (second >= 0xDC00 && second <= 0xDFFF) { + // Unicode surrogate pair + pos++; + return createValue('symbol', (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000, pos - 2, pos); + } + } + } + return createValue('symbol', first, pos - 1, pos); + } + + function createDisjunction(alternatives, from, to) { + return addRaw({ + type: 'disjunction', + body: alternatives, + range: [from, to] + }); + } + + function createDot() { + return addRaw({ + type: 'dot', + range: [pos - 1, pos] + }); + } + + function createCharacterClassEscape(value) { + return addRaw({ + type: 'characterClassEscape', + value: value, + range: [pos - 2, pos] + }); + } + + function createReference(matchIndex) { + return addRaw({ + type: 'reference', + matchIndex: parseInt(matchIndex, 10), + range: [pos - 1 - matchIndex.length, pos] + }); + } + + function createGroup(behavior, disjunction, from, to) { + return addRaw({ + type: 'group', + behavior: behavior, + body: disjunction, + range: [from, to] + }); + } + + function createQuantifier(min, max, from, to) { + if (to == null) { + from = pos - 1; + to = pos; + } + + return addRaw({ + type: 'quantifier', + min: min, + max: max, + greedy: true, + body: null, // set later on + range: [from, to] + }); + } + + function createAlternative(terms, from, to) { + return addRaw({ + type: 'alternative', + body: terms, + range: [from, to] + }); + } + + function createCharacterClass(classRanges, negative, from, to) { + return addRaw({ + type: 'characterClass', + body: classRanges, + negative: negative, + range: [from, to] + }); + } + + function createClassRange(min, max, from, to) { + // See 15.10.2.15: + if (min.codePoint > max.codePoint) { + bail('invalid range in character class', min.raw + '-' + max.raw, from, to); + } + + return addRaw({ + type: 'characterClassRange', + min: min, + max: max, + range: [from, to] + }); + } + + function flattenBody(body) { + if (body.type === 'alternative') { + return body.body; + } else { + return [body]; + } + } + + function isEmpty(obj) { + return obj.type === 'empty'; + } + + function incr(amount) { + amount = amount || 1; + var res = str.substring(pos, pos + amount); + pos += amount || 1; + return res; + } + + function skip(value) { + if (!match(value)) { + bail('character', value); + } + } + + function match(value) { + if (str.indexOf(value, pos) === pos) { + return incr(value.length); + } + } + + function lookahead() { + return str[pos]; + } + + function current(value) { + return str.indexOf(value, pos) === pos; + } + + function next(value) { + return str[pos + 1] === value; + } + + function matchReg(regExp) { + var subStr = str.substring(pos); + var res = subStr.match(regExp); + if (res) { + res.range = []; + res.range[0] = pos; + incr(res[0].length); + res.range[1] = pos; + } + return res; + } + + function parseDisjunction() { + // Disjunction :: + // Alternative + // Alternative | Disjunction + var res = [], + from = pos; + res.push(parseAlternative()); + + while (match('|')) { + res.push(parseAlternative()); + } + + if (res.length === 1) { + return res[0]; + } + + return createDisjunction(res, from, pos); + } + + function parseAlternative() { + var res = [], + from = pos; + var term; + + // Alternative :: + // [empty] + // Alternative Term + while (term = parseTerm()) { + res.push(term); + } + + if (res.length === 1) { + return res[0]; + } + + return createAlternative(res, from, pos); + } + + function parseTerm() { + // Term :: + // Anchor + // Atom + // Atom Quantifier + + if (pos >= str.length || current('|') || current(')')) { + return null; /* Means: The term is empty */ + } + + var anchor = parseAnchor(); + + if (anchor) { + return anchor; + } + + var atom = parseAtom(); + if (!atom) { + bail('Expected atom'); + } + var quantifier = parseQuantifier() || false; + if (quantifier) { + quantifier.body = flattenBody(atom); + // The quantifier contains the atom. Therefore, the beginning of the + // quantifier range is given by the beginning of the atom. + updateRawStart(quantifier, atom.range[0]); + return quantifier; + } + return atom; + } + + function parseGroup(matchA, typeA, matchB, typeB) { + var type = null, + from = pos; + + if (match(matchA)) { + type = typeA; + } else if (match(matchB)) { + type = typeB; + } else { + return false; + } + + var body = parseDisjunction(); + if (!body) { + bail('Expected disjunction'); + } + skip(')'); + var group = createGroup(type, flattenBody(body), from, pos); + + if (type == 'normal') { + // Keep track of the number of closed groups. This is required for + // parseDecimalEscape(). In case the string is parsed a second time the + // value already holds the total count and no incrementation is required. + if (firstIteration) { + closedCaptureCounter++; + } + } + return group; + } + + function parseAnchor() { + // Anchor :: + // ^ + // $ + // \ b + // \ B + // ( ? = Disjunction ) + // ( ? ! Disjunction ) + var res, + from = pos; + + if (match('^')) { + return createAnchor('start', 1 /* rawLength */); + } else if (match('$')) { + return createAnchor('end', 1 /* rawLength */); + } else if (match('\\b')) { + return createAnchor('boundary', 2 /* rawLength */); + } else if (match('\\B')) { + return createAnchor('not-boundary', 2 /* rawLength */); + } else { + return parseGroup('(?=', 'lookahead', '(?!', 'negativeLookahead'); + } + } + + function parseQuantifier() { + // Quantifier :: + // QuantifierPrefix + // QuantifierPrefix ? + // + // QuantifierPrefix :: + // * + // + + // ? + // { DecimalDigits } + // { DecimalDigits , } + // { DecimalDigits , DecimalDigits } + + var res, + from = pos; + var quantifier; + var min, max; + + if (match('*')) { + quantifier = createQuantifier(0); + } else if (match('+')) { + quantifier = createQuantifier(1); + } else if (match('?')) { + quantifier = createQuantifier(0, 1); + } else if (res = matchReg(/^\{([0-9]+)\}/)) { + min = parseInt(res[1], 10); + quantifier = createQuantifier(min, min, res.range[0], res.range[1]); + } else if (res = matchReg(/^\{([0-9]+),\}/)) { + min = parseInt(res[1], 10); + quantifier = createQuantifier(min, undefined, res.range[0], res.range[1]); + } else if (res = matchReg(/^\{([0-9]+),([0-9]+)\}/)) { + min = parseInt(res[1], 10); + max = parseInt(res[2], 10); + if (min > max) { + bail('numbers out of order in {} quantifier', '', from, pos); + } + quantifier = createQuantifier(min, max, res.range[0], res.range[1]); + } + + if (quantifier) { + if (match('?')) { + quantifier.greedy = false; + quantifier.range[1] += 1; + } + } + + return quantifier; + } + + function parseAtom() { + // Atom :: + // PatternCharacter + // . + // \ AtomEscape + // CharacterClass + // ( Disjunction ) + // ( ? : Disjunction ) + + var res; + + // jviereck: allow ']', '}' here as well to be compatible with browser's + // implementations: ']'.match(/]/); + // if (res = matchReg(/^[^^$\\.*+?()[\]{}|]/)) { + if (res = matchReg(/^[^^$\\.*+?(){[|]/)) { + // PatternCharacter + return createCharacter(res); + } else if (match('.')) { + // . + return createDot(); + } else if (match('\\')) { + // \ AtomEscape + res = parseAtomEscape(); + if (!res) { + bail('atomEscape'); + } + return res; + } else if (res = parseCharacterClass()) { + return res; + } else { + // ( Disjunction ) + // ( ? : Disjunction ) + return parseGroup('(?:', 'ignore', '(', 'normal'); + } + } + + function parseUnicodeSurrogatePairEscape(firstEscape) { + if (hasUnicodeFlag) { + var first, second; + if (firstEscape.kind == 'unicodeEscape' && (first = firstEscape.codePoint) >= 0xD800 && first <= 0xDBFF && current('\\') && next('u')) { + var prevPos = pos; + pos++; + var secondEscape = parseClassEscape(); + if (secondEscape.kind == 'unicodeEscape' && (second = secondEscape.codePoint) >= 0xDC00 && second <= 0xDFFF) { + // Unicode surrogate pair + firstEscape.range[1] = secondEscape.range[1]; + firstEscape.codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + firstEscape.type = 'value'; + firstEscape.kind = 'unicodeCodePointEscape'; + addRaw(firstEscape); + } else { + pos = prevPos; + } + } + } + return firstEscape; + } + + function parseClassEscape() { + return parseAtomEscape(true); + } + + function parseAtomEscape(insideCharacterClass) { + // AtomEscape :: + // DecimalEscape + // CharacterEscape + // CharacterClassEscape + + var res, + from = pos; + + res = parseDecimalEscape(); + if (res) { + return res; + } + + // For ClassEscape + if (insideCharacterClass) { + if (match('b')) { + // 15.10.2.19 + // The production ClassEscape :: b evaluates by returning the + // CharSet containing the one character <BS> (Unicode value 0008). + return createEscaped('singleEscape', 0x0008, '\\b'); + } else if (match('B')) { + bail('\\B not possible inside of CharacterClass', '', from); + } + } + + res = parseCharacterEscape(); + + return res; + } + + function parseDecimalEscape() { + // DecimalEscape :: + // DecimalIntegerLiteral [lookahead ∉ DecimalDigit] + // CharacterClassEscape :: one of d D s S w W + + var res, match; + + if (res = matchReg(/^(?!0)\d+/)) { + match = res[0]; + var refIdx = parseInt(res[0], 10); + if (refIdx <= closedCaptureCounter) { + // If the number is smaller than the normal-groups found so + // far, then it is a reference... + return createReference(res[0]); + } else { + // ... otherwise it needs to be interpreted as a octal (if the + // number is in an octal format). If it is NOT octal format, + // then the slash is ignored and the number is matched later + // as normal characters. + + // Recall the negative decision to decide if the input must be parsed + // a second time with the total normal-groups. + backrefDenied.push(refIdx); + + // Reset the position again, as maybe only parts of the previous + // matched numbers are actual octal numbers. E.g. in '019' only + // the '01' should be matched. + incr(-res[0].length); + if (res = matchReg(/^[0-7]{1,3}/)) { + return createEscaped('octal', parseInt(res[0], 8), res[0], 1); + } else { + // If we end up here, we have a case like /\91/. Then the + // first slash is to be ignored and the 9 & 1 to be treated + // like ordinary characters. Create a character for the + // first number only here - other number-characters + // (if available) will be matched later. + res = createCharacter(matchReg(/^[89]/)); + return updateRawStart(res, res.range[0] - 1); + } + } + } + // Only allow octal numbers in the following. All matched numbers start + // with a zero (if the do not, the previous if-branch is executed). + // If the number is not octal format and starts with zero (e.g. `091`) + // then only the zeros `0` is treated here and the `91` are ordinary + // characters. + // Example: + // /\091/.exec('\091')[0].length === 3 + else if (res = matchReg(/^[0-7]{1,3}/)) { + match = res[0]; + if (/^0{1,3}$/.test(match)) { + // If they are all zeros, then only take the first one. + return createEscaped('null', 0x0000, '0', match.length + 1); + } else { + return createEscaped('octal', parseInt(match, 8), match, 1); + } + } else if (res = matchReg(/^[dDsSwW]/)) { + return createCharacterClassEscape(res[0]); + } + return false; + } + + function parseCharacterEscape() { + // CharacterEscape :: + // ControlEscape + // c ControlLetter + // HexEscapeSequence + // UnicodeEscapeSequence + // IdentityEscape + + var res; + if (res = matchReg(/^[fnrtv]/)) { + // ControlEscape + var codePoint = 0; + switch (res[0]) { + case 't': + codePoint = 0x009;break; + case 'n': + codePoint = 0x00A;break; + case 'v': + codePoint = 0x00B;break; + case 'f': + codePoint = 0x00C;break; + case 'r': + codePoint = 0x00D;break; + } + return createEscaped('singleEscape', codePoint, '\\' + res[0]); + } else if (res = matchReg(/^c([a-zA-Z])/)) { + // c ControlLetter + return createEscaped('controlLetter', res[1].charCodeAt(0) % 32, res[1], 2); + } else if (res = matchReg(/^x([0-9a-fA-F]{2})/)) { + // HexEscapeSequence + return createEscaped('hexadecimalEscape', parseInt(res[1], 16), res[1], 2); + } else if (res = matchReg(/^u([0-9a-fA-F]{4})/)) { + // UnicodeEscapeSequence + return parseUnicodeSurrogatePairEscape(createEscaped('unicodeEscape', parseInt(res[1], 16), res[1], 2)); + } else if (hasUnicodeFlag && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) { + // RegExpUnicodeEscapeSequence (ES6 Unicode code point escape) + return createEscaped('unicodeCodePointEscape', parseInt(res[1], 16), res[1], 4); + } else { + // IdentityEscape + return parseIdentityEscape(); + } + } + + // Taken from the Esprima parser. + function isIdentifierPart(ch) { + // Generated by `tools/generate-identifier-regex.js`. + var NonAsciiIdentifierPart = new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'); + + return ch === 36 || ch === 95 || // $ (dollar) and _ (underscore) + ch >= 65 && ch <= 90 || // A..Z + ch >= 97 && ch <= 122 || // a..z + ch >= 48 && ch <= 57 || // 0..9 + ch === 92 || // \ (backslash) + ch >= 0x80 && NonAsciiIdentifierPart.test(String.fromCharCode(ch)); + } + + function parseIdentityEscape() { + // IdentityEscape :: + // SourceCharacter but not IdentifierPart + // <ZWJ> + // <ZWNJ> + + var ZWJ = '\u200C'; + var ZWNJ = '\u200D'; + + var tmp; + + if (!isIdentifierPart(lookahead())) { + tmp = incr(); + return createEscaped('identifier', tmp.charCodeAt(0), tmp, 1); + } + + if (match(ZWJ)) { + // <ZWJ> + return createEscaped('identifier', 0x200C, ZWJ); + } else if (match(ZWNJ)) { + // <ZWNJ> + return createEscaped('identifier', 0x200D, ZWNJ); + } + + return null; + } + + function parseCharacterClass() { + // CharacterClass :: + // [ [lookahead ∉ {^}] ClassRanges ] + // [ ^ ClassRanges ] + + var res, + from = pos; + if (res = matchReg(/^\[\^/)) { + res = parseClassRanges(); + skip(']'); + return createCharacterClass(res, true, from, pos); + } else if (match('[')) { + res = parseClassRanges(); + skip(']'); + return createCharacterClass(res, false, from, pos); + } + + return null; + } + + function parseClassRanges() { + // ClassRanges :: + // [empty] + // NonemptyClassRanges + + var res; + if (current(']')) { + // Empty array means nothing insinde of the ClassRange. + return []; + } else { + res = parseNonemptyClassRanges(); + if (!res) { + bail('nonEmptyClassRanges'); + } + return res; + } + } + + function parseHelperClassRanges(atom) { + var from, to, res; + if (current('-') && !next(']')) { + // ClassAtom - ClassAtom ClassRanges + skip('-'); + + res = parseClassAtom(); + if (!res) { + bail('classAtom'); + } + to = pos; + var classRanges = parseClassRanges(); + if (!classRanges) { + bail('classRanges'); + } + from = atom.range[0]; + if (classRanges.type === 'empty') { + return [createClassRange(atom, res, from, to)]; + } + return [createClassRange(atom, res, from, to)].concat(classRanges); + } + + res = parseNonemptyClassRangesNoDash(); + if (!res) { + bail('nonEmptyClassRangesNoDash'); + } + + return [atom].concat(res); + } + + function parseNonemptyClassRanges() { + // NonemptyClassRanges :: + // ClassAtom + // ClassAtom NonemptyClassRangesNoDash + // ClassAtom - ClassAtom ClassRanges + + var atom = parseClassAtom(); + if (!atom) { + bail('classAtom'); + } + + if (current(']')) { + // ClassAtom + return [atom]; + } + + // ClassAtom NonemptyClassRangesNoDash + // ClassAtom - ClassAtom ClassRanges + return parseHelperClassRanges(atom); + } + + function parseNonemptyClassRangesNoDash() { + // NonemptyClassRangesNoDash :: + // ClassAtom + // ClassAtomNoDash NonemptyClassRangesNoDash + // ClassAtomNoDash - ClassAtom ClassRanges + + var res = parseClassAtom(); + if (!res) { + bail('classAtom'); + } + if (current(']')) { + // ClassAtom + return res; + } + + // ClassAtomNoDash NonemptyClassRangesNoDash + // ClassAtomNoDash - ClassAtom ClassRanges + return parseHelperClassRanges(res); + } + + function parseClassAtom() { + // ClassAtom :: + // - + // ClassAtomNoDash + if (match('-')) { + return createCharacter('-'); + } else { + return parseClassAtomNoDash(); + } + } + + function parseClassAtomNoDash() { + // ClassAtomNoDash :: + // SourceCharacter but not one of \ or ] or - + // \ ClassEscape + + var res; + if (res = matchReg(/^[^\\\]-]/)) { + return createCharacter(res[0]); + } else if (match('\\')) { + res = parseClassEscape(); + if (!res) { + bail('classEscape'); + } + + return parseUnicodeSurrogatePairEscape(res); + } + } + + function bail(message, details, from, to) { + from = from == null ? pos : from; + to = to == null ? from : to; + + var contextStart = Math.max(0, from - 10); + var contextEnd = Math.min(to + 10, str.length); + + // Output a bit of context and a line pointing to where our error is. + // + // We are assuming that there are no actual newlines in the content as this is a regular expression. + var context = ' ' + str.substring(contextStart, contextEnd); + var pointer = ' ' + new Array(from - contextStart + 1).join(' ') + '^'; + + throw SyntaxError(message + ' at position ' + from + (details ? ': ' + details : '') + '\n' + context + '\n' + pointer); + } + + var backrefDenied = []; + var closedCaptureCounter = 0; + var firstIteration = true; + var hasUnicodeFlag = (flags || "").indexOf("u") !== -1; + var pos = 0; + + // Convert the input to a string and treat the empty string special. + str = String(str); + if (str === '') { + str = '(?:)'; + } + + var result = parseDisjunction(); + + if (result.range[1] !== str.length) { + bail('Could not parse entire input - got stuck', '', result.range[1]); + } + + // The spec requires to interpret the `\2` in `/\2()()/` as backreference. + // As the parser collects the number of capture groups as the string is + // parsed it is impossible to make these decisions at the point when the + // `\2` is handled. In case the local decision turns out to be wrong after + // the parsing has finished, the input string is parsed a second time with + // the total number of capture groups set. + // + // SEE: https://github.com/jviereck/regjsparser/issues/70 + for (var i = 0; i < backrefDenied.length; i++) { + if (backrefDenied[i] <= closedCaptureCounter) { + // Parse the input a second time. + pos = 0; + firstIteration = false; + return parseDisjunction(); + } + } + + return result; + } + + var regjsparser = { + parse: parse + }; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = regjsparser; + } else { + window.regjsparser = regjsparser; + } + })(); + +/***/ }), +/* 606 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isFinite = __webpack_require__(458); + + module.exports = function (str, n) { + if (typeof str !== 'string') { + throw new TypeError('Expected `input` to be a string'); } - str += str; - } while (n = n >> 1); + if (n < 0 || !isFinite(n)) { + throw new TypeError('Expected `count` to be a positive finite number'); + } - return ret; -}; + var ret = ''; -},{"593":593}],593:[function(_dereq_,module,exports){ -arguments[4][407][0].apply(exports,arguments) -},{"407":407,"594":594}],594:[function(_dereq_,module,exports){ -arguments[4][408][0].apply(exports,arguments) -},{"408":408}],595:[function(_dereq_,module,exports){ -'use strict'; -module.exports = /^#!.*/; + do { + if (n & 1) { + ret += str; + } -},{}],596:[function(_dereq_,module,exports){ -'use strict'; -module.exports = function (str) { - var isExtendedLengthPath = /^\\\\\?\\/.test(str); - var hasNonAscii = /[^\x00-\x80]+/.test(str); + str += str; + } while (n >>= 1); - if (isExtendedLengthPath || hasNonAscii) { - return str; + return ret; + }; + +/***/ }), +/* 607 */ +/***/ (function(module, exports) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + + /** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ + exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); + }; + + /** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ + exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return charCode - bigA; + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return charCode - littleA + littleOffset; + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return charCode - zero + numberOffset; + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; + }; + +/***/ }), +/* 608 */ +/***/ (function(module, exports) { + + "use strict"; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + exports.GREATEST_LOWER_BOUND = 1; + exports.LEAST_UPPER_BOUND = 2; + + /** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ + function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } } - return str.replace(/\\/g, '/'); -}; - -},{}],597:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = _dereq_(606); - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = {}; - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = util.toSetString(aStr); - var isDuplicate = this._set.hasOwnProperty(sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - this._set[sStr] = idx; - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - var sStr = util.toSetString(aStr); - return this._set.hasOwnProperty(sStr); - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - var sStr = util.toSetString(aStr); - if (this._set.hasOwnProperty(sStr)) { - return this._set[sStr]; - } - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; -} - -},{"606":606}],598:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -{ - var base64 = _dereq_(599); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; -} - -},{"599":599}],599:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; -} - -},{}],600:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; -} - -},{}],601:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = _dereq_(606); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; -} - -},{"606":606}],602:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; -} - -},{}],603:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = _dereq_(606); - var binarySearch = _dereq_(600); - var ArraySet = _dereq_(597).ArraySet; - var base64VLQ = _dereq_(598); - var quickSort = _dereq_(602).quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names, true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; -} - -},{"597":597,"598":598,"600":600,"602":602,"606":606}],604:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var base64VLQ = _dereq_(598); - var util = _dereq_(606); - var ArraySet = _dereq_(597).ArraySet; - var MappingList = _dereq_(601).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null && !this._sources.has(source)) { - this._sources.add(source); - } - - if (name != null && !this._names.has(name)) { - this._names.add(name); - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - result += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - result += ','; - } - } - - result += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - result += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - result += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - result += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - result += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, - key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; -} - -},{"597":597,"598":598,"601":601,"606":606}],605:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var SourceMapGenerator = _dereq_(604).SourceMapGenerator; - var util = _dereq_(606); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; -} - -},{"604":604,"606":606}],606:[function(_dereq_,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consequtive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '<dir>/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -} - -},{}],607:[function(_dereq_,module,exports){ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = _dereq_(604).SourceMapGenerator; -exports.SourceMapConsumer = _dereq_(603).SourceMapConsumer; -exports.SourceNode = _dereq_(605).SourceNode; - -},{"603":603,"604":604,"605":605}],608:[function(_dereq_,module,exports){ -'use strict'; -module.exports = function toFastProperties(obj) { - /*jshint -W027*/ - function f() {} - f.prototype = obj; - new f(); - return; - eval(obj); -}; - -},{}],609:[function(_dereq_,module,exports){ -'use strict'; -module.exports = function (str) { - var tail = str.length; - - while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) { - tail--; + /** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ + exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; + }; + +/***/ }), +/* 609 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(61); + + /** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ + function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; } - return str.slice(0, tail); -}; - -},{}],610:[function(_dereq_,module,exports){ -(function (process){ -var Module = _dereq_(1); - -var resolve = module.exports = function (loc, _require) { - try { - return (_require || _dereq_).resolve(loc); - } catch (err) { - return null; - } -}; - -var relativeMod; - -resolve.relative = function (loc) { - // we're in the browser, probably - if (typeof Module === "object") return null; - - if (!relativeMod) { - relativeMod = new Module; - relativeMod.paths = Module._nodeModulePaths(process.cwd()); - } - - try { - return Module._resolveFilename(loc, relativeMod); - } catch (err) { - return null; - } -}; - -}).call(this,_dereq_(10)) -},{"1":1,"10":10}],611:[function(_dereq_,module,exports){ -module.exports={ - "name": "babel-core", - "version": "5.8.34", - "description": "A compiler for writing next generation JavaScript", - "author": "Sebastian McKenzie <sebmck@gmail.com>", - "homepage": "https://babeljs.io/", - "license": "MIT", - "repository": "babel/babel", - "browser": { - "./lib/api/register/node.js": "./lib/api/register/browser.js" - }, - "keywords": [ - "6to5", - "babel", - "classes", - "const", - "es6", - "harmony", - "let", - "modules", - "transpile", - "transpiler", - "var" - ], - "scripts": { - "bench": "make bench", - "test": "make test" - }, - "dependencies": { - "babel-plugin-constant-folding": "^1.0.1", - "babel-plugin-dead-code-elimination": "^1.0.2", - "babel-plugin-eval": "^1.0.1", - "babel-plugin-inline-environment-variables": "^1.0.1", - "babel-plugin-jscript": "^1.0.4", - "babel-plugin-member-expression-literals": "^1.0.1", - "babel-plugin-property-literals": "^1.0.1", - "babel-plugin-proto-to-assign": "^1.0.3", - "babel-plugin-react-constant-elements": "^1.0.3", - "babel-plugin-react-display-name": "^1.0.3", - "babel-plugin-remove-console": "^1.0.1", - "babel-plugin-remove-debugger": "^1.0.1", - "babel-plugin-runtime": "^1.0.7", - "babel-plugin-undeclared-variables-check": "^1.0.2", - "babel-plugin-undefined-to-void": "^1.1.6", - "babylon": "^5.8.34", - "bluebird": "^2.9.33", - "chalk": "^1.0.0", - "convert-source-map": "^1.1.0", - "core-js": "^1.0.0", - "debug": "^2.1.1", - "detect-indent": "^3.0.0", - "esutils": "^2.0.0", - "fs-readdir-recursive": "^0.1.0", - "globals": "^6.4.0", - "home-or-tmp": "^1.0.0", - "is-integer": "^1.0.4", - "js-tokens": "1.0.1", - "json5": "^0.4.0", - "line-numbers": "0.2.0", - "lodash": "^3.10.0", - "minimatch": "^2.0.3", - "output-file-sync": "^1.1.0", - "path-exists": "^1.0.0", - "path-is-absolute": "^1.0.0", - "private": "^0.1.6", - "regenerator": "0.8.40", - "regexpu": "^1.3.0", - "repeating": "^1.1.2", - "resolve": "^1.1.6", - "shebang-regex": "^1.0.0", - "slash": "^1.0.0", - "source-map": "^0.5.0", - "source-map-support": "^0.2.10", - "to-fast-properties": "^1.0.0", - "trim-right": "^1.0.0", - "try-resolve": "^1.0.0" - } -} -},{}],612:[function(_dereq_,module,exports){ -module.exports={"abstract-expression-call":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"PROPERTY"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"referenceGet"},"computed":false},"computed":true},"arguments":[{"type":"Identifier","name":"OBJECT"}]},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"OBJECT"}]}}]},"abstract-expression-delete":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"PROPERTY"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"referenceDelete"},"computed":false},"computed":true},"arguments":[{"type":"Identifier","name":"OBJECT"}]}}]},"abstract-expression-get":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"PROPERTY"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"referenceGet"},"computed":false},"computed":true},"arguments":[{"type":"Identifier","name":"OBJECT"}]}}]},"abstract-expression-set":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"PROPERTY"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"referenceSet"},"computed":false},"computed":true},"arguments":[{"type":"Identifier","name":"OBJECT"},{"type":"Identifier","name":"VALUE"}]}}]},"array-comprehension-container":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"KEY"},"init":{"type":"ArrayExpression","elements":[]}}],"kind":"var"},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"KEY"}}]},"parenthesizedExpression":true},"arguments":[]}}]},"array-from":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"from"},"computed":false},"arguments":[{"type":"Identifier","name":"VALUE"}]}}]},"array-push":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"KEY"},"property":{"type":"Identifier","name":"push"},"computed":false},"arguments":[{"type":"Identifier","name":"STATEMENT"}]}}]},"call":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"OBJECT"},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"CONTEXT"}]}}]},"class-decorator":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"CLASS_REF"},"right":{"type":"LogicalExpression","left":{"type":"CallExpression","callee":{"type":"Identifier","name":"DECORATOR"},"arguments":[{"type":"Identifier","name":"CLASS_REF"}]},"operator":"||","right":{"type":"Identifier","name":"CLASS_REF"}}}}]},"class-derived-default-constructor":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Super"},"arguments":[{"type":"SpreadElement","argument":{"type":"Identifier","name":"arguments"}}]}}]},"parenthesizedExpression":true}}]},"default-parameter-assign":{"type":"Program","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"VARIABLE_NAME"},"operator":"===","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"VARIABLE_NAME"},"right":{"type":"Identifier","name":"DEFAULT_VALUE"}}},"alternate":null}]},"default-parameter":{"type":"Program","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"VARIABLE_NAME"},"init":{"type":"ConditionalExpression","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARGUMENTS"},"property":{"type":"Identifier","name":"length"},"computed":false},"operator":"<=","right":{"type":"Identifier","name":"ARGUMENT_KEY"}},"operator":"||","right":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARGUMENTS"},"property":{"type":"Identifier","name":"ARGUMENT_KEY"},"computed":true},"operator":"===","right":{"type":"Identifier","name":"undefined"}}},"consequent":{"type":"Identifier","name":"DEFAULT_VALUE"},"alternate":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARGUMENTS"},"property":{"type":"Identifier","name":"ARGUMENT_KEY"},"computed":true}}}],"kind":"let"}]},"exports-assign":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"exports"},"property":{"type":"Identifier","name":"KEY"},"computed":false},"right":{"type":"Identifier","name":"VALUE"}}}]},"exports-default-assign":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"module"},"property":{"type":"Identifier","name":"exports"},"computed":false},"right":{"type":"Identifier","name":"VALUE"}}}]},"exports-from-assign":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"exports"},{"type":"Identifier","name":"ID"},{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"enumerable"},"value":{"type":"Literal","value":true},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"get"},"value":{"type":"FunctionExpression","id":{"type":"Identifier","name":"get"},"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"INIT"}}]}},"kind":"init"}]}]}}]},"exports-module-declaration-loose":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"exports"},"property":{"type":"Identifier","name":"__esModule"},"computed":false},"right":{"type":"Literal","value":true}}}]},"exports-module-declaration":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"exports"},{"type":"Literal","value":"__esModule"},{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"value"},"value":{"type":"Literal","value":true},"kind":"init"}]}]}}]},"for-of-array":{"type":"Program","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"KEY"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"KEY"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARR"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"KEY"}},"body":{"type":"ExpressionStatement","expression":{"type":"Identifier","name":"BODY"}}}]},"for-of-loose":{"type":"Program","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"LOOP_OBJECT"},"init":{"type":"Identifier","name":"OBJECT"}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"IS_ARRAY"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"isArray"},"computed":false},"arguments":[{"type":"Identifier","name":"LOOP_OBJECT"}]}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"INDEX"},"init":{"type":"Literal","value":0}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"LOOP_OBJECT"},"init":{"type":"ConditionalExpression","test":{"type":"Identifier","name":"IS_ARRAY"},"consequent":{"type":"Identifier","name":"LOOP_OBJECT"},"alternate":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"LOOP_OBJECT"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"computed":true},"arguments":[]}}}],"kind":"var"},"test":null,"update":null,"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ID"},"init":null}],"kind":"var"},{"type":"IfStatement","test":{"type":"Identifier","name":"IS_ARRAY"},"consequent":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"INDEX"},"operator":">=","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"LOOP_OBJECT"},"property":{"type":"Identifier","name":"length"},"computed":false}},"consequent":{"type":"BreakStatement","label":null},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ID"},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"LOOP_OBJECT"},"property":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"INDEX"}},"computed":true}}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"INDEX"},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"LOOP_OBJECT"},"property":{"type":"Identifier","name":"next"},"computed":false},"arguments":[]}}},{"type":"IfStatement","test":{"type":"MemberExpression","object":{"type":"Identifier","name":"INDEX"},"property":{"type":"Identifier","name":"done"},"computed":false},"consequent":{"type":"BreakStatement","label":null},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ID"},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"INDEX"},"property":{"type":"Identifier","name":"value"},"computed":false}}}]}}]}}]},"for-of":{"type":"Program","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ITERATOR_COMPLETION"},"init":{"type":"Literal","value":true}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ITERATOR_HAD_ERROR_KEY"},"init":{"type":"Literal","value":false}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ITERATOR_ERROR_KEY"},"init":{"type":"Identifier","name":"undefined"}}],"kind":"var"},{"type":"TryStatement","block":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ITERATOR_KEY"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"OBJECT"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"computed":true},"arguments":[]}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"STEP_KEY"},"init":null}],"kind":"var"},"test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ITERATOR_COMPLETION"},"right":{"type":"MemberExpression","object":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"STEP_KEY"},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"ITERATOR_KEY"},"property":{"type":"Identifier","name":"next"},"computed":false},"arguments":[]},"parenthesizedExpression":true},"property":{"type":"Identifier","name":"done"},"computed":false},"parenthesizedExpression":true}},"update":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ITERATOR_COMPLETION"},"right":{"type":"Literal","value":true}},"body":{"type":"BlockStatement","body":[]}}]},"handler":{"type":"CatchClause","param":{"type":"Identifier","name":"err"},"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ITERATOR_HAD_ERROR_KEY"},"right":{"type":"Literal","value":true}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"ITERATOR_ERROR_KEY"},"right":{"type":"Identifier","name":"err"}}}]}},"guardedHandlers":[],"finalizer":{"type":"BlockStatement","body":[{"type":"TryStatement","block":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"Identifier","name":"ITERATOR_COMPLETION"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"ITERATOR_KEY"},"property":{"type":"Literal","value":"return"},"computed":true}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"ITERATOR_KEY"},"property":{"type":"Literal","value":"return"},"computed":true},"arguments":[]}}]},"alternate":null}]},"handler":null,"guardedHandlers":[],"finalizer":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"Identifier","name":"ITERATOR_HAD_ERROR_KEY"},"consequent":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"Identifier","name":"ITERATOR_ERROR_KEY"}}]},"alternate":null}]}}]}}]},"helper-async-to-generator":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"fn"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"gen"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"fn"},"property":{"type":"Identifier","name":"apply"},"computed":false},"arguments":[{"type":"ThisExpression"},{"type":"Identifier","name":"arguments"}]}}],"kind":"var"},{"type":"ReturnStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"Promise"},"arguments":[{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"resolve"},{"type":"Identifier","name":"reject"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"callNext"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"step"},"property":{"type":"Identifier","name":"bind"},"computed":false},"arguments":[{"type":"Literal","value":null,"rawValue":null},{"type":"Literal","value":"next"}]}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"callThrow"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"step"},"property":{"type":"Identifier","name":"bind"},"computed":false},"arguments":[{"type":"Literal","value":null,"rawValue":null},{"type":"Literal","value":"throw"}]}}],"kind":"var"},{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"step"},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"key"},{"type":"Identifier","name":"arg"}],"body":{"type":"BlockStatement","body":[{"type":"TryStatement","block":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"info"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"gen"},"property":{"type":"Identifier","name":"key"},"computed":true},"arguments":[{"type":"Identifier","name":"arg"}]}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"value"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"info"},"property":{"type":"Identifier","name":"value"},"computed":false}}],"kind":"var"}]},"handler":{"type":"CatchClause","param":{"type":"Identifier","name":"error"},"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"reject"},"arguments":[{"type":"Identifier","name":"error"}]}},{"type":"ReturnStatement","argument":null}]}},"guardedHandlers":[],"finalizer":null},{"type":"IfStatement","test":{"type":"MemberExpression","object":{"type":"Identifier","name":"info"},"property":{"type":"Identifier","name":"done"},"computed":false},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"resolve"},"arguments":[{"type":"Identifier","name":"value"}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Promise"},"property":{"type":"Identifier","name":"resolve"},"computed":false},"arguments":[{"type":"Identifier","name":"value"}]},"property":{"type":"Identifier","name":"then"},"computed":false},"arguments":[{"type":"Identifier","name":"callNext"},{"type":"Identifier","name":"callThrow"}]}}]}}]}},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"callNext"},"arguments":[]}}]}}]}}]}}}]},"parenthesizedExpression":true}}]},"helper-bind":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Function"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"bind"},"computed":false}}]},"helper-class-call-check":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"instance"},{"type":"Identifier","name":"Constructor"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"BinaryExpression","left":{"type":"Identifier","name":"instance"},"operator":"instanceof","right":{"type":"Identifier","name":"Constructor"},"parenthesizedExpression":true}},"consequent":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"Literal","value":"Cannot call a class as a function"}]}}]},"alternate":null}]},"parenthesizedExpression":true}}]},"helper-create-class":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"defineProperties"},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"props"}],"body":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"props"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"descriptor"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"props"},"property":{"type":"Identifier","name":"i"},"computed":true}}],"kind":"var"},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"enumerable"},"computed":false},"right":{"type":"LogicalExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"enumerable"},"computed":false},"operator":"||","right":{"type":"Literal","value":false}}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"configurable"},"computed":false},"right":{"type":"Literal","value":true}}},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Literal","value":"value"},"operator":"in","right":{"type":"Identifier","name":"descriptor"}},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"writable"},"computed":false},"right":{"type":"Literal","value":true}}},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"target"},{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"key"},"computed":false},{"type":"Identifier","name":"descriptor"}]}}]}}]}},{"type":"ReturnStatement","argument":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"Constructor"},{"type":"Identifier","name":"protoProps"},{"type":"Identifier","name":"staticProps"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"Identifier","name":"protoProps"},"consequent":{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"defineProperties"},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"Constructor"},"property":{"type":"Identifier","name":"prototype"},"computed":false},{"type":"Identifier","name":"protoProps"}]}},"alternate":null},{"type":"IfStatement","test":{"type":"Identifier","name":"staticProps"},"consequent":{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"defineProperties"},"arguments":[{"type":"Identifier","name":"Constructor"},{"type":"Identifier","name":"staticProps"}]}},"alternate":null},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"Constructor"}}]}}}]},"parenthesizedExpression":true},"arguments":[]}}]},"helper-create-decorated-class":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"defineProperties"},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"descriptors"},{"type":"Identifier","name":"initializers"}],"body":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptors"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"descriptor"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptors"},"property":{"type":"Identifier","name":"i"},"computed":true}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"decorators"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"decorators"},"computed":false}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"key"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"key"},"computed":false}}],"kind":"var"},{"type":"ExpressionStatement","expression":{"type":"UnaryExpression","operator":"delete","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor","leadingComments":null},"property":{"type":"Identifier","name":"key"},"computed":false,"leadingComments":null},"leadingComments":null}},{"type":"ExpressionStatement","expression":{"type":"UnaryExpression","operator":"delete","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"decorators"},"computed":false}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"enumerable"},"computed":false},"right":{"type":"LogicalExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"enumerable"},"computed":false},"operator":"||","right":{"type":"Literal","value":false}}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"configurable"},"computed":false},"right":{"type":"Literal","value":true}}},{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"Literal","value":"value"},"operator":"in","right":{"type":"Identifier","name":"descriptor"}},"operator":"||","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false}},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"writable"},"computed":false},"right":{"type":"Literal","value":true}}},"alternate":null},{"type":"IfStatement","test":{"type":"Identifier","name":"decorators"},"consequent":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"f"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"f"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"decorators"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"f"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"decorator"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"decorators"},"property":{"type":"Identifier","name":"f"},"computed":true}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"decorator"}},"operator":"===","right":{"type":"Literal","value":"function"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"descriptor"},"right":{"type":"LogicalExpression","left":{"type":"CallExpression","callee":{"type":"Identifier","name":"decorator"},"arguments":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptor"}]},"operator":"||","right":{"type":"Identifier","name":"descriptor"}}}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"BinaryExpression","left":{"type":"BinaryExpression","left":{"type":"BinaryExpression","left":{"type":"Literal","value":"The decorator for method "},"operator":"+","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"key"},"computed":false}},"operator":"+","right":{"type":"Literal","value":" is of the invalid type "}},"operator":"+","right":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"decorator"}}}]}}]}}]}},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false},"operator":"!==","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"initializers"},"property":{"type":"Identifier","name":"key"},"computed":true},"right":{"type":"Identifier","name":"descriptor"}}},{"type":"ContinueStatement","label":null}]},"alternate":null}]},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptor"}]}}]}}]}},{"type":"ReturnStatement","argument":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"Constructor"},{"type":"Identifier","name":"protoProps"},{"type":"Identifier","name":"staticProps"},{"type":"Identifier","name":"protoInitializers"},{"type":"Identifier","name":"staticInitializers"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"Identifier","name":"protoProps"},"consequent":{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"defineProperties"},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"Constructor"},"property":{"type":"Identifier","name":"prototype"},"computed":false},{"type":"Identifier","name":"protoProps"},{"type":"Identifier","name":"protoInitializers"}]}},"alternate":null},{"type":"IfStatement","test":{"type":"Identifier","name":"staticProps"},"consequent":{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"defineProperties"},"arguments":[{"type":"Identifier","name":"Constructor"},{"type":"Identifier","name":"staticProps"},{"type":"Identifier","name":"staticInitializers"}]}},"alternate":null},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"Constructor"}}]}}}]},"parenthesizedExpression":true},"arguments":[]}}]},"helper-create-decorated-object":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"descriptors"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"target"},"init":{"type":"ObjectExpression","properties":[]}}],"kind":"var"},{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptors"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"descriptor"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptors"},"property":{"type":"Identifier","name":"i"},"computed":true}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"decorators"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"decorators"},"computed":false}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"key"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"key"},"computed":false}}],"kind":"var"},{"type":"ExpressionStatement","expression":{"type":"UnaryExpression","operator":"delete","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor","leadingComments":null},"property":{"type":"Identifier","name":"key"},"computed":false,"leadingComments":null},"leadingComments":null}},{"type":"ExpressionStatement","expression":{"type":"UnaryExpression","operator":"delete","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"decorators"},"computed":false}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"enumerable"},"computed":false},"right":{"type":"Literal","value":true}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"configurable"},"computed":false},"right":{"type":"Literal","value":true}}},{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"Literal","value":"value"},"operator":"in","right":{"type":"Identifier","name":"descriptor"}},"operator":"||","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false}},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"writable"},"computed":false},"right":{"type":"Literal","value":true}}},"alternate":null},{"type":"IfStatement","test":{"type":"Identifier","name":"decorators"},"consequent":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"f"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"f"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"decorators"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"f"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"decorator"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"decorators"},"property":{"type":"Identifier","name":"f"},"computed":true}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"decorator"}},"operator":"===","right":{"type":"Literal","value":"function"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"descriptor"},"right":{"type":"LogicalExpression","left":{"type":"CallExpression","callee":{"type":"Identifier","name":"decorator"},"arguments":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptor"}]},"operator":"||","right":{"type":"Identifier","name":"descriptor"}}}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"BinaryExpression","left":{"type":"BinaryExpression","left":{"type":"BinaryExpression","left":{"type":"Literal","value":"The decorator for method "},"operator":"+","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"key"},"computed":false}},"operator":"+","right":{"type":"Literal","value":" is of the invalid type "}},"operator":"+","right":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"decorator"}}}]}}]}}]}}]},"alternate":null},{"type":"IfStatement","test":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"value"},"computed":false},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"target"}]}}}]},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptor"}]}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"target"}}]},"parenthesizedExpression":true}}]},"helper-default-props":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"defaultProps"},{"type":"Identifier","name":"props"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"Identifier","name":"defaultProps"},"consequent":{"type":"BlockStatement","body":[{"type":"ForInStatement","left":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"propName"},"init":null}],"kind":"var"},"right":{"type":"Identifier","name":"defaultProps"},"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"props"},"property":{"type":"Identifier","name":"propName"},"computed":true}},"operator":"===","right":{"type":"Literal","value":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"props"},"property":{"type":"Identifier","name":"propName"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"defaultProps"},"property":{"type":"Identifier","name":"propName"},"computed":true}}}]},"alternate":null}]}}]},"alternate":null},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"props"}}]},"parenthesizedExpression":true}}]},"helper-defaults":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"defaults"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"keys"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getOwnPropertyNames"},"computed":false},"arguments":[{"type":"Identifier","name":"defaults"}]}}],"kind":"var"},{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":0}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"keys"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"key"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"keys"},"property":{"type":"Identifier","name":"i"},"computed":true}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"value"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getOwnPropertyDescriptor"},"computed":false},"arguments":[{"type":"Identifier","name":"defaults"},{"type":"Identifier","name":"key"}]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"LogicalExpression","left":{"type":"Identifier","name":"value"},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"value"},"property":{"type":"Identifier","name":"configurable"},"computed":false}},"operator":"&&","right":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"key"},"computed":true},"operator":"===","right":{"type":"Identifier","name":"undefined"}}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"value"}]}}]},"alternate":null}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"obj"}}]},"parenthesizedExpression":true}}]},"helper-define-decorated-property-descriptor":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptors"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_descriptor"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptors"},"property":{"type":"Identifier","name":"key"},"computed":true}}],"kind":"var"},{"type":"IfStatement","test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"Identifier","name":"_descriptor"}},"consequent":{"type":"ReturnStatement","argument":null,"leadingComments":null,"trailingComments":null},"alternate":null},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"descriptor","leadingComments":null},"init":{"type":"ObjectExpression","properties":[]},"leadingComments":null}],"kind":"var"},{"type":"ForInStatement","left":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_key"},"init":null}],"kind":"var"},"right":{"type":"Identifier","name":"_descriptor"},"body":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"_key"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"_descriptor"},"property":{"type":"Identifier","name":"_key"},"computed":true}},"trailingComments":null}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor","leadingComments":null},"property":{"type":"Identifier","name":"value"},"computed":false,"leadingComments":null},"right":{"type":"ConditionalExpression","test":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false},"consequent":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"descriptor"},"property":{"type":"Identifier","name":"initializer"},"computed":false},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"target"}]},"alternate":{"type":"Identifier","name":"undefined"}},"leadingComments":null}},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"target"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"descriptor"}]}}]},"parenthesizedExpression":true}}]},"helper-define-property":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"key"},{"type":"Identifier","name":"value"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"key","leadingComments":null},"operator":"in","right":{"type":"Identifier","name":"obj"},"leadingComments":null},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperty"},"computed":false},"arguments":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"key"},{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"value"},"value":{"type":"Identifier","name":"value"},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"enumerable"},"value":{"type":"Literal","value":true},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"configurable"},"value":{"type":"Literal","value":true},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"writable"},"value":{"type":"Literal","value":true},"kind":"init"}]}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"key"},"computed":true},"right":{"type":"Identifier","name":"value"}}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"obj"}}]},"parenthesizedExpression":true}}]},"helper-extends":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"LogicalExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"assign"},"computed":false},"operator":"||","right":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"target"}],"body":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":1}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"arguments"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"source"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"arguments"},"property":{"type":"Identifier","name":"i"},"computed":true}}],"kind":"var"},{"type":"ForInStatement","left":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"key"},"init":null}],"kind":"var"},"right":{"type":"Identifier","name":"source"},"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"hasOwnProperty"},"computed":false},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"source"},{"type":"Identifier","name":"key"}]},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"target"},"property":{"type":"Identifier","name":"key"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"source"},"property":{"type":"Identifier","name":"key"},"computed":true}}}]},"alternate":null}]}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"target"}}]}}}}]},"helper-get":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":{"type":"Identifier","name":"get"},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"object"},{"type":"Identifier","name":"property"},{"type":"Identifier","name":"receiver"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"object"},"operator":"===","right":{"type":"Literal","value":null,"rawValue":null}},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"object"},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"Function"},"property":{"type":"Identifier","name":"prototype"},"computed":false}}},"alternate":null},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"desc"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getOwnPropertyDescriptor"},"computed":false},"arguments":[{"type":"Identifier","name":"object"},{"type":"Identifier","name":"property"}]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"desc"},"operator":"===","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"parent"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getPrototypeOf"},"computed":false},"arguments":[{"type":"Identifier","name":"object"}]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"parent"},"operator":"===","right":{"type":"Literal","value":null,"rawValue":null}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"undefined"}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"Identifier","name":"get"},"arguments":[{"type":"Identifier","name":"parent"},{"type":"Identifier","name":"property"},{"type":"Identifier","name":"receiver"}]}}]}}]},"alternate":{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Literal","value":"value"},"operator":"in","right":{"type":"Identifier","name":"desc"}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"desc"},"property":{"type":"Identifier","name":"value"},"computed":false}}]},"alternate":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"getter"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"desc"},"property":{"type":"Identifier","name":"get"},"computed":false}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"getter"},"operator":"===","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"undefined"}}]},"alternate":null},{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"getter"},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"receiver"}]}}]}}}]},"parenthesizedExpression":true}}]},"helper-has-own":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"hasOwnProperty"},"computed":false}}]},"helper-inherits":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"subClass"},{"type":"Identifier","name":"superClass"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"superClass"}},"operator":"!==","right":{"type":"Literal","value":"function"}},"operator":"&&","right":{"type":"BinaryExpression","left":{"type":"Identifier","name":"superClass"},"operator":"!==","right":{"type":"Literal","value":null,"rawValue":null}}},"consequent":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"BinaryExpression","left":{"type":"Literal","value":"Super expression must either be null or a function, not "},"operator":"+","right":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"superClass"}}}]}}]},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"subClass"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"create"},"computed":false},"arguments":[{"type":"LogicalExpression","left":{"type":"Identifier","name":"superClass"},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"superClass"},"property":{"type":"Identifier","name":"prototype"},"computed":false}},{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"constructor"},"value":{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"value"},"value":{"type":"Identifier","name":"subClass"},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"enumerable"},"value":{"type":"Literal","value":false},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"writable"},"value":{"type":"Literal","value":true},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"configurable"},"value":{"type":"Literal","value":true},"kind":"init"}]},"kind":"init"}]}]}}},{"type":"IfStatement","test":{"type":"Identifier","name":"superClass"},"consequent":{"type":"ExpressionStatement","expression":{"type":"ConditionalExpression","test":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"setPrototypeOf"},"computed":false},"consequent":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"setPrototypeOf"},"computed":false},"arguments":[{"type":"Identifier","name":"subClass"},{"type":"Identifier","name":"superClass"}]},"alternate":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"subClass"},"property":{"type":"Identifier","name":"__proto__"},"computed":false},"right":{"type":"Identifier","name":"superClass"}}}},"alternate":null}]},"parenthesizedExpression":true}}]},"helper-instanceof":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"left"},{"type":"Identifier","name":"right"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"Identifier","name":"right"},"operator":"!=","right":{"type":"Literal","value":null,"rawValue":null}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"right"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"hasInstance"},"computed":false},"computed":true}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"right"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"hasInstance"},"computed":false},"computed":true},"arguments":[{"type":"Identifier","name":"left"}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"BinaryExpression","left":{"type":"Identifier","name":"left"},"operator":"instanceof","right":{"type":"Identifier","name":"right"}}}]}}]},"parenthesizedExpression":true}}]},"helper-interop-export-wildcard":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"defaults"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"newObj"},"init":{"type":"CallExpression","callee":{"type":"Identifier","name":"defaults"},"arguments":[{"type":"ObjectExpression","properties":[]},{"type":"Identifier","name":"obj"}]}}],"kind":"var"},{"type":"ExpressionStatement","expression":{"type":"UnaryExpression","operator":"delete","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"newObj"},"property":{"type":"Literal","value":"default"},"computed":true}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"newObj"}}]},"parenthesizedExpression":true}}]},"helper-interop-require-default":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"ConditionalExpression","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"obj"},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"__esModule"},"computed":false}},"consequent":{"type":"Identifier","name":"obj"},"alternate":{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Literal","value":"default"},"value":{"type":"Identifier","name":"obj"},"kind":"init"}]}}}]},"parenthesizedExpression":true}}]},"helper-interop-require-wildcard":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"obj"},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"__esModule"},"computed":false}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"obj"}}]},"alternate":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"newObj"},"init":{"type":"ObjectExpression","properties":[]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"obj"},"operator":"!=","right":{"type":"Literal","value":null,"rawValue":null}},"consequent":{"type":"BlockStatement","body":[{"type":"ForInStatement","left":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"key"},"init":null}],"kind":"var"},"right":{"type":"Identifier","name":"obj"},"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"hasOwnProperty"},"computed":false},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"key"}]},"consequent":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"newObj"},"property":{"type":"Identifier","name":"key"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"key"},"computed":true}}},"alternate":null}]}}]},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"newObj"},"property":{"type":"Literal","value":"default"},"computed":true},"right":{"type":"Identifier","name":"obj"}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"newObj"}}]}}]},"parenthesizedExpression":true}}]},"helper-interop-require":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"ConditionalExpression","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"obj"},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"__esModule"},"computed":false}},"consequent":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Literal","value":"default"},"computed":true},"alternate":{"type":"Identifier","name":"obj"}}}]},"parenthesizedExpression":true}}]},"helper-new-arrow-check":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"innerThis"},{"type":"Identifier","name":"boundThis"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"innerThis"},"operator":"!==","right":{"type":"Identifier","name":"boundThis"}},"consequent":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"Literal","value":"Cannot instantiate an arrow function"}]}}]},"alternate":null}]},"parenthesizedExpression":true}}]},"helper-object-destructuring-empty":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"obj"},"operator":"==","right":{"type":"Literal","value":null,"rawValue":null}},"consequent":{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"Literal","value":"Cannot destructure undefined"}]}},"alternate":null}]},"parenthesizedExpression":true}}]},"helper-object-without-properties":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"keys"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"target"},"init":{"type":"ObjectExpression","properties":[]}}],"kind":"var"},{"type":"ForInStatement","left":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":null}],"kind":"var"},"right":{"type":"Identifier","name":"obj"},"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"keys"},"property":{"type":"Identifier","name":"indexOf"},"computed":false},"arguments":[{"type":"Identifier","name":"i"}]},"operator":">=","right":{"type":"Literal","value":0}},"consequent":{"type":"ContinueStatement","label":null},"alternate":null},{"type":"IfStatement","test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"hasOwnProperty"},"computed":false},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"obj"},{"type":"Identifier","name":"i"}]}},"consequent":{"type":"ContinueStatement","label":null},"alternate":null},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"target"},"property":{"type":"Identifier","name":"i"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"i"},"computed":true}}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"target"}}]},"parenthesizedExpression":true}}]},"helper-self-global":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"ConditionalExpression","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"global"}},"operator":"===","right":{"type":"Literal","value":"undefined"}},"consequent":{"type":"Identifier","name":"self"},"alternate":{"type":"Identifier","name":"global"}}}]},"helper-set":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":{"type":"Identifier","name":"set"},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"object"},{"type":"Identifier","name":"property"},{"type":"Identifier","name":"value"},{"type":"Identifier","name":"receiver"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"desc"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getOwnPropertyDescriptor"},"computed":false},"arguments":[{"type":"Identifier","name":"object"},{"type":"Identifier","name":"property"}]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"desc"},"operator":"===","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"parent"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"getPrototypeOf"},"computed":false},"arguments":[{"type":"Identifier","name":"object"}]}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"parent"},"operator":"!==","right":{"type":"Literal","value":null,"rawValue":null}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"set"},"arguments":[{"type":"Identifier","name":"parent"},{"type":"Identifier","name":"property"},{"type":"Identifier","name":"value"},{"type":"Identifier","name":"receiver"}]}}]},"alternate":null}]},"alternate":{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"Literal","value":"value"},"operator":"in","right":{"type":"Identifier","name":"desc"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"desc"},"property":{"type":"Identifier","name":"writable"},"computed":false}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"desc"},"property":{"type":"Identifier","name":"value"},"computed":false},"right":{"type":"Identifier","name":"value"}}}]},"alternate":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"setter"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"desc"},"property":{"type":"Identifier","name":"set"},"computed":false}}],"kind":"var"},{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"setter"},"operator":"!==","right":{"type":"Identifier","name":"undefined"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"setter"},"property":{"type":"Identifier","name":"call"},"computed":false},"arguments":[{"type":"Identifier","name":"receiver"},{"type":"Identifier","name":"value"}]}}]},"alternate":null}]}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"value"}}]},"parenthesizedExpression":true}}]},"helper-slice":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"MemberExpression","object":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"prototype"},"computed":false},"property":{"type":"Identifier","name":"slice"},"computed":false}}]},"helper-sliced-to-array-loose":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"arr"},{"type":"Identifier","name":"i"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"isArray"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"arr"}}]},"alternate":{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"operator":"in","right":{"type":"CallExpression","callee":{"type":"Identifier","name":"Object"},"arguments":[{"type":"Identifier","name":"arr"}]}},"consequent":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_arr"},"init":{"type":"ArrayExpression","elements":[]}}],"kind":"var"},{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_iterator"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"arr"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"computed":true},"arguments":[]}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_step"},"init":null}],"kind":"var"},"test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"MemberExpression","object":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_step"},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"_iterator"},"property":{"type":"Identifier","name":"next"},"computed":false},"arguments":[]},"parenthesizedExpression":true},"property":{"type":"Identifier","name":"done"},"computed":false}},"update":null,"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"_arr"},"property":{"type":"Identifier","name":"push"},"computed":false},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"_step"},"property":{"type":"Identifier","name":"value"},"computed":false}]}},{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"i"},"operator":"&&","right":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"_arr"},"property":{"type":"Identifier","name":"length"},"computed":false},"operator":"===","right":{"type":"Identifier","name":"i"}}},"consequent":{"type":"BreakStatement","label":null},"alternate":null}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"_arr"}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"Literal","value":"Invalid attempt to destructure non-iterable instance"}]}}]}}}]},"parenthesizedExpression":true}}]},"helper-sliced-to-array":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"sliceIterator","leadingComments":null},"generator":false,"expression":false,"params":[{"type":"Identifier","name":"arr"},{"type":"Identifier","name":"i"}],"body":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_arr","leadingComments":null},"init":{"type":"ArrayExpression","elements":[]},"leadingComments":null}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_n"},"init":{"type":"Literal","value":true}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_d"},"init":{"type":"Literal","value":false}}],"kind":"var"},{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_e"},"init":{"type":"Identifier","name":"undefined"}}],"kind":"var"},{"type":"TryStatement","block":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_i"},"init":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"arr"},"property":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"computed":true},"arguments":[]}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"_s"},"init":null}],"kind":"var"},"test":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_n"},"right":{"type":"MemberExpression","object":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_s"},"right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"_i"},"property":{"type":"Identifier","name":"next"},"computed":false},"arguments":[]},"parenthesizedExpression":true},"property":{"type":"Identifier","name":"done"},"computed":false},"parenthesizedExpression":true}},"update":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_n"},"right":{"type":"Literal","value":true}},"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"_arr"},"property":{"type":"Identifier","name":"push"},"computed":false},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"_s"},"property":{"type":"Identifier","name":"value"},"computed":false}]}},{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"i"},"operator":"&&","right":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"_arr"},"property":{"type":"Identifier","name":"length"},"computed":false},"operator":"===","right":{"type":"Identifier","name":"i"}}},"consequent":{"type":"BreakStatement","label":null},"alternate":null}]}}]},"handler":{"type":"CatchClause","param":{"type":"Identifier","name":"err"},"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_d"},"right":{"type":"Literal","value":true}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"Identifier","name":"_e"},"right":{"type":"Identifier","name":"err"}}}]}},"guardedHandlers":[],"finalizer":{"type":"BlockStatement","body":[{"type":"TryStatement","block":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"UnaryExpression","operator":"!","prefix":true,"argument":{"type":"Identifier","name":"_n"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"_i"},"property":{"type":"Literal","value":"return"},"computed":true}},"consequent":{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"_i"},"property":{"type":"Literal","value":"return"},"computed":true},"arguments":[]}},"alternate":null}]},"handler":null,"guardedHandlers":[],"finalizer":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"Identifier","name":"_d"},"consequent":{"type":"ThrowStatement","argument":{"type":"Identifier","name":"_e"}},"alternate":null}]}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"_arr"}}]}},{"type":"ReturnStatement","argument":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"arr"},{"type":"Identifier","name":"i"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"isArray"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"arr"}}]},"alternate":{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Identifier","name":"iterator"},"computed":false},"operator":"in","right":{"type":"CallExpression","callee":{"type":"Identifier","name":"Object"},"arguments":[{"type":"Identifier","name":"arr"}]}},"consequent":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"Identifier","name":"sliceIterator"},"arguments":[{"type":"Identifier","name":"arr"},{"type":"Identifier","name":"i"}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"TypeError"},"arguments":[{"type":"Literal","value":"Invalid attempt to destructure non-iterable instance"}]}}]}}}]}}}]},"parenthesizedExpression":true},"arguments":[]}}]},"helper-tagged-template-literal-loose":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"strings"},{"type":"Identifier","name":"raw"}],"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"strings"},"property":{"type":"Identifier","name":"raw"},"computed":false},"right":{"type":"Identifier","name":"raw"}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"strings"}}]},"parenthesizedExpression":true}}]},"helper-tagged-template-literal":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"strings"},{"type":"Identifier","name":"raw"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"freeze"},"computed":false},"arguments":[{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"defineProperties"},"computed":false},"arguments":[{"type":"Identifier","name":"strings"},{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"raw"},"value":{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"value"},"value":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Object"},"property":{"type":"Identifier","name":"freeze"},"computed":false},"arguments":[{"type":"Identifier","name":"raw"}]},"kind":"init"}]},"kind":"init"}]}]}]}}]},"parenthesizedExpression":true}}]},"helper-temporal-assert-defined":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"val"},{"type":"Identifier","name":"name"},{"type":"Identifier","name":"undef"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"val"},"operator":"===","right":{"type":"Identifier","name":"undef"}},"consequent":{"type":"BlockStatement","body":[{"type":"ThrowStatement","argument":{"type":"NewExpression","callee":{"type":"Identifier","name":"ReferenceError"},"arguments":[{"type":"BinaryExpression","left":{"type":"Identifier","name":"name"},"operator":"+","right":{"type":"Literal","value":" is not defined - temporal dead zone"}}]}}]},"alternate":null},{"type":"ReturnStatement","argument":{"type":"Literal","value":true}}]},"parenthesizedExpression":true}}]},"helper-temporal-undefined":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"ObjectExpression","properties":[],"parenthesizedExpression":true}}]},"helper-to-array":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"arr"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"ConditionalExpression","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"isArray"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]},"consequent":{"type":"Identifier","name":"arr"},"alternate":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"from"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]}}}]},"parenthesizedExpression":true}}]},"helper-to-consumable-array":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"arr"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"isArray"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]},"consequent":{"type":"BlockStatement","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"i"},"init":{"type":"Literal","value":0}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"arr2"},"init":{"type":"CallExpression","callee":{"type":"Identifier","name":"Array"},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"arr"},"property":{"type":"Identifier","name":"length"},"computed":false}]}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"i"},"operator":"<","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"arr"},"property":{"type":"Identifier","name":"length"},"computed":false}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"i"}},"body":{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"arr2"},"property":{"type":"Identifier","name":"i"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"arr"},"property":{"type":"Identifier","name":"i"},"computed":true}}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"arr2"}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Array"},"property":{"type":"Identifier","name":"from"},"computed":false},"arguments":[{"type":"Identifier","name":"arr"}]}}]}}]},"parenthesizedExpression":true}}]},"helper-typeof-react-element":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"LogicalExpression","left":{"type":"LogicalExpression","left":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"Symbol"}},"operator":"===","right":{"type":"Literal","value":"function"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Literal","value":"for"},"computed":true}},"operator":"&&","right":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"Symbol"},"property":{"type":"Literal","value":"for"},"computed":true},"arguments":[{"type":"Literal","value":"react.element"}]}},"operator":"||","right":{"type":"Literal","value":60103}}}]},"helper-typeof":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"obj"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"ConditionalExpression","test":{"type":"LogicalExpression","left":{"type":"Identifier","name":"obj"},"operator":"&&","right":{"type":"BinaryExpression","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"obj"},"property":{"type":"Identifier","name":"constructor"},"computed":false},"operator":"===","right":{"type":"Identifier","name":"Symbol"}}},"consequent":{"type":"Literal","value":"symbol"},"alternate":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"obj"}}}}]},"parenthesizedExpression":true}}]},"let-scoping-return":{"type":"Program","body":[{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"RETURN"}},"operator":"===","right":{"type":"Literal","value":"object"}},"consequent":{"type":"ReturnStatement","argument":{"type":"MemberExpression","object":{"type":"Identifier","name":"RETURN"},"property":{"type":"Identifier","name":"v"},"computed":false}},"alternate":null}]},"named-function":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"GET_OUTER_ID"},"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"Identifier","name":"FUNCTION_ID"}}]}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"FUNCTION"}}]},"parenthesizedExpression":true},"arguments":[]}}]},"property-method-assignment-wrapper-generator":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"FUNCTION_KEY"}],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"FUNCTION_ID"},"generator":true,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"YieldExpression","delegate":true,"argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_KEY"},"property":{"type":"Identifier","name":"apply"},"computed":false},"arguments":[{"type":"ThisExpression"},{"type":"Identifier","name":"arguments"}]}}}]}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_ID"},"property":{"type":"Identifier","name":"toString"},"computed":false},"right":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_KEY"},"property":{"type":"Identifier","name":"toString"},"computed":false},"arguments":[]}}]}}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"FUNCTION_ID"}}]},"parenthesizedExpression":true},"arguments":[{"type":"Identifier","name":"FUNCTION"}]}}]},"property-method-assignment-wrapper":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"FUNCTION_KEY"}],"body":{"type":"BlockStatement","body":[{"type":"FunctionDeclaration","id":{"type":"Identifier","name":"FUNCTION_ID"},"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_KEY"},"property":{"type":"Identifier","name":"apply"},"computed":false},"arguments":[{"type":"ThisExpression"},{"type":"Identifier","name":"arguments"}]}}]}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_ID"},"property":{"type":"Identifier","name":"toString"},"computed":false},"right":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"FUNCTION_KEY"},"property":{"type":"Identifier","name":"toString"},"computed":false},"arguments":[]}}]}}}},{"type":"ReturnStatement","argument":{"type":"Identifier","name":"FUNCTION_ID"}}]},"parenthesizedExpression":true},"arguments":[{"type":"Identifier","name":"FUNCTION"}]}}]},"prototype-identifier":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"MemberExpression","object":{"type":"Identifier","name":"CLASS_NAME"},"property":{"type":"Identifier","name":"prototype"},"computed":false}}]},"require-assign-key":{"type":"Program","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"VARIABLE_NAME"},"init":{"type":"MemberExpression","object":{"type":"CallExpression","callee":{"type":"Identifier","name":"require"},"arguments":[{"type":"Identifier","name":"MODULE_NAME"}]},"property":{"type":"Identifier","name":"KEY"},"computed":false}}],"kind":"var"}]},"require":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"require"},"arguments":[{"type":"Identifier","name":"MODULE_NAME"}]}}]},"rest":{"type":"Program","body":[{"type":"ForStatement","init":{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"LEN"},"init":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARGUMENTS"},"property":{"type":"Identifier","name":"length"},"computed":false}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"ARRAY"},"init":{"type":"CallExpression","callee":{"type":"Identifier","name":"Array"},"arguments":[{"type":"Identifier","name":"ARRAY_LEN"}]}},{"type":"VariableDeclarator","id":{"type":"Identifier","name":"KEY"},"init":{"type":"Identifier","name":"START"}}],"kind":"var"},"test":{"type":"BinaryExpression","left":{"type":"Identifier","name":"KEY"},"operator":"<","right":{"type":"Identifier","name":"LEN"}},"update":{"type":"UpdateExpression","operator":"++","prefix":false,"argument":{"type":"Identifier","name":"KEY"}},"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARRAY"},"property":{"type":"Identifier","name":"ARRAY_KEY"},"computed":true},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"ARGUMENTS"},"property":{"type":"Identifier","name":"KEY"},"computed":true}}}]}}]},"self-contained-helpers-head":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"exports"},"property":{"type":"Literal","value":"default"},"computed":true},"right":{"type":"Identifier","name":"HELPER"}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"exports"},"property":{"type":"Identifier","name":"__esModule"},"computed":false},"right":{"type":"Literal","value":true}}}]},"system":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"MemberExpression","object":{"type":"Identifier","name":"System"},"property":{"type":"Identifier","name":"register"},"computed":false},"arguments":[{"type":"Identifier","name":"MODULE_NAME"},{"type":"Identifier","name":"MODULE_DEPENDENCIES"},{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"EXPORT_IDENTIFIER"}],"body":{"type":"BlockStatement","body":[{"type":"ReturnStatement","argument":{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"setters"},"value":{"type":"Identifier","name":"SETTERS"},"kind":"init"},{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"execute"},"value":{"type":"Identifier","name":"EXECUTE"},"kind":"init"}]}}]}}]}}]},"tail-call-body":{"type":"Program","body":[{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"AGAIN_ID"},"init":{"type":"Literal","value":true}}],"kind":"var"},{"type":"LabeledStatement","body":{"type":"WhileStatement","test":{"type":"Identifier","name":"AGAIN_ID"},"body":{"type":"ExpressionStatement","expression":{"type":"Identifier","name":"BLOCK"}}},"label":{"type":"Identifier","name":"FUNCTION_ID"}}]}]},"test-exports":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"exports"}},"operator":"!==","right":{"type":"Literal","value":"undefined"}}}]},"test-module":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"module"}},"operator":"!==","right":{"type":"Literal","value":"undefined"}}}]},"umd-commonjs-strict":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"root"},{"type":"Identifier","name":"factory"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"define"}},"operator":"===","right":{"type":"Literal","value":"function"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"define"},"property":{"type":"Identifier","name":"amd"},"computed":false}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"define"},"arguments":[{"type":"Identifier","name":"AMD_ARGUMENTS"},{"type":"Identifier","name":"factory"}]}}]},"alternate":{"type":"IfStatement","test":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"exports"}},"operator":"===","right":{"type":"Literal","value":"object"}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"factory"},"arguments":[{"type":"Identifier","name":"COMMON_ARGUMENTS"}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"factory"},"arguments":[{"type":"Identifier","name":"BROWSER_ARGUMENTS"}]}}]}}}]},"parenthesizedExpression":true},"arguments":[{"type":"Identifier","name":"UMD_ROOT"},{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"FACTORY_PARAMETERS"}],"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"Identifier","name":"FACTORY_BODY"}}]}}]}}]},"umd-runner-body":{"type":"Program","body":[{"type":"ExpressionStatement","expression":{"type":"FunctionExpression","id":null,"generator":false,"expression":false,"params":[{"type":"Identifier","name":"global"},{"type":"Identifier","name":"factory"}],"body":{"type":"BlockStatement","body":[{"type":"IfStatement","test":{"type":"LogicalExpression","left":{"type":"BinaryExpression","left":{"type":"UnaryExpression","operator":"typeof","prefix":true,"argument":{"type":"Identifier","name":"define"}},"operator":"===","right":{"type":"Literal","value":"function"}},"operator":"&&","right":{"type":"MemberExpression","object":{"type":"Identifier","name":"define"},"property":{"type":"Identifier","name":"amd"},"computed":false}},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"define"},"arguments":[{"type":"Identifier","name":"AMD_ARGUMENTS"},{"type":"Identifier","name":"factory"}]}}]},"alternate":{"type":"IfStatement","test":{"type":"Identifier","name":"COMMON_TEST"},"consequent":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"factory"},"arguments":[{"type":"Identifier","name":"COMMON_ARGUMENTS"}]}}]},"alternate":{"type":"BlockStatement","body":[{"type":"VariableDeclaration","declarations":[{"type":"VariableDeclarator","id":{"type":"Identifier","name":"mod"},"init":{"type":"ObjectExpression","properties":[{"type":"Property","method":false,"shorthand":false,"computed":false,"key":{"type":"Identifier","name":"exports"},"value":{"type":"ObjectExpression","properties":[]},"kind":"init"}]}}],"kind":"var"},{"type":"ExpressionStatement","expression":{"type":"CallExpression","callee":{"type":"Identifier","name":"factory"},"arguments":[{"type":"MemberExpression","object":{"type":"Identifier","name":"mod"},"property":{"type":"Identifier","name":"exports"},"computed":false},{"type":"Identifier","name":"BROWSER_ARGUMENTS"}]}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"Identifier","name":"global"},"property":{"type":"Identifier","name":"GLOBAL_ARG"},"computed":false},"right":{"type":"MemberExpression","object":{"type":"Identifier","name":"mod"},"property":{"type":"Identifier","name":"exports"},"computed":false}}}]}}}]},"parenthesizedExpression":true}}]}} -},{}],613:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.parse = parse; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _parser = _dereq_(617); - -var _parser2 = _interopRequireDefault(_parser); - -_dereq_(622); - -_dereq_(621); - -_dereq_(619); - -_dereq_(616); - -_dereq_(620); - -_dereq_(618); - -_dereq_(615); - -var _tokenizerTypes = _dereq_(629); - -_dereq_(627); - -_dereq_(626); - -var _pluginsFlow = _dereq_(623); - -var _pluginsFlow2 = _interopRequireDefault(_pluginsFlow); - -var _pluginsJsx = _dereq_(624); - -var _pluginsJsx2 = _interopRequireDefault(_pluginsJsx); - -_parser.plugins.flow = _pluginsFlow2["default"]; -_parser.plugins.jsx = _pluginsJsx2["default"]; - -function parse(input, options) { - return new _parser2["default"](options, input).parse(); -} - -exports.tokTypes = _tokenizerTypes.types; -},{"615":615,"616":616,"617":617,"618":618,"619":619,"620":620,"621":621,"622":622,"623":623,"624":624,"626":626,"627":627,"629":629}],614:[function(_dereq_,module,exports){ -// A second optional argument can be given to further configure -// the parser process. These options are recognized: - -"use strict"; - -exports.__esModule = true; -exports.getOptions = getOptions; -var defaultOptions = { - // Source type ("script" or "module") for different semantics - sourceType: "script", - // By default, reserved words are not enforced. Disable - // `allowReserved` to enforce them. When this option has the - // value "never", reserved words and keywords can also not be - // used as property names. - allowReserved: true, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - plugins: {}, - // Babel-specific options - features: {}, - strictMode: null -}; - -exports.defaultOptions = defaultOptions; -// Interpret and default an options object - -function getOptions(opts) { - var options = {}; - for (var key in defaultOptions) { - options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; - } - return options; -} -},{}],615:[function(_dereq_,module,exports){ -/** - * Based on the comment attachment algorithm used in espree and estraverse. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -function last(stack) { - return stack[stack.length - 1]; -} - -var pp = _index2["default"].prototype; - -pp.addComment = function (comment) { - this.state.trailingComments.push(comment); - this.state.leadingComments.push(comment); -}; - -pp.processComment = function (node) { - if (node.type === "Program" && node.body.length > 0) return; - - var stack = this.state.commentStack; - - var lastChild, trailingComments, i; - - if (this.state.trailingComments.length > 0) { - // If the first comment in trailingComments comes after the - // current node, then we're good - all comments in the array will - // come after the node and so it's safe to add them as official - // trailingComments. - if (this.state.trailingComments[0].start >= node.end) { - trailingComments = this.state.trailingComments; - this.state.trailingComments = []; - } else { - // Otherwise, if the first comment doesn't come after the - // current node, that means we have a mix of leading and trailing - // comments in the array and that leadingComments contains the - // same items as trailingComments. Reset trailingComments to - // zero items and we'll handle this by evaluating leadingComments - // later. - this.state.trailingComments.length = 0; - } - } else { - var lastInStack = last(stack); - if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) { - trailingComments = lastInStack.trailingComments; - lastInStack.trailingComments = null; - } - } - - // Eating the stack. - while (stack.length > 0 && last(stack).start >= node.start) { - lastChild = stack.pop(); - } - - if (lastChild) { - if (lastChild.leadingComments) { - if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) { - node.leadingComments = lastChild.leadingComments; - lastChild.leadingComments = null; - } else { - // A leading comment for an anonymous class had been stolen by its first MethodDefinition, - // so this takes back the leading comment. - // See also: https://github.com/eslint/espree/issues/158 - for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { - if (lastChild.leadingComments[i].end <= node.start) { - node.leadingComments = lastChild.leadingComments.splice(0, i + 1); - break; - } - } - } - } - } else if (this.state.leadingComments.length > 0) { - if (last(this.state.leadingComments).end <= node.start) { - node.leadingComments = this.state.leadingComments; - this.state.leadingComments = []; - } else { - // https://github.com/eslint/espree/issues/2 - // - // In special cases, such as return (without a value) and - // debugger, all comments will end up as leadingComments and - // will otherwise be eliminated. This step runs when the - // commentStack is empty and there are comments left - // in leadingComments. - // - // This loop figures out the stopping point between the actual - // leading and trailing comments by finding the location of the - // first comment that comes after the given node. - for (i = 0; i < this.state.leadingComments.length; i++) { - if (this.state.leadingComments[i].end > node.start) { - break; - } - } - - // Split the array based on the location of the first comment - // that comes after the node. Keep in mind that this could - // result in an empty array, and if so, the array must be - // deleted. - node.leadingComments = this.state.leadingComments.slice(0, i); - if (node.leadingComments.length === 0) { - node.leadingComments = null; - } - - // Similarly, trailing comments are attached later. The variable - // must be reset to null if there are no trailing comments. - trailingComments = this.state.leadingComments.slice(i); - if (trailingComments.length === 0) { - trailingComments = null; - } - } - } - - if (trailingComments) { - if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) { - node.innerComments = trailingComments; - } else { - node.trailingComments = trailingComments; - } - } - - stack.push(node); -}; -},{"617":617}],616:[function(_dereq_,module,exports){ -// A recursive descent parser operates by defining functions for all -// syntactic elements, and recursively calling those, each function -// advancing the input stream and returning an AST node. Precedence -// of constructs (for example, the fact that `!x[1]` means `!(x[1])` -// instead of `(!x)[1]` is handled by the fact that the parser -// function that parses unary prefix operators is called first, and -// in turn calls the function that parses `[]` subscripts — that -// way, it'll receive the node for `x[1]` already parsed, and wraps -// *that* in the unary operator node. -// -// Acorn uses an [operator precedence parser][opp] to handle binary -// operator precedence, because it is much more compact than using -// the technique outlined above, which uses different, nesting -// functions to specify precedence, for all of the ten binary -// precedence levels that JavaScript defines. -// -// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser - -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _tokenizerTypes = _dereq_(629); - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var _utilIdentifier = _dereq_(630); - -var pp = _index2["default"].prototype; - -// Check if property name clashes with already added. -// Object/class getters and setters are not allowed to clash — -// either with each other or with an init property — and in -// strict mode, init properties are also not allowed to be repeated. - -pp.checkPropClash = function (prop, propHash) { - if (prop.computed || prop.method || prop.shorthand) return; - - var key = prop.key, - name = undefined; - switch (key.type) { - case "Identifier": - name = key.name;break; - case "Literal": - name = String(key.value);break; - default: - return; - } - - var kind = prop.kind; - if (name === "__proto__" && kind === "init") { - if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); - propHash.proto = true; - } -}; - -// ### Expression parsing - -// These nest, from the most general expression type at the top to -// 'atomic', nondivisible expression types at the bottom. Most of -// the functions will simply let the function (s) below them parse, -// and, *if* the syntactic construct they handle is present, wrap -// the AST node that the inner parser gave them in another node. - -// Parse a full expression. The optional arguments are used to -// forbid the `in` operator (in for loops initalization expressions) -// and provide reference for storing '=' operator inside shorthand -// property assignment in contexts where both object expression -// and object pattern might appear (so it's possible to raise -// delayed syntax error at correct position). - -pp.parseExpression = function (noIn, refShorthandDefaultPos) { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); - if (this.match(_tokenizerTypes.types.comma)) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; - while (this.eat(_tokenizerTypes.types.comma)) { - node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos)); - } - this.toReferencedList(node.expressions); - return this.finishNode(node, "SequenceExpression"); - } - return expr; -}; - -// Parse an assignment expression. This includes applications of -// operators like `+=`. - -pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) { - if (this.match(_tokenizerTypes.types._yield) && this.state.inGenerator) { - return this.parseYield(); - } - - var failOnShorthandAssign = undefined; - if (!refShorthandDefaultPos) { - refShorthandDefaultPos = { start: 0 }; - failOnShorthandAssign = true; - } else { - failOnShorthandAssign = false; - } - var startPos = this.state.start, - startLoc = this.state.startLoc; - if (this.match(_tokenizerTypes.types.parenL) || this.match(_tokenizerTypes.types.name)) { - this.state.potentialArrowAt = this.state.start; - } - var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos); - if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); - if (this.state.type.isAssign) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.state.value; - node.left = this.match(_tokenizerTypes.types.eq) ? this.toAssignable(left) : left; - refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly - this.checkLVal(left); - if (left.parenthesizedExpression) { - var errorMsg = undefined; - if (left.type === "ObjectPattern") { - errorMsg = "`({a}) = 0` use `({a} = 0)`"; - } else if (left.type === "ArrayPattern") { - errorMsg = "`([a]) = 0` use `([a] = 0)`"; - } - if (errorMsg) { - this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg); - } - } - this.next(); - node.right = this.parseMaybeAssign(noIn); - return this.finishNode(node, "AssignmentExpression"); - } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } - return left; -}; - -// Parse a ternary conditional (`?:`) operator. - -pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var expr = this.parseExprOps(noIn, refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - if (this.eat(_tokenizerTypes.types.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); - this.expect(_tokenizerTypes.types.colon); - node.alternate = this.parseMaybeAssign(noIn); - return this.finishNode(node, "ConditionalExpression"); - } - return expr; -}; - -// Start the precedence parser. - -pp.parseExprOps = function (noIn, refShorthandDefaultPos) { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var expr = this.parseMaybeUnary(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { - return expr; - } else { - return this.parseExprOp(expr, startPos, startLoc, -1, noIn); - } -}; - -// Parse binary operators with the operator precedence parsing -// algorithm. `left` is the left-hand side of the operator. -// `minPrec` provides context that allows the function to stop and -// defer further parser to one of its callers when it encounters an -// operator that has a lower precedence than the set it is parsing. - -pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { - var prec = this.state.type.binop; - if (prec != null && (!noIn || !this.match(_tokenizerTypes.types._in))) { - if (prec > minPrec) { - var node = this.startNodeAt(leftStartPos, leftStartLoc); - node.left = left; - node.operator = this.state.value; - var op = this.state.type; - this.next(); - var startPos = this.state.start, - startLoc = this.state.startLoc; - node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn); - this.finishNode(node, op === _tokenizerTypes.types.logicalOR || op === _tokenizerTypes.types.logicalAND ? "LogicalExpression" : "BinaryExpression"); - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); - } - } - return left; -}; - -// Parse unary operators, both prefix and postfix. - -pp.parseMaybeUnary = function (refShorthandDefaultPos) { - if (this.state.type.prefix) { - var node = this.startNode(), - update = this.match(_tokenizerTypes.types.incDec); - node.operator = this.state.value; - node.prefix = true; - this.next(); - node.argument = this.parseMaybeUnary(); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); - if (update) { - this.checkLVal(node.argument); - } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { - this.raise(node.start, "Deleting local variable in strict mode"); - } - return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); - } - - var startPos = this.state.start, - startLoc = this.state.startLoc; - var expr = this.parseExprSubscripts(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - while (this.state.type.postfix && !this.canInsertSemicolon()) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.state.value; - node.prefix = false; - node.argument = expr; - this.checkLVal(expr); - this.next(); - expr = this.finishNode(node, "UpdateExpression"); - } - return expr; -}; - -// Parse call, dot, and `[]`-subscript expressions. - -pp.parseExprSubscripts = function (refShorthandDefaultPos) { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var expr = this.parseExprAtom(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { - return expr; - } else { - return this.parseSubscripts(expr, startPos, startLoc); - } -}; - -pp.parseSubscripts = function (base, startPos, startLoc, noCalls) { - for (;;) { - if (!noCalls && this.eat(_tokenizerTypes.types.doubleColon)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.callee = this.parseNoCallExpr(); - return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls); - } else if (this.eat(_tokenizerTypes.types.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseIdent(true); - node.computed = false; - base = this.finishNode(node, "MemberExpression"); - } else if (this.eat(_tokenizerTypes.types.bracketL)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(_tokenizerTypes.types.bracketR); - base = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.match(_tokenizerTypes.types.parenL)) { - var possibleAsync = base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon(); - this.next(); - - var node = this.startNodeAt(startPos, startLoc); - node.callee = base; - node.arguments = this.parseExprList(_tokenizerTypes.types.parenR, this.options.features["es7.trailingFunctionCommas"]); - base = this.finishNode(node, "CallExpression"); - - if (possibleAsync && (this.match(_tokenizerTypes.types.colon) || this.match(_tokenizerTypes.types.arrow))) { - base = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node); - } else { - this.toReferencedList(node.arguments); - } - } else if (this.match(_tokenizerTypes.types.backQuote)) { - var node = this.startNodeAt(startPos, startLoc); - node.tag = base; - node.quasi = this.parseTemplate(); - base = this.finishNode(node, "TaggedTemplateExpression"); - } else { - return base; - } - } -}; - -pp.parseAsyncArrowFromCallExpression = function (node, call) { - if (!this.options.features["es7.asyncFunctions"]) this.unexpected(); - this.expect(_tokenizerTypes.types.arrow); - return this.parseArrowExpression(node, call.arguments, true); -}; - -// Parse a no-call expression (like argument of `new` or `::` operators). - -pp.parseNoCallExpr = function () { - var startPos = this.state.start, - startLoc = this.state.startLoc; - return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); -}; - -// Parse an atomic expression — either a single token that is an -// expression, an expression started by a keyword like `function` or -// `new`, or an expression wrapped in punctuation like `()`, `[]`, -// or `{}`. - -pp.parseExprAtom = function (refShorthandDefaultPos) { - var node = undefined, - canBeArrow = this.state.potentialArrowAt === this.state.start; - switch (this.state.type) { - case _tokenizerTypes.types._super: - if (!this.state.inFunction) this.raise(this.state.start, "'super' outside of function or class"); - case _tokenizerTypes.types._this: - var type = this.match(_tokenizerTypes.types._this) ? "ThisExpression" : "Super"; - node = this.startNode(); - this.next(); - return this.finishNode(node, type); - - case _tokenizerTypes.types._yield: - if (this.state.inGenerator) this.unexpected(); - - case _tokenizerTypes.types._do: - if (this.options.features["es7.doExpressions"]) { - var _node = this.startNode(); - this.next(); - var oldInFunction = this.state.inFunction; - var oldLabels = this.state.labels; - this.state.labels = []; - this.state.inFunction = false; - _node.body = this.parseBlock(); - this.state.inFunction = oldInFunction; - this.state.labels = oldLabels; - return this.finishNode(_node, "DoExpression"); - } - - case _tokenizerTypes.types.name: - node = this.startNode(); - var id = this.parseIdent(true); - - if (this.options.features["es7.asyncFunctions"]) { - if (id.name === "await") { - if (this.inAsync) return this.parseAwait(node); - } else if (id.name === "async" && this.match(_tokenizerTypes.types._function) && !this.canInsertSemicolon()) { - this.next(); - return this.parseFunction(node, false, false, true); - } else if (canBeArrow && id.name === "async" && this.match(_tokenizerTypes.types.name)) { - var params = [this.parseIdent()]; - this.expect(_tokenizerTypes.types.arrow); - // var foo = bar => {}; - return this.parseArrowExpression(node, params, true); - } - } - - if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokenizerTypes.types.arrow)) { - return this.parseArrowExpression(node, [id]); - } - - return id; - - case _tokenizerTypes.types.regexp: - var value = this.state.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; - - case _tokenizerTypes.types.num:case _tokenizerTypes.types.string: - return this.parseLiteral(this.state.value); - - case _tokenizerTypes.types._null:case _tokenizerTypes.types._true:case _tokenizerTypes.types._false: - node = this.startNode(); - node.rawValue = node.value = this.match(_tokenizerTypes.types._null) ? null : this.match(_tokenizerTypes.types._true); - node.raw = this.state.type.keyword; - this.next(); - return this.finishNode(node, "Literal"); - - case _tokenizerTypes.types.parenL: - return this.parseParenAndDistinguishExpression(null, null, canBeArrow); - - case _tokenizerTypes.types.bracketL: - node = this.startNode(); - this.next(); - // check whether this is array comprehension or regular array - if (this.options.features["es7.comprehensions"] && this.match(_tokenizerTypes.types._for)) { - return this.parseComprehension(node, false); - } - node.elements = this.parseExprList(_tokenizerTypes.types.bracketR, true, true, refShorthandDefaultPos); - this.toReferencedList(node.elements); - return this.finishNode(node, "ArrayExpression"); - - case _tokenizerTypes.types.braceL: - return this.parseObj(false, refShorthandDefaultPos); - - case _tokenizerTypes.types._function: - node = this.startNode(); - this.next(); - return this.parseFunction(node, false); - - case _tokenizerTypes.types.at: - this.parseDecorators(); - - case _tokenizerTypes.types._class: - node = this.startNode(); - this.takeDecorators(node); - return this.parseClass(node, false); - - case _tokenizerTypes.types._new: - return this.parseNew(); - - case _tokenizerTypes.types.backQuote: - return this.parseTemplate(); - - case _tokenizerTypes.types.doubleColon: - node = this.startNode(); - this.next(); - node.object = null; - var callee = node.callee = this.parseNoCallExpr(); - if (callee.type === "MemberExpression") { - return this.finishNode(node, "BindExpression"); - } else { - this.raise(callee.start, "Binding should be performed on object property."); - } - - default: - this.unexpected(); - } -}; - -pp.parseLiteral = function (value) { - var node = this.startNode(); - node.rawValue = node.value = value; - node.raw = this.input.slice(this.state.start, this.state.end); - this.next(); - return this.finishNode(node, "Literal"); -}; - -pp.parseParenExpression = function () { - this.expect(_tokenizerTypes.types.parenL); - var val = this.parseExpression(); - this.expect(_tokenizerTypes.types.parenR); - return val; -}; - -pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow, isAsync) { - startPos = startPos || this.state.start; - startLoc = startLoc || this.state.startLoc; - var val = undefined; - this.next(); - - if (this.options.features["es7.comprehensions"] && this.match(_tokenizerTypes.types._for)) { - return this.parseComprehension(this.startNodeAt(startPos, startLoc), true); - } - - var innerStartPos = this.state.start, - innerStartLoc = this.state.startLoc; - var exprList = [], - first = true; - var refShorthandDefaultPos = { start: 0 }, - spreadStart = undefined, - innerParenStart = undefined, - optionalCommaStart = undefined; - while (!this.match(_tokenizerTypes.types.parenR)) { - if (first) { - first = false; - } else { - this.expect(_tokenizerTypes.types.comma); - if (this.match(_tokenizerTypes.types.parenR) && this.options.features["es7.trailingFunctionCommas"]) { - optionalCommaStart = this.state.start; - break; - } - } - - if (this.match(_tokenizerTypes.types.ellipsis)) { - var spreadNodeStartPos = this.state.start, - spreadNodeStartLoc = this.state.startLoc; - spreadStart = this.state.start; - exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartLoc, spreadNodeStartPos)); - break; - } else { - if (this.match(_tokenizerTypes.types.parenL) && !innerParenStart) { - innerParenStart = this.state.start; - } - exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem)); - } - } - var innerEndPos = this.state.start; - var innerEndLoc = this.state.startLoc; - this.expect(_tokenizerTypes.types.parenR); - - if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokenizerTypes.types.arrow)) { - if (innerParenStart) this.unexpected(innerParenStart); - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, isAsync); - } - - if (!exprList.length) { - if (isAsync) { - return; - } else { - this.unexpected(this.state.lastTokStart); - } - } - if (optionalCommaStart) this.unexpected(optionalCommaStart); - if (spreadStart) this.unexpected(spreadStart); - if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); - - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc); - val.expressions = exprList; - this.toReferencedList(val.expressions); - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); - } else { - val = exprList[0]; - } - - val.parenthesizedExpression = true; - return val; -}; - -pp.parseParenItem = function (node) { - return node; -}; - -// New's precedence is slightly tricky. It must allow its argument -// to be a `[]` or dot subscript expression, but not a call — at -// least, not without wrapping it in parentheses. Thus, it uses the - -pp.parseNew = function () { - var node = this.startNode(); - var meta = this.parseIdent(true); - - if (this.eat(_tokenizerTypes.types.dot)) { - node.meta = meta; - node.property = this.parseIdent(true); - - if (node.property.name !== "target") { - this.raise(node.property.start, "The only valid meta property for new is new.target"); - } - - return this.finishNode(node, "MetaProperty"); - } - - node.callee = this.parseNoCallExpr(); - - if (this.eat(_tokenizerTypes.types.parenL)) { - node.arguments = this.parseExprList(_tokenizerTypes.types.parenR, this.options.features["es7.trailingFunctionCommas"]); - this.toReferencedList(node.arguments); - } else { - node.arguments = []; - } - - return this.finishNode(node, "NewExpression"); -}; - -// Parse template expression. - -pp.parseTemplateElement = function () { - var elem = this.startNode(); - elem.value = { - raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"), - cooked: this.state.value - }; - this.next(); - elem.tail = this.match(_tokenizerTypes.types.backQuote); - return this.finishNode(elem, "TemplateElement"); -}; - -pp.parseTemplate = function () { - var node = this.startNode(); - this.next(); - node.expressions = []; - var curElt = this.parseTemplateElement(); - node.quasis = [curElt]; - while (!curElt.tail) { - this.expect(_tokenizerTypes.types.dollarBraceL); - node.expressions.push(this.parseExpression()); - this.expect(_tokenizerTypes.types.braceR); - node.quasis.push(curElt = this.parseTemplateElement()); - } - this.next(); - return this.finishNode(node, "TemplateLiteral"); -}; - -// Parse an object literal or binding pattern. - -pp.parseObj = function (isPattern, refShorthandDefaultPos) { - var node = this.startNode(), - first = true, - propHash = Object.create(null); - node.properties = []; - var decorators = []; - this.next(); - while (!this.eat(_tokenizerTypes.types.braceR)) { - if (first) { - first = false; - } else { - this.expect(_tokenizerTypes.types.comma); - if (this.eat(_tokenizerTypes.types.braceR)) break; - } - - while (this.match(_tokenizerTypes.types.at)) { - decorators.push(this.parseDecorator()); - } - - var prop = this.startNode(), - isGenerator = false, - isAsync = false, - startPos = undefined, - startLoc = undefined; - if (decorators.length) { - prop.decorators = decorators; - decorators = []; - } - if (this.options.features["es7.objectRestSpread"] && this.match(_tokenizerTypes.types.ellipsis)) { - prop = this.parseSpread(); - prop.type = "SpreadProperty"; - node.properties.push(prop); - continue; - } - prop.method = false; - prop.shorthand = false; - if (isPattern || refShorthandDefaultPos) { - startPos = this.state.start; - startLoc = this.state.startLoc; - } - if (!isPattern) { - isGenerator = this.eat(_tokenizerTypes.types.star); - } - if (!isPattern && this.options.features["es7.asyncFunctions"] && this.isContextual("async")) { - if (isGenerator) this.unexpected(); - var asyncId = this.parseIdent(); - if (this.match(_tokenizerTypes.types.colon) || this.match(_tokenizerTypes.types.parenL) || this.match(_tokenizerTypes.types.braceR)) { - prop.key = asyncId; - } else { - isAsync = true; - this.parsePropertyName(prop); - } - } else { - this.parsePropertyName(prop); - } - this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos); - this.checkPropClash(prop, propHash); - node.properties.push(this.finishNode(prop, "Property")); - } - if (decorators.length) { - this.raise(this.state.start, "You have trailing decorators with no property"); - } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); -}; - -pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) { - if (this.eat(_tokenizerTypes.types.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos); - prop.kind = "init"; - } else if (this.match(_tokenizerTypes.types.parenL)) { - if (isPattern) this.unexpected(); - prop.kind = "init"; - prop.method = true; - prop.value = this.parseMethod(isGenerator, isAsync); - } else if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && !this.match(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR)) { - if (isGenerator || isAsync || isPattern) this.unexpected(); - prop.kind = prop.key.name; - this.parsePropertyName(prop); - prop.value = this.parseMethod(false); - var paramCount = prop.kind === "get" ? 0 : 1; - if (prop.value.params.length !== paramCount) { - var start = prop.value.start; - if (prop.kind === "get") this.raise(start, "getter should have no params");else this.raise(start, "setter should have exactly one param"); - } - } else if (!prop.computed && prop.key.type === "Identifier") { - prop.kind = "init"; - if (isPattern) { - if (this.isKeyword(prop.key.name) || this.strict && (_utilIdentifier.reservedWords.strictBind(prop.key.name) || _utilIdentifier.reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name); - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); - } else if (this.match(_tokenizerTypes.types.eq) && refShorthandDefaultPos) { - if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.state.start; - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); - } else { - prop.value = prop.key.__clone(); - } - prop.shorthand = true; - } else { - this.unexpected(); - } -}; - -pp.parsePropertyName = function (prop) { - if (this.eat(_tokenizerTypes.types.bracketL)) { - prop.computed = true; - prop.key = this.parseMaybeAssign(); - this.expect(_tokenizerTypes.types.bracketR); - return prop.key; - } else { - prop.computed = false; - return prop.key = this.match(_tokenizerTypes.types.num) || this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.parseIdent(true); - } -}; - -// Initialize empty function node. - -pp.initFunction = function (node, isAsync) { - node.id = null; - node.generator = false; - node.expression = false; - if (this.options.features["es7.asyncFunctions"]) { - node.async = !!isAsync; - } -}; - -// Parse object or class method. - -pp.parseMethod = function (isGenerator, isAsync) { - var node = this.startNode(); - this.initFunction(node, isAsync); - this.expect(_tokenizerTypes.types.parenL); - node.params = this.parseBindingList(_tokenizerTypes.types.parenR, false, this.options.features["es7.trailingFunctionCommas"]); - node.generator = isGenerator; - this.parseFunctionBody(node); - return this.finishNode(node, "FunctionExpression"); -}; - -// Parse arrow function expression with given parameters. - -pp.parseArrowExpression = function (node, params, isAsync) { - this.initFunction(node, isAsync); - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true); - return this.finishNode(node, "ArrowFunctionExpression"); -}; - -// Parse function body and check parameters. - -pp.parseFunctionBody = function (node, allowExpression) { - var isExpression = allowExpression && !this.match(_tokenizerTypes.types.braceL); - - var oldInAsync = this.inAsync; - this.inAsync = node.async; - if (isExpression) { - node.body = this.parseMaybeAssign(); - node.expression = true; - } else { - // Start a new scope with regard to labels and the `inFunction` - // flag (restore them to their old value afterwards). - var oldInFunc = this.state.inFunction, - oldInGen = this.state.inGenerator, - oldLabels = this.state.labels; - this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = []; - node.body = this.parseBlock(true); - node.expression = false; - this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels; - } - this.inAsync = oldInAsync; - - // If this is a strict mode function, verify that argument names - // are not repeated, and it does not try to bind the words `eval` - // or `arguments`. - if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) { - var nameHash = Object.create(null), - oldStrict = this.strict; - this.strict = true; - if (node.id) { - this.checkLVal(node.id, true); - } - var _arr = node.params; - for (var _i = 0; _i < _arr.length; _i++) { - var param = _arr[_i]; - this.checkLVal(param, true, nameHash); - } - this.strict = oldStrict; - } -}; - -// Parses a comma-separated list of expressions, and returns them as -// an array. `close` is the token type that ends the list, and -// `allowEmpty` can be turned on to allow subsequent commas with -// nothing in between them to be parsed as `null` (which is needed -// for array literals). - -pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (first) { - first = false; - } else { - this.expect(_tokenizerTypes.types.comma); - if (allowTrailingComma && this.eat(close)) break; - } - - elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos)); - } - return elts; -}; - -pp.parseExprListItem = function (allowEmpty, refShorthandDefaultPos) { - var elt = undefined; - if (allowEmpty && this.match(_tokenizerTypes.types.comma)) { - elt = null; - } else if (this.match(_tokenizerTypes.types.ellipsis)) { - elt = this.parseSpread(refShorthandDefaultPos); - } else { - elt = this.parseMaybeAssign(false, refShorthandDefaultPos); - } - return elt; -}; - -// Parse the next token as an identifier. If `liberal` is true (used -// when parsing properties), it will also convert keywords into -// identifiers. - -pp.parseIdent = function (liberal) { - var node = this.startNode(); - if (this.match(_tokenizerTypes.types.name)) { - if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.state.value) || this.strict && _utilIdentifier.reservedWords.strict(this.state.value))) this.raise(this.state.start, "The keyword '" + this.state.value + "' is reserved"); - node.name = this.state.value; - } else if (liberal && this.state.type.keyword) { - node.name = this.state.type.keyword; - } else { - this.unexpected(); - } - this.next(); - return this.finishNode(node, "Identifier"); -}; - -// Parses await expression inside async function. - -pp.parseAwait = function (node) { - if (this.eat(_tokenizerTypes.types.semi) || this.canInsertSemicolon()) { - this.unexpected(); - } - node.all = this.eat(_tokenizerTypes.types.star); - node.argument = this.parseMaybeUnary(); - return this.finishNode(node, "AwaitExpression"); -}; - -// Parses yield expression inside generator. - -pp.parseYield = function () { - var node = this.startNode(); - this.next(); - if (this.match(_tokenizerTypes.types.semi) || this.canInsertSemicolon() || !this.match(_tokenizerTypes.types.star) && !this.state.type.startsExpr) { - node.delegate = false; - node.argument = null; - } else { - node.delegate = this.eat(_tokenizerTypes.types.star); - node.argument = this.parseMaybeAssign(); - } - return this.finishNode(node, "YieldExpression"); -}; - -// Parses array and generator comprehensions. - -pp.parseComprehension = function (node, isGenerator) { - node.blocks = []; - while (this.match(_tokenizerTypes.types._for)) { - var block = this.startNode(); - this.next(); - this.expect(_tokenizerTypes.types.parenL); - block.left = this.parseBindingAtom(); - this.checkLVal(block.left, true); - this.expectContextual("of"); - block.right = this.parseExpression(); - this.expect(_tokenizerTypes.types.parenR); - node.blocks.push(this.finishNode(block, "ComprehensionBlock")); - } - node.filter = this.eat(_tokenizerTypes.types._if) ? this.parseParenExpression() : null; - node.body = this.parseExpression(); - this.expect(isGenerator ? _tokenizerTypes.types.parenR : _tokenizerTypes.types.bracketR); - node.generator = isGenerator; - return this.finishNode(node, "ComprehensionExpression"); -}; -},{"617":617,"629":629,"630":630}],617:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// istanbul ignore next - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _utilIdentifier = _dereq_(630); - -var _options = _dereq_(614); - -var _tokenizer = _dereq_(627); - -var _tokenizer2 = _interopRequireDefault(_tokenizer); - -// Registered plugins - -var plugins = {}; - -exports.plugins = plugins; - -var Parser = (function (_Tokenizer) { - _inherits(Parser, _Tokenizer); - - function Parser(options, input) { - _classCallCheck(this, Parser); - - _Tokenizer.call(this, input); - - this.options = _options.getOptions(options); - this.isKeyword = _utilIdentifier.isKeyword; - this.isReservedWord = _utilIdentifier.reservedWords[6]; - this.input = input; - this.loadPlugins(this.options.plugins); - - // Figure out if it's a module code. - this.inModule = this.options.sourceType === "module"; - this.strict = this.options.strictMode === false ? false : this.inModule; - - // If enabled, skip leading hashbang line. - if (this.state.pos === 0 && this.input[0] === "#" && this.input[1] === "!") { - this.skipLineComment(2); - } - } - - Parser.prototype.extend = function extend(name, f) { - this[name] = f(this[name]); - }; - - Parser.prototype.loadPlugins = function loadPlugins(plugins) { - for (var _name in plugins) { - var plugin = exports.plugins[_name]; - if (!plugin) throw new Error("Plugin '" + _name + "' not found"); - plugin(this, plugins[_name]); - } - }; - - Parser.prototype.parse = function parse() { - var file = this.startNode(); - var program = this.startNode(); - this.nextToken(); - return this.parseTopLevel(file, program); - }; - - return Parser; -})(_tokenizer2["default"]); - -exports["default"] = Parser; -},{"614":614,"627":627,"630":630}],618:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _utilLocation = _dereq_(631); - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var pp = _index2["default"].prototype; - -// This function is used to raise exceptions on parse errors. It -// takes an offset integer (into the current `input`) to indicate -// the location of the error, attaches the position to the end -// of the error message, and then raises a `SyntaxError` with that -// message. - -pp.raise = function (pos, message) { - var loc = _utilLocation.getLineInfo(this.input, pos); - message += " (" + loc.line + ":" + loc.column + ")"; - var err = new SyntaxError(message); - err.pos = pos; - err.loc = loc; - throw err; -}; -},{"617":617,"631":631}],619:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _tokenizerTypes = _dereq_(629); - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var _utilIdentifier = _dereq_(630); - -var pp = _index2["default"].prototype; - -// Convert existing expression atom to assignable pattern -// if possible. - -pp.toAssignable = function (node, isBinding) { - if (node) { - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - break; - - case "ObjectExpression": - node.type = "ObjectPattern"; - var _arr = node.properties; - for (var _i = 0; _i < _arr.length; _i++) { - var prop = _arr[_i]; - if (prop.type === "SpreadProperty") continue; - if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter"); - this.toAssignable(prop.value, isBinding); - } - break; - - case "ArrayExpression": - node.type = "ArrayPattern"; - this.toAssignableList(node.elements, isBinding); - break; - - case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - delete node.operator; - } else { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); - } - break; - - case "MemberExpression": - if (!isBinding) break; - - default: - this.raise(node.start, "Assigning to rvalue"); - } - } - return node; -}; - -// Convert list of expression atoms to binding list. - -pp.toAssignableList = function (exprList, isBinding) { - var end = exprList.length; - if (end) { - var last = exprList[end - 1]; - if (last && last.type === "RestElement") { - --end; - } else if (last && last.type === "SpreadElement") { - last.type = "RestElement"; - var arg = last.argument; - this.toAssignable(arg, isBinding); - if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") { - this.unexpected(arg.start); - } - --end; - } - } - for (var i = 0; i < end; i++) { - var elt = exprList[i]; - if (elt) this.toAssignable(elt, isBinding); - } - return exprList; -}; - -// Convert list of expression atoms to a list of - -pp.toReferencedList = function (exprList) { - return exprList; -}; - -// Parses spread element. - -pp.parseSpread = function (refShorthandDefaultPos) { - var node = this.startNode(); - this.next(); - node.argument = this.parseMaybeAssign(refShorthandDefaultPos); - return this.finishNode(node, "SpreadElement"); -}; - -pp.parseRest = function () { - var node = this.startNode(); - this.next(); - node.argument = this.match(_tokenizerTypes.types.name) || this.match(_tokenizerTypes.types.bracketL) ? this.parseBindingAtom() : this.unexpected(); - return this.finishNode(node, "RestElement"); -}; - -// Parses lvalue (assignable) atom. - -pp.parseBindingAtom = function () { - switch (this.state.type) { - case _tokenizerTypes.types.name: - return this.parseIdent(); - - case _tokenizerTypes.types.bracketL: - var node = this.startNode(); - this.next(); - node.elements = this.parseBindingList(_tokenizerTypes.types.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); - - case _tokenizerTypes.types.braceL: - return this.parseObj(true); - - default: - this.unexpected(); - } -}; - -pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (first) first = false;else this.expect(_tokenizerTypes.types.comma); - if (allowEmpty && this.match(_tokenizerTypes.types.comma)) { - elts.push(null); - } else if (allowTrailingComma && this.eat(close)) { - break; - } else if (this.match(_tokenizerTypes.types.ellipsis)) { - elts.push(this.parseAssignableListItemTypes(this.parseRest())); - this.expect(close); - break; - } else { - var left = this.parseMaybeDefault(); - this.parseAssignableListItemTypes(left); - elts.push(this.parseMaybeDefault(null, null, left)); - } - } - return elts; -}; - -pp.parseAssignableListItemTypes = function (param) { - return param; -}; - -// Parses assignment pattern around given atom if possible. - -pp.parseMaybeDefault = function (startPos, startLoc, left) { - startLoc = startLoc || this.state.startLoc; - startPos = startPos || this.state.start; - left = left || this.parseBindingAtom(); - if (!this.eat(_tokenizerTypes.types.eq)) return left; - - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); -}; - -// Verify that a node is an lval — something that can be assigned -// to. - -pp.checkLVal = function (expr, isBinding, checkClashes) { - switch (expr.type) { - case "Identifier": - if (this.strict && (_utilIdentifier.reservedWords.strictBind(expr.name) || _utilIdentifier.reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); - if (checkClashes) { - if (checkClashes[expr.name]) { - this.raise(expr.start, "Argument name clash in strict mode"); - } else { - checkClashes[expr.name] = true; - } - } - break; - - case "MemberExpression": - if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression"); - break; - - case "ObjectPattern": - var _arr2 = expr.properties; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var prop = _arr2[_i2]; - if (prop.type === "Property") prop = prop.value; - this.checkLVal(prop, isBinding, checkClashes); - } - break; - - case "ArrayPattern": - var _arr3 = expr.elements; - - for (var _i3 = 0; _i3 < _arr3.length; _i3++) { - var elem = _arr3[_i3]; - if (elem) this.checkLVal(elem, isBinding, checkClashes); - } - break; - - case "AssignmentPattern": - this.checkLVal(expr.left, isBinding, checkClashes); - break; - - case "SpreadProperty": - case "RestElement": - this.checkLVal(expr.argument, isBinding, checkClashes); - break; - - default: - this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue"); - } -}; -},{"617":617,"629":629,"630":630}],620:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var _utilLocation = _dereq_(631); - -// Start an AST node, attaching a start offset. - -var pp = _index2["default"].prototype; - -var Node = (function () { - function Node(parser, pos, loc) { - _classCallCheck(this, Node); - - this.type = ""; - this.start = pos; - this.end = 0; - this.loc = new _utilLocation.SourceLocation(loc); - } - - Node.prototype.__clone = function __clone() { - var node2 = new Node(); - for (var key in this) node2[key] = this[key]; - return node2; - }; - - return Node; -})(); - -exports.Node = Node; - -pp.startNode = function () { - return new Node(this, this.state.start, this.state.startLoc); -}; - -pp.startNodeAt = function (pos, loc) { - return new Node(this, pos, loc); -}; - -function finishNodeAt(node, type, pos, loc) { - node.type = type; - node.end = pos; - node.loc.end = loc; - this.processComment(node); - return node; -} - -// Finish an AST node, adding `type` and `end` properties. - -pp.finishNode = function (node, type) { - return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc); -}; - -// Finish node at given position - -pp.finishNodeAt = function (node, type, pos, loc) { - return finishNodeAt.call(this, node, type, pos, loc); -}; -},{"617":617,"631":631}],621:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _tokenizerTypes = _dereq_(629); - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var _utilWhitespace = _dereq_(632); - -var pp = _index2["default"].prototype; - -// ### Statement parsing - -// Parse a program. Initializes the parser, reads any number of -// statements, and wraps them in a Program node. Optionally takes a -// `program` argument. If present, the statements will be appended -// to its body instead of creating a new node. - -pp.parseTopLevel = function (file, program) { - program.sourceType = this.options.sourceType; - program.body = []; - - var first = true; - while (!this.match(_tokenizerTypes.types.eof)) { - var stmt = this.parseStatement(true, true); - program.body.push(stmt); - if (first) { - if (this.isUseStrict(stmt)) this.setStrict(true); - first = false; - } - } - this.next(); - - file.program = this.finishNode(program, "Program"); - file.comments = this.state.comments; - file.tokens = this.state.tokens; - - return this.finishNode(file, "File"); -}; - -var loopLabel = { kind: "loop" }, - switchLabel = { kind: "switch" }; - -// Parse a single statement. -// -// If expecting a statement and finding a slash operator, parse a -// regular expression literal. This is to handle cases like -// `if (foo) /blah/.exec(foo)`, where looking at the previous token -// does not help. - -pp.parseStatement = function (declaration, topLevel) { - if (this.match(_tokenizerTypes.types.at)) { - this.parseDecorators(true); - } - - var starttype = this.state.type, - node = this.startNode(); - - // Most types of statements are recognized by the keyword they - // start with. Many are trivial to parse, some require a bit of - // complexity. - - switch (starttype) { - case _tokenizerTypes.types._break:case _tokenizerTypes.types._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); - case _tokenizerTypes.types._debugger: - return this.parseDebuggerStatement(node); - case _tokenizerTypes.types._do: - return this.parseDoStatement(node); - case _tokenizerTypes.types._for: - return this.parseForStatement(node); - case _tokenizerTypes.types._function: - if (!declaration) this.unexpected(); - return this.parseFunctionStatement(node); - - case _tokenizerTypes.types._class: - if (!declaration) this.unexpected(); - this.takeDecorators(node); - return this.parseClass(node, true); - - case _tokenizerTypes.types._if: - return this.parseIfStatement(node); - case _tokenizerTypes.types._return: - return this.parseReturnStatement(node); - case _tokenizerTypes.types._switch: - return this.parseSwitchStatement(node); - case _tokenizerTypes.types._throw: - return this.parseThrowStatement(node); - case _tokenizerTypes.types._try: - return this.parseTryStatement(node); - case _tokenizerTypes.types._let:case _tokenizerTypes.types._const: - if (!declaration) this.unexpected(); // NOTE: falls through to _var - case _tokenizerTypes.types._var: - return this.parseVarStatement(node, starttype); - case _tokenizerTypes.types._while: - return this.parseWhileStatement(node); - case _tokenizerTypes.types._with: - return this.parseWithStatement(node); - case _tokenizerTypes.types.braceL: - return this.parseBlock(); - case _tokenizerTypes.types.semi: - return this.parseEmptyStatement(node); - case _tokenizerTypes.types._export: - case _tokenizerTypes.types._import: - if (!this.options.allowImportExportEverywhere) { - if (!topLevel) this.raise(this.state.start, "'import' and 'export' may only appear at the top level"); - - if (!this.inModule) this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: module'"); - } - return starttype === _tokenizerTypes.types._import ? this.parseImport(node) : this.parseExport(node); - - case _tokenizerTypes.types.name: - if (this.options.features["es7.asyncFunctions"] && this.state.value === "async") { - // peek ahead and see if next token is a function - var state = this.state.clone(); - this.next(); - if (this.match(_tokenizerTypes.types._function) && !this.canInsertSemicolon()) { - this.expect(_tokenizerTypes.types._function); - return this.parseFunction(node, true, false, true); - } else { - this.state = state; - } - } - - // If the statement does not start with a statement keyword or a - // brace, it's an ExpressionStatement or LabeledStatement. We - // simply start parsing an expression, and afterwards, if the - // next token is a colon and the expression was a simple - // Identifier node, we switch to interpreting it as a label. - default: - var maybeName = this.state.value, - expr = this.parseExpression(); - - if (starttype === _tokenizerTypes.types.name && expr.type === "Identifier" && this.eat(_tokenizerTypes.types.colon)) { - return this.parseLabeledStatement(node, maybeName, expr); - } else { - return this.parseExpressionStatement(node, expr); - } - } -}; - -pp.takeDecorators = function (node) { - if (this.state.decorators.length) { - node.decorators = this.state.decorators; - this.state.decorators = []; - } -}; - -pp.parseDecorators = function (allowExport) { - while (this.match(_tokenizerTypes.types.at)) { - this.state.decorators.push(this.parseDecorator()); - } - - if (allowExport && this.match(_tokenizerTypes.types._export)) { - return; - } - - if (!this.match(_tokenizerTypes.types._class)) { - this.raise(this.state.start, "Leading decorators must be attached to a class declaration"); - } -}; - -pp.parseDecorator = function () { - if (!this.options.features["es7.decorators"]) { - this.unexpected(); - } - var node = this.startNode(); - this.next(); - node.expression = this.parseMaybeAssign(); - return this.finishNode(node, "Decorator"); -}; - -pp.parseBreakContinueStatement = function (node, keyword) { - var isBreak = keyword === "break"; - this.next(); - - if (this.eat(_tokenizerTypes.types.semi) || this.canInsertSemicolon()) { - node.label = null; - } else if (!this.match(_tokenizerTypes.types.name)) { - this.unexpected(); - } else { - node.label = this.parseIdent(); - this.semicolon(); - } - - // Verify that there is an actual destination to break or - // continue to. - for (var i = 0; i < this.state.labels.length; ++i) { - var lab = this.state.labels[i]; - if (node.label == null || lab.name === node.label.name) { - if (lab.kind != null && (isBreak || lab.kind === "loop")) break; - if (node.label && isBreak) break; - } - } - if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword); - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); -}; - -pp.parseDebuggerStatement = function (node) { - this.next(); - this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); -}; - -pp.parseDoStatement = function (node) { - this.next(); - this.state.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.state.labels.pop(); - this.expect(_tokenizerTypes.types._while); - node.test = this.parseParenExpression(); - this.eat(_tokenizerTypes.types.semi); - return this.finishNode(node, "DoWhileStatement"); -}; - -// Disambiguating between a `for` and a `for`/`in` or `for`/`of` -// loop is non-trivial. Basically, we have to parse the init `var` -// statement or expression, disallowing the `in` operator (see -// the second parameter to `parseExpression`), and then check -// whether the next token is `in` or `of`. When there is no init -// part (semicolon immediately after the opening parenthesis), it -// is a regular `for` loop. - -pp.parseForStatement = function (node) { - this.next(); - this.state.labels.push(loopLabel); - this.expect(_tokenizerTypes.types.parenL); - - if (this.match(_tokenizerTypes.types.semi)) { - return this.parseFor(node, null); - } - - if (this.match(_tokenizerTypes.types._var) || this.match(_tokenizerTypes.types._let) || this.match(_tokenizerTypes.types._const)) { - var _init = this.startNode(), - varKind = this.state.type; - this.next(); - this.parseVar(_init, true, varKind); - this.finishNode(_init, "VariableDeclaration"); - if ((this.match(_tokenizerTypes.types._in) || this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== _tokenizerTypes.types._var && _init.declarations[0].init)) return this.parseForIn(node, _init); - return this.parseFor(node, _init); - } - - var refShorthandDefaultPos = { start: 0 }; - var init = this.parseExpression(true, refShorthandDefaultPos); - if (this.match(_tokenizerTypes.types._in) || this.isContextual("of")) { - this.toAssignable(init); - this.checkLVal(init); - return this.parseForIn(node, init); - } else if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } - return this.parseFor(node, init); -}; - -pp.parseFunctionStatement = function (node) { - this.next(); - return this.parseFunction(node, true); -}; - -pp.parseIfStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement(false); - node.alternate = this.eat(_tokenizerTypes.types._else) ? this.parseStatement(false) : null; - return this.finishNode(node, "IfStatement"); -}; - -pp.parseReturnStatement = function (node) { - if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) { - this.raise(this.state.start, "'return' outside of function"); - } - - this.next(); - - // In `return` (and `break`/`continue`), the keywords with - // optional arguments, we eagerly look for a semicolon or the - // possibility to insert one. - - if (this.eat(_tokenizerTypes.types.semi) || this.canInsertSemicolon()) { - node.argument = null; - } else { - node.argument = this.parseExpression(); - this.semicolon(); - } - - return this.finishNode(node, "ReturnStatement"); -}; - -pp.parseSwitchStatement = function (node) { - this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; - this.expect(_tokenizerTypes.types.braceL); - this.state.labels.push(switchLabel); - - // Statements under must be grouped (by label) in SwitchCase - // nodes. `cur` is used to keep the node that we are currently - // adding statements to. - - for (var cur, sawDefault; !this.match(_tokenizerTypes.types.braceR);) { - if (this.match(_tokenizerTypes.types._case) || this.match(_tokenizerTypes.types._default)) { - var isCase = this.match(_tokenizerTypes.types._case); - if (cur) this.finishNode(cur, "SwitchCase"); - node.cases.push(cur = this.startNode()); - cur.consequent = []; - this.next(); - if (isCase) { - cur.test = this.parseExpression(); - } else { - if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses"); - sawDefault = true; - cur.test = null; - } - this.expect(_tokenizerTypes.types.colon); - } else { - if (!cur) this.unexpected(); - cur.consequent.push(this.parseStatement(true)); - } - } - if (cur) this.finishNode(cur, "SwitchCase"); - this.next(); // Closing brace - this.state.labels.pop(); - return this.finishNode(node, "SwitchStatement"); -}; - -pp.parseThrowStatement = function (node) { - this.next(); - if (_utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw"); - node.argument = this.parseExpression(); - this.semicolon(); - return this.finishNode(node, "ThrowStatement"); -}; - -// Reused empty array added for node fields that are always empty. - -var empty = []; - -pp.parseTryStatement = function (node) { - this.next(); - node.block = this.parseBlock(); - node.handler = null; - if (this.match(_tokenizerTypes.types._catch)) { - var clause = this.startNode(); - this.next(); - this.expect(_tokenizerTypes.types.parenL); - clause.param = this.parseBindingAtom(); - this.checkLVal(clause.param, true); - this.expect(_tokenizerTypes.types.parenR); - clause.body = this.parseBlock(); - node.handler = this.finishNode(clause, "CatchClause"); - } - - node.guardedHandlers = empty; - node.finalizer = this.eat(_tokenizerTypes.types._finally) ? this.parseBlock() : null; - - if (!node.handler && !node.finalizer) { - this.raise(node.start, "Missing catch or finally clause"); - } - - return this.finishNode(node, "TryStatement"); -}; - -pp.parseVarStatement = function (node, kind) { - this.next(); - this.parseVar(node, false, kind); - this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); -}; - -pp.parseWhileStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - this.state.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.state.labels.pop(); - return this.finishNode(node, "WhileStatement"); -}; - -pp.parseWithStatement = function (node) { - if (this.strict) this.raise(this.state.start, "'with' in strict mode"); - this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement(false); - return this.finishNode(node, "WithStatement"); -}; - -pp.parseEmptyStatement = function (node) { - this.next(); - return this.finishNode(node, "EmptyStatement"); -}; - -pp.parseLabeledStatement = function (node, maybeName, expr) { - var _arr = this.state.labels; - - for (var _i = 0; _i < _arr.length; _i++) { - var label = _arr[_i]; - if (label.name === maybeName) { - this.raise(expr.start, "Label '" + maybeName + "' is already declared"); - } - } - - var kind = this.state.type.isLoop ? "loop" : this.match(_tokenizerTypes.types._switch) ? "switch" : null; - for (var i = this.state.labels.length - 1; i >= 0; i--) { - var label = this.state.labels[i]; - if (label.statementStart === node.start) { - label.statementStart = this.state.start; - label.kind = kind; - } else { - break; - } - } - - this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start }); - node.body = this.parseStatement(true); - this.state.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); -}; - -pp.parseExpressionStatement = function (node, expr) { - node.expression = expr; - this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); -}; - -// Parse a semicolon-enclosed block of statements, handling `"use -// strict"` declarations when `allowStrict` is true (used for -// function bodies). - -pp.parseBlock = function (allowStrict) { - var node = this.startNode(), - first = true, - oldStrict = undefined; - node.body = []; - this.expect(_tokenizerTypes.types.braceL); - while (!this.eat(_tokenizerTypes.types.braceR)) { - var stmt = this.parseStatement(true); - node.body.push(stmt); - if (first && allowStrict && this.isUseStrict(stmt)) { - oldStrict = this.strict; - this.setStrict(this.strict = true); - } - first = false; - } - if (oldStrict === false) this.setStrict(false); - return this.finishNode(node, "BlockStatement"); -}; - -// Parse a regular `for` loop. The disambiguation code in -// `parseStatement` will already have parsed the init statement or -// expression. - -pp.parseFor = function (node, init) { - node.init = init; - this.expect(_tokenizerTypes.types.semi); - node.test = this.match(_tokenizerTypes.types.semi) ? null : this.parseExpression(); - this.expect(_tokenizerTypes.types.semi); - node.update = this.match(_tokenizerTypes.types.parenR) ? null : this.parseExpression(); - this.expect(_tokenizerTypes.types.parenR); - node.body = this.parseStatement(false); - this.state.labels.pop(); - return this.finishNode(node, "ForStatement"); -}; - -// Parse a `for`/`in` and `for`/`of` loop, which are almost -// same from parser's perspective. - -pp.parseForIn = function (node, init) { - var type = this.match(_tokenizerTypes.types._in) ? "ForInStatement" : "ForOfStatement"; - this.next(); - node.left = init; - node.right = this.parseExpression(); - this.expect(_tokenizerTypes.types.parenR); - node.body = this.parseStatement(false); - this.state.labels.pop(); - return this.finishNode(node, type); -}; - -// Parse a list of variable declarations. - -pp.parseVar = function (node, isFor, kind) { - node.declarations = []; - node.kind = kind.keyword; - for (;;) { - var decl = this.startNode(); - this.parseVarHead(decl); - if (this.eat(_tokenizerTypes.types.eq)) { - decl.init = this.parseMaybeAssign(isFor); - } else if (kind === _tokenizerTypes.types._const && !(this.match(_tokenizerTypes.types._in) || this.isContextual("of"))) { - this.unexpected(); - } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(_tokenizerTypes.types._in) || this.isContextual("of")))) { - this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value"); - } else { - decl.init = null; - } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); - if (!this.eat(_tokenizerTypes.types.comma)) break; - } - return node; -}; - -pp.parseVarHead = function (decl) { - decl.id = this.parseBindingAtom(); - this.checkLVal(decl.id, true); -}; - -// Parse a function declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseFunction = function (node, isStatement, allowExpressionBody, isAsync) { - this.initFunction(node, isAsync); - node.generator = this.eat(_tokenizerTypes.types.star); - - if (isStatement || this.match(_tokenizerTypes.types.name)) { - node.id = this.parseIdent(); - } - - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody); - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); -}; - -pp.parseFunctionParams = function (node) { - this.expect(_tokenizerTypes.types.parenL); - node.params = this.parseBindingList(_tokenizerTypes.types.parenR, false, this.options.features["es7.trailingFunctionCommas"]); -}; - -// Parse a class declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseClass = function (node, isStatement) { - this.next(); - this.parseClassId(node, isStatement); - this.parseClassSuper(node); - var classBody = this.startNode(); - var hadConstructor = false; - classBody.body = []; - this.expect(_tokenizerTypes.types.braceL); - var decorators = []; - while (!this.eat(_tokenizerTypes.types.braceR)) { - if (this.eat(_tokenizerTypes.types.semi)) continue; - if (this.match(_tokenizerTypes.types.at)) { - decorators.push(this.parseDecorator()); - continue; - } - var method = this.startNode(); - if (decorators.length) { - method.decorators = decorators; - decorators = []; - } - var isMaybeStatic = this.match(_tokenizerTypes.types.name) && this.state.value === "static"; - var isGenerator = this.eat(_tokenizerTypes.types.star), - isAsync = false; - this.parsePropertyName(method); - method["static"] = isMaybeStatic && !this.match(_tokenizerTypes.types.parenL); - if (method["static"]) { - if (isGenerator) this.unexpected(); - isGenerator = this.eat(_tokenizerTypes.types.star); - this.parsePropertyName(method); - } - if (!isGenerator && method.key.type === "Identifier" && !method.computed && this.isClassProperty()) { - classBody.body.push(this.parseClassProperty(method)); - continue; - } - if (this.options.features["es7.asyncFunctions"] && !this.match(_tokenizerTypes.types.parenL) && !method.computed && method.key.type === "Identifier" && method.key.name === "async") { - isAsync = true; - this.parsePropertyName(method); - } - var isGetSet = false; - method.kind = "method"; - if (!method.computed) { - var key = method.key; - - if (!isAsync && !isGenerator && key.type === "Identifier" && !this.match(_tokenizerTypes.types.parenL) && (key.name === "get" || key.name === "set")) { - isGetSet = true; - method.kind = key.name; - key = this.parsePropertyName(method); - } - if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) { - if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class"); - if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier"); - if (isGenerator) this.raise(key.start, "Constructor can't be a generator"); - if (isAsync) this.raise(key.start, "Constructor can't be an async function"); - method.kind = "constructor"; - hadConstructor = true; - } - } - if (method.kind === "constructor" && method.decorators) { - this.raise(method.start, "You can't attach decorators to a class constructor"); - } - this.parseClassMethod(classBody, method, isGenerator, isAsync); - if (isGetSet) { - var paramCount = method.kind === "get" ? 0 : 1; - if (method.value.params.length !== paramCount) { - var start = method.value.start; - if (method.kind === "get") { - this.raise(start, "getter should have no params"); - } else { - this.raise(start, "setter should have exactly one param"); - } - } - } - } - - if (decorators.length) { - this.raise(this.state.start, "You have trailing decorators with no method"); - } - - node.body = this.finishNode(classBody, "ClassBody"); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); -}; - -pp.isClassProperty = function () { - return this.match(_tokenizerTypes.types.eq) || this.match(_tokenizerTypes.types.semi) || this.canInsertSemicolon(); -}; - -pp.parseClassProperty = function (node) { - if (this.match(_tokenizerTypes.types.eq)) { - if (!this.options.features["es7.classProperties"]) this.unexpected(); - this.next(); - node.value = this.parseMaybeAssign(); - } else { - node.value = null; - } - this.semicolon(); - return this.finishNode(node, "ClassProperty"); -}; - -pp.parseClassMethod = function (classBody, method, isGenerator, isAsync) { - method.value = this.parseMethod(isGenerator, isAsync); - classBody.body.push(this.finishNode(method, "MethodDefinition")); -}; - -pp.parseClassId = function (node, isStatement) { - node.id = this.match(_tokenizerTypes.types.name) ? this.parseIdent() : isStatement ? this.unexpected() : null; -}; - -pp.parseClassSuper = function (node) { - node.superClass = this.eat(_tokenizerTypes.types._extends) ? this.parseExprSubscripts() : null; -}; - -// Parses module export declaration. - -pp.parseExport = function (node) { - this.next(); - // export * from '...' - if (this.match(_tokenizerTypes.types.star)) { - var specifier = this.startNode(); - this.next(); - if (this.options.features["es7.exportExtensions"] && this.eatContextual("as")) { - specifier.exported = this.parseIdent(); - node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]; - this.parseExportSpecifiersMaybe(node); - this.parseExportFrom(node, true); - } else { - this.parseExportFrom(node, true); - return this.finishNode(node, "ExportAllDeclaration"); - } - } else if (this.options.features["es7.exportExtensions"] && this.isExportDefaultSpecifier()) { - var specifier = this.startNode(); - specifier.exported = this.parseIdent(true); - node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; - if (this.match(_tokenizerTypes.types.comma) && this.lookahead().type === _tokenizerTypes.types.star) { - this.expect(_tokenizerTypes.types.comma); - var _specifier = this.startNode(); - this.expect(_tokenizerTypes.types.star); - this.expectContextual("as"); - _specifier.exported = this.parseIdent(); - node.specifiers.push(this.finishNode(_specifier, "ExportNamespaceSpecifier")); - } else { - this.parseExportSpecifiersMaybe(node); - } - this.parseExportFrom(node, true); - } else if (this.eat(_tokenizerTypes.types._default)) { - // export default ... - var possibleDeclaration = this.match(_tokenizerTypes.types._function) || this.match(_tokenizerTypes.types._class); - var expr = this.parseMaybeAssign(); - var needsSemi = true; - if (possibleDeclaration) { - needsSemi = false; - if (expr.id) { - expr.type = expr.type === "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration"; - } - } - node.declaration = expr; - if (needsSemi) this.semicolon(); - this.checkExport(node); - return this.finishNode(node, "ExportDefaultDeclaration"); - } else if (this.state.type.keyword || this.shouldParseExportDeclaration()) { - node.specifiers = []; - node.source = null; - node.declaration = this.parseExportDeclaration(node); - } else { - // export { x, y as z } [from '...'] - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(); - this.parseExportFrom(node); - } - this.checkExport(node); - return this.finishNode(node, "ExportNamedDeclaration"); -}; - -pp.parseExportDeclaration = function () { - return this.parseStatement(true); -}; - -pp.isExportDefaultSpecifier = function () { - if (this.match(_tokenizerTypes.types.name)) { - return this.state.value !== "type" && this.state.value !== "async"; - } - - if (!this.match(_tokenizerTypes.types._default)) { - return false; - } - - var lookahead = this.lookahead(); - return lookahead.type === _tokenizerTypes.types.comma || lookahead.type === _tokenizerTypes.types.name && lookahead.value === "from"; -}; - -pp.parseExportSpecifiersMaybe = function (node) { - if (this.eat(_tokenizerTypes.types.comma)) { - node.specifiers = node.specifiers.concat(this.parseExportSpecifiers()); - } -}; - -pp.parseExportFrom = function (node, expect) { - if (this.eatContextual("from")) { - node.source = this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.unexpected(); - this.checkExport(node); - } else { - if (expect) { - this.unexpected(); - } else { - node.source = null; - } - } - - this.semicolon(); -}; - -pp.shouldParseExportDeclaration = function () { - return this.options.features["es7.asyncFunctions"] && this.isContextual("async"); -}; - -pp.checkExport = function (node) { - if (this.state.decorators.length) { - var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression"); - if (!node.declaration || !isClass) { - this.raise(node.start, "You can only use decorators on an export when exporting a class"); - } - this.takeDecorators(node.declaration); - } -}; - -// Parses a comma-separated list of module exports. - -pp.parseExportSpecifiers = function () { - var nodes = [], - first = true; - // export { x, y as z } [from '...'] - this.expect(_tokenizerTypes.types.braceL); - - while (!this.eat(_tokenizerTypes.types.braceR)) { - if (first) { - first = false; - } else { - this.expect(_tokenizerTypes.types.comma); - if (this.eat(_tokenizerTypes.types.braceR)) break; - } - - var node = this.startNode(); - node.local = this.parseIdent(this.match(_tokenizerTypes.types._default)); - node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local.__clone(); - nodes.push(this.finishNode(node, "ExportSpecifier")); - } - - return nodes; -}; - -// Parses import declaration. - -pp.parseImport = function (node) { - this.next(); - - // import '...' - if (this.match(_tokenizerTypes.types.string)) { - node.specifiers = []; - node.source = this.parseExprAtom(); - } else { - node.specifiers = []; - this.parseImportSpecifiers(node); - this.expectContextual("from"); - node.source = this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.unexpected(); - } - this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); -}; - -// Parses a comma-separated list of module imports. - -pp.parseImportSpecifiers = function (node) { - var first = true; - if (this.match(_tokenizerTypes.types.name)) { - // import defaultObj, { x, y as z } from '...' - var startPos = this.state.start, - startLoc = this.state.startLoc; - node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(), startPos, startLoc)); - if (!this.eat(_tokenizerTypes.types.comma)) return; - } - - if (this.match(_tokenizerTypes.types.star)) { - var specifier = this.startNode(); - this.next(); - this.expectContextual("as"); - specifier.local = this.parseIdent(); - this.checkLVal(specifier.local, true); - node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier")); - return; - } - - this.expect(_tokenizerTypes.types.braceL); - while (!this.eat(_tokenizerTypes.types.braceR)) { - if (first) { - first = false; - } else { - this.expect(_tokenizerTypes.types.comma); - if (this.eat(_tokenizerTypes.types.braceR)) break; - } - - var specifier = this.startNode(); - specifier.imported = this.parseIdent(true); - specifier.local = this.eatContextual("as") ? this.parseIdent() : specifier.imported.__clone(); - this.checkLVal(specifier.local, true); - node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); - } -}; - -pp.parseImportSpecifierDefault = function (id, startPos, startLoc) { - var node = this.startNodeAt(startPos, startLoc); - node.local = id; - this.checkLVal(node.local, true); - return this.finishNode(node, "ImportDefaultSpecifier"); -}; -},{"617":617,"629":629,"632":632}],622:[function(_dereq_,module,exports){ -"use strict"; - -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _tokenizerTypes = _dereq_(629); - -var _index = _dereq_(617); - -var _index2 = _interopRequireDefault(_index); - -var _utilWhitespace = _dereq_(632); - -var pp = _index2["default"].prototype; - -// ## Parser utilities - -// Test whether a statement node is the string literal `"use strict"`. - -pp.isUseStrict = function (stmt) { - return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.raw.slice(1, -1) === "use strict"; -}; - -// TODO - -pp.isRelational = function (op) { - return this.match(_tokenizerTypes.types.relational) && this.state.value === op; -}; - -// TODO - -pp.expectRelational = function (op) { - if (this.isRelational(op)) { - this.next(); - } else { - this.unexpected(); - } -}; - -// Tests whether parsed token is a contextual keyword. - -pp.isContextual = function (name) { - return this.match(_tokenizerTypes.types.name) && this.state.value === name; -}; - -// Consumes contextual keyword if possible. - -pp.eatContextual = function (name) { - return this.state.value === name && this.eat(_tokenizerTypes.types.name); -}; - -// Asserts that following token is given contextual keyword. - -pp.expectContextual = function (name) { - if (!this.eatContextual(name)) this.unexpected(); -}; - -// Test whether a semicolon can be inserted at the current position. - -pp.canInsertSemicolon = function () { - return this.match(_tokenizerTypes.types.eof) || this.match(_tokenizerTypes.types.braceR) || _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); -}; - -// Consume a semicolon, or, failing that, see if we are allowed to -// pretend that there is a semicolon at this position. - -pp.semicolon = function () { - if (!this.eat(_tokenizerTypes.types.semi) && !this.canInsertSemicolon()) this.unexpected(); -}; - -// Expect a token of a given type. If found, consume it, otherwise, -// raise an unexpected token error. - -pp.expect = function (type) { - return this.eat(type) || this.unexpected(); -}; - -// Raise an unexpected token error. - -pp.unexpected = function (pos) { - this.raise(pos != null ? pos : this.state.start, "Unexpected token"); -}; -},{"617":617,"629":629,"632":632}],623:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _tokenizerTypes = _dereq_(629); - -var _parser = _dereq_(617); - -var _parser2 = _interopRequireDefault(_parser); - -var pp = _parser2["default"].prototype; - -pp.flowParseTypeInitialiser = function (tok) { - var oldInType = this.state.inType; - this.state.inType = true; - this.expect(tok || _tokenizerTypes.types.colon); - var type = this.flowParseType(); - this.state.inType = oldInType; - return type; -}; - -pp.flowParseDeclareClass = function (node) { - this.next(); - this.flowParseInterfaceish(node, true); - return this.finishNode(node, "DeclareClass"); -}; - -pp.flowParseDeclareFunction = function (node) { - this.next(); - - var id = node.id = this.parseIdent(); - - var typeNode = this.startNode(); - var typeContainer = this.startNode(); - - if (this.isRelational("<")) { - typeNode.typeParameters = this.flowParseTypeParameterDeclaration(); - } else { - typeNode.typeParameters = null; - } - - this.expect(_tokenizerTypes.types.parenL); - var tmp = this.flowParseFunctionTypeParams(); - typeNode.params = tmp.params; - typeNode.rest = tmp.rest; - this.expect(_tokenizerTypes.types.parenR); - typeNode.returnType = this.flowParseTypeInitialiser(); - - typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation"); - id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation"); - - this.finishNode(id, id.type); - - this.semicolon(); - - return this.finishNode(node, "DeclareFunction"); -}; - -pp.flowParseDeclare = function (node) { - if (this.match(_tokenizerTypes.types._class)) { - return this.flowParseDeclareClass(node); - } else if (this.match(_tokenizerTypes.types._function)) { - return this.flowParseDeclareFunction(node); - } else if (this.match(_tokenizerTypes.types._var)) { - return this.flowParseDeclareVariable(node); - } else if (this.isContextual("module")) { - return this.flowParseDeclareModule(node); - } else { - this.unexpected(); - } -}; - -pp.flowParseDeclareVariable = function (node) { - this.next(); - node.id = this.flowParseTypeAnnotatableIdentifier(); - this.semicolon(); - return this.finishNode(node, "DeclareVariable"); -}; - -pp.flowParseDeclareModule = function (node) { - this.next(); - - if (this.match(_tokenizerTypes.types.string)) { - node.id = this.parseExprAtom(); - } else { - node.id = this.parseIdent(); - } - - var bodyNode = node.body = this.startNode(); - var body = bodyNode.body = []; - this.expect(_tokenizerTypes.types.braceL); - while (!this.match(_tokenizerTypes.types.braceR)) { - var node2 = this.startNode(); - - // todo: declare check - this.next(); - - body.push(this.flowParseDeclare(node2)); - } - this.expect(_tokenizerTypes.types.braceR); - - this.finishNode(bodyNode, "BlockStatement"); - return this.finishNode(node, "DeclareModule"); -}; - -// Interfaces - -pp.flowParseInterfaceish = function (node, allowStatic) { - node.id = this.parseIdent(); - - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - } else { - node.typeParameters = null; - } - - node["extends"] = []; - - if (this.eat(_tokenizerTypes.types._extends)) { - do { - node["extends"].push(this.flowParseInterfaceExtends()); - } while (this.eat(_tokenizerTypes.types.comma)); - } - - node.body = this.flowParseObjectType(allowStatic); -}; - -pp.flowParseInterfaceExtends = function () { - var node = this.startNode(); - - node.id = this.parseIdent(); - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterInstantiation(); - } else { - node.typeParameters = null; - } - - return this.finishNode(node, "InterfaceExtends"); -}; - -pp.flowParseInterface = function (node) { - this.flowParseInterfaceish(node, false); - return this.finishNode(node, "InterfaceDeclaration"); -}; - -// Type aliases - -pp.flowParseTypeAlias = function (node) { - node.id = this.parseIdent(); - - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - } else { - node.typeParameters = null; - } - - node.right = this.flowParseTypeInitialiser(_tokenizerTypes.types.eq); - this.semicolon(); - - return this.finishNode(node, "TypeAlias"); -}; - -// Type annotations - -pp.flowParseTypeParameterDeclaration = function () { - var node = this.startNode(); - node.params = []; - - this.expectRelational("<"); - while (!this.isRelational(">")) { - node.params.push(this.flowParseTypeAnnotatableIdentifier()); - if (!this.isRelational(">")) { - this.expect(_tokenizerTypes.types.comma); - } - } - this.expectRelational(">"); - - return this.finishNode(node, "TypeParameterDeclaration"); -}; - -pp.flowParseTypeParameterInstantiation = function () { - var node = this.startNode(), - oldInType = this.state.inType; - node.params = []; - - this.state.inType = true; - - this.expectRelational("<"); - while (!this.isRelational(">")) { - node.params.push(this.flowParseType()); - if (!this.isRelational(">")) { - this.expect(_tokenizerTypes.types.comma); - } - } - this.expectRelational(">"); - - this.state.inType = oldInType; - - return this.finishNode(node, "TypeParameterInstantiation"); -}; - -pp.flowParseObjectPropertyKey = function () { - return this.match(_tokenizerTypes.types.num) || this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.parseIdent(true); -}; - -pp.flowParseObjectTypeIndexer = function (node, isStatic) { - node["static"] = isStatic; - - this.expect(_tokenizerTypes.types.bracketL); - node.id = this.flowParseObjectPropertyKey(); - node.key = this.flowParseTypeInitialiser(); - this.expect(_tokenizerTypes.types.bracketR); - node.value = this.flowParseTypeInitialiser(); - - this.flowObjectTypeSemicolon(); - return this.finishNode(node, "ObjectTypeIndexer"); -}; - -pp.flowParseObjectTypeMethodish = function (node) { - node.params = []; - node.rest = null; - node.typeParameters = null; - - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - } - - this.expect(_tokenizerTypes.types.parenL); - while (this.match(_tokenizerTypes.types.name)) { - node.params.push(this.flowParseFunctionTypeParam()); - if (!this.match(_tokenizerTypes.types.parenR)) { - this.expect(_tokenizerTypes.types.comma); - } - } - - if (this.eat(_tokenizerTypes.types.ellipsis)) { - node.rest = this.flowParseFunctionTypeParam(); - } - this.expect(_tokenizerTypes.types.parenR); - node.returnType = this.flowParseTypeInitialiser(); - - return this.finishNode(node, "FunctionTypeAnnotation"); -}; - -pp.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) { - var node = this.startNodeAt(startPos, startLoc); - node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc)); - node["static"] = isStatic; - node.key = key; - node.optional = false; - this.flowObjectTypeSemicolon(); - return this.finishNode(node, "ObjectTypeProperty"); -}; - -pp.flowParseObjectTypeCallProperty = function (node, isStatic) { - var valueNode = this.startNode(); - node["static"] = isStatic; - node.value = this.flowParseObjectTypeMethodish(valueNode); - this.flowObjectTypeSemicolon(); - return this.finishNode(node, "ObjectTypeCallProperty"); -}; - -pp.flowParseObjectType = function (allowStatic) { - var nodeStart = this.startNode(); - var node; - var propertyKey; - var isStatic; - - nodeStart.callProperties = []; - nodeStart.properties = []; - nodeStart.indexers = []; - - this.expect(_tokenizerTypes.types.braceL); - - while (!this.match(_tokenizerTypes.types.braceR)) { - var optional = false; - var startPos = this.state.start, - startLoc = this.state.startLoc; - node = this.startNode(); - if (allowStatic && this.isContextual("static")) { - this.next(); - isStatic = true; - } - - if (this.match(_tokenizerTypes.types.bracketL)) { - nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic)); - } else if (this.match(_tokenizerTypes.types.parenL) || this.isRelational("<")) { - nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, allowStatic)); - } else { - if (isStatic && this.match(_tokenizerTypes.types.colon)) { - propertyKey = this.parseIdent(); - } else { - propertyKey = this.flowParseObjectPropertyKey(); - } - if (this.isRelational("<") || this.match(_tokenizerTypes.types.parenL)) { - // This is a method property - nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey)); - } else { - if (this.eat(_tokenizerTypes.types.question)) { - optional = true; - } - node.key = propertyKey; - node.value = this.flowParseTypeInitialiser(); - node.optional = optional; - node["static"] = isStatic; - this.flowObjectTypeSemicolon(); - nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty")); - } - } - } - - this.expect(_tokenizerTypes.types.braceR); - - return this.finishNode(nodeStart, "ObjectTypeAnnotation"); -}; - -pp.flowObjectTypeSemicolon = function () { - if (!this.eat(_tokenizerTypes.types.semi) && !this.eat(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR)) { - this.unexpected(); - } -}; - -pp.flowParseGenericType = function (startPos, startLoc, id) { - var node = this.startNodeAt(startPos, startLoc); - - node.typeParameters = null; - node.id = id; - - while (this.eat(_tokenizerTypes.types.dot)) { - var node2 = this.startNodeAt(startPos, startLoc); - node2.qualification = node.id; - node2.id = this.parseIdent(); - node.id = this.finishNode(node2, "QualifiedTypeIdentifier"); - } - - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterInstantiation(); - } - - return this.finishNode(node, "GenericTypeAnnotation"); -}; - -pp.flowParseTypeofType = function () { - var node = this.startNode(); - this.expect(_tokenizerTypes.types._typeof); - node.argument = this.flowParsePrimaryType(); - return this.finishNode(node, "TypeofTypeAnnotation"); -}; - -pp.flowParseTupleType = function () { - var node = this.startNode(); - node.types = []; - this.expect(_tokenizerTypes.types.bracketL); - // We allow trailing commas - while (this.state.pos < this.input.length && !this.match(_tokenizerTypes.types.bracketR)) { - node.types.push(this.flowParseType()); - if (this.match(_tokenizerTypes.types.bracketR)) break; - this.expect(_tokenizerTypes.types.comma); - } - this.expect(_tokenizerTypes.types.bracketR); - return this.finishNode(node, "TupleTypeAnnotation"); -}; - -pp.flowParseFunctionTypeParam = function () { - var optional = false; - var node = this.startNode(); - node.name = this.parseIdent(); - if (this.eat(_tokenizerTypes.types.question)) { - optional = true; - } - node.optional = optional; - node.typeAnnotation = this.flowParseTypeInitialiser(); - return this.finishNode(node, "FunctionTypeParam"); -}; - -pp.flowParseFunctionTypeParams = function () { - var ret = { params: [], rest: null }; - while (this.match(_tokenizerTypes.types.name)) { - ret.params.push(this.flowParseFunctionTypeParam()); - if (!this.match(_tokenizerTypes.types.parenR)) { - this.expect(_tokenizerTypes.types.comma); - } - } - if (this.eat(_tokenizerTypes.types.ellipsis)) { - ret.rest = this.flowParseFunctionTypeParam(); - } - return ret; -}; - -pp.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) { - switch (id.name) { - case "any": - return this.finishNode(node, "AnyTypeAnnotation"); - - case "void": - return this.finishNode(node, "VoidTypeAnnotation"); - - case "bool": - case "boolean": - return this.finishNode(node, "BooleanTypeAnnotation"); - - case "mixed": - return this.finishNode(node, "MixedTypeAnnotation"); - - case "number": - return this.finishNode(node, "NumberTypeAnnotation"); - - case "string": - return this.finishNode(node, "StringTypeAnnotation"); - - default: - return this.flowParseGenericType(startPos, startLoc, id); - } -}; - -// The parsing of types roughly parallels the parsing of expressions, and -// primary types are kind of like primary expressions...they're the -// primitives with which other types are constructed. -pp.flowParsePrimaryType = function () { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var node = this.startNode(); - var tmp; - var type; - var isGroupedType = false; - - switch (this.state.type) { - case _tokenizerTypes.types.name: - return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdent()); - - case _tokenizerTypes.types.braceL: - return this.flowParseObjectType(); - - case _tokenizerTypes.types.bracketL: - return this.flowParseTupleType(); - - case _tokenizerTypes.types.relational: - if (this.state.value === "<") { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - this.expect(_tokenizerTypes.types.parenL); - tmp = this.flowParseFunctionTypeParams(); - node.params = tmp.params; - node.rest = tmp.rest; - this.expect(_tokenizerTypes.types.parenR); - - this.expect(_tokenizerTypes.types.arrow); - - node.returnType = this.flowParseType(); - - return this.finishNode(node, "FunctionTypeAnnotation"); - } - - case _tokenizerTypes.types.parenL: - this.next(); - - // Check to see if this is actually a grouped type - if (!this.match(_tokenizerTypes.types.parenR) && !this.match(_tokenizerTypes.types.ellipsis)) { - if (this.match(_tokenizerTypes.types.name)) { - var token = this.lookahead().type; - isGroupedType = token !== _tokenizerTypes.types.question && token !== _tokenizerTypes.types.colon; - } else { - isGroupedType = true; - } - } - - if (isGroupedType) { - type = this.flowParseType(); - this.expect(_tokenizerTypes.types.parenR); - - // If we see a => next then someone was probably confused about - // function types, so we can provide a better error message - if (this.eat(_tokenizerTypes.types.arrow)) { - this.raise(node, "Unexpected token =>. It looks like " + "you are trying to write a function type, but you ended up " + "writing a grouped type followed by an =>, which is a syntax " + "error. Remember, function type parameters are named so function " + "types look like (name1: type1, name2: type2) => returnType. You " + "probably wrote (type1) => returnType"); - } - - return type; - } - - tmp = this.flowParseFunctionTypeParams(); - node.params = tmp.params; - node.rest = tmp.rest; - - this.expect(_tokenizerTypes.types.parenR); - - this.expect(_tokenizerTypes.types.arrow); - - node.returnType = this.flowParseType(); - node.typeParameters = null; - - return this.finishNode(node, "FunctionTypeAnnotation"); - - case _tokenizerTypes.types.string: - node.rawValue = node.value = this.state.value; - node.raw = this.input.slice(this.state.start, this.state.end); - this.next(); - return this.finishNode(node, "StringLiteralTypeAnnotation"); - - case _tokenizerTypes.types._true:case _tokenizerTypes.types._false: - node.value = this.match(_tokenizerTypes.types._true); - this.next(); - return this.finishNode(node, "BooleanLiteralTypeAnnotation"); - - case _tokenizerTypes.types.num: - node.rawValue = node.value = this.state.value; - node.raw = this.input.slice(this.state.start, this.state.end); - this.next(); - return this.finishNode(node, "NumberLiteralTypeAnnotation"); - - default: - if (this.state.type.keyword === "typeof") { - return this.flowParseTypeofType(); - } - } - - this.unexpected(); -}; - -pp.flowParsePostfixType = function () { - var node = this.startNode(); - var type = node.elementType = this.flowParsePrimaryType(); - if (this.match(_tokenizerTypes.types.bracketL)) { - this.expect(_tokenizerTypes.types.bracketL); - this.expect(_tokenizerTypes.types.bracketR); - return this.finishNode(node, "ArrayTypeAnnotation"); - } else { - return type; - } -}; - -pp.flowParsePrefixType = function () { - var node = this.startNode(); - if (this.eat(_tokenizerTypes.types.question)) { - node.typeAnnotation = this.flowParsePrefixType(); - return this.finishNode(node, "NullableTypeAnnotation"); - } else { - return this.flowParsePostfixType(); - } -}; - -pp.flowParseIntersectionType = function () { - var node = this.startNode(); - var type = this.flowParsePrefixType(); - node.types = [type]; - while (this.eat(_tokenizerTypes.types.bitwiseAND)) { - node.types.push(this.flowParsePrefixType()); - } - return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); -}; - -pp.flowParseUnionType = function () { - var node = this.startNode(); - var type = this.flowParseIntersectionType(); - node.types = [type]; - while (this.eat(_tokenizerTypes.types.bitwiseOR)) { - node.types.push(this.flowParseIntersectionType()); - } - return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation"); -}; - -pp.flowParseType = function () { - var oldInType = this.state.inType; - this.state.inType = true; - var type = this.flowParseUnionType(); - this.state.inType = oldInType; - return type; -}; - -pp.flowParseTypeAnnotation = function () { - var node = this.startNode(); - node.typeAnnotation = this.flowParseTypeInitialiser(); - return this.finishNode(node, "TypeAnnotation"); -}; - -pp.flowParseTypeAnnotatableIdentifier = function (requireTypeAnnotation, canBeOptionalParam) { - var ident = this.parseIdent(); - var isOptionalParam = false; - - if (canBeOptionalParam && this.eat(_tokenizerTypes.types.question)) { - this.expect(_tokenizerTypes.types.question); - isOptionalParam = true; - } - - if (requireTypeAnnotation || this.match(_tokenizerTypes.types.colon)) { - ident.typeAnnotation = this.flowParseTypeAnnotation(); - this.finishNode(ident, ident.type); - } - - if (isOptionalParam) { - ident.optional = true; - this.finishNode(ident, ident.type); - } - - return ident; -}; - -exports["default"] = function (instance) { - // function name(): string {} - instance.extend("parseFunctionBody", function (inner) { - return function (node, allowExpression) { - if (this.match(_tokenizerTypes.types.colon) && !allowExpression) { - // if allowExpression is true then we're parsing an arrow function and if - // there's a return type then it's been handled elsewhere - node.returnType = this.flowParseTypeAnnotation(); - } - - return inner.call(this, node, allowExpression); - }; - }); - - instance.extend("parseStatement", function (inner) { - return function (declaration, topLevel) { - // strict mode handling of `interface` since it's a reserved word - if (this.strict && this.match(_tokenizerTypes.types.name) && this.state.value === "interface") { - var node = this.startNode(); - this.next(); - return this.flowParseInterface(node); - } else { - return inner.call(this, declaration, topLevel); - } - }; - }); - - instance.extend("parseExpressionStatement", function (inner) { - return function (node, expr) { - if (expr.type === "Identifier") { - if (expr.name === "declare") { - if (this.match(_tokenizerTypes.types._class) || this.match(_tokenizerTypes.types.name) || this.match(_tokenizerTypes.types._function) || this.match(_tokenizerTypes.types._var)) { - return this.flowParseDeclare(node); - } - } else if (this.match(_tokenizerTypes.types.name)) { - if (expr.name === "interface") { - return this.flowParseInterface(node); - } else if (expr.name === "type") { - return this.flowParseTypeAlias(node); - } - } - } - - return inner.call(this, node, expr); - }; - }); - - instance.extend("shouldParseExportDeclaration", function (inner) { - return function () { - return this.isContextual("type") || inner.call(this); - }; - }); - - instance.extend("parseParenItem", function () { - return function (node, startLoc, startPos, forceArrow) { - if (this.match(_tokenizerTypes.types.colon)) { - var typeCastNode = this.startNodeAt(startLoc, startPos); - typeCastNode.expression = node; - typeCastNode.typeAnnotation = this.flowParseTypeAnnotation(); - - if (forceArrow && !this.match(_tokenizerTypes.types.arrow)) { - this.unexpected(); - } - - if (this.eat(_tokenizerTypes.types.arrow)) { - // ((lol): number => {}); - var func = this.parseArrowExpression(this.startNodeAt(startLoc, startPos), [node]); - func.returnType = typeCastNode.typeAnnotation; - return func; - } else { - return this.finishNode(typeCastNode, "TypeCastExpression"); - } - } else { - return node; - } - }; - }); - - instance.extend("parseExport", function (inner) { - return function (node) { - node = inner.call(this, node); - if (node.type === "ExportNamedDeclaration") { - node.exportKind = node.exportKind || "value"; - } - return node; - }; - }); - - instance.extend("parseExportDeclaration", function (inner) { - return function (node) { - if (this.isContextual("type")) { - node.exportKind = "type"; - - var declarationNode = this.startNode(); - this.next(); - - if (this.match(_tokenizerTypes.types.braceL)) { - // export type { foo, bar }; - node.specifiers = this.parseExportSpecifiers(); - this.parseExportFrom(node); - return null; - } else { - // export type Foo = Bar; - return this.flowParseTypeAlias(declarationNode); - } - } else { - return inner.call(this, node); - } - }; - }); - - instance.extend("parseClassId", function (inner) { - return function (node, isStatement) { - inner.call(this, node, isStatement); - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - } - }; - }); - - // don't consider `void` to be a keyword as then it'll use the void token type - // and set startExpr - instance.extend("isKeyword", function (inner) { - return function (name) { - if (this.state.inType && name === "void") { - return false; - } else { - return inner.call(this, name); - } - }; - }); - - instance.extend("readToken", function (inner) { - return function (code) { - if (this.state.inType && (code === 62 || code === 60)) { - return this.finishOp(_tokenizerTypes.types.relational, 1); - } else { - return inner.call(this, code); - } - }; - }); - - instance.extend("jsx_readToken", function (inner) { - return function () { - if (!this.state.inType) return inner.call(this); - }; - }); - - function typeCastToParameter(node) { - node.expression.typeAnnotation = node.typeAnnotation; - return node.expression; - } - - instance.extend("toAssignableList", function (inner) { - return function (exprList, isBinding) { - for (var i = 0; i < exprList.length; i++) { - var expr = exprList[i]; - if (expr && expr.type === "TypeCastExpression") { - exprList[i] = typeCastToParameter(expr); - } - } - return inner.call(this, exprList, isBinding); - }; - }); - - instance.extend("toReferencedList", function () { - return function (exprList) { - for (var i = 0; i < exprList.length; i++) { - var expr = exprList[i]; - if (expr && expr._exprListItem && expr.type === "TypeCastExpression") { - this.raise(expr.start, "Unexpected type cast"); - } - } - - return exprList; - }; - }); - - instance.extend("parseExprListItem", function (inner) { - return function (allowEmpty, refShorthandDefaultPos) { - var container = this.startNode(); - var node = inner.call(this, allowEmpty, refShorthandDefaultPos); - if (this.match(_tokenizerTypes.types.colon)) { - container._exprListItem = true; - container.expression = node; - container.typeAnnotation = this.flowParseTypeAnnotation(); - return this.finishNode(container, "TypeCastExpression"); - } else { - return node; - } - }; - }); - - instance.extend("parseClassProperty", function (inner) { - return function (node) { - if (this.match(_tokenizerTypes.types.colon)) { - node.typeAnnotation = this.flowParseTypeAnnotation(); - } - return inner.call(this, node); - }; - }); - - instance.extend("isClassProperty", function (inner) { - return function () { - return this.match(_tokenizerTypes.types.colon) || inner.call(this); - }; - }); - - instance.extend("parseClassMethod", function () { - return function (classBody, method, isGenerator, isAsync) { - var typeParameters; - if (this.isRelational("<")) { - typeParameters = this.flowParseTypeParameterDeclaration(); - } - method.value = this.parseMethod(isGenerator, isAsync); - method.value.typeParameters = typeParameters; - classBody.body.push(this.finishNode(method, "MethodDefinition")); - }; - }); - - instance.extend("parseClassSuper", function (inner) { - return function (node, isStatement) { - inner.call(this, node, isStatement); - if (node.superClass && this.isRelational("<")) { - node.superTypeParameters = this.flowParseTypeParameterInstantiation(); - } - if (this.isContextual("implements")) { - this.next(); - var implemented = node["implements"] = []; - do { - var _node = this.startNode(); - _node.id = this.parseIdent(); - if (this.isRelational("<")) { - _node.typeParameters = this.flowParseTypeParameterInstantiation(); - } else { - _node.typeParameters = null; - } - implemented.push(this.finishNode(_node, "ClassImplements")); - } while (this.eat(_tokenizerTypes.types.comma)); - } - }; - }); - - instance.extend("parseObjPropValue", function (inner) { - return function (prop) { - var typeParameters; - - // method shorthand - if (this.isRelational("<")) { - typeParameters = this.flowParseTypeParameterDeclaration(); - if (!this.match(_tokenizerTypes.types.parenL)) this.unexpected(); - } - - inner.apply(this, arguments); - - // add typeParameters if we found them - if (typeParameters) { - prop.value.typeParameters = typeParameters; - } - }; - }); - - instance.extend("parseAssignableListItemTypes", function () { - return function (param) { - if (this.eat(_tokenizerTypes.types.question)) { - param.optional = true; - } - if (this.match(_tokenizerTypes.types.colon)) { - param.typeAnnotation = this.flowParseTypeAnnotation(); - } - this.finishNode(param, param.type); - return param; - }; - }); - - instance.extend("parseImportSpecifiers", function (inner) { - return function (node) { - node.importKind = "value"; - - var kind = this.match(_tokenizerTypes.types._typeof) ? "typeof" : this.isContextual("type") ? "type" : null; - if (kind) { - var lh = this.lookahead(); - if (lh.type === _tokenizerTypes.types.name && lh.value !== "from" || lh.type === _tokenizerTypes.types.braceL || lh.type === _tokenizerTypes.types.star) { - this.next(); - node.importKind = kind; - } - } - - inner.call(this, node); - }; - }); - - // function foo<T>() {} - instance.extend("parseFunctionParams", function (inner) { - return function (node) { - if (this.isRelational("<")) { - node.typeParameters = this.flowParseTypeParameterDeclaration(); - } - inner.call(this, node); - }; - }); - - // var foo: string = bar - instance.extend("parseVarHead", function (inner) { - return function (decl) { - inner.call(this, decl); - if (this.match(_tokenizerTypes.types.colon)) { - decl.id.typeAnnotation = this.flowParseTypeAnnotation(); - this.finishNode(decl.id, decl.id.type); - } - }; - }); - - // var foo = (async (): number => {}); - instance.extend("parseAsyncArrowFromCallExpression", function (inner) { - return function (node, call) { - if (this.match(_tokenizerTypes.types.colon)) { - node.returnType = this.flowParseTypeAnnotation(); - } - - return inner.call(this, node, call); - }; - }); - - instance.extend("parseParenAndDistinguishExpression", function (inner) { - return function (startPos, startLoc, canBeArrow, isAsync) { - startPos = startPos || this.state.start; - startLoc = startLoc || this.state.startLoc; - - if (this.lookahead().type === _tokenizerTypes.types.parenR) { - // var foo = (): number => {}; - this.expect(_tokenizerTypes.types.parenL); - this.expect(_tokenizerTypes.types.parenR); - - var node = this.startNodeAt(startPos, startLoc); - if (this.match(_tokenizerTypes.types.colon)) node.returnType = this.flowParseTypeAnnotation(); - this.expect(_tokenizerTypes.types.arrow); - return this.parseArrowExpression(node, [], isAsync); - } else { - // var foo = (foo): number => {}; - var node = inner.call(this, startPos, startLoc, canBeArrow, isAsync); - - if (this.match(_tokenizerTypes.types.colon)) { - var state = this.state.clone(); - try { - return this.parseParenItem(node, startPos, startLoc, true); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - return node; - } else { - throw err; - } - } - } else { - return node; - } - } - }; - }); -}; - -module.exports = exports["default"]; -},{"617":617,"629":629}],624:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var _xhtml = _dereq_(625); - -var _xhtml2 = _interopRequireDefault(_xhtml); - -var _tokenizerTypes = _dereq_(629); - -var _tokenizerContext = _dereq_(626); - -var _parser = _dereq_(617); - -var _parser2 = _interopRequireDefault(_parser); - -var _utilIdentifier = _dereq_(630); - -var _utilWhitespace = _dereq_(632); - -var HEX_NUMBER = /^[\da-fA-F]+$/; -var DECIMAL_NUMBER = /^\d+$/; - -_tokenizerContext.types.j_oTag = new _tokenizerContext.TokContext("<tag", false); -_tokenizerContext.types.j_cTag = new _tokenizerContext.TokContext("</tag", false); -_tokenizerContext.types.j_expr = new _tokenizerContext.TokContext("<tag>...</tag>", true, true); - -_tokenizerTypes.types.jsxName = new _tokenizerTypes.TokenType("jsxName"); -_tokenizerTypes.types.jsxText = new _tokenizerTypes.TokenType("jsxText", { beforeExpr: true }); -_tokenizerTypes.types.jsxTagStart = new _tokenizerTypes.TokenType("jsxTagStart"); -_tokenizerTypes.types.jsxTagEnd = new _tokenizerTypes.TokenType("jsxTagEnd"); - -_tokenizerTypes.types.jsxTagStart.updateContext = function () { - this.state.context.push(_tokenizerContext.types.j_expr); // treat as beginning of JSX expression - this.state.context.push(_tokenizerContext.types.j_oTag); // start opening tag context - this.state.exprAllowed = false; -}; - -_tokenizerTypes.types.jsxTagEnd.updateContext = function (prevType) { - var out = this.state.context.pop(); - if (out === _tokenizerContext.types.j_oTag && prevType === _tokenizerTypes.types.slash || out === _tokenizerContext.types.j_cTag) { - this.state.context.pop(); - this.state.exprAllowed = this.curContext() === _tokenizerContext.types.j_expr; - } else { - this.state.exprAllowed = true; - } -}; - -var pp = _parser2["default"].prototype; - -// Reads inline JSX contents token. - -pp.jsxReadToken = function () { - var out = "", - chunkStart = this.state.pos; - for (;;) { - if (this.state.pos >= this.input.length) { - this.raise(this.state.start, "Unterminated JSX contents"); - } - - var ch = this.input.charCodeAt(this.state.pos); - - switch (ch) { - case 60: // "<" - case 123: - // "{" - if (this.state.pos === this.state.start) { - if (ch === 60 && this.state.exprAllowed) { - ++this.state.pos; - return this.finishToken(_tokenizerTypes.types.jsxTagStart); - } - return this.getTokenFromCode(ch); - } - out += this.input.slice(chunkStart, this.state.pos); - return this.finishToken(_tokenizerTypes.types.jsxText, out); - - case 38: - // "&" - out += this.input.slice(chunkStart, this.state.pos); - out += this.jsxReadEntity(); - chunkStart = this.state.pos; - break; - - default: - if (_utilWhitespace.isNewLine(ch)) { - out += this.input.slice(chunkStart, this.state.pos); - out += this.jsxReadNewLine(true); - chunkStart = this.state.pos; - } else { - ++this.state.pos; - } - } - } -}; - -pp.jsxReadNewLine = function (normalizeCRLF) { - var ch = this.input.charCodeAt(this.state.pos); - var out; - ++this.state.pos; - if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) { - ++this.state.pos; - out = normalizeCRLF ? "\n" : "\r\n"; - } else { - out = String.fromCharCode(ch); - } - ++this.state.curLine; - this.state.lineStart = this.state.pos; - - return out; -}; - -pp.jsxReadString = function (quote) { - var out = "", - chunkStart = ++this.state.pos; - for (;;) { - if (this.state.pos >= this.input.length) { - this.raise(this.state.start, "Unterminated string constant"); - } - - var ch = this.input.charCodeAt(this.state.pos); - if (ch === quote) break; - if (ch === 38) { - // "&" - out += this.input.slice(chunkStart, this.state.pos); - out += this.jsxReadEntity(); - chunkStart = this.state.pos; - } else if (_utilWhitespace.isNewLine(ch)) { - out += this.input.slice(chunkStart, this.state.pos); - out += this.jsxReadNewLine(false); - chunkStart = this.state.pos; - } else { - ++this.state.pos; - } - } - out += this.input.slice(chunkStart, this.state.pos++); - return this.finishToken(_tokenizerTypes.types.string, out); -}; - -pp.jsxReadEntity = function () { - var str = "", - count = 0, - entity; - var ch = this.input[this.state.pos]; - - var startPos = ++this.state.pos; - while (this.state.pos < this.input.length && count++ < 10) { - ch = this.input[this.state.pos++]; - if (ch === ";") { - if (str[0] === "#") { - if (str[1] === "x") { - str = str.substr(2); - if (HEX_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 16)); - } else { - str = str.substr(1); - if (DECIMAL_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 10)); - } - } else { - entity = _xhtml2["default"][str]; - } - break; - } - str += ch; - } - if (!entity) { - this.state.pos = startPos; - return "&"; - } - return entity; -}; - -// Read a JSX identifier (valid tag or attribute name). -// -// Optimized version since JSX identifiers can"t contain -// escape characters and so can be read as single slice. -// Also assumes that first character was already checked -// by isIdentifierStart in readToken. - -pp.jsxReadWord = function () { - var ch, - start = this.state.pos; - do { - ch = this.input.charCodeAt(++this.state.pos); - } while (_utilIdentifier.isIdentifierChar(ch) || ch === 45); // "-" - return this.finishToken(_tokenizerTypes.types.jsxName, this.input.slice(start, this.state.pos)); -}; - -// Transforms JSX element name to string. - -function getQualifiedJSXName(object) { - if (object.type === "JSXIdentifier") { - return object.name; - } - - if (object.type === "JSXNamespacedName") { - return object.namespace.name + ":" + object.name.name; - } - - if (object.type === "JSXMemberExpression") { - return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property); - } -} - -// Parse next token as JSX identifier - -pp.jsxParseIdentifier = function () { - var node = this.startNode(); - if (this.match(_tokenizerTypes.types.jsxName)) { - node.name = this.state.value; - } else if (this.state.type.keyword) { - node.name = this.state.type.keyword; - } else { - this.unexpected(); - } - this.next(); - return this.finishNode(node, "JSXIdentifier"); -}; - -// Parse namespaced identifier. - -pp.jsxParseNamespacedName = function () { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var name = this.jsxParseIdentifier(); - if (!this.eat(_tokenizerTypes.types.colon)) return name; - - var node = this.startNodeAt(startPos, startLoc); - node.namespace = name; - node.name = this.jsxParseIdentifier(); - return this.finishNode(node, "JSXNamespacedName"); -}; - -// Parses element name in any form - namespaced, member -// or single identifier. - -pp.jsxParseElementName = function () { - var startPos = this.state.start, - startLoc = this.state.startLoc; - var node = this.jsxParseNamespacedName(); - while (this.eat(_tokenizerTypes.types.dot)) { - var newNode = this.startNodeAt(startPos, startLoc); - newNode.object = node; - newNode.property = this.jsxParseIdentifier(); - node = this.finishNode(newNode, "JSXMemberExpression"); - } - return node; -}; - -// Parses any type of JSX attribute value. - -pp.jsxParseAttributeValue = function () { - var node; - switch (this.state.type) { - case _tokenizerTypes.types.braceL: - node = this.jsxParseExpressionContainer(); - if (node.expression.type === "JSXEmptyExpression") { - this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"); - } else { - return node; - } - - case _tokenizerTypes.types.jsxTagStart: - case _tokenizerTypes.types.string: - node = this.parseExprAtom(); - node.rawValue = null; - return node; - - default: - this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text"); - } -}; - -// JSXEmptyExpression is unique type since it doesn"t actually parse anything, -// and so it should start at the end of last read token (left brace) and finish -// at the beginning of the next one (right brace). - -pp.jsxParseEmptyExpression = function () { - var tmp = this.state.start; - this.state.start = this.state.lastTokEnd; - this.state.lastTokEnd = tmp; - - tmp = this.state.startLoc; - this.state.startLoc = this.state.lastTokEndLoc; - this.state.lastTokEndLoc = tmp; - - return this.finishNode(this.startNode(), "JSXEmptyExpression"); -}; - -// Parses JSX expression enclosed into curly brackets. - -pp.jsxParseExpressionContainer = function () { - var node = this.startNode(); - this.next(); - if (this.match(_tokenizerTypes.types.braceR)) { - node.expression = this.jsxParseEmptyExpression(); - } else { - node.expression = this.parseExpression(); - } - this.expect(_tokenizerTypes.types.braceR); - return this.finishNode(node, "JSXExpressionContainer"); -}; - -// Parses following JSX attribute name-value pair. - -pp.jsxParseAttribute = function () { - var node = this.startNode(); - if (this.eat(_tokenizerTypes.types.braceL)) { - this.expect(_tokenizerTypes.types.ellipsis); - node.argument = this.parseMaybeAssign(); - this.expect(_tokenizerTypes.types.braceR); - return this.finishNode(node, "JSXSpreadAttribute"); - } - node.name = this.jsxParseNamespacedName(); - node.value = this.eat(_tokenizerTypes.types.eq) ? this.jsxParseAttributeValue() : null; - return this.finishNode(node, "JSXAttribute"); -}; - -// Parses JSX opening tag starting after "<". - -pp.jsxParseOpeningElementAt = function (startPos, startLoc) { - var node = this.startNodeAt(startPos, startLoc); - node.attributes = []; - node.name = this.jsxParseElementName(); - while (!this.match(_tokenizerTypes.types.slash) && !this.match(_tokenizerTypes.types.jsxTagEnd)) { - node.attributes.push(this.jsxParseAttribute()); - } - node.selfClosing = this.eat(_tokenizerTypes.types.slash); - this.expect(_tokenizerTypes.types.jsxTagEnd); - return this.finishNode(node, "JSXOpeningElement"); -}; - -// Parses JSX closing tag starting after "</". - -pp.jsxParseClosingElementAt = function (startPos, startLoc) { - var node = this.startNodeAt(startPos, startLoc); - node.name = this.jsxParseElementName(); - this.expect(_tokenizerTypes.types.jsxTagEnd); - return this.finishNode(node, "JSXClosingElement"); -}; - -// Parses entire JSX element, including it"s opening tag -// (starting after "<"), attributes, contents and closing tag. - -pp.jsxParseElementAt = function (startPos, startLoc) { - var node = this.startNodeAt(startPos, startLoc); - var children = []; - var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc); - var closingElement = null; - - if (!openingElement.selfClosing) { - contents: for (;;) { - switch (this.state.type) { - case _tokenizerTypes.types.jsxTagStart: - startPos = this.state.start;startLoc = this.state.startLoc; - this.next(); - if (this.eat(_tokenizerTypes.types.slash)) { - closingElement = this.jsxParseClosingElementAt(startPos, startLoc); - break contents; - } - children.push(this.jsxParseElementAt(startPos, startLoc)); - break; - - case _tokenizerTypes.types.jsxText: - children.push(this.parseExprAtom()); - break; - - case _tokenizerTypes.types.braceL: - children.push(this.jsxParseExpressionContainer()); - break; - - default: - this.unexpected(); - } - } - - if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { - this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">"); - } - } - - node.openingElement = openingElement; - node.closingElement = closingElement; - node.children = children; - if (this.match(_tokenizerTypes.types.relational) && this.state.value === "<") { - this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag"); - } - return this.finishNode(node, "JSXElement"); -}; - -// Parses entire JSX element from current position. - -pp.jsxParseElement = function () { - var startPos = this.state.start, - startLoc = this.state.startLoc; - this.next(); - return this.jsxParseElementAt(startPos, startLoc); -}; - -exports["default"] = function (instance) { - instance.extend("parseExprAtom", function (inner) { - return function (refShortHandDefaultPos) { - if (this.match(_tokenizerTypes.types.jsxText)) { - var node = this.parseLiteral(this.state.value); - // https://github.com/babel/babel/issues/2078 - node.rawValue = null; - return node; - } else if (this.match(_tokenizerTypes.types.jsxTagStart)) { - return this.jsxParseElement(); - } else { - return inner.call(this, refShortHandDefaultPos); - } - }; - }); - - instance.extend("readToken", function (inner) { - return function (code) { - var context = this.curContext(); - - if (context === _tokenizerContext.types.j_expr) { - return this.jsxReadToken(); - } - - if (context === _tokenizerContext.types.j_oTag || context === _tokenizerContext.types.j_cTag) { - if (_utilIdentifier.isIdentifierStart(code)) { - return this.jsxReadWord(); - } - - if (code === 62) { - ++this.state.pos; - return this.finishToken(_tokenizerTypes.types.jsxTagEnd); - } - - if ((code === 34 || code === 39) && context === _tokenizerContext.types.j_oTag) { - return this.jsxReadString(code); - } - } - - if (code === 60 && this.state.exprAllowed) { - ++this.state.pos; - return this.finishToken(_tokenizerTypes.types.jsxTagStart); - } - - return inner.call(this, code); - }; - }); - - instance.extend("updateContext", function (inner) { - return function (prevType) { - if (this.match(_tokenizerTypes.types.braceL)) { - var curContext = this.curContext(); - if (curContext === _tokenizerContext.types.j_oTag) { - this.state.context.push(_tokenizerContext.types.b_expr); - } else if (curContext === _tokenizerContext.types.j_expr) { - this.state.context.push(_tokenizerContext.types.b_tmpl); - } else { - inner.call(this, prevType); - } - this.state.exprAllowed = true; - } else if (this.match(_tokenizerTypes.types.slash) && prevType === _tokenizerTypes.types.jsxTagStart) { - this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore - this.state.context.push(_tokenizerContext.types.j_cTag); // reconsider as closing tag context - this.state.exprAllowed = false; - } else { - return inner.call(this, prevType); - } - }; - }); -}; - -module.exports = exports["default"]; -},{"617":617,"625":625,"626":626,"629":629,"630":630,"632":632}],625:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports["default"] = { - quot: "\"", - amp: "&", - apos: "'", - lt: "<", - gt: ">", - nbsp: " ", - iexcl: "¡", - cent: "¢", - pound: "£", - curren: "¤", - yen: "¥", - brvbar: "¦", - sect: "§", - uml: "¨", - copy: "©", - ordf: "ª", - laquo: "«", - not: "¬", - shy: "", - reg: "®", - macr: "¯", - deg: "°", - plusmn: "±", - sup2: "²", - sup3: "³", - acute: "´", - micro: "µ", - para: "¶", - middot: "·", - cedil: "¸", - sup1: "¹", - ordm: "º", - raquo: "»", - frac14: "¼", - frac12: "½", - frac34: "¾", - iquest: "¿", - Agrave: "À", - Aacute: "Á", - Acirc: "Â", - Atilde: "Ã", - Auml: "Ä", - Aring: "Å", - AElig: "Æ", - Ccedil: "Ç", - Egrave: "È", - Eacute: "É", - Ecirc: "Ê", - Euml: "Ë", - Igrave: "Ì", - Iacute: "Í", - Icirc: "Î", - Iuml: "Ï", - ETH: "Ð", - Ntilde: "Ñ", - Ograve: "Ò", - Oacute: "Ó", - Ocirc: "Ô", - Otilde: "Õ", - Ouml: "Ö", - times: "×", - Oslash: "Ø", - Ugrave: "Ù", - Uacute: "Ú", - Ucirc: "Û", - Uuml: "Ü", - Yacute: "Ý", - THORN: "Þ", - szlig: "ß", - agrave: "à", - aacute: "á", - acirc: "â", - atilde: "ã", - auml: "ä", - aring: "å", - aelig: "æ", - ccedil: "ç", - egrave: "è", - eacute: "é", - ecirc: "ê", - euml: "ë", - igrave: "ì", - iacute: "í", - icirc: "î", - iuml: "ï", - eth: "ð", - ntilde: "ñ", - ograve: "ò", - oacute: "ó", - ocirc: "ô", - otilde: "õ", - ouml: "ö", - divide: "÷", - oslash: "ø", - ugrave: "ù", - uacute: "ú", - ucirc: "û", - uuml: "ü", - yacute: "ý", - thorn: "þ", - yuml: "ÿ", - OElig: "Œ", - oelig: "œ", - Scaron: "Š", - scaron: "š", - Yuml: "Ÿ", - fnof: "ƒ", - circ: "ˆ", - tilde: "˜", - Alpha: "Α", - Beta: "Β", - Gamma: "Γ", - Delta: "Δ", - Epsilon: "Ε", - Zeta: "Ζ", - Eta: "Η", - Theta: "Θ", - Iota: "Ι", - Kappa: "Κ", - Lambda: "Λ", - Mu: "Μ", - Nu: "Ν", - Xi: "Ξ", - Omicron: "Ο", - Pi: "Π", - Rho: "Ρ", - Sigma: "Σ", - Tau: "Τ", - Upsilon: "Υ", - Phi: "Φ", - Chi: "Χ", - Psi: "Ψ", - Omega: "Ω", - alpha: "α", - beta: "β", - gamma: "γ", - delta: "δ", - epsilon: "ε", - zeta: "ζ", - eta: "η", - theta: "θ", - iota: "ι", - kappa: "κ", - lambda: "λ", - mu: "μ", - nu: "ν", - xi: "ξ", - omicron: "ο", - pi: "π", - rho: "ρ", - sigmaf: "ς", - sigma: "σ", - tau: "τ", - upsilon: "υ", - phi: "φ", - chi: "χ", - psi: "ψ", - omega: "ω", - thetasym: "ϑ", - upsih: "ϒ", - piv: "ϖ", - ensp: " ", - emsp: " ", - thinsp: " ", - zwnj: "", - zwj: "", - lrm: "", - rlm: "", - ndash: "–", - mdash: "—", - lsquo: "‘", - rsquo: "’", - sbquo: "‚", - ldquo: "“", - rdquo: "”", - bdquo: "„", - dagger: "†", - Dagger: "‡", - bull: "•", - hellip: "…", - permil: "‰", - prime: "′", - Prime: "″", - lsaquo: "‹", - rsaquo: "›", - oline: "‾", - frasl: "⁄", - euro: "€", - image: "ℑ", - weierp: "℘", - real: "ℜ", - trade: "™", - alefsym: "ℵ", - larr: "←", - uarr: "↑", - rarr: "→", - darr: "↓", - harr: "↔", - crarr: "↵", - lArr: "⇐", - uArr: "⇑", - rArr: "⇒", - dArr: "⇓", - hArr: "⇔", - forall: "∀", - part: "∂", - exist: "∃", - empty: "∅", - nabla: "∇", - isin: "∈", - notin: "∉", - ni: "∋", - prod: "∏", - sum: "∑", - minus: "−", - lowast: "∗", - radic: "√", - prop: "∝", - infin: "∞", - ang: "∠", - and: "∧", - or: "∨", - cap: "∩", - cup: "∪", - "int": "∫", - there4: "∴", - sim: "∼", - cong: "≅", - asymp: "≈", - ne: "≠", - equiv: "≡", - le: "≤", - ge: "≥", - sub: "⊂", - sup: "⊃", - nsub: "⊄", - sube: "⊆", - supe: "⊇", - oplus: "⊕", - otimes: "⊗", - perp: "⊥", - sdot: "⋅", - lceil: "⌈", - rceil: "⌉", - lfloor: "⌊", - rfloor: "⌋", - lang: "〈", - rang: "〉", - loz: "◊", - spades: "♠", - clubs: "♣", - hearts: "♥", - diams: "♦" -}; -module.exports = exports["default"]; -},{}],626:[function(_dereq_,module,exports){ -// The algorithm used to determine whether a regexp can appear at a -// given point in the program is loosely based on sweet.js' approach. -// See https://github.com/mozilla/sweet.js/wiki/design - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _types = _dereq_(629); - -var TokContext = function TokContext(token, isExpr, preserveSpace, override) { - _classCallCheck(this, TokContext); - - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; -}; - -exports.TokContext = TokContext; -var types = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", true), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - f_expr: new TokContext("function", true) -}; - -exports.types = types; -// Token-specific context update code - -_types.types.parenR.updateContext = _types.types.braceR.updateContext = function () { - if (this.state.context.length === 1) { - this.state.exprAllowed = true; - return; - } - - var out = this.state.context.pop(); - if (out === types.b_stat && this.curContext() === types.f_expr) { - this.state.context.pop(); - this.state.exprAllowed = false; - } else if (out === types.b_tmpl) { - this.state.exprAllowed = true; - } else { - this.state.exprAllowed = !out.isExpr; - } -}; - -_types.types.braceL.updateContext = function (prevType) { - this.state.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); - this.state.exprAllowed = true; -}; - -_types.types.dollarBraceL.updateContext = function () { - this.state.context.push(types.b_tmpl); - this.state.exprAllowed = true; -}; - -_types.types.parenL.updateContext = function (prevType) { - var statementParens = prevType === _types.types._if || prevType === _types.types._for || prevType === _types.types._with || prevType === _types.types._while; - this.state.context.push(statementParens ? types.p_stat : types.p_expr); - this.state.exprAllowed = true; -}; - -_types.types.incDec.updateContext = function () { - // tokExprAllowed stays unchanged -}; - -_types.types._function.updateContext = function () { - if (this.curContext() !== types.b_stat) { - this.state.context.push(types.f_expr); - } - - this.state.exprAllowed = false; -}; - -_types.types.backQuote.updateContext = function () { - if (this.curContext() === types.q_tmpl) { - this.state.context.pop(); - } else { - this.state.context.push(types.q_tmpl); - } - this.state.exprAllowed = false; -}; -},{"629":629}],627:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _utilIdentifier = _dereq_(630); - -var _types = _dereq_(629); - -var _context = _dereq_(626); - -var _utilLocation = _dereq_(631); - -var _utilWhitespace = _dereq_(632); - -var _state = _dereq_(628); - -var _state2 = _interopRequireDefault(_state); - -// Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = function Token(state) { - _classCallCheck(this, Token); - - this.type = state.type; - this.value = state.value; - this.start = state.start; - this.end = state.end; - this.loc = new _utilLocation.SourceLocation(state.startLoc, state.endLoc); -} - -// ## Tokenizer - -// Are we running under Rhino? -/* global Packages */ -; - -exports.Token = Token; -var isRhino = typeof Packages === "object" && Object.prototype.toString.call(Packages) === "[object JavaPackage]"; - -// Parse a regular expression. Some context-awareness is necessary, -// since a '/' inside a '[]' set does not end the expression. - -function tryCreateRegexp(src, flags, throwErrorStart) { - try { - return new RegExp(src, flags); - } catch (e) { - if (throwErrorStart !== undefined) { - if (e instanceof SyntaxError) this.raise(throwErrorStart, "Error parsing regular expression: " + e.message); - this.raise(e); - } - } -} - -var regexpUnicodeSupport = !!tryCreateRegexp("", "u"); - -function codePointToString(code) { - // UTF-16 Decoding - if (code <= 0xFFFF) return String.fromCharCode(code); - return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); -} - -var Tokenizer = (function () { - function Tokenizer(input) { - _classCallCheck(this, Tokenizer); - - this.state = new _state2["default"](); - this.state.init(input); - } - - // Move to the next token - - Tokenizer.prototype.next = function next() { - this.state.tokens.push(new Token(this.state)); - - this.state.lastTokEnd = this.state.end; - this.state.lastTokStart = this.state.start; - this.state.lastTokEndLoc = this.state.endLoc; - this.state.lastTokStartLoc = this.state.startLoc; - this.nextToken(); - }; - - // TODO - - Tokenizer.prototype.eat = function eat(type) { - if (this.match(type)) { - this.next(); - return true; - } else { - return false; - } - }; - - // TODO - - Tokenizer.prototype.match = function match(type) { - return this.state.type === type; - }; - - // TODO - - Tokenizer.prototype.lookahead = function lookahead() { - var old = this.state; - this.state = old.clone(); - this.next(); - var curr = this.state.clone(); - this.state = old; - return curr; - }; - - // Toggle strict mode. Re-reads the next number or string to please - // pedantic tests (`"use strict"; 010;` should fail). - - Tokenizer.prototype.setStrict = function setStrict(strict) { - this.strict = strict; - if (!this.match(_types.types.num) && !this.match(_types.types.string)) return; - this.state.pos = this.state.start; - while (this.state.pos < this.state.lineStart) { - this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; - --this.state.curLine; - } - this.nextToken(); - }; - - Tokenizer.prototype.curContext = function curContext() { - return this.state.context[this.state.context.length - 1]; - }; - - // Read a single token, updating the parser object's token-related - // properties. - - Tokenizer.prototype.nextToken = function nextToken() { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - - this.state.start = this.state.pos; - this.state.startLoc = this.state.curPosition(); - if (this.state.pos >= this.input.length) return this.finishToken(_types.types.eof); - - if (curContext.override) { - return curContext.override(this); - } else { - return this.readToken(this.fullCharCodeAtPos()); - } - }; - - Tokenizer.prototype.readToken = function readToken(code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (_utilIdentifier.isIdentifierStart(code, true) || code === 92 /* '\' */) return this.readWord(); - - return this.getTokenFromCode(code); - }; - - Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { - var code = this.input.charCodeAt(this.state.pos); - if (code <= 0xd7ff || code >= 0xe000) return code; - - var next = this.input.charCodeAt(this.state.pos + 1); - return (code << 10) + next - 0x35fdc00; - }; - - Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? "CommentBlock" : "CommentLine", - value: text, - start: start, - end: end, - loc: new _utilLocation.SourceLocation(startLoc, endLoc), - range: [start, end] - }; - - this.state.tokens.push(comment); - this.state.comments.push(comment); - this.addComment(comment); - }; - - Tokenizer.prototype.skipBlockComment = function skipBlockComment() { - var startLoc = this.state.curPosition(); - var start = this.state.pos, - end = this.input.indexOf("*/", this.state.pos += 2); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); - - this.state.pos = end + 2; - _utilWhitespace.lineBreakG.lastIndex = start; - var match = undefined; - while ((match = _utilWhitespace.lineBreakG.exec(this.input)) && match.index < this.state.pos) { - ++this.state.curLine; - this.state.lineStart = match.index + match[0].length; - } - - this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { - var start = this.state.pos; - var startLoc = this.state.curPosition(); - var ch = this.input.charCodeAt(this.state.pos += startSkip); - while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this.state.pos; - ch = this.input.charCodeAt(this.state.pos); - } - - this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - // Called at the start of the parse and after every token. Skips - // whitespace and comments, and. - - Tokenizer.prototype.skipSpace = function skipSpace() { - loop: while (this.state.pos < this.input.length) { - var ch = this.input.charCodeAt(this.state.pos); - switch (ch) { - case 32:case 160: - // ' ' - ++this.state.pos; - break; - - case 13: - if (this.input.charCodeAt(this.state.pos + 1) === 10) { - ++this.state.pos; - } - - case 10:case 8232:case 8233: - ++this.state.pos; - ++this.state.curLine; - this.state.lineStart = this.state.pos; - break; - - case 47: - // '/' - switch (this.input.charCodeAt(this.state.pos + 1)) { - case 42: - // '*' - this.skipBlockComment(); - break; - - case 47: - this.skipLineComment(2); - break; - - default: - break loop; - } - break; - - default: - if (ch > 8 && ch < 14 || ch >= 5760 && _utilWhitespace.nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.state.pos; - } else { - break loop; - } - } - } - }; - - // Called at the end of every token. Sets `end`, `val`, and - // maintains `context` and `exprAllowed`, and skips the space after - // the token, so that the next one's `start` will point at the - // right position. - - Tokenizer.prototype.finishToken = function finishToken(type, val) { - this.state.end = this.state.pos; - this.state.endLoc = this.state.curPosition(); - var prevType = this.state.type; - this.state.type = type; - this.state.value = val; - - this.updateContext(prevType); - }; - - // ### Token reading - - // This is the function that is called to fetch the next token. It - // is somewhat obscure, because it works in character codes rather - // than characters, and because operator parsing has been inlined - // into it. - // - // All in the name of speed. - // - - Tokenizer.prototype.readToken_dot = function readToken_dot() { - var next = this.input.charCodeAt(this.state.pos + 1); - if (next >= 48 && next <= 57) { - return this.readNumber(true); - } - - var next2 = this.input.charCodeAt(this.state.pos + 2); - if (next === 46 && next2 === 46) { - // 46 = dot '.' - this.state.pos += 3; - return this.finishToken(_types.types.ellipsis); - } else { - ++this.state.pos; - return this.finishToken(_types.types.dot); - } - }; - - Tokenizer.prototype.readToken_slash = function readToken_slash() { - // '/' - if (this.state.exprAllowed) { - ++this.state.pos; - return this.readRegexp(); - } - - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(_types.types.assign, 2); - } else { - return this.finishOp(_types.types.slash, 1); - } - }; - - Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { - // '%*' - var type = code === 42 ? _types.types.star : _types.types.modulo; - var width = 1; - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === 42 && this.options.features["es7.exponentiationOperator"]) { - // '*' - width++; - next = this.input.charCodeAt(this.state.pos + 2); - type = _types.types.exponent; - } - - if (next === 61) { - width++; - type = _types.types.assign; - } - - return this.finishOp(type, width); - }; - - Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { - // '|&' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === code) return this.finishOp(code === 124 ? _types.types.logicalOR : _types.types.logicalAND, 2); - if (next === 61) return this.finishOp(_types.types.assign, 2); - return this.finishOp(code === 124 ? _types.types.bitwiseOR : _types.types.bitwiseAND, 1); - }; - - Tokenizer.prototype.readToken_caret = function readToken_caret() { - // '^' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(_types.types.assign, 2); - } else { - return this.finishOp(_types.types.bitwiseXOR, 1); - } - }; - - Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { - // '+-' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === code) { - if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(_types.types.incDec, 2); - } - - if (next === 61) { - return this.finishOp(_types.types.assign, 2); - } else { - return this.finishOp(_types.types.plusMin, 1); - } - }; - - Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { - // '<>' - var next = this.input.charCodeAt(this.state.pos + 1); - var size = 1; - - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(_types.types.assign, size + 1); - return this.finishOp(_types.types.bitShift, size); - } - - if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { - if (this.inModule) this.unexpected(); - // `<!--`, an XML-style comment that should be interpreted as a line comment - this.skipLineComment(4); - this.skipSpace(); - return this.nextToken(); - } - - if (next === 61) { - size = this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2; - } - - return this.finishOp(_types.types.relational, size); - }; - - Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) { - // '=!' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) return this.finishOp(_types.types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2); - if (code === 61 && next === 62) { - // '=>' - this.state.pos += 2; - return this.finishToken(_types.types.arrow); - } - return this.finishOp(code === 61 ? _types.types.eq : _types.types.prefix, 1); - }; - - Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) { - switch (code) { - // The interpretation of a dot depends on whether it is followed - // by a digit or another two dots. - case 46: - // '.' - return this.readToken_dot(); - - // Punctuation tokens. - case 40: - ++this.state.pos;return this.finishToken(_types.types.parenL); - case 41: - ++this.state.pos;return this.finishToken(_types.types.parenR); - case 59: - ++this.state.pos;return this.finishToken(_types.types.semi); - case 44: - ++this.state.pos;return this.finishToken(_types.types.comma); - case 91: - ++this.state.pos;return this.finishToken(_types.types.bracketL); - case 93: - ++this.state.pos;return this.finishToken(_types.types.bracketR); - case 123: - ++this.state.pos;return this.finishToken(_types.types.braceL); - case 125: - ++this.state.pos;return this.finishToken(_types.types.braceR); - - case 58: - if (this.options.features["es7.functionBind"] && this.input.charCodeAt(this.state.pos + 1) === 58) { - return this.finishOp(_types.types.doubleColon, 2); - } else { - ++this.state.pos; - return this.finishToken(_types.types.colon); - } - - case 63: - ++this.state.pos;return this.finishToken(_types.types.question); - case 64: - ++this.state.pos;return this.finishToken(_types.types.at); - - case 96: - // '`' - ++this.state.pos; - return this.finishToken(_types.types.backQuote); - - case 48: - // '0' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number - if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number - if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number - // Anything else beginning with a digit is an integer, octal - // number, or float. - case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: - // 1-9 - return this.readNumber(false); - - // Quotes produce strings. - case 34:case 39: - // '"', "'" - return this.readString(code); - - // Operators are parsed inline in tiny state machines. '=' (61) is - // often referred to. `finishOp` simply skips the amount of - // characters it is given as second argument, and returns a token - // of the type given by its first argument. - - case 47: - // '/' - return this.readToken_slash(); - - case 37:case 42: - // '%*' - return this.readToken_mult_modulo(code); - - case 124:case 38: - // '|&' - return this.readToken_pipe_amp(code); - - case 94: - // '^' - return this.readToken_caret(); - - case 43:case 45: - // '+-' - return this.readToken_plus_min(code); - - case 60:case 62: - // '<>' - return this.readToken_lt_gt(code); - - case 61:case 33: - // '=!' - return this.readToken_eq_excl(code); - - case 126: - // '~' - return this.finishOp(_types.types.prefix, 1); - } - - this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'"); - }; - - Tokenizer.prototype.finishOp = function finishOp(type, size) { - var str = this.input.slice(this.state.pos, this.state.pos + size); - this.state.pos += size; - return this.finishToken(type, str); - }; - - Tokenizer.prototype.readRegexp = function readRegexp() { - // istanbul ignore next - - var _this = this; - - var escaped = undefined, - inClass = undefined, - start = this.state.pos; - for (;;) { - if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression"); - var ch = this.input.charAt(this.state.pos); - if (_utilWhitespace.lineBreak.test(ch)) { - this.raise(start, "Unterminated regular expression"); - } - if (escaped) { - escaped = false; - } else { - if (ch === "[") { - inClass = true; - } else if (ch === "]" && inClass) { - inClass = false; - } else if (ch === "/" && !inClass) { - break; - } - escaped = ch === "\\"; - } - ++this.state.pos; - } - var content = this.input.slice(start, this.state.pos); - ++this.state.pos; - // Need to use `readWord1` because '\uXXXX' sequences are allowed - // here (don't ask). - var mods = this.readWord1(); - var tmp = content; - if (mods) { - var validFlags = /^[gmsiyu]*$/; - if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag"); - if (mods.indexOf("u") >= 0 && !regexpUnicodeSupport) { - // Replace each astral symbol and every Unicode escape sequence that - // possibly represents an astral symbol or a paired surrogate with a - // single ASCII symbol to avoid throwing on regular expressions that - // are only valid in combination with the `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it would - // be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function (match, code, offset) { - code = Number("0x" + code); - if (code > 0x10FFFF) _this.raise(start + offset + 3, "Code point out of bounds"); - return "x"; - }); - tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); - } - } - // Detect invalid regular expressions. - var value = null; - // Rhino's regular expression parser is flaky and throws uncatchable exceptions, - // so don't do detection if we are running under Rhino - if (!isRhino) { - tryCreateRegexp.call(this, tmp, undefined, start); - // Get a regular expression object for this pattern-flag pair, or `null` in - // case the current environment doesn't support the flags it uses. - value = tryCreateRegexp.call(this, content, mods); - } - return this.finishToken(_types.types.regexp, { - pattern: content, - flags: mods, - value: value - }); - }; - - // Read an integer in the given radix. Return null if zero digits - // were read, the integer value otherwise. When `len` is given, this - // will return `null` unless the integer has exactly `len` digits. - - Tokenizer.prototype.readInt = function readInt(radix, len) { - var start = this.state.pos, - total = 0; - for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { - var code = this.input.charCodeAt(this.state.pos), - val = undefined; - if (code >= 97) { - val = code - 97 + 10; // a - } else if (code >= 65) { - val = code - 65 + 10; // A - } else if (code >= 48 && code <= 57) { - val = code - 48; // 0-9 - } else { - val = Infinity; - } - if (val >= radix) break; - ++this.state.pos; - total = total * radix + val; - } - if (this.state.pos === start || len != null && this.state.pos - start !== len) return null; - - return total; - }; - - Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) { - this.state.pos += 2; // 0x - var val = this.readInt(radix); - if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix); - if (_utilIdentifier.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); - return this.finishToken(_types.types.num, val); - }; - - // Read an integer, octal integer, or floating-point number. - - Tokenizer.prototype.readNumber = function readNumber(startsWithDot) { - var start = this.state.pos, - isFloat = false, - octal = this.input.charCodeAt(this.state.pos) === 48; - if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number"); - var next = this.input.charCodeAt(this.state.pos); - if (next === 46) { - // '.' - ++this.state.pos; - this.readInt(10); - isFloat = true; - next = this.input.charCodeAt(this.state.pos); - } - if (next === 69 || next === 101) { - // 'eE' - next = this.input.charCodeAt(++this.state.pos); - if (next === 43 || next === 45) ++this.state.pos; // '+-' - if (this.readInt(10) === null) this.raise(start, "Invalid number"); - isFloat = true; - } - if (_utilIdentifier.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); - - var str = this.input.slice(start, this.state.pos), - val = undefined; - if (isFloat) { - val = parseFloat(str); - } else if (!octal || str.length === 1) { - val = parseInt(str, 10); - } else if (/[89]/.test(str) || this.strict) { - this.raise(start, "Invalid number"); - } else { - val = parseInt(str, 8); - } - return this.finishToken(_types.types.num, val); - }; - - // Read a string value, interpreting backslash-escapes. - - Tokenizer.prototype.readCodePoint = function readCodePoint() { - var ch = this.input.charCodeAt(this.state.pos), - code = undefined; - - if (ch === 123) { - var codePos = ++this.state.pos; - code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos); - ++this.state.pos; - if (code > 0x10FFFF) this.raise(codePos, "Code point out of bounds"); - } else { - code = this.readHexChar(4); - } - return code; - }; - - Tokenizer.prototype.readString = function readString(quote) { - var out = "", - chunkStart = ++this.state.pos; - for (;;) { - if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant"); - var ch = this.input.charCodeAt(this.state.pos); - if (ch === quote) break; - if (ch === 92) { - // '\' - out += this.input.slice(chunkStart, this.state.pos); - out += this.readEscapedChar(false); - chunkStart = this.state.pos; - } else { - if (_utilWhitespace.isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant"); - ++this.state.pos; - } - } - out += this.input.slice(chunkStart, this.state.pos++); - return this.finishToken(_types.types.string, out); - }; - - // Reads template string tokens. - - Tokenizer.prototype.readTmplToken = function readTmplToken() { - var out = "", - chunkStart = this.state.pos; - for (;;) { - if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template"); - var ch = this.input.charCodeAt(this.state.pos); - if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) { - // '`', '${' - if (this.state.pos === this.state.start && this.match(_types.types.template)) { - if (ch === 36) { - this.state.pos += 2; - return this.finishToken(_types.types.dollarBraceL); - } else { - ++this.state.pos; - return this.finishToken(_types.types.backQuote); - } - } - out += this.input.slice(chunkStart, this.state.pos); - return this.finishToken(_types.types.template, out); - } - if (ch === 92) { - // '\' - out += this.input.slice(chunkStart, this.state.pos); - out += this.readEscapedChar(true); - chunkStart = this.state.pos; - } else if (_utilWhitespace.isNewLine(ch)) { - out += this.input.slice(chunkStart, this.state.pos); - ++this.state.pos; - switch (ch) { - case 13: - if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; - case 10: - out += "\n"; - break; - default: - out += String.fromCharCode(ch); - break; - } - ++this.state.curLine; - this.state.lineStart = this.state.pos; - chunkStart = this.state.pos; - } else { - ++this.state.pos; - } - } - }; - - // Used to read escaped characters - - Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) { - var ch = this.input.charCodeAt(++this.state.pos); - ++this.state.pos; - switch (ch) { - case 110: - return "\n"; // 'n' -> '\n' - case 114: - return "\r"; // 'r' -> '\r' - case 120: - return String.fromCharCode(this.readHexChar(2)); // 'x' - case 117: - return codePointToString(this.readCodePoint()); // 'u' - case 116: - return "\t"; // 't' -> '\t' - case 98: - return "\b"; // 'b' -> '\b' - case 118: - return "\u000b"; // 'v' -> '\u000b' - case 102: - return "\f"; // 'f' -> '\f' - case 13: - if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n' - case 10: - // ' \n' - this.state.lineStart = this.state.pos; - ++this.state.curLine; - return ""; - default: - if (ch >= 48 && ch <= 55) { - var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0]; - var octal = parseInt(octalStr, 8); - if (octal > 255) { - octalStr = octalStr.slice(0, -1); - octal = parseInt(octalStr, 8); - } - if (octal > 0 && (this.strict || inTemplate)) { - this.raise(this.state.pos - 2, "Octal literal in strict mode"); - } - this.state.pos += octalStr.length - 1; - return String.fromCharCode(octal); - } - return String.fromCharCode(ch); - } - }; - - // Used to read character escape sequences ('\x', '\u', '\U'). - - Tokenizer.prototype.readHexChar = function readHexChar(len) { - var codePos = this.state.pos; - var n = this.readInt(16, len); - if (n === null) this.raise(codePos, "Bad character escape sequence"); - return n; - }; - - // Read an identifier, and return it as a string. Sets `this.state.containsEsc` - // to whether the word contained a '\u' escape. - // - // Incrementally adds only escaped chars, adding other chunks as-is - // as a micro-optimization. - - Tokenizer.prototype.readWord1 = function readWord1() { - this.state.containsEsc = false; - var word = "", - first = true, - chunkStart = this.state.pos; - while (this.state.pos < this.input.length) { - var ch = this.fullCharCodeAtPos(); - if (_utilIdentifier.isIdentifierChar(ch, true)) { - this.state.pos += ch <= 0xffff ? 1 : 2; - } else if (ch === 92) { - // "\" - this.state.containsEsc = true; - - word += this.input.slice(chunkStart, this.state.pos); - var escStart = this.state.pos; - - if (this.input.charCodeAt(++this.state.pos) !== 117) { - // "u" - this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX"); - } - - ++this.state.pos; - var esc = this.readCodePoint(); - if (!(first ? _utilIdentifier.isIdentifierStart : _utilIdentifier.isIdentifierChar)(esc, true)) { - this.raise(escStart, "Invalid Unicode escape"); - } - - word += codePointToString(esc); - chunkStart = this.state.pos; - } else { - break; - } - first = false; - } - return word + this.input.slice(chunkStart, this.state.pos); - }; - - // Read an identifier or keyword token. Will check for reserved - // words when necessary. - - Tokenizer.prototype.readWord = function readWord() { - var word = this.readWord1(); - var type = _types.types.name; - if (!this.state.containsEsc && this.isKeyword(word)) type = _types.keywords[word]; - return this.finishToken(type, word); - }; - - Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) { - if (prevType === _types.types.colon) { - var _parent = this.curContext(); - if (_parent === _context.types.b_stat || _parent === _context.types.b_expr) { - return !_parent.isExpr; - } - } - - if (prevType === _types.types._return) { - return _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); - } - - if (prevType === _types.types._else || prevType === _types.types.semi || prevType === _types.types.eof || prevType === _types.types.parenR) { - return true; - } - - if (prevType === _types.types.braceL) { - return this.curContext() === _context.types.b_stat; - } - - return !this.state.exprAllowed; - }; - - Tokenizer.prototype.updateContext = function updateContext(prevType) { - var update = undefined, - type = this.state.type; - if (type.keyword && prevType === _types.types.dot) { - this.state.exprAllowed = false; - } else if (update = type.updateContext) { - update.call(this, prevType); - } else { - this.state.exprAllowed = type.beforeExpr; - } - }; - - return Tokenizer; -})(); - -exports["default"] = Tokenizer; -},{"626":626,"628":628,"629":629,"630":630,"631":631,"632":632}],628:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _utilLocation = _dereq_(631); - -var _context = _dereq_(626); - -var _types = _dereq_(629); - -var State = (function () { - function State() { - _classCallCheck(this, State); - } - - State.prototype.init = function init(input) { - this.input = input; - - // Used to signify the start of a potential arrow function - this.potentialArrowAt = -1; - - // Flags to track whether we are in a function, a generator. - this.inFunction = this.inGenerator = false; - - // Labels in scope. - this.labels = []; - - // Leading decorators. - this.decorators = []; - - // Token store. - this.tokens = []; - - // Comment store. - this.comments = []; - - // Comment attachment store - this.trailingComments = []; - this.leadingComments = []; - this.commentStack = []; - - // The current position of the tokenizer in the input. - this.pos = this.lineStart = 0; - this.curLine = 1; - - // Properties of the current token: - // Its type - this.type = _types.types.eof; - // For tokens that include more information than their type, the value - this.value = null; - // Its start and end offset - this.start = this.end = this.pos; - // And, if locations are used, the {line, column} object - // corresponding to those offsets - this.startLoc = this.endLoc = this.curPosition(); - - // Position information for the previous token - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - this.context = [_context.types.b_stat]; - this.exprAllowed = true; - - // Used to signal to callers of `readWord1` whether the word - // contained any escape sequences. This is needed because words with - // escape sequences must not be interpreted as keywords. - - this.containsEsc = false; - - return this; - }; - - State.prototype.curPosition = function curPosition() { - return new _utilLocation.Position(this.curLine, this.pos - this.lineStart); - }; - - State.prototype.clone = function clone() { - var state = new State(); - for (var key in this) { - var val = this[key]; - if (Array.isArray(val)) val = val.slice(); - state[key] = val; - } - return state; - }; - - return State; -})(); - -exports["default"] = State; -module.exports = exports["default"]; -},{"626":626,"629":629,"631":631}],629:[function(_dereq_,module,exports){ -// ## Token types - -// The assignment of fine-grained, information-carrying type objects -// allows the tokenizer to store the information it has about a -// token in a way that is very cheap for the parser to look up. - -// All token type variables start with an underscore, to make them -// easy to recognize. - -// The `beforeExpr` property is used to disambiguate between regular -// expressions and divisions. It is set on all token types that can -// be followed by an expression (thus, a slash after them would be a -// regular expression). -// -// `isLoop` marks a keyword as starting a loop, which is important -// to know when parsing a label, in order to allow or disallow -// continue jumps to that label. - -"use strict"; - -exports.__esModule = true; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var TokenType = function TokenType(label) { - var conf = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - _classCallCheck(this, TokenType); - - this.label = label; - this.keyword = conf.keyword; - this.beforeExpr = !!conf.beforeExpr; - this.startsExpr = !!conf.startsExpr; - this.rightAssociative = !!conf.rightAssociative; - this.isLoop = !!conf.isLoop; - this.isAssign = !!conf.isAssign; - this.prefix = !!conf.prefix; - this.postfix = !!conf.postfix; - this.binop = conf.binop || null; - this.updateContext = null; -}; - -exports.TokenType = TokenType; - -function binop(name, prec) { - return new TokenType(name, { beforeExpr: true, binop: prec }); -} -var beforeExpr = { beforeExpr: true }, - startsExpr = { startsExpr: true }; - -var types = { - num: new TokenType("num", startsExpr), - regexp: new TokenType("regexp", startsExpr), - string: new TokenType("string", startsExpr), - name: new TokenType("name", startsExpr), - eof: new TokenType("eof"), - - // Punctuation token types. - bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }), - bracketR: new TokenType("]"), - braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }), - braceR: new TokenType("}"), - parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }), - parenR: new TokenType(")"), - comma: new TokenType(",", beforeExpr), - semi: new TokenType(";", beforeExpr), - colon: new TokenType(":", beforeExpr), - doubleColon: new TokenType("::", beforeExpr), - dot: new TokenType("."), - question: new TokenType("?", beforeExpr), - arrow: new TokenType("=>", beforeExpr), - template: new TokenType("template"), - ellipsis: new TokenType("...", beforeExpr), - backQuote: new TokenType("`", startsExpr), - dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }), - at: new TokenType("@"), - - // Operators. These carry several kinds of properties to help the - // parser use them properly (the presence of these properties is - // what categorizes them as operators). - // - // `binop`, when present, specifies that this operator is a binary - // operator, and will refer to its precedence. - // - // `prefix` and `postfix` mark the operator as a prefix or postfix - // unary operator. - // - // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as - // binary operators with a very low precedence, that should result - // in AssignmentExpression nodes. - - eq: new TokenType("=", { beforeExpr: true, isAssign: true }), - assign: new TokenType("_=", { beforeExpr: true, isAssign: true }), - incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }), - prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }), - logicalOR: binop("||", 1), - logicalAND: binop("&&", 2), - bitwiseOR: binop("|", 3), - bitwiseXOR: binop("^", 4), - bitwiseAND: binop("&", 5), - equality: binop("==/!=", 6), - relational: binop("</>", 7), - bitShift: binop("<</>>", 8), - plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }), - modulo: binop("%", 10), - star: binop("*", 10), - slash: binop("/", 10), - exponent: new TokenType("**", { beforeExpr: true, binop: 11, rightAssociative: true }) -}; - -exports.types = types; -// Map keyword names to token types. - -var keywords = {}; - -exports.keywords = keywords; -// Succinct definitions of keyword token types -function kw(name) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - options.keyword = name; - keywords[name] = types["_" + name] = new TokenType(name, options); -} - -kw("break"); -kw("case", beforeExpr); -kw("catch"); -kw("continue"); -kw("debugger"); -kw("default", beforeExpr); -kw("do", { isLoop: true }); -kw("else", beforeExpr); -kw("finally"); -kw("for", { isLoop: true }); -kw("function", startsExpr); -kw("if"); -kw("return", beforeExpr); -kw("switch"); -kw("throw", beforeExpr); -kw("try"); -kw("var"); -kw("let"); -kw("const"); -kw("while", { isLoop: true }); -kw("with"); -kw("new", { beforeExpr: true, startsExpr: true }); -kw("this", startsExpr); -kw("super", startsExpr); -kw("class"); -kw("extends", beforeExpr); -kw("export"); -kw("import"); -kw("yield", { beforeExpr: true, startsExpr: true }); -kw("null", startsExpr); -kw("true", startsExpr); -kw("false", startsExpr); -kw("in", { beforeExpr: true, binop: 7 }); -kw("instanceof", { beforeExpr: true, binop: 7 }); -kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }); -kw("void", { beforeExpr: true, prefix: true, startsExpr: true }); -kw("delete", { beforeExpr: true, prefix: true, startsExpr: true }); -},{}],630:[function(_dereq_,module,exports){ -// This is a trick taken from Esprima. It turns out that, on -// non-Chrome browsers, to check whether a string is in a set, a -// predicate containing a big ugly `switch` statement is faster than -// a regular expression, and on Chrome the two are about on par. -// This function uses `eval` (non-lexical) to produce such a -// predicate from a space-separated string of words. -// -// It starts by sorting the words by length. - -"use strict"; - -exports.__esModule = true; -exports.isIdentifierStart = isIdentifierStart; -exports.isIdentifierChar = isIdentifierChar; -function makePredicate(words) { - words = words.split(" "); - return function (str) { - return words.indexOf(str) >= 0; - }; -} - -// Reserved word lists for various dialects of the language - -var reservedWords = { - 6: makePredicate("enum await"), - strict: makePredicate("implements interface let package private protected public static yield"), - strictBind: makePredicate("eval arguments") -}; - -exports.reservedWords = reservedWords; -// And the keywords - -var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); - -exports.isKeyword = isKeyword; -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `tools/generate-identifier-regex.js`. - -var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ"; -var nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_"; - -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - -// These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by tools/generate-identifier-regex.js -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541]; -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239]; - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code, set) { - var pos = 0x10000; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) return false; - - pos += set[i + 1]; - if (pos >= code) return true; - } -} - -// Test whether a given character code starts an identifier. - -function isIdentifierStart(code) { - if (code < 65) return code === 36; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes); -} - -// Test whether a given character is part of an identifier. - -function isIdentifierChar(code) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} -},{}],631:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getLineInfo = getLineInfo; -// istanbul ignore next - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _whitespace = _dereq_(632); - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. - -var Position = function Position(line, col) { - _classCallCheck(this, Position); - - this.line = line; - this.column = col; -}; - -exports.Position = Position; - -var SourceLocation = function SourceLocation(start, end) { - _classCallCheck(this, SourceLocation); - - this.start = start; - this.end = end; -} - -// The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -; - -exports.SourceLocation = SourceLocation; - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - _whitespace.lineBreakG.lastIndex = cur; - var match = _whitespace.lineBreakG.exec(input); - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } -} -},{"632":632}],632:[function(_dereq_,module,exports){ -// Matches a whole line break (where CRLF is considered a single -// line break). Used to count lines. - -"use strict"; - -exports.__esModule = true; -exports.isNewLine = isNewLine; -var lineBreak = /\r\n?|\n|\u2028|\u2029/; -exports.lineBreak = lineBreak; -var lineBreakG = new RegExp(lineBreak.source, "g"); - -exports.lineBreakG = lineBreakG; - -function isNewLine(code) { - return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; -} - -var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; -exports.nonASCIIwhitespace = nonASCIIwhitespace; -},{}]},{},[14])(14) -}); \ No newline at end of file + /** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ + function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = { generatedLine: -1, generatedColumn: 0 }; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + }; + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + }; + + exports.MappingList = MappingList; + +/***/ }), +/* 610 */ +/***/ (function(module, exports) { + + "use strict"; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + // It turns out that some (most?) JavaScript engines don't self-host + // `Array.prototype.sort`. This makes sense because C++ will likely remain + // faster than JS when doing raw CPU-intensive sorting. However, when using a + // custom comparator function, calling back and forth between the VM's C++ and + // JIT'd JS is rather slow *and* loses JIT type information, resulting in + // worse generated code for the comparator function than would be optimal. In + // fact, when sorting with a comparator, these costs outweigh the benefits of + // sorting in C++. By using our own JS-implemented Quick Sort (below), we get + // a ~3500ms mean speed-up in `bench/bench.html`. + + /** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ + function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; + } + + /** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ + function randomIntInRange(low, high) { + return Math.round(low + Math.random() * (high - low)); + } + + /** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ + function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } + } + + /** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); + }; + +/***/ }), +/* 611 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(61); + var binarySearch = __webpack_require__(608); + var ArraySet = __webpack_require__(281).ArraySet; + var base64VLQ = __webpack_require__(282); + var quickSort = __webpack_require__(610).quickSort; + + function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap) : new BasicSourceMapConsumer(sourceMap); + } + + SourceMapConsumer.fromSourceMap = function (aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + SourceMapConsumer.prototype._version = 3; + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + + SourceMapConsumer.prototype.__generatedMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function get() { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } + }); + + SourceMapConsumer.prototype.__originalMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function get() { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } + }); + + SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + + SourceMapConsumer.GENERATED_ORDER = 1; + SourceMapConsumer.ORIGINAL_ORDER = 2; + + SourceMapConsumer.GREATEST_LOWER_BOUND = 1; + SourceMapConsumer.LEAST_UPPER_BOUND = 2; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + + exports.SourceMapConsumer = SourceMapConsumer; + + /** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ + function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + sources = sources.map(String + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + ).map(util.normalize + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + ).map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; + } + + BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer + */ + BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot); + smc.file = aSourceMap._file; + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping(); + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + BasicSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function get() { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); + } + }); + + /** + * Provide the JIT with a nice shape / hidden class. + */ + function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } else if (aStr.charAt(index) === ',') { + index++; + } else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) { + return sc == null; + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } + + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } + + var url; + if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]; + } + + if ((!url.path || url.path == "/") && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + + exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + + /** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ + function IndexedSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + }; + }); + } + + IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + + /** + * The version of the source mapping spec that we are consuming. + */ + IndexedSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function get() { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + }); + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return needle.generatedColumn - section.generatedOffset.generatedColumn; + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), + bias: aArgs.bias + }); + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + + exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + +/***/ }), +/* 612 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var SourceMapGenerator = __webpack_require__(283).SourceMapGenerator; + var util = __webpack_require__(61); + + // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other + // operating systems these days (capturing the result). + var REGEX_NEWLINE = /(\r?\n)/; + + // Newline character code for charCodeAt() comparisons + var NEWLINE_CODE = 10; + + // Private symbol for identifying `SourceNode`s when multiple versions of + // the source-map library are loaded. This MUST NOT CHANGE across + // versions! + var isSourceNode = "$$$isSourceNode$$$"; + + /** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ + function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are removed from this array, by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var shiftNextLine = function shiftNextLine() { + var lineContents = remainingLines.shift(); + // The last line of a file might not have a newline. + var newLine = remainingLines.shift() || ""; + return lineContents + newLine; + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, + lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[0]; + var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn); + remainingLines[0] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[0]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[0] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLines.length > 0) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source; + node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name)); + } + } + }; + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } else { + throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); + } + return this; + }; + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length - 1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } else { + throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); + } + return this; + }; + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + }; + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len - 1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + }; + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; + }; + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; + }; + + /** + * Returns the string representation of this source node along with a source + * map. + */ + SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null && original.line !== null && original.column !== null) { + if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; + }; + + exports.SourceNode = SourceNode; + +/***/ }), +/* 613 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var ansiRegex = __webpack_require__(176)(); + + module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; + }; + +/***/ }), +/* 614 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var argv = process.argv; + + var terminator = argv.indexOf('--'); + var hasFlag = function hasFlag(flag) { + flag = '--' + flag; + var pos = argv.indexOf(flag); + return pos !== -1 && (terminator !== -1 ? pos < terminator : true); + }; + + module.exports = function () { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + return false; + } + + if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in process.env) { + return true; + } + + if (process.env.TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { + return true; + } + + return false; + }(); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 615 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + module.exports = function toFastproperties(o) { + function Sub() {} + Sub.prototype = o; + var receiver = new Sub(); // create an instance + function ic() { + return _typeof(receiver.foo); + } // perform access + ic(); + ic(); + return o; + eval("o" + o); // ensure no dead code elimination + }; + +/***/ }), +/* 616 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function (str) { + var tail = str.length; + + while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) { + tail--; + } + + return str.slice(0, tail); + }; + +/***/ }), +/* 617 */ +/***/ (function(module, exports) { + + 'use strict'; + + if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; + } else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function TempCtor() {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + }; + } + +/***/ }), +/* 618 */ +/***/ (function(module, exports) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + module.exports = function isBuffer(arg) { + return arg && (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; + }; + +/***/ }), +/* 619 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * A shim that replaces Babel's require('package.json') statement. + * Babel requires the entire package.json file just to get the version number. + */ + var version = exports.version = ("6.25.0"); + +/***/ }), +/* 620 */ +/***/ (function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.runScripts = runScripts; + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of the React source tree. An additional + * grant of patent rights can be found in the PATENTS file in the same directory. + */ + + var scriptTypes = ['text/jsx', 'text/babel']; + + var headEl = void 0; + var inlineScriptCount = 0; + + /** + * Actually transform the code. + */ + function transformCode(transformFn, script) { + var source = void 0; + if (script.url != null) { + source = script.url; + } else { + source = 'Inline Babel script'; + inlineScriptCount++; + if (inlineScriptCount > 1) { + source += ' (' + inlineScriptCount + ')'; + } + } + + return transformFn(script.content, _extends({ + filename: source + }, buildBabelOptions(script))).code; + } + + /** + * Builds the Babel options for transforming the specified script, using some + * sensible default presets and plugins if none were explicitly provided. + */ + function buildBabelOptions(script) { + return { + presets: script.presets || ['react', 'es2015'], + plugins: script.plugins || ['transform-class-properties', 'transform-object-rest-spread', 'transform-flow-strip-types'], + sourceMaps: 'inline' + }; + } + + /** + * Appends a script element at the end of the <head> with the content of code, + * after transforming it. + */ + function run(transformFn, script) { + var scriptEl = document.createElement('script'); + scriptEl.text = transformCode(transformFn, script); + headEl.appendChild(scriptEl); + } + + /** + * Load script from the provided url and pass the content to the callback. + */ + function load(url, successCallback, errorCallback) { + var xhr = new XMLHttpRequest(); + + // async, however scripts will be executed in the order they are in the + // DOM to mirror normal script loading. + xhr.open('GET', url, true); + if ('overrideMimeType' in xhr) { + xhr.overrideMimeType('text/plain'); + } + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + if (xhr.status === 0 || xhr.status === 200) { + successCallback(xhr.responseText); + } else { + errorCallback(); + throw new Error('Could not load ' + url); + } + } + }; + return xhr.send(null); + } + + /** + * Converts a comma-separated data attribute string into an array of values. If + * the string is empty, returns an empty array. If the string is not defined, + * returns null. + */ + function getPluginsOrPresetsFromScript(script, attributeName) { + var rawValue = script.getAttribute(attributeName); + if (rawValue === '') { + // Empty string means to not load ANY presets or plugins + return []; + } + if (!rawValue) { + // Any other falsy value (null, undefined) means we're not overriding this + // setting, and should use the default. + return null; + } + return rawValue.split(',').map(function (item) { + return item.trim(); + }); + } + + /** + * Loop over provided script tags and get the content, via innerHTML if an + * inline script, or by using XHR. Transforms are applied if needed. The scripts + * are executed in the order they are found on the page. + */ + function loadScripts(transformFn, scripts) { + var result = []; + var count = scripts.length; + + function check() { + var script, i; + + for (i = 0; i < count; i++) { + script = result[i]; + + if (script.loaded && !script.executed) { + script.executed = true; + run(transformFn, script); + } else if (!script.loaded && !script.error && !script.async) { + break; + } + } + } + + scripts.forEach(function (script, i) { + var scriptData = { + // script.async is always true for non-JavaScript script tags + async: script.hasAttribute('async'), + error: false, + executed: false, + plugins: getPluginsOrPresetsFromScript(script, 'data-plugins'), + presets: getPluginsOrPresetsFromScript(script, 'data-presets') + }; + + if (script.src) { + result[i] = _extends({}, scriptData, { + content: null, + loaded: false, + url: script.src + }); + + load(script.src, function (content) { + result[i].loaded = true; + result[i].content = content; + check(); + }, function () { + result[i].error = true; + check(); + }); + } else { + result[i] = _extends({}, scriptData, { + content: script.innerHTML, + loaded: true, + url: null + }); + } + }); + + check(); + } + + /** + * Run script tags with type="text/jsx". + * @param {Array} scriptTags specify script tags to run, run all in the <head> if not given + */ + function runScripts(transformFn, scripts) { + headEl = document.getElementsByTagName('head')[0]; + if (!scripts) { + scripts = document.getElementsByTagName('script'); + } + + // Array.prototype.slice cannot be used on NodeList on IE8 + var jsxScripts = []; + for (var i = 0; i < scripts.length; i++) { + var script = scripts.item(i); + // Support the old type="text/jsx;harmony=true" + var type = script.type.split(';')[0]; + if (scriptTypes.indexOf(type) !== -1) { + jsxScripts.push(script); + } + } + + if (jsxScripts.length === 0) { + return; + } + + console.warn('You are using the in-browser Babel transformer. Be sure to precompile ' + 'your scripts for production - https://babeljs.io/docs/setup/'); + + loadScripts(transformFn, jsxScripts); + } + +/***/ }), +/* 621 */ +/***/ (function(module, exports) { + + module.exports = { + "builtin": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "System": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "es5": { + "Array": false, + "Boolean": false, + "constructor": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "propertyIsEnumerable": false, + "RangeError": false, + "ReferenceError": false, + "RegExp": false, + "String": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false + }, + "es6": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "System": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "browser": { + "addEventListener": false, + "alert": false, + "AnalyserNode": false, + "Animation": false, + "AnimationEffectReadOnly": false, + "AnimationEffectTiming": false, + "AnimationEffectTimingReadOnly": false, + "AnimationEvent": false, + "AnimationPlaybackEvent": false, + "AnimationTimeline": false, + "applicationCache": false, + "ApplicationCache": false, + "ApplicationCacheErrorEvent": false, + "atob": false, + "Attr": false, + "Audio": false, + "AudioBuffer": false, + "AudioBufferSourceNode": false, + "AudioContext": false, + "AudioDestinationNode": false, + "AudioListener": false, + "AudioNode": false, + "AudioParam": false, + "AudioProcessingEvent": false, + "AutocompleteErrorEvent": false, + "BarProp": false, + "BatteryManager": false, + "BeforeUnloadEvent": false, + "BiquadFilterNode": false, + "Blob": false, + "blur": false, + "btoa": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "cancelAnimationFrame": false, + "cancelIdleCallback": false, + "CanvasGradient": false, + "CanvasPattern": false, + "CanvasRenderingContext2D": false, + "CDATASection": false, + "ChannelMergerNode": false, + "ChannelSplitterNode": false, + "CharacterData": false, + "clearInterval": false, + "clearTimeout": false, + "clientInformation": false, + "ClientRect": false, + "ClientRectList": false, + "ClipboardEvent": false, + "close": false, + "closed": false, + "CloseEvent": false, + "Comment": false, + "CompositionEvent": false, + "confirm": false, + "console": false, + "ConvolverNode": false, + "createImageBitmap": false, + "Credential": false, + "CredentialsContainer": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CSS": false, + "CSSAnimation": false, + "CSSFontFaceRule": false, + "CSSImportRule": false, + "CSSKeyframeRule": false, + "CSSKeyframesRule": false, + "CSSMediaRule": false, + "CSSPageRule": false, + "CSSRule": false, + "CSSRuleList": false, + "CSSStyleDeclaration": false, + "CSSStyleRule": false, + "CSSStyleSheet": false, + "CSSSupportsRule": false, + "CSSTransition": false, + "CSSUnknownRule": false, + "CSSViewportRule": false, + "customElements": false, + "CustomEvent": false, + "DataTransfer": false, + "DataTransferItem": false, + "DataTransferItemList": false, + "Debug": false, + "defaultStatus": false, + "defaultstatus": false, + "DelayNode": false, + "DeviceMotionEvent": false, + "DeviceOrientationEvent": false, + "devicePixelRatio": false, + "dispatchEvent": false, + "document": false, + "Document": false, + "DocumentFragment": false, + "DocumentTimeline": false, + "DocumentType": false, + "DOMError": false, + "DOMException": false, + "DOMImplementation": false, + "DOMParser": false, + "DOMSettableTokenList": false, + "DOMStringList": false, + "DOMStringMap": false, + "DOMTokenList": false, + "DragEvent": false, + "DynamicsCompressorNode": false, + "Element": false, + "ElementTimeControl": false, + "ErrorEvent": false, + "event": false, + "Event": false, + "EventSource": false, + "EventTarget": false, + "external": false, + "FederatedCredential": false, + "fetch": false, + "File": false, + "FileError": false, + "FileList": false, + "FileReader": false, + "find": false, + "focus": false, + "FocusEvent": false, + "FontFace": false, + "FormData": false, + "frameElement": false, + "frames": false, + "GainNode": false, + "Gamepad": false, + "GamepadButton": false, + "GamepadEvent": false, + "getComputedStyle": false, + "getSelection": false, + "HashChangeEvent": false, + "Headers": false, + "history": false, + "History": false, + "HTMLAllCollection": false, + "HTMLAnchorElement": false, + "HTMLAppletElement": false, + "HTMLAreaElement": false, + "HTMLAudioElement": false, + "HTMLBaseElement": false, + "HTMLBlockquoteElement": false, + "HTMLBodyElement": false, + "HTMLBRElement": false, + "HTMLButtonElement": false, + "HTMLCanvasElement": false, + "HTMLCollection": false, + "HTMLContentElement": false, + "HTMLDataListElement": false, + "HTMLDetailsElement": false, + "HTMLDialogElement": false, + "HTMLDirectoryElement": false, + "HTMLDivElement": false, + "HTMLDListElement": false, + "HTMLDocument": false, + "HTMLElement": false, + "HTMLEmbedElement": false, + "HTMLFieldSetElement": false, + "HTMLFontElement": false, + "HTMLFormControlsCollection": false, + "HTMLFormElement": false, + "HTMLFrameElement": false, + "HTMLFrameSetElement": false, + "HTMLHeadElement": false, + "HTMLHeadingElement": false, + "HTMLHRElement": false, + "HTMLHtmlElement": false, + "HTMLIFrameElement": false, + "HTMLImageElement": false, + "HTMLInputElement": false, + "HTMLIsIndexElement": false, + "HTMLKeygenElement": false, + "HTMLLabelElement": false, + "HTMLLayerElement": false, + "HTMLLegendElement": false, + "HTMLLIElement": false, + "HTMLLinkElement": false, + "HTMLMapElement": false, + "HTMLMarqueeElement": false, + "HTMLMediaElement": false, + "HTMLMenuElement": false, + "HTMLMetaElement": false, + "HTMLMeterElement": false, + "HTMLModElement": false, + "HTMLObjectElement": false, + "HTMLOListElement": false, + "HTMLOptGroupElement": false, + "HTMLOptionElement": false, + "HTMLOptionsCollection": false, + "HTMLOutputElement": false, + "HTMLParagraphElement": false, + "HTMLParamElement": false, + "HTMLPictureElement": false, + "HTMLPreElement": false, + "HTMLProgressElement": false, + "HTMLQuoteElement": false, + "HTMLScriptElement": false, + "HTMLSelectElement": false, + "HTMLShadowElement": false, + "HTMLSourceElement": false, + "HTMLSpanElement": false, + "HTMLStyleElement": false, + "HTMLTableCaptionElement": false, + "HTMLTableCellElement": false, + "HTMLTableColElement": false, + "HTMLTableElement": false, + "HTMLTableRowElement": false, + "HTMLTableSectionElement": false, + "HTMLTemplateElement": false, + "HTMLTextAreaElement": false, + "HTMLTitleElement": false, + "HTMLTrackElement": false, + "HTMLUListElement": false, + "HTMLUnknownElement": false, + "HTMLVideoElement": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBEnvironment": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "Image": false, + "ImageBitmap": false, + "ImageData": false, + "indexedDB": false, + "innerHeight": false, + "innerWidth": false, + "InputEvent": false, + "InputMethodContext": false, + "IntersectionObserver": false, + "IntersectionObserverEntry": false, + "Intl": false, + "KeyboardEvent": false, + "KeyframeEffect": false, + "KeyframeEffectReadOnly": false, + "length": false, + "localStorage": false, + "location": false, + "Location": false, + "locationbar": false, + "matchMedia": false, + "MediaElementAudioSourceNode": false, + "MediaEncryptedEvent": false, + "MediaError": false, + "MediaKeyError": false, + "MediaKeyEvent": false, + "MediaKeyMessageEvent": false, + "MediaKeys": false, + "MediaKeySession": false, + "MediaKeyStatusMap": false, + "MediaKeySystemAccess": false, + "MediaList": false, + "MediaQueryList": false, + "MediaQueryListEvent": false, + "MediaSource": false, + "MediaRecorder": false, + "MediaStream": false, + "MediaStreamAudioDestinationNode": false, + "MediaStreamAudioSourceNode": false, + "MediaStreamEvent": false, + "MediaStreamTrack": false, + "menubar": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "MIDIAccess": false, + "MIDIConnectionEvent": false, + "MIDIInput": false, + "MIDIInputMap": false, + "MIDIMessageEvent": false, + "MIDIOutput": false, + "MIDIOutputMap": false, + "MIDIPort": false, + "MimeType": false, + "MimeTypeArray": false, + "MouseEvent": false, + "moveBy": false, + "moveTo": false, + "MutationEvent": false, + "MutationObserver": false, + "MutationRecord": false, + "name": false, + "NamedNodeMap": false, + "navigator": false, + "Navigator": false, + "Node": false, + "NodeFilter": false, + "NodeIterator": false, + "NodeList": false, + "Notification": false, + "OfflineAudioCompletionEvent": false, + "OfflineAudioContext": false, + "offscreenBuffering": false, + "onbeforeunload": true, + "onblur": true, + "onerror": true, + "onfocus": true, + "onload": true, + "onresize": true, + "onunload": true, + "open": false, + "openDatabase": false, + "opener": false, + "opera": false, + "Option": false, + "OscillatorNode": false, + "outerHeight": false, + "outerWidth": false, + "PageTransitionEvent": false, + "pageXOffset": false, + "pageYOffset": false, + "parent": false, + "PasswordCredential": false, + "Path2D": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "PeriodicWave": false, + "Permissions": false, + "PermissionStatus": false, + "personalbar": false, + "Plugin": false, + "PluginArray": false, + "PopStateEvent": false, + "postMessage": false, + "print": false, + "ProcessingInstruction": false, + "ProgressEvent": false, + "PromiseRejectionEvent": false, + "prompt": false, + "PushManager": false, + "PushSubscription": false, + "RadioNodeList": false, + "Range": false, + "ReadableByteStream": false, + "ReadableStream": false, + "removeEventListener": false, + "Request": false, + "requestAnimationFrame": false, + "requestIdleCallback": false, + "resizeBy": false, + "resizeTo": false, + "Response": false, + "RTCIceCandidate": false, + "RTCSessionDescription": false, + "RTCPeerConnection": false, + "screen": false, + "Screen": false, + "screenLeft": false, + "ScreenOrientation": false, + "screenTop": false, + "screenX": false, + "screenY": false, + "ScriptProcessorNode": false, + "scroll": false, + "scrollbars": false, + "scrollBy": false, + "scrollTo": false, + "scrollX": false, + "scrollY": false, + "SecurityPolicyViolationEvent": false, + "Selection": false, + "self": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerRegistration": false, + "sessionStorage": false, + "setInterval": false, + "setTimeout": false, + "ShadowRoot": false, + "SharedKeyframeList": false, + "SharedWorker": false, + "showModalDialog": false, + "SiteBoundCredential": false, + "speechSynthesis": false, + "SpeechSynthesisEvent": false, + "SpeechSynthesisUtterance": false, + "status": false, + "statusbar": false, + "stop": false, + "Storage": false, + "StorageEvent": false, + "styleMedia": false, + "StyleSheet": false, + "StyleSheetList": false, + "SubtleCrypto": false, + "SVGAElement": false, + "SVGAltGlyphDefElement": false, + "SVGAltGlyphElement": false, + "SVGAltGlyphItemElement": false, + "SVGAngle": false, + "SVGAnimateColorElement": false, + "SVGAnimatedAngle": false, + "SVGAnimatedBoolean": false, + "SVGAnimatedEnumeration": false, + "SVGAnimatedInteger": false, + "SVGAnimatedLength": false, + "SVGAnimatedLengthList": false, + "SVGAnimatedNumber": false, + "SVGAnimatedNumberList": false, + "SVGAnimatedPathData": false, + "SVGAnimatedPoints": false, + "SVGAnimatedPreserveAspectRatio": false, + "SVGAnimatedRect": false, + "SVGAnimatedString": false, + "SVGAnimatedTransformList": false, + "SVGAnimateElement": false, + "SVGAnimateMotionElement": false, + "SVGAnimateTransformElement": false, + "SVGAnimationElement": false, + "SVGCircleElement": false, + "SVGClipPathElement": false, + "SVGColor": false, + "SVGColorProfileElement": false, + "SVGColorProfileRule": false, + "SVGComponentTransferFunctionElement": false, + "SVGCSSRule": false, + "SVGCursorElement": false, + "SVGDefsElement": false, + "SVGDescElement": false, + "SVGDiscardElement": false, + "SVGDocument": false, + "SVGElement": false, + "SVGElementInstance": false, + "SVGElementInstanceList": false, + "SVGEllipseElement": false, + "SVGEvent": false, + "SVGExternalResourcesRequired": false, + "SVGFEBlendElement": false, + "SVGFEColorMatrixElement": false, + "SVGFEComponentTransferElement": false, + "SVGFECompositeElement": false, + "SVGFEConvolveMatrixElement": false, + "SVGFEDiffuseLightingElement": false, + "SVGFEDisplacementMapElement": false, + "SVGFEDistantLightElement": false, + "SVGFEDropShadowElement": false, + "SVGFEFloodElement": false, + "SVGFEFuncAElement": false, + "SVGFEFuncBElement": false, + "SVGFEFuncGElement": false, + "SVGFEFuncRElement": false, + "SVGFEGaussianBlurElement": false, + "SVGFEImageElement": false, + "SVGFEMergeElement": false, + "SVGFEMergeNodeElement": false, + "SVGFEMorphologyElement": false, + "SVGFEOffsetElement": false, + "SVGFEPointLightElement": false, + "SVGFESpecularLightingElement": false, + "SVGFESpotLightElement": false, + "SVGFETileElement": false, + "SVGFETurbulenceElement": false, + "SVGFilterElement": false, + "SVGFilterPrimitiveStandardAttributes": false, + "SVGFitToViewBox": false, + "SVGFontElement": false, + "SVGFontFaceElement": false, + "SVGFontFaceFormatElement": false, + "SVGFontFaceNameElement": false, + "SVGFontFaceSrcElement": false, + "SVGFontFaceUriElement": false, + "SVGForeignObjectElement": false, + "SVGGElement": false, + "SVGGeometryElement": false, + "SVGGlyphElement": false, + "SVGGlyphRefElement": false, + "SVGGradientElement": false, + "SVGGraphicsElement": false, + "SVGHKernElement": false, + "SVGICCColor": false, + "SVGImageElement": false, + "SVGLangSpace": false, + "SVGLength": false, + "SVGLengthList": false, + "SVGLinearGradientElement": false, + "SVGLineElement": false, + "SVGLocatable": false, + "SVGMarkerElement": false, + "SVGMaskElement": false, + "SVGMatrix": false, + "SVGMetadataElement": false, + "SVGMissingGlyphElement": false, + "SVGMPathElement": false, + "SVGNumber": false, + "SVGNumberList": false, + "SVGPaint": false, + "SVGPathElement": false, + "SVGPathSeg": false, + "SVGPathSegArcAbs": false, + "SVGPathSegArcRel": false, + "SVGPathSegClosePath": false, + "SVGPathSegCurvetoCubicAbs": false, + "SVGPathSegCurvetoCubicRel": false, + "SVGPathSegCurvetoCubicSmoothAbs": false, + "SVGPathSegCurvetoCubicSmoothRel": false, + "SVGPathSegCurvetoQuadraticAbs": false, + "SVGPathSegCurvetoQuadraticRel": false, + "SVGPathSegCurvetoQuadraticSmoothAbs": false, + "SVGPathSegCurvetoQuadraticSmoothRel": false, + "SVGPathSegLinetoAbs": false, + "SVGPathSegLinetoHorizontalAbs": false, + "SVGPathSegLinetoHorizontalRel": false, + "SVGPathSegLinetoRel": false, + "SVGPathSegLinetoVerticalAbs": false, + "SVGPathSegLinetoVerticalRel": false, + "SVGPathSegList": false, + "SVGPathSegMovetoAbs": false, + "SVGPathSegMovetoRel": false, + "SVGPatternElement": false, + "SVGPoint": false, + "SVGPointList": false, + "SVGPolygonElement": false, + "SVGPolylineElement": false, + "SVGPreserveAspectRatio": false, + "SVGRadialGradientElement": false, + "SVGRect": false, + "SVGRectElement": false, + "SVGRenderingIntent": false, + "SVGScriptElement": false, + "SVGSetElement": false, + "SVGStopElement": false, + "SVGStringList": false, + "SVGStylable": false, + "SVGStyleElement": false, + "SVGSVGElement": false, + "SVGSwitchElement": false, + "SVGSymbolElement": false, + "SVGTests": false, + "SVGTextContentElement": false, + "SVGTextElement": false, + "SVGTextPathElement": false, + "SVGTextPositioningElement": false, + "SVGTitleElement": false, + "SVGTransform": false, + "SVGTransformable": false, + "SVGTransformList": false, + "SVGTRefElement": false, + "SVGTSpanElement": false, + "SVGUnitTypes": false, + "SVGURIReference": false, + "SVGUseElement": false, + "SVGViewElement": false, + "SVGViewSpec": false, + "SVGVKernElement": false, + "SVGZoomAndPan": false, + "SVGZoomEvent": false, + "Text": false, + "TextDecoder": false, + "TextEncoder": false, + "TextEvent": false, + "TextMetrics": false, + "TextTrack": false, + "TextTrackCue": false, + "TextTrackCueList": false, + "TextTrackList": false, + "TimeEvent": false, + "TimeRanges": false, + "toolbar": false, + "top": false, + "Touch": false, + "TouchEvent": false, + "TouchList": false, + "TrackEvent": false, + "TransitionEvent": false, + "TreeWalker": false, + "UIEvent": false, + "URL": false, + "URLSearchParams": false, + "ValidityState": false, + "VTTCue": false, + "WaveShaperNode": false, + "WebGLActiveInfo": false, + "WebGLBuffer": false, + "WebGLContextEvent": false, + "WebGLFramebuffer": false, + "WebGLProgram": false, + "WebGLRenderbuffer": false, + "WebGLRenderingContext": false, + "WebGLShader": false, + "WebGLShaderPrecisionFormat": false, + "WebGLTexture": false, + "WebGLUniformLocation": false, + "WebSocket": false, + "WheelEvent": false, + "window": false, + "Window": false, + "Worker": false, + "XDomainRequest": false, + "XMLDocument": false, + "XMLHttpRequest": false, + "XMLHttpRequestEventTarget": false, + "XMLHttpRequestProgressEvent": false, + "XMLHttpRequestUpload": false, + "XMLSerializer": false, + "XPathEvaluator": false, + "XPathException": false, + "XPathExpression": false, + "XPathNamespace": false, + "XPathNSResolver": false, + "XPathResult": false, + "XSLTProcessor": false + }, + "worker": { + "applicationCache": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "Cache": false, + "caches": false, + "clearInterval": false, + "clearTimeout": false, + "close": true, + "console": false, + "fetch": false, + "FileReaderSync": false, + "FormData": false, + "Headers": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "ImageData": false, + "importScripts": true, + "indexedDB": false, + "location": false, + "MessageChannel": false, + "MessagePort": false, + "name": false, + "navigator": false, + "Notification": false, + "onclose": true, + "onconnect": true, + "onerror": true, + "onlanguagechange": true, + "onmessage": true, + "onoffline": true, + "ononline": true, + "onrejectionhandled": true, + "onunhandledrejection": true, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "postMessage": true, + "Promise": false, + "Request": false, + "Response": false, + "self": true, + "ServiceWorkerRegistration": false, + "setInterval": false, + "setTimeout": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false, + "WebSocket": false, + "Worker": false, + "XMLHttpRequest": false + }, + "node": { + "__dirname": false, + "__filename": false, + "arguments": false, + "Buffer": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "exports": true, + "GLOBAL": false, + "global": false, + "Intl": false, + "module": false, + "process": false, + "require": false, + "root": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false + }, + "commonjs": { + "exports": true, + "module": false, + "require": false, + "global": false + }, + "amd": { + "define": false, + "require": false + }, + "mocha": { + "after": false, + "afterEach": false, + "before": false, + "beforeEach": false, + "context": false, + "describe": false, + "it": false, + "mocha": false, + "run": false, + "setup": false, + "specify": false, + "suite": false, + "suiteSetup": false, + "suiteTeardown": false, + "teardown": false, + "test": false, + "xcontext": false, + "xdescribe": false, + "xit": false, + "xspecify": false + }, + "jasmine": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "fail": false, + "fdescribe": false, + "fit": false, + "it": false, + "jasmine": false, + "pending": false, + "runs": false, + "spyOn": false, + "spyOnProperty": false, + "waits": false, + "waitsFor": false, + "xdescribe": false, + "xit": false + }, + "jest": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "check": false, + "describe": false, + "expect": false, + "gen": false, + "it": false, + "fdescribe": false, + "fit": false, + "jest": false, + "pit": false, + "require": false, + "test": false, + "xdescribe": false, + "xit": false, + "xtest": false + }, + "qunit": { + "asyncTest": false, + "deepEqual": false, + "equal": false, + "expect": false, + "module": false, + "notDeepEqual": false, + "notEqual": false, + "notOk": false, + "notPropEqual": false, + "notStrictEqual": false, + "ok": false, + "propEqual": false, + "QUnit": false, + "raises": false, + "start": false, + "stop": false, + "strictEqual": false, + "test": false, + "throws": false + }, + "phantomjs": { + "console": true, + "exports": true, + "phantom": true, + "require": true, + "WebPage": true + }, + "couch": { + "emit": false, + "exports": false, + "getRow": false, + "log": false, + "module": false, + "provides": false, + "require": false, + "respond": false, + "send": false, + "start": false, + "sum": false + }, + "rhino": { + "defineClass": false, + "deserialize": false, + "gc": false, + "help": false, + "importClass": false, + "importPackage": false, + "java": false, + "load": false, + "loadClass": false, + "Packages": false, + "print": false, + "quit": false, + "readFile": false, + "readUrl": false, + "runCommand": false, + "seal": false, + "serialize": false, + "spawn": false, + "sync": false, + "toint32": false, + "version": false + }, + "nashorn": { + "__DIR__": false, + "__FILE__": false, + "__LINE__": false, + "com": false, + "edu": false, + "exit": false, + "Java": false, + "java": false, + "javafx": false, + "JavaImporter": false, + "javax": false, + "JSAdapter": false, + "load": false, + "loadWithNewGlobal": false, + "org": false, + "Packages": false, + "print": false, + "quit": false + }, + "wsh": { + "ActiveXObject": true, + "Enumerator": true, + "GetObject": true, + "ScriptEngine": true, + "ScriptEngineBuildVersion": true, + "ScriptEngineMajorVersion": true, + "ScriptEngineMinorVersion": true, + "VBArray": true, + "WScript": true, + "WSH": true, + "XDomainRequest": true + }, + "jquery": { + "$": false, + "jQuery": false + }, + "yui": { + "Y": false, + "YUI": false, + "YUI_config": false + }, + "shelljs": { + "cat": false, + "cd": false, + "chmod": false, + "config": false, + "cp": false, + "dirs": false, + "echo": false, + "env": false, + "error": false, + "exec": false, + "exit": false, + "find": false, + "grep": false, + "ls": false, + "ln": false, + "mkdir": false, + "mv": false, + "popd": false, + "pushd": false, + "pwd": false, + "rm": false, + "sed": false, + "set": false, + "target": false, + "tempdir": false, + "test": false, + "touch": false, + "which": false + }, + "prototypejs": { + "$": false, + "$$": false, + "$A": false, + "$break": false, + "$continue": false, + "$F": false, + "$H": false, + "$R": false, + "$w": false, + "Abstract": false, + "Ajax": false, + "Autocompleter": false, + "Builder": false, + "Class": false, + "Control": false, + "Draggable": false, + "Draggables": false, + "Droppables": false, + "Effect": false, + "Element": false, + "Enumerable": false, + "Event": false, + "Field": false, + "Form": false, + "Hash": false, + "Insertion": false, + "ObjectRange": false, + "PeriodicalExecuter": false, + "Position": false, + "Prototype": false, + "Scriptaculous": false, + "Selector": false, + "Sortable": false, + "SortableObserver": false, + "Sound": false, + "Template": false, + "Toggle": false, + "Try": false + }, + "meteor": { + "$": false, + "_": false, + "Accounts": false, + "AccountsClient": false, + "AccountsServer": false, + "AccountsCommon": false, + "App": false, + "Assets": false, + "Blaze": false, + "check": false, + "Cordova": false, + "DDP": false, + "DDPServer": false, + "DDPRateLimiter": false, + "Deps": false, + "EJSON": false, + "Email": false, + "HTTP": false, + "Log": false, + "Match": false, + "Meteor": false, + "Mongo": false, + "MongoInternals": false, + "Npm": false, + "Package": false, + "Plugin": false, + "process": false, + "Random": false, + "ReactiveDict": false, + "ReactiveVar": false, + "Router": false, + "ServiceConfiguration": false, + "Session": false, + "share": false, + "Spacebars": false, + "Template": false, + "Tinytest": false, + "Tracker": false, + "UI": false, + "Utils": false, + "WebApp": false, + "WebAppInternals": false + }, + "mongo": { + "_isWindows": false, + "_rand": false, + "BulkWriteResult": false, + "cat": false, + "cd": false, + "connect": false, + "db": false, + "getHostName": false, + "getMemInfo": false, + "hostname": false, + "ISODate": false, + "listFiles": false, + "load": false, + "ls": false, + "md5sumFile": false, + "mkdir": false, + "Mongo": false, + "NumberInt": false, + "NumberLong": false, + "ObjectId": false, + "PlanCache": false, + "print": false, + "printjson": false, + "pwd": false, + "quit": false, + "removeFile": false, + "rs": false, + "sh": false, + "UUID": false, + "version": false, + "WriteResult": false + }, + "applescript": { + "$": false, + "Application": false, + "Automation": false, + "console": false, + "delay": false, + "Library": false, + "ObjC": false, + "ObjectSpecifier": false, + "Path": false, + "Progress": false, + "Ref": false + }, + "serviceworker": { + "caches": false, + "Cache": false, + "CacheStorage": false, + "Client": false, + "clients": false, + "Clients": false, + "ExtendableEvent": false, + "ExtendableMessageEvent": false, + "FetchEvent": false, + "importScripts": false, + "registration": false, + "self": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerGlobalScope": false, + "ServiceWorkerMessageEvent": false, + "ServiceWorkerRegistration": false, + "skipWaiting": false, + "WindowClient": false + }, + "atomtest": { + "advanceClock": false, + "fakeClearInterval": false, + "fakeClearTimeout": false, + "fakeSetInterval": false, + "fakeSetTimeout": false, + "resetTimeouts": false, + "waitsForPromise": false + }, + "embertest": { + "andThen": false, + "click": false, + "currentPath": false, + "currentRouteName": false, + "currentURL": false, + "fillIn": false, + "find": false, + "findWithAssert": false, + "keyEvent": false, + "pauseTest": false, + "resumeTest": false, + "triggerEvent": false, + "visit": false + }, + "protractor": { + "$": false, + "$$": false, + "browser": false, + "By": false, + "by": false, + "DartObject": false, + "element": false, + "protractor": false + }, + "shared-node-browser": { + "clearInterval": false, + "clearTimeout": false, + "console": false, + "setInterval": false, + "setTimeout": false + }, + "webextensions": { + "browser": false, + "chrome": false, + "opr": false + }, + "greasemonkey": { + "GM_addStyle": false, + "GM_deleteValue": false, + "GM_getResourceText": false, + "GM_getResourceURL": false, + "GM_getValue": false, + "GM_info": false, + "GM_listValues": false, + "GM_log": false, + "GM_openInTab": false, + "GM_registerMenuCommand": false, + "GM_setClipboard": false, + "GM_setValue": false, + "GM_xmlhttpRequest": false, + "unsafeWindow": false + } + }; + +/***/ }), +/* 622 */ +/***/ (function(module, exports) { + + module.exports = { + "75": 8490, + "83": 383, + "107": 8490, + "115": 383, + "181": 924, + "197": 8491, + "383": 83, + "452": 453, + "453": 452, + "455": 456, + "456": 455, + "458": 459, + "459": 458, + "497": 498, + "498": 497, + "837": 8126, + "914": 976, + "917": 1013, + "920": 1012, + "921": 8126, + "922": 1008, + "924": 181, + "928": 982, + "929": 1009, + "931": 962, + "934": 981, + "937": 8486, + "962": 931, + "976": 914, + "977": 1012, + "981": 934, + "982": 928, + "1008": 922, + "1009": 929, + "1012": [ + 920, + 977 + ], + "1013": 917, + "7776": 7835, + "7835": 7776, + "8126": [ + 837, + 921 + ], + "8486": 937, + "8490": 75, + "8491": 197, + "66560": 66600, + "66561": 66601, + "66562": 66602, + "66563": 66603, + "66564": 66604, + "66565": 66605, + "66566": 66606, + "66567": 66607, + "66568": 66608, + "66569": 66609, + "66570": 66610, + "66571": 66611, + "66572": 66612, + "66573": 66613, + "66574": 66614, + "66575": 66615, + "66576": 66616, + "66577": 66617, + "66578": 66618, + "66579": 66619, + "66580": 66620, + "66581": 66621, + "66582": 66622, + "66583": 66623, + "66584": 66624, + "66585": 66625, + "66586": 66626, + "66587": 66627, + "66588": 66628, + "66589": 66629, + "66590": 66630, + "66591": 66631, + "66592": 66632, + "66593": 66633, + "66594": 66634, + "66595": 66635, + "66596": 66636, + "66597": 66637, + "66598": 66638, + "66599": 66639, + "66600": 66560, + "66601": 66561, + "66602": 66562, + "66603": 66563, + "66604": 66564, + "66605": 66565, + "66606": 66566, + "66607": 66567, + "66608": 66568, + "66609": 66569, + "66610": 66570, + "66611": 66571, + "66612": 66572, + "66613": 66573, + "66614": 66574, + "66615": 66575, + "66616": 66576, + "66617": 66577, + "66618": 66578, + "66619": 66579, + "66620": 66580, + "66621": 66581, + "66622": 66582, + "66623": 66583, + "66624": 66584, + "66625": 66585, + "66626": 66586, + "66627": 66587, + "66628": 66588, + "66629": 66589, + "66630": 66590, + "66631": 66591, + "66632": 66592, + "66633": 66593, + "66634": 66594, + "66635": 66595, + "66636": 66596, + "66637": 66597, + "66638": 66598, + "66639": 66599, + "68736": 68800, + "68737": 68801, + "68738": 68802, + "68739": 68803, + "68740": 68804, + "68741": 68805, + "68742": 68806, + "68743": 68807, + "68744": 68808, + "68745": 68809, + "68746": 68810, + "68747": 68811, + "68748": 68812, + "68749": 68813, + "68750": 68814, + "68751": 68815, + "68752": 68816, + "68753": 68817, + "68754": 68818, + "68755": 68819, + "68756": 68820, + "68757": 68821, + "68758": 68822, + "68759": 68823, + "68760": 68824, + "68761": 68825, + "68762": 68826, + "68763": 68827, + "68764": 68828, + "68765": 68829, + "68766": 68830, + "68767": 68831, + "68768": 68832, + "68769": 68833, + "68770": 68834, + "68771": 68835, + "68772": 68836, + "68773": 68837, + "68774": 68838, + "68775": 68839, + "68776": 68840, + "68777": 68841, + "68778": 68842, + "68779": 68843, + "68780": 68844, + "68781": 68845, + "68782": 68846, + "68783": 68847, + "68784": 68848, + "68785": 68849, + "68786": 68850, + "68800": 68736, + "68801": 68737, + "68802": 68738, + "68803": 68739, + "68804": 68740, + "68805": 68741, + "68806": 68742, + "68807": 68743, + "68808": 68744, + "68809": 68745, + "68810": 68746, + "68811": 68747, + "68812": 68748, + "68813": 68749, + "68814": 68750, + "68815": 68751, + "68816": 68752, + "68817": 68753, + "68818": 68754, + "68819": 68755, + "68820": 68756, + "68821": 68757, + "68822": 68758, + "68823": 68759, + "68824": 68760, + "68825": 68761, + "68826": 68762, + "68827": 68763, + "68828": 68764, + "68829": 68765, + "68830": 68766, + "68831": 68767, + "68832": 68768, + "68833": 68769, + "68834": 68770, + "68835": 68771, + "68836": 68772, + "68837": 68773, + "68838": 68774, + "68839": 68775, + "68840": 68776, + "68841": 68777, + "68842": 68778, + "68843": 68779, + "68844": 68780, + "68845": 68781, + "68846": 68782, + "68847": 68783, + "68848": 68784, + "68849": 68785, + "68850": 68786, + "71840": 71872, + "71841": 71873, + "71842": 71874, + "71843": 71875, + "71844": 71876, + "71845": 71877, + "71846": 71878, + "71847": 71879, + "71848": 71880, + "71849": 71881, + "71850": 71882, + "71851": 71883, + "71852": 71884, + "71853": 71885, + "71854": 71886, + "71855": 71887, + "71856": 71888, + "71857": 71889, + "71858": 71890, + "71859": 71891, + "71860": 71892, + "71861": 71893, + "71862": 71894, + "71863": 71895, + "71864": 71896, + "71865": 71897, + "71866": 71898, + "71867": 71899, + "71868": 71900, + "71869": 71901, + "71870": 71902, + "71871": 71903, + "71872": 71840, + "71873": 71841, + "71874": 71842, + "71875": 71843, + "71876": 71844, + "71877": 71845, + "71878": 71846, + "71879": 71847, + "71880": 71848, + "71881": 71849, + "71882": 71850, + "71883": 71851, + "71884": 71852, + "71885": 71853, + "71886": 71854, + "71887": 71855, + "71888": 71856, + "71889": 71857, + "71890": 71858, + "71891": 71859, + "71892": 71860, + "71893": 71861, + "71894": 71862, + "71895": 71863, + "71896": 71864, + "71897": 71865, + "71898": 71866, + "71899": 71867, + "71900": 71868, + "71901": 71869, + "71902": 71870, + "71903": 71871 + }; + +/***/ }) +/******/ ]))) +}); +; \ No newline at end of file