[
  {
    "path": ".coveragerc",
    "content": "[run]\nbranch = True\nomit =\n  atc/atcd/tests/*\n  # files generated by thrift\n  atc/atc_thrift/atc_thrift/*\n  # chef files\n  chef/*/*\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "<!--\nIf you are filling an issue, please provide the information below, if this is not a bug and just a question, you can skip it.\n\n---------------------------------------------------\nBUG REPORT INFORMATION\n---------------------------------------------------\nHere are a few questions that will help us get a better understanding of your setup. Please take a minute to answer them, this will avoid some back and forth communication by providing some context to us.\n-->\n**Meeting the requirements:**\n**ATC** has a few requirements, this section is used to make sure the requirements are met. Until you can check all the boxes, **ATC** will not work on your system.\n- [ ] `atcd` runs on Linux\n- [ ] `atcd` has 2 physical interfaces\n - [ ] 1 that connects to the internet (WAN)\n - [ ] 1 that connects to the local network (LAN)\n- [ ] the traffic from the devices that are being shaped is routed through `atcd`\n- [ ] `atcd` sees the real IP of the devices (e.g there is no **NAT** on the LAN segment)\n\n**Checking for special atcd options:**\n\nIn some cases, `atcd` default configuration may not be suitable for your system. Use:\n```\natcd -h\n```\ndo change those default to suit your setup.\nFor instance, if your lan interface is `wlan0`, you should start `atcd` using:\n```\natcd --atcd-lan wlan0\n```\n\n**Steps to reproduce the issue:**\n1.\n2.\n3.\n\n\n**Describe the results you received:**\n\n\n**Describe the results you expected:**\n\n\n\n**Any additional information that you think is important:**\n\n\n**Dumping system info:**\n\nWhile this may not be required in many cases, providing the following information will help us better understand your setup.\n\n**NOTE**: before putting the output on gist, please check its content is fine to be publically available\n\nRun https://github.com/facebook/augmented-traffic-control/blob/master/utils/dump_system_info.sh and upload the content of the logs to [https://gist.github.com/](gist)\n\n```\ncurl https://raw.githubusercontent.com/facebook/augmented-traffic-control/master/utils/dump_system_info.sh | bash -s -\n```\n\nThis default to using `eth0` and `eth1` for `wan` and `lan` respectively. If you are using other interfaces (let say eth0 and wlan0 respectively), use:\n```\ncurl https://raw.githubusercontent.com/facebook/augmented-traffic-control/master/utils/dump_system_info.sh | bash -s -  eth0 wlan0\n```\n"
  },
  {
    "path": ".gitignore",
    "content": "*.log\n*.pot\n*.pyc\n*.sqlite3\nlocal_settings.py\n*.swp\n*.swo\nexternal/\ncollected_static/\n.vagrant\n.DS_Store\nMakefile.in\naclocal.m4\nautom4te.cache/\nbuild-aux/\nconfig.h\nconfig.h.in\nconfig.status\nconfigure\nlibtool\nm4/\n.deps/\n.libs/\n**/build/\n**/dist/\n*.egg-info\n*.lo\n*.o\n*.la\nstamp-h1\ncheck_atc\ncheck_atc.trs\n*.cap\n*.har\npcap2har/\ninternal\n.coverage\n.kitchen/\n"
  },
  {
    "path": ".pep8",
    "content": "[pep8]\nexclude = migrations,*/atc_thrift/\n"
  },
  {
    "path": ".rubocop.yml",
    "content": "AllCops:\n    Exclude:\n        - '**/Berksfile'\n        - '**/Vagrantfile'\n        - '**/metadata.rb'\nStyle/HashSyntax:\n    Enabled: false\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: python\npython:\n    - \"2.7\"\ninstall:\n    - pip install flake8\n    - pip install pep8\n    - pip install atc/atc_thrift/ atc/atcd/ atc/django-atc-api/ atc/django-atc-demo-ui/ atc/django-atc-profile-storage/\n    - pip install -r atc/atcd/requirements/requirements-testing.txt\nscript:\n    - make python_lint\n    - py.test atc/atcd/tests\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n* 0.1.6\n    * Suport for Django 1.10 #296\n\n* 0.1.5\n    * Fix handling of POSTed profiles. #287\n\n* 0.1.4\n    * Bump django to 1.9 and django-bootstrap-themes to 3.3.6\n    * Fix chef run on Ubuntu\n\n* 0.1.3\n    * Support Django rest framework 3.2\n\n* 0.1.2\n    * Fixes:\n        * Better detection of logging subsystem and don't fail if /dev/log does not exist\n        * Regenerating thrift files was overriding package version #107\n        * Fixes the UI to run in older browsers\n    * Featues:\n        * UI improvements\n        * Added remote controlling functionality to the UI\n        * Added a set of sample profiles #56\n        * Created a dockerized instance of ATC\n        * Added --atcd-dont-drop-packets flag to not drop packets when going beyond the max bandwidth. Packets will be buffered instead.\n    * Misc:\n        * More unittest\n        * More documentation fixes\n        * Shape test util\n        * Script to dump system config for troubleshooting purpose\n        * Code refactoring\n        * Updated to React 0.13.3\n\n* 0.1.1\n    * Fixes:\n        * Fix profile creation in Firefox #59\n        * Fix installing packages through pip when wheel is not used #77\n    * Misc:\n        * Added some unittest\n        * Build and test PR on Travis\n        * Bunch of typo fixes\n        * More documentation\n\n* 0.1.0\n    * Initial Release\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Augmented Traffic Control\nWe want to make contributing to this project as easy and transparent as\npossible.\n\n## Our Development Process\n\nAugmented Traffic Control is maintained and developed on github. It is designed to be\neasily extensible and contain API that can be reused by external services/frontends.\n\nSend us your pull requests, and we'd be happy to provide feedback and merge\nas appropriate.\n\n## Pull Requests\nWe actively welcome your pull requests.\n1. Fork the repo and create your branch from `master`.\n2. If you've added code that should be tested, add tests\n3. If you've changed APIs, update the documentation.\n4. Make sure your code lints (e.g., pyflakes, PEP8, etc).46. If you haven't already, complete the Contributor License Agreement (\"CLA\").\n5. If you haven't already, complete the Contributor License Agreement (\"CLA\").\n\n## Contributor License Agreement (\"CLA\")\nIn order to accept your pull request, we need you to submit a CLA. You only need\nto do this once to work on any of Facebook's open source projects.\n\nComplete your CLA here: <https://code.facebook.com/cla>\n\n## Issues\nWe use GitHub issues to track public bugs. Please ensure your description is\nclear and has sufficient instructions to be able to reproduce the issue.\n\nFacebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe\ndisclosure of security bugs. In those cases, please go through the process\noutlined on that page and do not file a public issue.\n\n## Coding Style\n* PEP-8 compliant\n* 80 character line length\n* General pyFlakes compliance (e.g., no * imports)\n\n## License\nBy contributing to Augmented Traffic Control, you agree that your contributions will be licensed\nunder its BSD license.\n"
  },
  {
    "path": "CONTRIBUTORS.md",
    "content": "* Alessandro Salvatori\n* Ameesh Goyal\n* Andrew Pope\n* Anthony Gargiulo\n* Chris Vander Mey\n* Emmanuel Bretelle\n* Gus Luxton\n* John Morrow\n* Patrick Shuff\n* Zeal Jagannatha\n"
  },
  {
    "path": "LICENSE",
    "content": "BSD License\n\nFor Augmented Traffic Control software\n\nCopyright (c) 2014-present, Facebook, Inc. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n * Neither the name Facebook nor the names of its contributors may be used to\n   endorse or promote products derived from this software without specific\n   prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "Makefile",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n\n\n# Vagrant names used for testing.\n# Described fully in `tests/Vagrantfile`.\nTESTVMS = gateway client server\n\nFLAKE=python -m flake8\nPEP=pep8\n\n\n# By default, we just lint since we want this to be **fast**.\n# In the future when unit testing becomes better this should run quick tests.\n.PHONY: default\ndefault: lint\n\n\n# Do all the things!\n.PHONY: all\nall: lint fulltest\n\n\n# Install packages locally.\n.PHONY: install\ninstall:\n\tcd atc/atc_thrift && pip install --upgrade --force-reinstall .\n\tcd atc/atcd && pip install --upgrade --force-reinstall .\n\tcd atc/django-atc-api && pip install --upgrade --force-reinstall .\n\tcd atc/django-atc-demo-ui && pip install --upgrade --force-reinstall .\n\tcd atc/django-atc-profile-storage && pip install --upgrade --force-reinstall .\n\n\n# Publish packages to PyPi.\n.PHONY: publish\npublish:\n\tcd atc/atc_thrift && python setup.py publish\n\tcd atc/atcd && python setup.py publish\n\tcd atc/django-atc-api && python setup.py publish\n\tcd atc/django-atc-demo-ui && python setup.py publish\n\tcd atc/django-atc-profile-storage && python setup.py publish\n\n\n# Cleans up python dist files\n.PHONY: clean\nclean:\n\trm -rf atc/{atcd,atc_thrift,django-atc-api,django-atc-demo-ui,django-atc-profile-storage}/{build,dist}\n\n\n# Lint the various sources that ATC includes:\n#  chef/  - chef cookbooks\n#  atc/   - ATC source code\n#  tests/ - ATC test code\n.PHONY: lint\nlint: chef_lint python_lint\n\n.PHONY: chef_lint\nchef_lint:\n\trubocop chef/atc\n\tfoodcritic chef/atc\n\n.PHONY: python_lint\npython_lint:\n\t$(PEP) atc\n\t$(FLAKE) atc\n\t$(FLAKE) tests/\n\n\n# Performs setup, runs the tests, then cleans up.\n# Should be used for automated testing.\n.PHONY: fulltest\nfulltest: testvup test testvdown\n\n\n# Runs the ATC test suite.\n# This can be run manually for quick testing.\n# Requires that the test VMs have been created by `testvup`\n.PHONY: test\ntest:\n\tnosetests -s tests/\n\n\n# Creates vagrant VMs for testing.\n.PHONY: testvup\ntestvup:\n\tcd tests/ && vagrant up ${TESTVMS}\n\n\n# Tears down vagrant VMs.\n.PHONY: testvdown\ntestvdown:\n\tcd tests/ && vagrant destroy -f ${TESTVMS}\n"
  },
  {
    "path": "PATENTS",
    "content": "Additional Grant of Patent Rights Version 2\n\n\"Software\" means the Augmented Traffic Control software distributed by Facebook, Inc.\n\nFacebook, Inc. (\"Facebook\") hereby grants to each recipient of the Software\n(\"you\") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable\n(subject to the termination provision below) license under any Necessary\nClaims, to make, have made, use, sell, offer to sell, import, and otherwise\ntransfer the Software. For avoidance of doubt, no license is granted under\nFacebook’s rights in any patent claims that are infringed by (i) modifications\nto the Software made by you or any third party or (ii) the Software in\ncombination with any software or other technology.\n\nThe license granted hereunder will terminate, automatically and without notice,\nif you (or any of your subsidiaries, corporate affiliates or agents) initiate\ndirectly or indirectly, or take a direct financial interest in, any Patent\nAssertion: (i) against Facebook or any of its subsidiaries or corporate\naffiliates, (ii) against any party if such Patent Assertion arises in whole or\nin part from any software, technology, product or service of Facebook or any of\nits subsidiaries or corporate affiliates, or (iii) against any party relating\nto the Software. Notwithstanding the foregoing, if Facebook or any of its\nsubsidiaries or corporate affiliates files a lawsuit alleging patent\ninfringement against you in the first instance, and you respond by filing a\npatent infringement counterclaim in that lawsuit against that party that is\nunrelated to the Software, the license granted hereunder will not terminate\nunder section (i) of this paragraph due to such counterclaim.\n\nA \"Necessary Claim\" is a claim of a patent owned by Facebook that is\nnecessarily infringed by the Software standing alone.\n\nA \"Patent Assertion\" is any lawsuit or other action alleging direct, indirect,\nor contributory infringement or inducement to infringe any patent, including a\ncross-claim or counterclaim.\n"
  },
  {
    "path": "README.md",
    "content": "# Augmented Traffic Control\n\n[![build-status-image]][travis]\n[![pypi-version]][pypi]\n\n\nFull documentation for the project is available at [http://facebook.github.io/augmented-traffic-control/](http://facebook.github.io/augmented-traffic-control/).\n\n## Overview\n\nAugmented Traffic Control (ATC) is a tool to simulate network conditions. It allows controlling the connection that a device has to the internet. Developers can use `ATC` to test their application across varying network conditions, easily emulating high speed, mobile, and even severely impaired networks.\nAspects of the connection that can be controlled include:\n\n* bandwidth\n* latency\n* packet loss\n* corrupted packets\n* packets ordering\n\nIn order to be able to shape the network traffic, ATC must be running on a device that routes the traffic and sees the real IP address of the device, like your network gateway for instance. This also allows any devices that route through `ATC` to be able to shape their traffic. Traffic can be shaped/unshaped using a web interface allowing any devices with a web browser to use `ATC` without the need for a client application.\n\nATC is made of multiple components that interact together:\n* [`atcd`](atc/atcd): The ATC daemon which is responsible for setting/unsetting traffic shaping. `atcd` exposes a [Thrift](https://thrift.apache.org/) interface to interact with it.\n* [`django-atc-api`](atc/django-atc-api): A [Django](https://www.djangoproject.com/) app based on [Django Rest Framework](http://www.django-rest-framework.org/) that provides a RESTful interface to `atcd`.\n* [`django-atc-demo-ui`](atc/django-atc-demo-ui): A Django app that provides a simple Web UI to use `atc` from a mobile phone.\n* [`django-atc-profile-storage`](atc/django-atc-profile-storage): A Django app that can be used to save shaping profiles, making it easier to re-use them later without manually re-entering those settings.\n\nBy splitting `ATC` in sub-components, it make it easier to hack on it or build on top of it. While `django-atc-demo-ui` is shipped as part of `ATC`'s main repository to allow people to be able to use `ATC` out of the box, by providing a REST API to `atcd`, it makes it relatively easy to interact with `atcd` via the command line and opens the path for the community to be able to build creative command line tools, web UI or mobile apps that interact with `ATC`.\n\n![ATC architecture][atc_architecture]\n\n## Requirements\n\nMost requirements are handled automatically by [pip](https://pip.pypa.io), the packaging system used by ATC, and each `ATC` package may have different requirements and the README.md files of the respective packages should be checked for more details. Anyhow, some requirements apply to the overall codebase:\n\n* Python 2.7: Currently, ATC is only supported on python version 2.7.\n* Django 1.10: Currently, ATC is only supported using django version 1.10.\n\n\n## Installing ATC\n\nThe fact that `ATC` is splitted in multiple packages allows for multiple deployment scenarii. However, deploying all the packages on the same host is the simplest and most likely fitting most use cases.\n\nTo get more details on how to install/configure each packages, please refer to the packages' respective READMEs.\n\n### Packages\n\nThe easiest way to install `ATC` is by using `pip`.\n``` bash\npip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage\n```\n\n### Django\n\nNow that we have all the packages installed, we need to create a new Django project in which we will use our Django app.\n\n``` bash\ndjango-admin startproject atcui\ncd atcui\n```\n\nNow that we have our django project, we need to configure it to use our apps and we need to tell it how to route to our apps.\n\nOpen `atcui/settings.py` and enable the `ATC` apps by adding to `INSTALLED_APPS`:\n\n``` python\nINSTALLED_APPS = (\n    ...\n    # Django ATC API\n    'rest_framework',\n    'atc_api',\n    # Django ATC Demo UI\n    'bootstrap_themes',\n    'django_static_jquery',\n    'atc_demo_ui',\n    # Django ATC Profile Storage\n    'atc_profile_storage',\n)\n```\n\nNow, open `atcui/urls.py` and enable routing to the `ATC` apps by adding the routes to `urlpatterns`:\n``` python\n...\n...\nfrom django.views.generic.base import RedirectView\nfrom django.conf.urls import include\n\nurlpatterns = [\n    ...\n    # Django ATC API\n    url(r'^api/v1/', include('atc_api.urls')),\n    # Django ATC Demo UI\n    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),\n    # Django ATC profile storage\n    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),\n    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),\n]\n```\n\nFinally, let's update the Django DB:\n``` bash\npython manage.py migrate\n```\n\n## Running ATC\n\nAll require packages should now be installed and configured. We now need to run the daemon and the UI interface. While we will run `ATC` straight from the command line in this example, you can refer to example [sysvinit](chef/atc/files/default/init.d) and [upstart](chef/atc/templates/default/upstart) scripts.\n\n### atcd\n\n`atcd` modifies network related settings and as such needs to run in privileged mode:\n\n``` bash\nsudo atcd\n```\nSupposing `eth0` is your interface to connect to the internet and `eth1`, your interface to connect to your lan, this should just work. If your setting is slightly different, use the command line arguments `--atcd-wan` and `--atcd-lan` to adapt to your configuration.\n\n### ATC UI\n\nThe UI on the other hand is a standard Django Web app and can be run as a normal user. Make sure you are in the directory that was created when you ran `django-admin startproject atcui` and run:\n\n``` bash\npython manage.py runserver 0.0.0.0:8000\n```\n\nYou should now be able to access the web UI at http://localhost:8000\n\n## ATC Code Structure\n\nATC source code is available under the [atc](atc/) directory, it is currently composed of:\n\n* [atc_thrift](atc/atc_thrift) the thrift interface's library\n* [atcd](atc/atcd) the ATC daemon that runs on the router doing the traffic shaping\n* [django-atc-api](atc/django-atc-api) A django app that provides a RESTful interface to `atcd`\n* [django-atc-demo-ui](atc/django-atc-demo-ui) A django app that provides a simple demo UI leveraging the RESTful API\n* [django-atc-profile-storage](atc/django-atc-profile-storage) A django app that allows saving shaping profiles to DB allowing users to select their favorite profile from a list instead of re-entering all the profile details every time.\n\n\nThe [chef](chef/) directory contains 2 chef cookbooks:\n\n* [atc](chef/atc/) A cookbook to deploy ATC. It also allows to deploy ATC in a Virtual Box VM in order to develop on ATC.\n* [atclient](chef/atcclient) Set up a Linux Desktop VM that can be used to test shaping end to end.\n\n### atcd\n\n`atcd` is the daemon that runs on the router that does the shaping. Interaction with the daemon is done using [thrift](https://thrift.apache.org/). The interface definition can be found in [atc_thrift.thrift](atc/atc_thrift/atc_thrift.thrift).\n\n### atc_thrift\n\n`atc_thrift` defines the thrift interface to communicate with the `atcd` daemon.\n\n### django-atc-api\n\n`django-atc-api` is a django app that provide a REST API to the `atcd` daemon. Web applications, command line tools can use the API in order to shape/unshape traffic.\n\n### django-atc-demo-ui\n\n`django-atc-demo-ui` is a simple Web UI to enable/disable traffic shaping. The UI is mostly written in [React](http://facebook.github.io/react/)\n\n### django-atc-profile-storage\n\n`django-atc-profile-storage` allows saving profiles to DB. A typical use case will be to save a list of predefined/often used shaping settings that you want to be able to accessing in just a few clicks/taps.\n\n## Developing on ATC\n\nTo make ATC development easier, we use Virtual Box and Vagrant to provision and run a VM that will run the ATC daemon and the ATC UI from your git checkout.\n\nInteracting with ATC will only shape the traffic within the VM and not on the host.\n\n### Setting up the environment\n\nNote: vagrant is an easy way to set up a test environment, but virtualization will produce different results than a setup on bare-metal. We recommend using vagrant only for testing/development and using bare-metal for setups which require realistic shaping settings.\n\nYou will need to install VirtualBox, Vagrant and a couple of plugins:\n\n* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n* [Vagrant](https://www.vagrantup.com/downloads.html)\n* [Chef DK](https://downloads.chef.io/chef-dk/)\n* Install some vagrant plugins:\n * vagrant plugin install vagrant-berkshelf --plugin-version '>= 2.0.1'\n * vagrant plugin install vagrant-omnibus\n* Clone this repo: git clone git@github.com:facebook/augmented-traffic-control.git atc\n\n### Running ATC\n\nOnce in the repo, go to the `chef/atc` directory and run:\n\n``` bash\nvagrant up trusty\n```\n\nThis will take some time before it completes, once the VM is provision, SSH into it:\n\n``` bash\nvagrant ssh trusty\n```\n\nYou should now be able to access ATC at: http://localhost:8080/\n\n### Using the Sample Profiles\n\nOnce you've got ATC up and running, you can run the script `utils/restore-profiles.sh` to setup the set of default profiles.\n\nThe script needs to be passed a `hostname:port` with the location of your ATC instance:\n\n    utils/restore-profiles.sh localhost:8080\n\nAfter doing this, you should see the 10 sample profiles listed below in your ATC instance:\n\n- `2G - Developing Rural`\n- `2G - Developing Urban`\n- `3G - Average`\n- `3G - Good`\n- `Cable`\n- `DSL`\n- `Edge - Average`\n- `Edge - Good`\n- `Edge - Lossy`\n- `No Connectivity`\n\nNaturally, you cannot improve your natural network speed by selecting a faster profile than your service. For example, selecting the `Cable` profile will not make your network faster if your natural connection speed resembles DSL more closely.\n\n### Hacking on the code\n\nHacking on ATC is done from the host and tested in the VM. In order to reflect the changes, you will need to start the services manually.\n\nBoth `atcd` and `atcui` have their python libraries installed in a *python virtualenv* so you will need to activate the environment in order to be able to run the services.\n\nThe *virtualenv* is installed in */usr/local/atc/venv/bin/activate* .\n\n``` bash\nsource /usr/local/atc/venv/bin/activate\n```\n\n#### Running the daemon\n\nThe `atcd` daemon is running under the root user privileges, all operations below needs to be done as root.\n\nTo run the daemon manually, first make sure it is not running in the background:\n\n``` bash\nservice atcd stop\n```\n\nAnd run the daemon:\n\n``` bash\natcd\n```\n\nOnce you are happy with your changes and you want to test them, you will need to kill the daemon and restart it in order to apply the changes.\n\n#### Running the API/UI\n\nThis is a django project and, when running the django built-in HTTP server, will detect code changes and reload automatically.\n\nTo run the HTTP REST API and UI:\n\n``` bash\ncd /var/django && python manage.py runserver 0.0.0.0:8000\n```\n\n[atc_architecture]: https://facebook.github.io/augmented-traffic-control/images/atc_overview.png\n[build-status-image]: https://travis-ci.org/facebook/augmented-traffic-control.svg?branch=master\n[travis]: https://travis-ci.org/facebook/augmented-traffic-control?branch=master\n[pypi-version]: https://pypip.in/version/atcd/badge.svg\n[pypi]: https://pypi.python.org/pypi/atcd\n\n"
  },
  {
    "path": "Setup.md",
    "content": "Setup\n========\n\nRequirements\n--------\n\n### Linux\n\n`ATC` makes use of [`iproute2`](http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2) which is only\nsupported on platforms running a linux kernel.\n\n### Network Gateway\n\n`ATC` is intended to be deployed to a network gateway. Normally this would mean that the machine `ATC` runs on would\nrequire **2 network interfaces**, one for WAN and one for LAN. However it is possible to simulate this setup by making\nuse of more advanced [virtual interfaces](https://wiki.archlinux.org/index.php/VLAN) and routing options on the host.\n\n### `python 2.7` and `pip`\n\n`ATC` requires `python 2.7` to work correctly, complete with `pip`. \n\n### virtualenv\n\nAlthough not strictly required, use of a [virtualenv](https://virtualenv.pypa.io/en/latest/) is recommended.\n\nTo setup a new virtualenv in `~/atc/venv`:\n\n```shell\nmkdir -p ~/atc\nvirtualenv ~/atc/venv\nsource ~/atc/venv/bin/activate\n```\n\nOn production environments, you probably want to put your atc installation somewhere besides\n`~/atc`.\n\nATC Daemon\n--------\n\nInstallation:\n\n```shell\npip install atcd\n```\n\nRunning `atcd` (as root):\n\n```shell\natcd --atcd-lan eth0 --atcd-wan eth1\n```\n\nATC Interface\n--------\n\nInstall the ATC API and UI packages:\n\n```shell\npip install django-atc-api django-atc-demo-ui django-atc-profile-storage\n```\n\n### Django Webapp Setup\n\nATC's Interfaces are written with [Django](https://www.djangoproject.com/), so they require a\n`django` webapp to work correctly.\n\nTo create and setup this webapp you will need the `django` python package:\n\n```shell\npip install django\n```\n\nTo create a new Django webapp:\n\n```shell\ncd ~/atc\ndjango-admin startproject atcui\n```\n\nOnce you have a django webapp setup, you can enable the ATC apps by adding them to the `INSTALLED_APPS` list in\ndjango's `settings.py`:\n\n```python\nINSTALLED_APPS = (\n    ...\n    # Django ATC API\n    'rest_framework',\n    'atc_api',\n    # Django ATC Demo UI\n    'bootstrap_themes',\n    'django_static_jquery',\n    'atc_demo_ui',\n    # Django ATC Profile Storage\n    'atc_profile_storage',\n)\n```\n\nOnce this is done, you can add the ATC urls to the django webapp's `urls.py`:\n\n```python\nfrom django.views.generic.base import RedirectView\n\n...\n\nurlpatterns = patterns('',\n    ...\n    # Django ATC API\n    url(r'^api/v1/', include('atc_api.urls')),\n    # Django ATC Demo UI\n    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),\n    # Django ATC profile storage\n    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),\n    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),\n)\n```\n\nMigrate the django database:\n\n```shell\npython manage.py migrate\n```\n\nAnd finally, run the django server:\n\n```shell\npython manage.py runserver 0.0.0.0:8080\n```\n"
  },
  {
    "path": "atc/atc_thrift/MANIFEST.in",
    "content": "include README.md\n"
  },
  {
    "path": "atc/atc_thrift/Makefile",
    "content": "all:\n\tthrift  --out . --gen py:new_style atc_thrift.thrift\n"
  },
  {
    "path": "atc/atc_thrift/README.md",
    "content": "ATC Thrift\n==========\n\nATC Thrift is `Augmented Traffic Control` (ATC) Thrift Library\n\n`atc_thrift.thrift` contains the description of the atc_thrift interface.\nChange to the API should be made in this file and the client/server code should\nbe regenerated using:\n  make\n"
  },
  {
    "path": "atc/atc_thrift/__init__.py",
    "content": ""
  },
  {
    "path": "atc/atc_thrift/atc_thrift/Atcd-remote",
    "content": "#!/usr/bin/env python\n#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  options string: py:new_style\n#\n\nimport sys\nimport pprint\nfrom urlparse import urlparse\nfrom thrift.transport import TTransport\nfrom thrift.transport import TSocket\nfrom thrift.transport import THttpClient\nfrom thrift.protocol import TBinaryProtocol\n\nfrom atc_thrift import Atcd\nfrom atc_thrift.ttypes import *\n\nif len(sys.argv) <= 1 or sys.argv[1] == '--help':\n  print ''\n  print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'\n  print ''\n  print 'Functions:'\n  print '  TrafficControlRc startShaping(TrafficControl tc)'\n  print '  TrafficControlRc stopShaping(TrafficControlledDevice device)'\n  print '  TrafficControl getCurrentShaping(TrafficControlledDevice device)'\n  print '  bool isShaped(TrafficControlledDevice device)'\n  print '  PacketCapture startPacketCapture(TrafficControlledDevice device, i32 timeout)'\n  print '  PacketCapture stopPacketCapture(TrafficControlledDevice device)'\n  print '  void stopAllPacketCaptures()'\n  print '   listPacketCaptures(TrafficControlledDevice device)'\n  print '   listRunningPacketCaptures()'\n  print '  i32 getShapedDeviceCount()'\n  print '  AccessToken requestToken(string ip, i32 duration)'\n  print '  bool requestRemoteControl(TrafficControlledDevice device, AccessToken accessToken)'\n  print '   getDevicesControlledBy(string ip)'\n  print '   getDevicesControlling(string ip)'\n  print ''\n  sys.exit(0)\n\npp = pprint.PrettyPrinter(indent = 2)\nhost = 'localhost'\nport = 9090\nuri = ''\nframed = False\nhttp = False\nargi = 1\n\nif sys.argv[argi] == '-h':\n  parts = sys.argv[argi+1].split(':')\n  host = parts[0]\n  if len(parts) > 1:\n    port = int(parts[1])\n  argi += 2\n\nif sys.argv[argi] == '-u':\n  url = urlparse(sys.argv[argi+1])\n  parts = url[1].split(':')\n  host = parts[0]\n  if len(parts) > 1:\n    port = int(parts[1])\n  else:\n    port = 80\n  uri = url[2]\n  if url[4]:\n    uri += '?%s' % url[4]\n  http = True\n  argi += 2\n\nif sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':\n  framed = True\n  argi += 1\n\ncmd = sys.argv[argi]\nargs = sys.argv[argi+1:]\n\nif http:\n  transport = THttpClient.THttpClient(host, port, uri)\nelse:\n  socket = TSocket.TSocket(host, port)\n  if framed:\n    transport = TTransport.TFramedTransport(socket)\n  else:\n    transport = TTransport.TBufferedTransport(socket)\nprotocol = TBinaryProtocol.TBinaryProtocol(transport)\nclient = Atcd.Client(protocol)\ntransport.open()\n\nif cmd == 'startShaping':\n  if len(args) != 1:\n    print 'startShaping requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.startShaping(eval(args[0]),))\n\nelif cmd == 'stopShaping':\n  if len(args) != 1:\n    print 'stopShaping requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.stopShaping(eval(args[0]),))\n\nelif cmd == 'getCurrentShaping':\n  if len(args) != 1:\n    print 'getCurrentShaping requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.getCurrentShaping(eval(args[0]),))\n\nelif cmd == 'isShaped':\n  if len(args) != 1:\n    print 'isShaped requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.isShaped(eval(args[0]),))\n\nelif cmd == 'startPacketCapture':\n  if len(args) != 2:\n    print 'startPacketCapture requires 2 args'\n    sys.exit(1)\n  pp.pprint(client.startPacketCapture(eval(args[0]),eval(args[1]),))\n\nelif cmd == 'stopPacketCapture':\n  if len(args) != 1:\n    print 'stopPacketCapture requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.stopPacketCapture(eval(args[0]),))\n\nelif cmd == 'stopAllPacketCaptures':\n  if len(args) != 0:\n    print 'stopAllPacketCaptures requires 0 args'\n    sys.exit(1)\n  pp.pprint(client.stopAllPacketCaptures())\n\nelif cmd == 'listPacketCaptures':\n  if len(args) != 1:\n    print 'listPacketCaptures requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.listPacketCaptures(eval(args[0]),))\n\nelif cmd == 'listRunningPacketCaptures':\n  if len(args) != 0:\n    print 'listRunningPacketCaptures requires 0 args'\n    sys.exit(1)\n  pp.pprint(client.listRunningPacketCaptures())\n\nelif cmd == 'getShapedDeviceCount':\n  if len(args) != 0:\n    print 'getShapedDeviceCount requires 0 args'\n    sys.exit(1)\n  pp.pprint(client.getShapedDeviceCount())\n\nelif cmd == 'requestToken':\n  if len(args) != 2:\n    print 'requestToken requires 2 args'\n    sys.exit(1)\n  pp.pprint(client.requestToken(args[0],eval(args[1]),))\n\nelif cmd == 'requestRemoteControl':\n  if len(args) != 2:\n    print 'requestRemoteControl requires 2 args'\n    sys.exit(1)\n  pp.pprint(client.requestRemoteControl(eval(args[0]),eval(args[1]),))\n\nelif cmd == 'getDevicesControlledBy':\n  if len(args) != 1:\n    print 'getDevicesControlledBy requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.getDevicesControlledBy(args[0],))\n\nelif cmd == 'getDevicesControlling':\n  if len(args) != 1:\n    print 'getDevicesControlling requires 1 args'\n    sys.exit(1)\n  pp.pprint(client.getDevicesControlling(args[0],))\n\nelse:\n  print 'Unrecognized method %s' % cmd\n  sys.exit(1)\n\ntransport.close()\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/Atcd.py",
    "content": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\nfrom ttypes import *\nfrom thrift.Thrift import TProcessor\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n  from thrift.protocol import fastbinary\nexcept:\n  fastbinary = None\n\n\nclass Iface(object):\n  def startShaping(self, tc):\n    \"\"\"\n    Parameters:\n     - tc\n    \"\"\"\n    pass\n\n  def stopShaping(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    pass\n\n  def getCurrentShaping(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    pass\n\n  def isShaped(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    pass\n\n  def startPacketCapture(self, device, timeout):\n    \"\"\"\n    Parameters:\n     - device\n     - timeout\n    \"\"\"\n    pass\n\n  def stopPacketCapture(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    pass\n\n  def stopAllPacketCaptures(self):\n    pass\n\n  def listPacketCaptures(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    pass\n\n  def listRunningPacketCaptures(self):\n    pass\n\n  def getShapedDeviceCount(self):\n    pass\n\n  def requestToken(self, ip, duration):\n    \"\"\"\n    Parameters:\n     - ip\n     - duration\n    \"\"\"\n    pass\n\n  def requestRemoteControl(self, device, accessToken):\n    \"\"\"\n    Parameters:\n     - device\n     - accessToken\n    \"\"\"\n    pass\n\n  def getDevicesControlledBy(self, ip):\n    \"\"\"\n    Parameters:\n     - ip\n    \"\"\"\n    pass\n\n  def getDevicesControlling(self, ip):\n    \"\"\"\n    Parameters:\n     - ip\n    \"\"\"\n    pass\n\n\nclass Client(Iface):\n  def __init__(self, iprot, oprot=None):\n    self._iprot = self._oprot = iprot\n    if oprot is not None:\n      self._oprot = oprot\n    self._seqid = 0\n\n  def startShaping(self, tc):\n    \"\"\"\n    Parameters:\n     - tc\n    \"\"\"\n    self.send_startShaping(tc)\n    return self.recv_startShaping()\n\n  def send_startShaping(self, tc):\n    self._oprot.writeMessageBegin('startShaping', TMessageType.CALL, self._seqid)\n    args = startShaping_args()\n    args.tc = tc\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_startShaping(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = startShaping_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"startShaping failed: unknown result\");\n\n  def stopShaping(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    self.send_stopShaping(device)\n    return self.recv_stopShaping()\n\n  def send_stopShaping(self, device):\n    self._oprot.writeMessageBegin('stopShaping', TMessageType.CALL, self._seqid)\n    args = stopShaping_args()\n    args.device = device\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_stopShaping(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = stopShaping_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"stopShaping failed: unknown result\");\n\n  def getCurrentShaping(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    self.send_getCurrentShaping(device)\n    return self.recv_getCurrentShaping()\n\n  def send_getCurrentShaping(self, device):\n    self._oprot.writeMessageBegin('getCurrentShaping', TMessageType.CALL, self._seqid)\n    args = getCurrentShaping_args()\n    args.device = device\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_getCurrentShaping(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = getCurrentShaping_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"getCurrentShaping failed: unknown result\");\n\n  def isShaped(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    self.send_isShaped(device)\n    return self.recv_isShaped()\n\n  def send_isShaped(self, device):\n    self._oprot.writeMessageBegin('isShaped', TMessageType.CALL, self._seqid)\n    args = isShaped_args()\n    args.device = device\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_isShaped(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = isShaped_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"isShaped failed: unknown result\");\n\n  def startPacketCapture(self, device, timeout):\n    \"\"\"\n    Parameters:\n     - device\n     - timeout\n    \"\"\"\n    self.send_startPacketCapture(device, timeout)\n    return self.recv_startPacketCapture()\n\n  def send_startPacketCapture(self, device, timeout):\n    self._oprot.writeMessageBegin('startPacketCapture', TMessageType.CALL, self._seqid)\n    args = startPacketCapture_args()\n    args.device = device\n    args.timeout = timeout\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_startPacketCapture(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = startPacketCapture_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"startPacketCapture failed: unknown result\");\n\n  def stopPacketCapture(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    self.send_stopPacketCapture(device)\n    return self.recv_stopPacketCapture()\n\n  def send_stopPacketCapture(self, device):\n    self._oprot.writeMessageBegin('stopPacketCapture', TMessageType.CALL, self._seqid)\n    args = stopPacketCapture_args()\n    args.device = device\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_stopPacketCapture(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = stopPacketCapture_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"stopPacketCapture failed: unknown result\");\n\n  def stopAllPacketCaptures(self):\n    self.send_stopAllPacketCaptures()\n    self.recv_stopAllPacketCaptures()\n\n  def send_stopAllPacketCaptures(self):\n    self._oprot.writeMessageBegin('stopAllPacketCaptures', TMessageType.CALL, self._seqid)\n    args = stopAllPacketCaptures_args()\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_stopAllPacketCaptures(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = stopAllPacketCaptures_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    return\n\n  def listPacketCaptures(self, device):\n    \"\"\"\n    Parameters:\n     - device\n    \"\"\"\n    self.send_listPacketCaptures(device)\n    return self.recv_listPacketCaptures()\n\n  def send_listPacketCaptures(self, device):\n    self._oprot.writeMessageBegin('listPacketCaptures', TMessageType.CALL, self._seqid)\n    args = listPacketCaptures_args()\n    args.device = device\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_listPacketCaptures(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = listPacketCaptures_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    if result.failure is not None:\n      raise result.failure\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"listPacketCaptures failed: unknown result\");\n\n  def listRunningPacketCaptures(self):\n    self.send_listRunningPacketCaptures()\n    return self.recv_listRunningPacketCaptures()\n\n  def send_listRunningPacketCaptures(self):\n    self._oprot.writeMessageBegin('listRunningPacketCaptures', TMessageType.CALL, self._seqid)\n    args = listRunningPacketCaptures_args()\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_listRunningPacketCaptures(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = listRunningPacketCaptures_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"listRunningPacketCaptures failed: unknown result\");\n\n  def getShapedDeviceCount(self):\n    self.send_getShapedDeviceCount()\n    return self.recv_getShapedDeviceCount()\n\n  def send_getShapedDeviceCount(self):\n    self._oprot.writeMessageBegin('getShapedDeviceCount', TMessageType.CALL, self._seqid)\n    args = getShapedDeviceCount_args()\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_getShapedDeviceCount(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = getShapedDeviceCount_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"getShapedDeviceCount failed: unknown result\");\n\n  def requestToken(self, ip, duration):\n    \"\"\"\n    Parameters:\n     - ip\n     - duration\n    \"\"\"\n    self.send_requestToken(ip, duration)\n    return self.recv_requestToken()\n\n  def send_requestToken(self, ip, duration):\n    self._oprot.writeMessageBegin('requestToken', TMessageType.CALL, self._seqid)\n    args = requestToken_args()\n    args.ip = ip\n    args.duration = duration\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_requestToken(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = requestToken_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"requestToken failed: unknown result\");\n\n  def requestRemoteControl(self, device, accessToken):\n    \"\"\"\n    Parameters:\n     - device\n     - accessToken\n    \"\"\"\n    self.send_requestRemoteControl(device, accessToken)\n    return self.recv_requestRemoteControl()\n\n  def send_requestRemoteControl(self, device, accessToken):\n    self._oprot.writeMessageBegin('requestRemoteControl', TMessageType.CALL, self._seqid)\n    args = requestRemoteControl_args()\n    args.device = device\n    args.accessToken = accessToken\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_requestRemoteControl(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = requestRemoteControl_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"requestRemoteControl failed: unknown result\");\n\n  def getDevicesControlledBy(self, ip):\n    \"\"\"\n    Parameters:\n     - ip\n    \"\"\"\n    self.send_getDevicesControlledBy(ip)\n    return self.recv_getDevicesControlledBy()\n\n  def send_getDevicesControlledBy(self, ip):\n    self._oprot.writeMessageBegin('getDevicesControlledBy', TMessageType.CALL, self._seqid)\n    args = getDevicesControlledBy_args()\n    args.ip = ip\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_getDevicesControlledBy(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = getDevicesControlledBy_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"getDevicesControlledBy failed: unknown result\");\n\n  def getDevicesControlling(self, ip):\n    \"\"\"\n    Parameters:\n     - ip\n    \"\"\"\n    self.send_getDevicesControlling(ip)\n    return self.recv_getDevicesControlling()\n\n  def send_getDevicesControlling(self, ip):\n    self._oprot.writeMessageBegin('getDevicesControlling', TMessageType.CALL, self._seqid)\n    args = getDevicesControlling_args()\n    args.ip = ip\n    args.write(self._oprot)\n    self._oprot.writeMessageEnd()\n    self._oprot.trans.flush()\n\n  def recv_getDevicesControlling(self):\n    (fname, mtype, rseqid) = self._iprot.readMessageBegin()\n    if mtype == TMessageType.EXCEPTION:\n      x = TApplicationException()\n      x.read(self._iprot)\n      self._iprot.readMessageEnd()\n      raise x\n    result = getDevicesControlling_result()\n    result.read(self._iprot)\n    self._iprot.readMessageEnd()\n    if result.success is not None:\n      return result.success\n    raise TApplicationException(TApplicationException.MISSING_RESULT, \"getDevicesControlling failed: unknown result\");\n\n\nclass Processor(Iface, TProcessor):\n  def __init__(self, handler):\n    self._handler = handler\n    self._processMap = {}\n    self._processMap[\"startShaping\"] = Processor.process_startShaping\n    self._processMap[\"stopShaping\"] = Processor.process_stopShaping\n    self._processMap[\"getCurrentShaping\"] = Processor.process_getCurrentShaping\n    self._processMap[\"isShaped\"] = Processor.process_isShaped\n    self._processMap[\"startPacketCapture\"] = Processor.process_startPacketCapture\n    self._processMap[\"stopPacketCapture\"] = Processor.process_stopPacketCapture\n    self._processMap[\"stopAllPacketCaptures\"] = Processor.process_stopAllPacketCaptures\n    self._processMap[\"listPacketCaptures\"] = Processor.process_listPacketCaptures\n    self._processMap[\"listRunningPacketCaptures\"] = Processor.process_listRunningPacketCaptures\n    self._processMap[\"getShapedDeviceCount\"] = Processor.process_getShapedDeviceCount\n    self._processMap[\"requestToken\"] = Processor.process_requestToken\n    self._processMap[\"requestRemoteControl\"] = Processor.process_requestRemoteControl\n    self._processMap[\"getDevicesControlledBy\"] = Processor.process_getDevicesControlledBy\n    self._processMap[\"getDevicesControlling\"] = Processor.process_getDevicesControlling\n\n  def process(self, iprot, oprot):\n    (name, type, seqid) = iprot.readMessageBegin()\n    if name not in self._processMap:\n      iprot.skip(TType.STRUCT)\n      iprot.readMessageEnd()\n      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))\n      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)\n      x.write(oprot)\n      oprot.writeMessageEnd()\n      oprot.trans.flush()\n      return\n    else:\n      self._processMap[name](self, seqid, iprot, oprot)\n    return True\n\n  def process_startShaping(self, seqid, iprot, oprot):\n    args = startShaping_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = startShaping_result()\n    try:\n      result.success = self._handler.startShaping(args.tc)\n    except TrafficControlException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"startShaping\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_stopShaping(self, seqid, iprot, oprot):\n    args = stopShaping_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = stopShaping_result()\n    try:\n      result.success = self._handler.stopShaping(args.device)\n    except TrafficControlException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"stopShaping\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_getCurrentShaping(self, seqid, iprot, oprot):\n    args = getCurrentShaping_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = getCurrentShaping_result()\n    try:\n      result.success = self._handler.getCurrentShaping(args.device)\n    except TrafficControlException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"getCurrentShaping\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_isShaped(self, seqid, iprot, oprot):\n    args = isShaped_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = isShaped_result()\n    try:\n      result.success = self._handler.isShaped(args.device)\n    except TrafficControlException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"isShaped\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_startPacketCapture(self, seqid, iprot, oprot):\n    args = startPacketCapture_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = startPacketCapture_result()\n    try:\n      result.success = self._handler.startPacketCapture(args.device, args.timeout)\n    except PacketCaptureException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"startPacketCapture\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_stopPacketCapture(self, seqid, iprot, oprot):\n    args = stopPacketCapture_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = stopPacketCapture_result()\n    try:\n      result.success = self._handler.stopPacketCapture(args.device)\n    except PacketCaptureException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"stopPacketCapture\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_stopAllPacketCaptures(self, seqid, iprot, oprot):\n    args = stopAllPacketCaptures_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = stopAllPacketCaptures_result()\n    self._handler.stopAllPacketCaptures()\n    oprot.writeMessageBegin(\"stopAllPacketCaptures\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_listPacketCaptures(self, seqid, iprot, oprot):\n    args = listPacketCaptures_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = listPacketCaptures_result()\n    try:\n      result.success = self._handler.listPacketCaptures(args.device)\n    except TrafficControlException, failure:\n      result.failure = failure\n    oprot.writeMessageBegin(\"listPacketCaptures\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_listRunningPacketCaptures(self, seqid, iprot, oprot):\n    args = listRunningPacketCaptures_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = listRunningPacketCaptures_result()\n    result.success = self._handler.listRunningPacketCaptures()\n    oprot.writeMessageBegin(\"listRunningPacketCaptures\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_getShapedDeviceCount(self, seqid, iprot, oprot):\n    args = getShapedDeviceCount_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = getShapedDeviceCount_result()\n    result.success = self._handler.getShapedDeviceCount()\n    oprot.writeMessageBegin(\"getShapedDeviceCount\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_requestToken(self, seqid, iprot, oprot):\n    args = requestToken_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = requestToken_result()\n    result.success = self._handler.requestToken(args.ip, args.duration)\n    oprot.writeMessageBegin(\"requestToken\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_requestRemoteControl(self, seqid, iprot, oprot):\n    args = requestRemoteControl_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = requestRemoteControl_result()\n    result.success = self._handler.requestRemoteControl(args.device, args.accessToken)\n    oprot.writeMessageBegin(\"requestRemoteControl\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_getDevicesControlledBy(self, seqid, iprot, oprot):\n    args = getDevicesControlledBy_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = getDevicesControlledBy_result()\n    result.success = self._handler.getDevicesControlledBy(args.ip)\n    oprot.writeMessageBegin(\"getDevicesControlledBy\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n  def process_getDevicesControlling(self, seqid, iprot, oprot):\n    args = getDevicesControlling_args()\n    args.read(iprot)\n    iprot.readMessageEnd()\n    result = getDevicesControlling_result()\n    result.success = self._handler.getDevicesControlling(args.ip)\n    oprot.writeMessageBegin(\"getDevicesControlling\", TMessageType.REPLY, seqid)\n    result.write(oprot)\n    oprot.writeMessageEnd()\n    oprot.trans.flush()\n\n\n# HELPER FUNCTIONS AND STRUCTURES\n\nclass startShaping_args(object):\n  \"\"\"\n  Attributes:\n   - tc\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'tc', (TrafficControl, TrafficControl.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, tc=None,):\n    self.tc = tc\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.tc = TrafficControl()\n          self.tc.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('startShaping_args')\n    if self.tc is not None:\n      oprot.writeFieldBegin('tc', TType.STRUCT, 1)\n      self.tc.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass startShaping_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (TrafficControlRc, TrafficControlRc.thrift_spec), None, ), # 0\n    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = TrafficControlRc()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = TrafficControlException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('startShaping_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopShaping_args(object):\n  \"\"\"\n  Attributes:\n   - device\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, device=None,):\n    self.device = device\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopShaping_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopShaping_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (TrafficControlRc, TrafficControlRc.thrift_spec), None, ), # 0\n    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = TrafficControlRc()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = TrafficControlException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopShaping_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getCurrentShaping_args(object):\n  \"\"\"\n  Attributes:\n   - device\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, device=None,):\n    self.device = device\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getCurrentShaping_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getCurrentShaping_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (TrafficControl, TrafficControl.thrift_spec), None, ), # 0\n    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = TrafficControl()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = TrafficControlException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getCurrentShaping_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass isShaped_args(object):\n  \"\"\"\n  Attributes:\n   - device\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, device=None,):\n    self.device = device\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('isShaped_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass isShaped_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.BOOL, 'success', None, None, ), # 0\n    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.BOOL:\n          self.success = iprot.readBool();\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = TrafficControlException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('isShaped_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.BOOL, 0)\n      oprot.writeBool(self.success)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass startPacketCapture_args(object):\n  \"\"\"\n  Attributes:\n   - device\n   - timeout\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n    (2, TType.I32, 'timeout', None, None, ), # 2\n  )\n\n  def __init__(self, device=None, timeout=None,):\n    self.device = device\n    self.timeout = timeout\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.timeout = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('startPacketCapture_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    if self.timeout is not None:\n      oprot.writeFieldBegin('timeout', TType.I32, 2)\n      oprot.writeI32(self.timeout)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass startPacketCapture_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (PacketCapture, PacketCapture.thrift_spec), None, ), # 0\n    (1, TType.STRUCT, 'failure', (PacketCaptureException, PacketCaptureException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = PacketCapture()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = PacketCaptureException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('startPacketCapture_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopPacketCapture_args(object):\n  \"\"\"\n  Attributes:\n   - device\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, device=None,):\n    self.device = device\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopPacketCapture_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopPacketCapture_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (PacketCapture, PacketCapture.thrift_spec), None, ), # 0\n    (1, TType.STRUCT, 'failure', (PacketCaptureException, PacketCaptureException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = PacketCapture()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = PacketCaptureException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopPacketCapture_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopAllPacketCaptures_args(object):\n\n  thrift_spec = (\n  )\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopAllPacketCaptures_args')\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass stopAllPacketCaptures_result(object):\n\n  thrift_spec = (\n  )\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('stopAllPacketCaptures_result')\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass listPacketCaptures_args(object):\n  \"\"\"\n  Attributes:\n   - device\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, device=None,):\n    self.device = device\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('listPacketCaptures_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass listPacketCaptures_result(object):\n  \"\"\"\n  Attributes:\n   - success\n   - failure\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.LIST, 'success', (TType.STRUCT,(PacketCapture, PacketCapture.thrift_spec)), None, ), # 0\n    (1, TType.STRUCT, 'failure', (TrafficControlException, TrafficControlException.thrift_spec), None, ), # 1\n  )\n\n  def __init__(self, success=None, failure=None,):\n    self.success = success\n    self.failure = failure\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.LIST:\n          self.success = []\n          (_etype10, _size7) = iprot.readListBegin()\n          for _i11 in xrange(_size7):\n            _elem12 = PacketCapture()\n            _elem12.read(iprot)\n            self.success.append(_elem12)\n          iprot.readListEnd()\n        else:\n          iprot.skip(ftype)\n      elif fid == 1:\n        if ftype == TType.STRUCT:\n          self.failure = TrafficControlException()\n          self.failure.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('listPacketCaptures_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.LIST, 0)\n      oprot.writeListBegin(TType.STRUCT, len(self.success))\n      for iter13 in self.success:\n        iter13.write(oprot)\n      oprot.writeListEnd()\n      oprot.writeFieldEnd()\n    if self.failure is not None:\n      oprot.writeFieldBegin('failure', TType.STRUCT, 1)\n      self.failure.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass listRunningPacketCaptures_args(object):\n\n  thrift_spec = (\n  )\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('listRunningPacketCaptures_args')\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass listRunningPacketCaptures_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.LIST, 'success', (TType.STRUCT,(PacketCapture, PacketCapture.thrift_spec)), None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.LIST:\n          self.success = []\n          (_etype17, _size14) = iprot.readListBegin()\n          for _i18 in xrange(_size14):\n            _elem19 = PacketCapture()\n            _elem19.read(iprot)\n            self.success.append(_elem19)\n          iprot.readListEnd()\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('listRunningPacketCaptures_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.LIST, 0)\n      oprot.writeListBegin(TType.STRUCT, len(self.success))\n      for iter20 in self.success:\n        iter20.write(oprot)\n      oprot.writeListEnd()\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getShapedDeviceCount_args(object):\n\n  thrift_spec = (\n  )\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getShapedDeviceCount_args')\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getShapedDeviceCount_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.I32, 'success', None, None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.I32:\n          self.success = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getShapedDeviceCount_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.I32, 0)\n      oprot.writeI32(self.success)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass requestToken_args(object):\n  \"\"\"\n  Attributes:\n   - ip\n   - duration\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'ip', None, None, ), # 1\n    (2, TType.I32, 'duration', None, None, ), # 2\n  )\n\n  def __init__(self, ip=None, duration=None,):\n    self.ip = ip\n    self.duration = duration\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.ip = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.duration = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('requestToken_args')\n    if self.ip is not None:\n      oprot.writeFieldBegin('ip', TType.STRING, 1)\n      oprot.writeString(self.ip)\n      oprot.writeFieldEnd()\n    if self.duration is not None:\n      oprot.writeFieldBegin('duration', TType.I32, 2)\n      oprot.writeI32(self.duration)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass requestToken_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.STRUCT, 'success', (AccessToken, AccessToken.thrift_spec), None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.STRUCT:\n          self.success = AccessToken()\n          self.success.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('requestToken_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.STRUCT, 0)\n      self.success.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass requestRemoteControl_args(object):\n  \"\"\"\n  Attributes:\n   - device\n   - accessToken\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n    (2, TType.STRUCT, 'accessToken', (AccessToken, AccessToken.thrift_spec), None, ), # 2\n  )\n\n  def __init__(self, device=None, accessToken=None,):\n    self.device = device\n    self.accessToken = accessToken\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRUCT:\n          self.accessToken = AccessToken()\n          self.accessToken.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('requestRemoteControl_args')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    if self.accessToken is not None:\n      oprot.writeFieldBegin('accessToken', TType.STRUCT, 2)\n      self.accessToken.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass requestRemoteControl_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.BOOL, 'success', None, None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.BOOL:\n          self.success = iprot.readBool();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('requestRemoteControl_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.BOOL, 0)\n      oprot.writeBool(self.success)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getDevicesControlledBy_args(object):\n  \"\"\"\n  Attributes:\n   - ip\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'ip', None, None, ), # 1\n  )\n\n  def __init__(self, ip=None,):\n    self.ip = ip\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.ip = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getDevicesControlledBy_args')\n    if self.ip is not None:\n      oprot.writeFieldBegin('ip', TType.STRING, 1)\n      oprot.writeString(self.ip)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getDevicesControlledBy_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.LIST, 'success', (TType.STRUCT,(RemoteControlInstance, RemoteControlInstance.thrift_spec)), None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.LIST:\n          self.success = []\n          (_etype24, _size21) = iprot.readListBegin()\n          for _i25 in xrange(_size21):\n            _elem26 = RemoteControlInstance()\n            _elem26.read(iprot)\n            self.success.append(_elem26)\n          iprot.readListEnd()\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getDevicesControlledBy_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.LIST, 0)\n      oprot.writeListBegin(TType.STRUCT, len(self.success))\n      for iter27 in self.success:\n        iter27.write(oprot)\n      oprot.writeListEnd()\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getDevicesControlling_args(object):\n  \"\"\"\n  Attributes:\n   - ip\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'ip', None, None, ), # 1\n  )\n\n  def __init__(self, ip=None,):\n    self.ip = ip\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.ip = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getDevicesControlling_args')\n    if self.ip is not None:\n      oprot.writeFieldBegin('ip', TType.STRING, 1)\n      oprot.writeString(self.ip)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass getDevicesControlling_result(object):\n  \"\"\"\n  Attributes:\n   - success\n  \"\"\"\n\n  thrift_spec = (\n    (0, TType.LIST, 'success', (TType.STRUCT,(RemoteControlInstance, RemoteControlInstance.thrift_spec)), None, ), # 0\n  )\n\n  def __init__(self, success=None,):\n    self.success = success\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 0:\n        if ftype == TType.LIST:\n          self.success = []\n          (_etype31, _size28) = iprot.readListBegin()\n          for _i32 in xrange(_size28):\n            _elem33 = RemoteControlInstance()\n            _elem33.read(iprot)\n            self.success.append(_elem33)\n          iprot.readListEnd()\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('getDevicesControlling_result')\n    if self.success is not None:\n      oprot.writeFieldBegin('success', TType.LIST, 0)\n      oprot.writeListBegin(TType.STRUCT, len(self.success))\n      for iter34 in self.success:\n        iter34.write(oprot)\n      oprot.writeListEnd()\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/__init__.py",
    "content": "__all__ = ['ttypes', 'constants', 'Atcd']\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/constants.py",
    "content": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\nfrom ttypes import *\n\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift/ttypes.py",
    "content": "#\n# Autogenerated by Thrift Compiler (0.9.1)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n#  options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n  from thrift.protocol import fastbinary\nexcept:\n  fastbinary = None\n\n\nclass ReturnCode(object):\n  OK = 0\n  INVALID_IP = 1\n  INVALID_TIMEOUT = 2\n  ID_EXHAUST = 3\n  NETLINK_ERROR = 4\n  UNKNOWN_ERROR = 5\n  NETLINK_HTB_ERROR = 6\n  UNKNOWN_HTB_ERROR = 7\n  NETLINK_NETEM_ERROR = 8\n  UNKNOWN_NETEM_ERROR = 9\n  NETLINK_FW_ERROR = 10\n  UNKNOWN_FW_ERROR = 11\n  UNKNOWN_SESSION = 12\n  UNKNOWN_IP = 13\n  ACCESS_DENIED = 14\n\n  _VALUES_TO_NAMES = {\n    0: \"OK\",\n    1: \"INVALID_IP\",\n    2: \"INVALID_TIMEOUT\",\n    3: \"ID_EXHAUST\",\n    4: \"NETLINK_ERROR\",\n    5: \"UNKNOWN_ERROR\",\n    6: \"NETLINK_HTB_ERROR\",\n    7: \"UNKNOWN_HTB_ERROR\",\n    8: \"NETLINK_NETEM_ERROR\",\n    9: \"UNKNOWN_NETEM_ERROR\",\n    10: \"NETLINK_FW_ERROR\",\n    11: \"UNKNOWN_FW_ERROR\",\n    12: \"UNKNOWN_SESSION\",\n    13: \"UNKNOWN_IP\",\n    14: \"ACCESS_DENIED\",\n  }\n\n  _NAMES_TO_VALUES = {\n    \"OK\": 0,\n    \"INVALID_IP\": 1,\n    \"INVALID_TIMEOUT\": 2,\n    \"ID_EXHAUST\": 3,\n    \"NETLINK_ERROR\": 4,\n    \"UNKNOWN_ERROR\": 5,\n    \"NETLINK_HTB_ERROR\": 6,\n    \"UNKNOWN_HTB_ERROR\": 7,\n    \"NETLINK_NETEM_ERROR\": 8,\n    \"UNKNOWN_NETEM_ERROR\": 9,\n    \"NETLINK_FW_ERROR\": 10,\n    \"UNKNOWN_FW_ERROR\": 11,\n    \"UNKNOWN_SESSION\": 12,\n    \"UNKNOWN_IP\": 13,\n    \"ACCESS_DENIED\": 14,\n  }\n\n\nclass Delay(object):\n  \"\"\"\n  Attributes:\n   - delay\n   - jitter\n   - correlation\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.I32, 'delay', None, None, ), # 1\n    (2, TType.I32, 'jitter', None, 0, ), # 2\n    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3\n  )\n\n  def __init__(self, delay=None, jitter=thrift_spec[2][4], correlation=thrift_spec[3][4],):\n    self.delay = delay\n    self.jitter = jitter\n    self.correlation = correlation\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.I32:\n          self.delay = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.jitter = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.DOUBLE:\n          self.correlation = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('Delay')\n    if self.delay is not None:\n      oprot.writeFieldBegin('delay', TType.I32, 1)\n      oprot.writeI32(self.delay)\n      oprot.writeFieldEnd()\n    if self.jitter is not None:\n      oprot.writeFieldBegin('jitter', TType.I32, 2)\n      oprot.writeI32(self.jitter)\n      oprot.writeFieldEnd()\n    if self.correlation is not None:\n      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)\n      oprot.writeDouble(self.correlation)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass Loss(object):\n  \"\"\"\n  Attributes:\n   - percentage\n   - correlation\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.DOUBLE, 'percentage', None, None, ), # 1\n    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2\n  )\n\n  def __init__(self, percentage=None, correlation=thrift_spec[2][4],):\n    self.percentage = percentage\n    self.correlation = correlation\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.DOUBLE:\n          self.percentage = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.DOUBLE:\n          self.correlation = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('Loss')\n    if self.percentage is not None:\n      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)\n      oprot.writeDouble(self.percentage)\n      oprot.writeFieldEnd()\n    if self.correlation is not None:\n      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)\n      oprot.writeDouble(self.correlation)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass Reorder(object):\n  \"\"\"\n  Attributes:\n   - percentage\n   - gap\n   - correlation\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.DOUBLE, 'percentage', None, None, ), # 1\n    (2, TType.I32, 'gap', None, 0, ), # 2\n    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3\n  )\n\n  def __init__(self, percentage=None, gap=thrift_spec[2][4], correlation=thrift_spec[3][4],):\n    self.percentage = percentage\n    self.gap = gap\n    self.correlation = correlation\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.DOUBLE:\n          self.percentage = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.gap = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.DOUBLE:\n          self.correlation = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('Reorder')\n    if self.percentage is not None:\n      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)\n      oprot.writeDouble(self.percentage)\n      oprot.writeFieldEnd()\n    if self.gap is not None:\n      oprot.writeFieldBegin('gap', TType.I32, 2)\n      oprot.writeI32(self.gap)\n      oprot.writeFieldEnd()\n    if self.correlation is not None:\n      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)\n      oprot.writeDouble(self.correlation)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass Corruption(object):\n  \"\"\"\n  Attributes:\n   - percentage\n   - correlation\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.DOUBLE, 'percentage', None, 0, ), # 1\n    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2\n  )\n\n  def __init__(self, percentage=thrift_spec[1][4], correlation=thrift_spec[2][4],):\n    self.percentage = percentage\n    self.correlation = correlation\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.DOUBLE:\n          self.percentage = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.DOUBLE:\n          self.correlation = iprot.readDouble();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('Corruption')\n    if self.percentage is not None:\n      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)\n      oprot.writeDouble(self.percentage)\n      oprot.writeFieldEnd()\n    if self.correlation is not None:\n      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)\n      oprot.writeDouble(self.correlation)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass Shaping(object):\n  \"\"\"\n  Attributes:\n   - rate\n   - delay\n   - loss\n   - reorder\n   - corruption\n   - iptables_options\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.I32, 'rate', None, None, ), # 1\n    (2, TType.STRUCT, 'delay', (Delay, Delay.thrift_spec), Delay(**{\n      \"delay\" : 0,\n    }), ), # 2\n    (3, TType.STRUCT, 'loss', (Loss, Loss.thrift_spec), Loss(**{\n      \"percentage\" : 0,\n    }), ), # 3\n    (4, TType.STRUCT, 'reorder', (Reorder, Reorder.thrift_spec), Reorder(**{\n      \"percentage\" : 0,\n    }), ), # 4\n    (5, TType.STRUCT, 'corruption', (Corruption, Corruption.thrift_spec), Corruption(**{\n      \"percentage\" : 0,\n    }), ), # 5\n    (6, TType.LIST, 'iptables_options', (TType.STRING,None), None, ), # 6\n  )\n\n  def __init__(self, rate=None, delay=thrift_spec[2][4], loss=thrift_spec[3][4], reorder=thrift_spec[4][4], corruption=thrift_spec[5][4], iptables_options=None,):\n    self.rate = rate\n    if delay is self.thrift_spec[2][4]:\n      delay = Delay(**{\n      \"delay\" : 0,\n    })\n    self.delay = delay\n    if loss is self.thrift_spec[3][4]:\n      loss = Loss(**{\n      \"percentage\" : 0,\n    })\n    self.loss = loss\n    if reorder is self.thrift_spec[4][4]:\n      reorder = Reorder(**{\n      \"percentage\" : 0,\n    })\n    self.reorder = reorder\n    if corruption is self.thrift_spec[5][4]:\n      corruption = Corruption(**{\n      \"percentage\" : 0,\n    })\n    self.corruption = corruption\n    self.iptables_options = iptables_options\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.I32:\n          self.rate = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRUCT:\n          self.delay = Delay()\n          self.delay.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.STRUCT:\n          self.loss = Loss()\n          self.loss.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 4:\n        if ftype == TType.STRUCT:\n          self.reorder = Reorder()\n          self.reorder.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 5:\n        if ftype == TType.STRUCT:\n          self.corruption = Corruption()\n          self.corruption.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 6:\n        if ftype == TType.LIST:\n          self.iptables_options = []\n          (_etype3, _size0) = iprot.readListBegin()\n          for _i4 in xrange(_size0):\n            _elem5 = iprot.readString();\n            self.iptables_options.append(_elem5)\n          iprot.readListEnd()\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('Shaping')\n    if self.rate is not None:\n      oprot.writeFieldBegin('rate', TType.I32, 1)\n      oprot.writeI32(self.rate)\n      oprot.writeFieldEnd()\n    if self.delay is not None:\n      oprot.writeFieldBegin('delay', TType.STRUCT, 2)\n      self.delay.write(oprot)\n      oprot.writeFieldEnd()\n    if self.loss is not None:\n      oprot.writeFieldBegin('loss', TType.STRUCT, 3)\n      self.loss.write(oprot)\n      oprot.writeFieldEnd()\n    if self.reorder is not None:\n      oprot.writeFieldBegin('reorder', TType.STRUCT, 4)\n      self.reorder.write(oprot)\n      oprot.writeFieldEnd()\n    if self.corruption is not None:\n      oprot.writeFieldBegin('corruption', TType.STRUCT, 5)\n      self.corruption.write(oprot)\n      oprot.writeFieldEnd()\n    if self.iptables_options is not None:\n      oprot.writeFieldBegin('iptables_options', TType.LIST, 6)\n      oprot.writeListBegin(TType.STRING, len(self.iptables_options))\n      for iter6 in self.iptables_options:\n        oprot.writeString(iter6)\n      oprot.writeListEnd()\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass TrafficControlSetting(object):\n  \"\"\"\n  Attributes:\n   - up\n   - down\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'up', (Shaping, Shaping.thrift_spec), None, ), # 1\n    (2, TType.STRUCT, 'down', (Shaping, Shaping.thrift_spec), None, ), # 2\n  )\n\n  def __init__(self, up=None, down=None,):\n    self.up = up\n    self.down = down\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.up = Shaping()\n          self.up.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRUCT:\n          self.down = Shaping()\n          self.down.read(iprot)\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('TrafficControlSetting')\n    if self.up is not None:\n      oprot.writeFieldBegin('up', TType.STRUCT, 1)\n      self.up.write(oprot)\n      oprot.writeFieldEnd()\n    if self.down is not None:\n      oprot.writeFieldBegin('down', TType.STRUCT, 2)\n      self.down.write(oprot)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass TrafficControlledDevice(object):\n  \"\"\"\n  Attributes:\n   - controlledIP\n   - controllingIP\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'controlledIP', None, None, ), # 1\n    (2, TType.STRING, 'controllingIP', None, None, ), # 2\n  )\n\n  def __init__(self, controlledIP=None, controllingIP=None,):\n    self.controlledIP = controlledIP\n    self.controllingIP = controllingIP\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.controlledIP = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRING:\n          self.controllingIP = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('TrafficControlledDevice')\n    if self.controlledIP is not None:\n      oprot.writeFieldBegin('controlledIP', TType.STRING, 1)\n      oprot.writeString(self.controlledIP)\n      oprot.writeFieldEnd()\n    if self.controllingIP is not None:\n      oprot.writeFieldBegin('controllingIP', TType.STRING, 2)\n      oprot.writeString(self.controllingIP)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass RemoteControlInstance(object):\n  \"\"\"\n  Attributes:\n   - device\n   - timeout\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1\n    (2, TType.I32, 'timeout', None, None, ), # 2\n  )\n\n  def __init__(self, device=None, timeout=None,):\n    self.device = device\n    self.timeout = timeout\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.timeout = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('RemoteControlInstance')\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 1)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    if self.timeout is not None:\n      oprot.writeFieldBegin('timeout', TType.I32, 2)\n      oprot.writeI32(self.timeout)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass TrafficControl(object):\n  \"\"\"\n  Attributes:\n   - settings\n   - device\n   - timeout\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRUCT, 'settings', (TrafficControlSetting, TrafficControlSetting.thrift_spec), None, ), # 1\n    (2, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 2\n    (3, TType.I32, 'timeout', None, None, ), # 3\n  )\n\n  def __init__(self, settings=None, device=None, timeout=None,):\n    self.settings = settings\n    self.device = device\n    self.timeout = timeout\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRUCT:\n          self.settings = TrafficControlSetting()\n          self.settings.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRUCT:\n          self.device = TrafficControlledDevice()\n          self.device.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.I32:\n          self.timeout = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('TrafficControl')\n    if self.settings is not None:\n      oprot.writeFieldBegin('settings', TType.STRUCT, 1)\n      self.settings.write(oprot)\n      oprot.writeFieldEnd()\n    if self.device is not None:\n      oprot.writeFieldBegin('device', TType.STRUCT, 2)\n      self.device.write(oprot)\n      oprot.writeFieldEnd()\n    if self.timeout is not None:\n      oprot.writeFieldBegin('timeout', TType.I32, 3)\n      oprot.writeI32(self.timeout)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass TrafficControlRc(object):\n  \"\"\"\n  Attributes:\n   - code\n   - message\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.I32, 'code', None, None, ), # 1\n    (2, TType.STRING, 'message', None, None, ), # 2\n  )\n\n  def __init__(self, code=None, message=None,):\n    self.code = code\n    self.message = message\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.I32:\n          self.code = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRING:\n          self.message = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('TrafficControlRc')\n    if self.code is not None:\n      oprot.writeFieldBegin('code', TType.I32, 1)\n      oprot.writeI32(self.code)\n      oprot.writeFieldEnd()\n    if self.message is not None:\n      oprot.writeFieldBegin('message', TType.STRING, 2)\n      oprot.writeString(self.message)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass TrafficControlException(TException):\n  \"\"\"\n  Attributes:\n   - code\n   - message\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.I32, 'code', None, None, ), # 1\n    (2, TType.STRING, 'message', None, None, ), # 2\n  )\n\n  def __init__(self, code=None, message=None,):\n    self.code = code\n    self.message = message\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.I32:\n          self.code = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRING:\n          self.message = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('TrafficControlException')\n    if self.code is not None:\n      oprot.writeFieldBegin('code', TType.I32, 1)\n      oprot.writeI32(self.code)\n      oprot.writeFieldEnd()\n    if self.message is not None:\n      oprot.writeFieldBegin('message', TType.STRING, 2)\n      oprot.writeString(self.message)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __str__(self):\n    return repr(self)\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass PacketCaptureException(TException):\n  \"\"\"\n  Attributes:\n   - message\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'message', None, None, ), # 1\n  )\n\n  def __init__(self, message=None,):\n    self.message = message\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.message = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('PacketCaptureException')\n    if self.message is not None:\n      oprot.writeFieldBegin('message', TType.STRING, 1)\n      oprot.writeString(self.message)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __str__(self):\n    return repr(self)\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass PacketCaptureFile(object):\n  \"\"\"\n  Attributes:\n   - name\n   - url\n   - bytes\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'name', None, None, ), # 1\n    (2, TType.STRING, 'url', None, None, ), # 2\n    (3, TType.I32, 'bytes', None, 0, ), # 3\n  )\n\n  def __init__(self, name=None, url=None, bytes=thrift_spec[3][4],):\n    self.name = name\n    self.url = url\n    self.bytes = bytes\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.name = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.STRING:\n          self.url = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.I32:\n          self.bytes = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('PacketCaptureFile')\n    if self.name is not None:\n      oprot.writeFieldBegin('name', TType.STRING, 1)\n      oprot.writeString(self.name)\n      oprot.writeFieldEnd()\n    if self.url is not None:\n      oprot.writeFieldBegin('url', TType.STRING, 2)\n      oprot.writeString(self.url)\n      oprot.writeFieldEnd()\n    if self.bytes is not None:\n      oprot.writeFieldBegin('bytes', TType.I32, 3)\n      oprot.writeI32(self.bytes)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass PacketCapture(object):\n  \"\"\"\n  Attributes:\n   - ip\n   - start_time\n   - file\n   - pid\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.STRING, 'ip', None, None, ), # 1\n    (2, TType.I32, 'start_time', None, None, ), # 2\n    (3, TType.STRUCT, 'file', (PacketCaptureFile, PacketCaptureFile.thrift_spec), None, ), # 3\n    (4, TType.I32, 'pid', None, 0, ), # 4\n  )\n\n  def __init__(self, ip=None, start_time=None, file=None, pid=thrift_spec[4][4],):\n    self.ip = ip\n    self.start_time = start_time\n    self.file = file\n    self.pid = pid\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.STRING:\n          self.ip = iprot.readString();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.start_time = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.STRUCT:\n          self.file = PacketCaptureFile()\n          self.file.read(iprot)\n        else:\n          iprot.skip(ftype)\n      elif fid == 4:\n        if ftype == TType.I32:\n          self.pid = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('PacketCapture')\n    if self.ip is not None:\n      oprot.writeFieldBegin('ip', TType.STRING, 1)\n      oprot.writeString(self.ip)\n      oprot.writeFieldEnd()\n    if self.start_time is not None:\n      oprot.writeFieldBegin('start_time', TType.I32, 2)\n      oprot.writeI32(self.start_time)\n      oprot.writeFieldEnd()\n    if self.file is not None:\n      oprot.writeFieldBegin('file', TType.STRUCT, 3)\n      self.file.write(oprot)\n      oprot.writeFieldEnd()\n    if self.pid is not None:\n      oprot.writeFieldBegin('pid', TType.I32, 4)\n      oprot.writeI32(self.pid)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n\nclass AccessToken(object):\n  \"\"\"\n  Attributes:\n   - token\n   - interval\n   - valid_until\n  \"\"\"\n\n  thrift_spec = (\n    None, # 0\n    (1, TType.I32, 'token', None, None, ), # 1\n    (2, TType.I32, 'interval', None, None, ), # 2\n    (3, TType.I32, 'valid_until', None, None, ), # 3\n  )\n\n  def __init__(self, token=None, interval=None, valid_until=None,):\n    self.token = token\n    self.interval = interval\n    self.valid_until = valid_until\n\n  def read(self, iprot):\n    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n      return\n    iprot.readStructBegin()\n    while True:\n      (fname, ftype, fid) = iprot.readFieldBegin()\n      if ftype == TType.STOP:\n        break\n      if fid == 1:\n        if ftype == TType.I32:\n          self.token = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 2:\n        if ftype == TType.I32:\n          self.interval = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      elif fid == 3:\n        if ftype == TType.I32:\n          self.valid_until = iprot.readI32();\n        else:\n          iprot.skip(ftype)\n      else:\n        iprot.skip(ftype)\n      iprot.readFieldEnd()\n    iprot.readStructEnd()\n\n  def write(self, oprot):\n    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n      return\n    oprot.writeStructBegin('AccessToken')\n    if self.token is not None:\n      oprot.writeFieldBegin('token', TType.I32, 1)\n      oprot.writeI32(self.token)\n      oprot.writeFieldEnd()\n    if self.interval is not None:\n      oprot.writeFieldBegin('interval', TType.I32, 2)\n      oprot.writeI32(self.interval)\n      oprot.writeFieldEnd()\n    if self.valid_until is not None:\n      oprot.writeFieldBegin('valid_until', TType.I32, 3)\n      oprot.writeI32(self.valid_until)\n      oprot.writeFieldEnd()\n    oprot.writeFieldStop()\n    oprot.writeStructEnd()\n\n  def validate(self):\n    return\n\n\n  def __repr__(self):\n    L = ['%s=%r' % (key, value)\n      for key, value in self.__dict__.iteritems()]\n    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))\n\n  def __eq__(self, other):\n    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__\n\n  def __ne__(self, other):\n    return not (self == other)\n"
  },
  {
    "path": "atc/atc_thrift/atc_thrift.thrift",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nenum ReturnCode {\n    OK = 0,\n    INVALID_IP,\n    INVALID_TIMEOUT,\n    ID_EXHAUST,\n    NETLINK_ERROR,\n    UNKNOWN_ERROR,\n    NETLINK_HTB_ERROR,\n    UNKNOWN_HTB_ERROR,\n    NETLINK_NETEM_ERROR,\n    UNKNOWN_NETEM_ERROR,\n    NETLINK_FW_ERROR,\n    UNKNOWN_FW_ERROR,\n    UNKNOWN_SESSION,\n    UNKNOWN_IP,\n    ACCESS_DENIED,\n}\n\nstruct Delay {\n  1: i32 delay,\n  2: optional i32 jitter = 0,\n  3: optional double correlation = 0,\n}\n\nstruct Loss {\n  1: double percentage,\n  2: optional double correlation = 0,\n}\n\nstruct Reorder {\n  1: double percentage,\n  2: i32 gap = 0,\n  3: optional double correlation = 0,\n}\n\nstruct Corruption {\n  1: double percentage = 0,\n  2: optional double correlation = 0,\n}\n\nstruct Shaping {\n  1: i32 rate,\n  2: optional Delay delay = {\"delay\": 0},\n  3: optional Loss loss = {\"percentage\": 0},\n  4: optional Reorder reorder = {\"percentage\": 0},\n  5: optional Corruption corruption = {\"percentage\": 0},\n  6: optional list<string> iptables_options,\n}\n\nstruct TrafficControlSetting {\n  1: Shaping up,\n  2: Shaping down,\n}\n\nstruct TrafficControlledDevice {\n  1: string controlledIP,\n  2: optional string controllingIP,\n}\n\nstruct RemoteControlInstance {\n  1: TrafficControlledDevice device,\n  2: optional i32 timeout,\n}\n\nstruct TrafficControl {\n  1: TrafficControlSetting settings,\n  2: TrafficControlledDevice device,\n  3: i32 timeout,\n}\n\nstruct TrafficControlRc {\n  1: ReturnCode code,\n  2: optional string message,\n}\n\nexception TrafficControlException {\n  1: ReturnCode code,\n  2: optional string message,\n}\n\nexception PacketCaptureException {\n  1: string message,\n}\n\nstruct PacketCaptureFile {\n  1: string name,\n  2: string url,\n  3: optional i32 bytes = 0,\n}\n\nstruct PacketCapture {\n  1: string ip,\n  2: i32 start_time,\n  3: PacketCaptureFile file,\n  4: optional i32 pid = 0,\n}\n\nstruct AccessToken {\n  1: i32 token,\n  2: i32 interval,\n  3: i32 valid_until,\n}\n\nservice Atcd {\n  TrafficControlRc startShaping(1: TrafficControl tc)\n    throws (1: TrafficControlException failure),\n  TrafficControlRc stopShaping(1: TrafficControlledDevice device)\n    throws (1: TrafficControlException failure),\n  TrafficControl getCurrentShaping(1: TrafficControlledDevice device)\n    throws (1: TrafficControlException failure),\n  /* tell if whether of not an ip is shaped */\n  bool isShaped(1: TrafficControlledDevice device)\n    throws (1: TrafficControlException failure),\n  PacketCapture startPacketCapture(1: TrafficControlledDevice device, 2: i32 timeout)\n    throws (1: PacketCaptureException failure),\n  PacketCapture stopPacketCapture(1: TrafficControlledDevice device)\n    throws (1: PacketCaptureException failure),\n  void stopAllPacketCaptures(),\n  list<PacketCapture> listPacketCaptures(1: TrafficControlledDevice device)\n    throws (1: TrafficControlException failure)\n  list<PacketCapture> listRunningPacketCaptures(),\n  /* returns the number of actively shaped devices */\n  i32 getShapedDeviceCount(),\n  /* Remote Control */\n  AccessToken requestToken(1: string ip, 2: i32 duration),\n  bool requestRemoteControl(1: TrafficControlledDevice device  2: AccessToken accessToken),\n  list<RemoteControlInstance> getDevicesControlledBy(1: string ip),\n  list<RemoteControlInstance> getDevicesControlling(1: string ip),\n}\n"
  },
  {
    "path": "atc/atc_thrift/setup.cfg",
    "content": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/atc_thrift/setup.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport os\nimport sys\nfrom setuptools import setup\n\nversion = '0.1.6'\n\nreadme = open('README.md', 'r')\n\n\nif sys.argv[-1] == 'publish':\n    if os.system(\"pip freeze | grep wheel\"):\n        print(\"wheel not installed.\\nUse `pip install wheel`.\\nExiting.\")\n        sys.exit()\n    if os.system(\"pip freeze | grep twine\"):\n        print(\"twine not installed.\\nUse `pip install twine`.\\nExiting.\")\n        sys.exit()\n    os.system(\"python setup.py sdist bdist_wheel\")\n    os.system(\"twine upload dist/*\")\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %s -m 'version %s'\" % (version, version))\n    print(\"  git push --tags\")\n    sys.exit()\n\nsetup(\n    name='atc_thrift',\n    version=version,\n    description='ATC Thrift Library',\n    author='Emmanuel Bretelle',\n    author_email='chantra@fb.com',\n    url='https://github.com/facebook/augmented-traffic-control',\n    packages=['atc_thrift'],\n    classifiers=['Programming Language :: Python', ],\n    long_description=readme.read(),\n    install_requires=['thrift']\n)\n"
  },
  {
    "path": "atc/atcd/MANIFEST.in",
    "content": "include README.md\ninclude requirements.txt\n"
  },
  {
    "path": "atc/atcd/README.md",
    "content": "# ATCD\n\n## Introduction\n\nATCD is the `Augmented Traffic Control` (ATC) Daemon which is reponsible for\nhandling traffic shaping request for the devices.\n\n`atcd` is written in python and provide a [Thrift](https://thrift.apache.org/) interface to interact with it.\n\n## Requirements\n\nIn order to be able to shape traffic, `atcd` must be running on a router that forwards the packets of your devices.\n\n`atcd` works at Layer 3 so it does shape traffic on a per IP basis, as such, the\n`atcd` gateway **must** see the real IP of the devices. In other words, if you are using\nNATting, all the devices behind the NAT will get shaped using the same shaping rules.\n\n`atcd` depends on the following packages:\n\n* python 2.7\n* pyroute2==0.3.3\n* pyotp==1.4.1\n* sparts==0.7.1\n* atc_thrift==0.1.6\n\n## Installation\n\nThe easiest way to install `atcd` is to install it directly from [pip](https://pypi.python.org/pypi).\n\n### From pip\n\n``` bash\npip install atcd\n```\n\n### From source\n\n``` bash\ncd path/to/atcd\npip install .\n```\n\n## Configuration\n\n`atcd` is configured via command line arguments, to get the full list of options\nrun:\n\n```\natcd -h\n```\n\nThe most important options to configure are:\n\n* --atcd-wan: The interface used to connect to internet.\n* --atcd-lan: The interface used to connect to your devices.\n* --sqlite-file: The location where atcd will keep current device settings.\n\n`atcd` init files for debian and rhel based distro can be found in the [chef cookbook](../../chef/atc/files/default/init.d/)\n\n## How atcd works\n\n### Overview\n\nIn order to shape traffic, `atcd` leverages Linux's builtin [Traffic Control subsystem][tchowto]. Communication with the Traffic Control subsystem is done over the netlink API and facilitated by [pyroute2][pyroute2], a pure python netlink library.\n\nPackets that needs to be shaped are expected to be marked. Based on that mark, a classifier will put the packets in the right \"buckets\", which then will throttle the bandwith, add latency, drop packets, corrupt them... depending on the shaping settings.\n\nThe diagram below illustrate the flow an IP packet goes through:\n![ATC Diagram][atc_diagram]\n\n### In more details\n\n#### Marking packets\n\nPackets are marked by using iptables'`MARK` target within the `mangle` table. Marking is done as the packet traverses the router on the `FORWARD` chain, e.g when shaping packets for/to IPs 10.0.2.2, 10.0.2.4 and 10.0.2.5:\n\n```bash\n-A FORWARD -d 10.0.2.2/32 -i eth0 -j MARK --set-xmark 0x2/0xffffffff\n-A FORWARD -s 10.0.2.2/32 -i eth1 -j MARK --set-xmark 0x2/0xffffffff\n-A FORWARD -d 10.0.2.4/32 -i eth0 -j MARK --set-xmark 0x3/0xffffffff\n-A FORWARD -s 10.0.2.4/32 -i eth1 -j MARK --set-xmark 0x3/0xffffffff\n-A FORWARD -d 10.0.2.5/32 -i eth0 -j MARK --set-xmark 0x4/0xffffffff\n-A FORWARD -s 10.0.2.5/32 -i eth1 -j MARK --set-xmark 0x4/0xffffffff\n```\nwhere `eth0` is the network interface that connects to the internet.\n\n#### Shaping packets\n\nThe Traffic Controlling part is more complex. Below is what the shaping on the uplink may look like for 3 devices with IPs 10.0.2.2, 10.0.2.4 and 10.0.2.5:\n```bash\n# tc filter show dev eth0\nfilter parent 1: protocol ip pref 1 fw\nfilter parent 1: protocol ip pref 1 fw handle 0x2 classid 1:2  police 0x1 rate 100000bit burst 12000b mtu 2Kb action drop overhead 0b\nref 1 bind 1\n\nfilter parent 1: protocol ip pref 1 fw handle 0x3 classid 1:3  police 0x3 rate 200000bit burst 12000b mtu 2Kb action drop overhead 0b\nref 1 bind 1\n\nfilter parent 1: protocol ip pref 1 fw handle 0x4 classid 1:4  police 0x5 rate 200000bit burst 12000b mtu 2Kb action drop overhead 0b\nref 1 bind 1\n\n# tc class show dev eth0\nclass htb 1:4 root leaf 8005: prio 0 rate 200000bit ceil 200000bit burst 1600b cburst 1600b\nclass htb 1:2 root leaf 8001: prio 0 rate 100000bit ceil 100000bit burst 1600b cburst 1600b\nclass htb 1:3 root leaf 8003: prio 0 rate 200000bit ceil 200000bit burst 1600b cburst 1600b\n# tc qdisc show dev eth0\nqdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 3755 direct_qlen 1000\nqdisc netem 8001: parent 1:2 limit 1000 delay 10.0ms loss 1%\nqdisc netem 8003: parent 1:3 limit 1000 delay 20.0ms loss 2%\nqdisc netem 8005: parent 1:4 limit 1000 delay 20.0ms loss 2%\n```\n\nSo what goes on? When a packets gets in, it goes through the root qdisc (line 4), which is virtually unlimited, filters are checked and if a packet is marked with mark 0x2, it will be passed onto the class with id 1:2 where throttling happens. After that, the packet is passed to its child qdisc that uses netem to provide packet loss, corruption, reordering... and then off it goes on the wire.\n\nThe diagram below represents how the `filter`, `class` and `qdisc` fit together:\n\n```\n                   root 1:\n                    _ |_          <-- filter matching\n                   /  |  \\\n                  /   |   \\\n                 /    |    \\\n               1:2   1:3   1:4    <-- bandwidth limits\n                |     |     |\n              8001: 8003:  8005:  <-- delay, packet loss, reordering and corruption\n```\n\nWhen requesting `atcd` to shape/unshape traffic for a given device, `atcd` will set/unset the needed `iptables` rules and `filter`, `class` and `qdisc` to control the traffic. Aside from this, it will run some periodic tasks for housekeeping (like expiring shaping settings...).\n\n## Security\n\n`atcd` has currently almost no authentication/authorization mechanism built-in. It is recommended to make `atcd` only listen on `localhost`, and offload the authentication to the API.\n\n[tchowto]: http://www.tldp.org/HOWTO/Traffic-Control-HOWTO/\n[pyroute2]: https://github.com/svinota/pyroute2\n[atc_diagram]: https://facebook.github.io/augmented-traffic-control/images/atc_diagram.png\n"
  },
  {
    "path": "atc/atcd/atcd/AtcdDBQueueTask.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom sqlite3 import OperationalError\nfrom atcd.db_manager import SQLiteManager\nfrom sparts.sparts import option\nfrom sparts.tasks.queue import QueueTask\n\n\nclass AtcdDBQueueTask(QueueTask):\n    OPT_PREFIX = 'sqlite'\n    workers = 1\n\n    DEFAULT_SQLITE_FILE = '/var/lib/atcd.db'\n\n    sqlite_file = option(\n        default=DEFAULT_SQLITE_FILE,\n        metavar='SQLITE_FILE',\n        help='Location to store the sqlite3 db [%(default)s]',\n        name='file',\n    )\n\n    def initTask(self):\n        super(AtcdDBQueueTask, self).initTask()\n        try:\n            self.sqlite_manager = SQLiteManager(self.sqlite_file, self.logger)\n        except OperationalError:\n            self.logger.exception(\n                'Unable to initialize DB from file \"{0}\"'.format(\n                    self.sqlite_file\n                )\n            )\n            raise\n\n    def execute(self, item, context):\n        try:\n            obj, action = item\n        except ValueError:\n            self.logger.exception('Error executing on item: {0}'.format(item))\n            return\n        try:\n            func = getattr(self.sqlite_manager, action)\n        except AttributeError:\n            self.logger.exception(\n                'unable to run action, {0}, no such method'.format(action)\n            )\n            raise\n        try:\n            if isinstance(obj, tuple):\n                func(*obj)\n            else:\n                func(obj)\n        except OperationalError:\n            self.logger.exception(\"Unsupported operation\")\n            return\n\n    def get_saved_shapings(self):\n        return self.sqlite_manager.get_saved_shapings()\n"
  },
  {
    "path": "atc/atcd/atcd/AtcdDeviceTimeoutTask.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask\nfrom sparts.tasks.periodic import PeriodicTask\n\n\nclass AtcdDeviceTimeoutTask(PeriodicTask):\n    INTERVAL = 10.0\n\n    def initTask(self):\n        super(AtcdDeviceTimeoutTask, self).initTask()\n        self.required_task = AtcdThriftHandlerTask.factory()\n\n    def execute(self):\n        AtcdMainTask = self.service.requireTask(\n            self.required_task\n        )\n        AtcdMainTask.stop_expired_shapings()\n"
  },
  {
    "path": "atc/atcd/atcd/AtcdThriftHandlerTask.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport functools\nimport logging\nimport logging.handlers\nimport os\nimport shlex\nimport socket\nimport subprocess\nfrom subprocess import Popen\nimport time\n\nfrom sparts.tasks.thrift import NBServerTask\nfrom sparts.tasks.thrift import ThriftHandlerTask\nfrom sparts.sparts import option\n\nfrom atc_thrift import Atcd\n\n# Atc thrift files\nimport atc_thrift.ttypes\nfrom atc_thrift.ttypes import PacketCapture\nfrom atc_thrift.ttypes import PacketCaptureException\nfrom atc_thrift.ttypes import PacketCaptureFile\nfrom atc_thrift.ttypes import ReturnCode\nfrom atc_thrift.ttypes import TrafficControl\nfrom atc_thrift.ttypes import TrafficControlException\nfrom atc_thrift.ttypes import TrafficControlRc\nfrom atc_thrift.ttypes import TrafficControlledDevice\n\nfrom atcd.access_manager import AccessManager\nfrom atcd.access_manager import AccessTokenException\nfrom atcd.idmanager import IdManager\nfrom atcd.AtcdDBQueueTask import AtcdDBQueueTask\n\nfrom sqlite3 import OperationalError\n\n\ndef AccessCheck(func):\n    @functools.wraps(func)\n    def wrapper(self, tc_or_dev, *args, **kwargs):\n        if isinstance(tc_or_dev, TrafficControl):\n            dev = tc_or_dev.device\n        elif isinstance(tc_or_dev, TrafficControlledDevice):\n            dev = tc_or_dev\n        else:\n            raise TypeError(\n                \"You are using this decorator on the wrong kind of function.\"\n                \" Valid functions are `name(self, tc)` or `name(self, device)`\"\n            )\n        if self.access_manager.access_allowed(dev):\n            return func(self, tc_or_dev)\n        else:\n            raise TrafficControlException(\n                code=ReturnCode.ACCESS_DENIED,\n                message=\"The device {0} is not allowed to control {1}\"\n                .format(dev.controllingIP, dev.controlledIP),\n            )\n\n    return wrapper\n\n\ndef from_module_import_class(modulename, classname):\n    \"\"\"Import a class from a module.\n\n    Allows importing a class from a module by using the class and module name\n    as strings.\n    ex: from_module_import_class('os.path', 'basename')\n\n    Args:\n        modulename: A string containing the name of the module to import from.\n        classname: A string containing the name of the class to import.\n\n    Returns:\n        None\n\n    Raises:\n        AttributeError: An error accessing the class.\n        ImportError: An error accessing the module.\n    \"\"\"\n    klass = getattr(\n        __import__(modulename, globals(), locals(), [classname], -1),\n        classname\n    )\n    globals()[classname] = klass\n\n\nclass AtcdNBServerTask(NBServerTask):\n    \"\"\"Atcd Non Blocking Thrift server.\n\n    Overrides sparks' Non blocking thrift server defaults for Atcd use.\n    \"\"\"\n    DEFAULT_PORT = 9090\n    DEFAULT_HOST = '127.0.0.1'\n\n\nclass AtcdThriftHandlerTask(ThriftHandlerTask):\n    \"\"\"Atcd's thrift handler.\n\n    This is the main entry point of the program that implements the atcd.thrift\n    interface definition.\n    Platform specific behaviour will be implemented in Atcd`Platform`Shaper\n    class.\n    \"\"\"\n    ID_MANAGER_ID_MIN = 1\n    ID_MANAGER_ID_MAX = 2**16\n\n    MODULE = Atcd\n    DEPS = [AtcdDBQueueTask]\n    DEFAULT_LAN = 'eth1'\n    DEFAULT_WAN = 'eth0'\n    DEFAULT_IPTABLES = '/sbin/iptables'\n    DEFAULT_TCPDUMP = '/usr/sbin/tcpdump'\n    DEFAULT_PCAP_DIR = '/tmp'\n    DEFAULT_PCAP_URL_BASE = 'http://localhost:80'\n    DEFAULT_BURST_SIZE = 12000\n    DEFAULT_MODE = 'secure'\n\n    OPT_PREFIX = 'atcd'\n\n    lan_name = option(\n        default=DEFAULT_LAN,\n        metavar='LAN',\n        help='name of the LAN interface [%(default)s]',\n        name='lan',\n    )\n    wan_name = option(\n        default=DEFAULT_WAN,\n        metavar='WAN',\n        help='name of the WAN interface [%(default)s]',\n        name='wan',\n    )\n    iptables = option(\n        default=DEFAULT_IPTABLES,\n        metavar='IPTABLES',\n        help='location of the iptables binary [%(default)s]'\n    )\n    tcpdump = option(\n        default=DEFAULT_TCPDUMP,\n        metavar='TCPDUMP',\n        help='location of the tcpdump binary [%(default)s]'\n    )\n    pcap_dir = option(\n        default=DEFAULT_PCAP_DIR,\n        metavar='PCAP_DIR',\n        help='Directory to store pcap files [%(default)s]'\n    )\n    pcap_url_base = option(\n        default=DEFAULT_PCAP_URL_BASE,\n        metavar='PCAP_URL_BASE',\n        help='URL for pcap service [%(default)s]'\n    )\n    burst_size = option(\n        default=DEFAULT_BURST_SIZE,\n        metavar='BURST_SIZE',\n        type=int,\n        help='Amount of bytes that can be burst at a capped speed '\n                '[%(default)s]'\n    )\n    dont_drop_packets = option(\n        action='store_true',\n        help='[EXPERIMENTAL] Do not drop packets when going above max allowed'\n             ' rate. Packets will be queued instead. Please mind that this'\n             ' option will likely disappear in the future and is only provided'\n             '  as a workaround until better longer term solution is found.',\n    )\n    fresh_start = option(\n        action='store_true',\n        help='Bypass saved shapings from a previous run [%(default)s]',\n    )\n\n    mode = option(\n        choices=['secure', 'unsecure'],\n        default=DEFAULT_MODE,\n        help='In which mode should atcd run? [%(default)s]',\n    )\n\n    @staticmethod\n    def factory():\n        \"\"\"Static method to discover and import the shaper to use.\n\n        Discover the platform on which Atcd is running and import the shaping\n        backend for this platform.\n\n        Returns:\n            The shaping backend class\n\n        Raises:\n            NotImplementedError: the shaping backend class couldn't be imported\n        \"\"\"\n        os_name = os.uname()[0]\n        klass = 'Atcd{0}Shaper'.format(os_name)\n        # If not imported yet, try to import\n        try:\n            if klass not in globals():\n                from_module_import_class(\n                    'atcd.backends.{0}'.format(os_name.lower()), klass\n                )\n        except AttributeError:\n            raise NotImplementedError('{0} is not implemented!'.format(klass))\n        except ImportError:\n            raise NotImplementedError(\n                '{0} backend is not implemented!'.format(os_name.lower())\n            )\n        return globals()[klass]\n\n    def initTask(self):\n        \"\"\"Thrift handler task initialization.\n\n        Performs the steps needed to initialize the shaping subsystem.\n        \"\"\"\n        super(AtcdThriftHandlerTask, self).initTask()\n\n        # Do this first because it can error out and it's better to\n        # error out before touching the networking stacks\n        self.db_task = self.service.tasks.AtcdDBQueueTask\n\n        self.lan = {'name': self.lan_name}\n        self.wan = {'name': self.wan_name}\n        self._links_lookup()\n\n        self._ip_to_id_map = {}\n        self._id_to_ip_map = {}\n        self.initialize_id_manager()\n        self.ip_to_pcap_proc_map = {}\n        self.initialize_shaping_system()\n\n        # Map of IP address to tc object that is currently\n        # being used to shape traffic from that IP.\n        # {ip: {'tc': tc, 'timeout': timeout}}\n        # {'10.0.0.1': {'tc': TrafficControl(...), 'timeout': 1234567890.1234}}\n        self._current_shapings = {}\n\n        self.access_manager = AccessManager(secure=self.mode != 'unsecure')\n        if not self.fresh_start:\n            self.logger.info('Restoring shaped connection from DB')\n            self._restore_saved_shapings()\n\n    def _links_lookup(self):\n        \"\"\"Initialize our mapping from network interface name to their device\n        id. Will raise and exception if one of the device is not found\n        \"\"\"\n        raise NotImplementedError('Subclass should implement this')\n\n    def initialize_id_manager(self):\n        \"\"\"Initialize the Id Manager. This is architecture dependant as the\n        shaping subsystems may have different requirements.\n        \"\"\"\n        self.idmanager = IdManager(\n            first_id=type(self).ID_MANAGER_ID_MIN,\n            max_id=type(self).ID_MANAGER_ID_MAX\n        )\n\n    def _restore_saved_shapings(self):\n        \"\"\"Restore the shapings from the sqlite3 db.\n        \"\"\"\n        # Isolate the things we are using eval on to reduce possible clownyness\n        # later on, also this way we don't have unused imports from importing\n        # blindly for eval\n        names = [\n            'TrafficControlledDevice', 'TrafficControl', 'Shaping',\n            'TrafficControlSetting', 'Loss', 'Delay', 'Corruption', 'Reorder'\n        ]\n        globals = {name: getattr(atc_thrift.ttypes, name) for name in names}\n\n        # CurrentShapings(ip varchar primary key, tc blob, timeout int)\n        results = []\n        try:\n            results = self.db_task.get_saved_shapings()\n        except OperationalError:\n            self.logger.exception('Unable to perform DB operation')\n        for result in results:\n            tc = eval(result['tc'], globals)\n            timeout = float(result['timeout'])\n            if timeout > time.time():\n                tc.timeout = timeout - time.time()\n                try:\n                    self.startShaping(tc)\n                except TrafficControlException as e:\n                    # We have a shaping set in database that is denied\n                    # probably because it was set in unsecure mode, passing\n                    if (\n                            e.code == ReturnCode.ACCESS_DENIED and\n                            self.mode == 'secure'):\n                        self.logger.warn(\n                            'Shaping Denied in secure mode, passing:'\n                            ' {0}'.format(e.message)\n                        )\n                        continue\n                    raise\n            else:\n                self.db_task.queue.put(\n                    (tc.device.controlledIP, 'remove_shaping')\n                )\n\n    def stop(self):\n        \"\"\"Implements sparts.vtask.VTask.stop()\n\n        Each shaping platform should implement its own in order to clean\n        its state before shutting down the main loop.\n        \"\"\"\n        raise NotImplementedError('Subclass should implement this')\n\n    def initialize_shaping_system(self):\n        \"\"\"Initialize the shaping subsystem.\n\n        Each shaping platform should implement its own.\n        \"\"\"\n        raise NotImplementedError('Subclass should implement this')\n\n    def set_logger(self):\n        \"\"\"Initialize the logging subsystem.\n        \"\"\"\n        self.logger = logging.getLogger(__name__)\n        self.logger.setLevel(logging.DEBUG)\n        fmt = logging.Formatter(fmt=logging.BASIC_FORMAT)\n        # create console handler and set level to debug\n        ch = logging.StreamHandler()\n        ch.setLevel(logging.DEBUG)\n        ch.setFormatter(fmt=fmt)\n        self.logger.addHandler(ch)\n        # create syslog handler and set level to debug\n        sh = logging.handlers.SysLogHandler(address='/dev/log')\n        sh.setLevel(logging.DEBUG)\n        sh.setFormatter(fmt=fmt)\n        self.logger.addHandler(sh)\n\n    def getShapedDeviceCount(self):\n        \"\"\"Get the number of devices currently being shaped.\n\n        Returns:\n            The number of devices currently shaped.\n        \"\"\"\n        self.logger.info(\"Request getShapedDeviceCount\")\n        return len(self._ip_to_id_map)\n\n    @AccessCheck\n    def startShaping(self, tc):\n        \"\"\"Start shaping a connection for a given device.\n\n        Implements the `startShaping` thrift method.\n        If the connection is already being shaped, the shaping will be updated\n        and the old one deleted.\n\n        Args:\n            A TrafficControl object that contains the device to be shaped, the\n            settings and the timeout.\n\n        Returns:\n            A TrafficControlRc object with code and message set to reflect\n            success/failure.\n\n        Raises:\n            A TrafficControlException with code and message set on uncaught\n            exception.\n        \"\"\"\n        self.logger.info(\"Request startShaping {0}\".format(tc))\n        # Sanity checking\n        # IP\n        try:\n            socket.inet_aton(tc.device.controlledIP)\n        except Exception as e:\n            return TrafficControlRc(\n                code=ReturnCode.INVALID_IP,\n                message=\"Invalid IP {}\".format(tc.device.controlledIP))\n        # timer\n        if tc.timeout < 0:\n            return TrafficControlRc(\n                code=ReturnCode.INVALID_TIMEOUT,\n                message=\"Invalid Timeout {}\".format(tc.timeout))\n\n        new_id = None\n        try:\n            new_id = self.idmanager.new()\n        except Exception as e:\n            return TrafficControlRc(\n                code=ReturnCode.ID_EXHAUST,\n                message=\"No more session available: {0}\".format(e))\n\n        old_id = self._ip_to_id_map.get(tc.device.controlledIP, None)\n        old_settings = self._current_shapings.get(\n            tc.device.controlledIP, {}\n        ).get('tc')\n\n        tcrc = self._shape_interface(\n            new_id,\n            self.wan,\n            tc.device.controlledIP,\n            tc.settings.up,\n        )\n        if tcrc.code != ReturnCode.OK:\n            return tcrc\n        tcrc = self._shape_interface(\n            new_id,\n            self.lan,\n            tc.device.controlledIP,\n            tc.settings.down,\n        )\n        # If we failed to set shaping for LAN interfaces, we should remove\n        # the shaping we just created for the WAN\n        if tcrc.code != ReturnCode.OK:\n            self._unshape_interface(\n                new_id,\n                self.wan,\n                tc.device.controlledIP,\n                tc.settings.up\n            )\n            return tcrc\n        self._add_mapping(new_id, tc)\n        self.db_task.queue.put(((tc, tc.timeout + time.time()), 'add_shaping'))\n        # if there were an existing id, remove it from dict\n        if old_id is not None:\n            self._unshape_interface(\n                old_id,\n                self.wan,\n                tc.device.controlledIP,\n                old_settings.settings.up,\n            )\n            self._unshape_interface(\n                old_id,\n                self.lan,\n                tc.device.controlledIP,\n                old_settings.settings.down,\n            )\n            del self._id_to_ip_map[old_id]\n            self.idmanager.free(old_id)\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    @AccessCheck\n    def stopShaping(self, dev):\n        \"\"\"Stop shaping a connection for a given traffic controlled device.\n\n        Implements the `stopShaping` thrift method.\n\n        Args:\n            A TrafficControlledDevice object that contains the shaped device.\n\n        Returns:\n            A TrafficControlRc object with code and message set to reflect\n            success/failure.\n\n        Raises:\n            A TrafficControlException with code and message set on uncaught\n            exception.\n        \"\"\"\n        self.logger.info(\n            \"Request stopShaping for ip {0}\".format(dev.controlledIP)\n        )\n        try:\n            socket.inet_aton(dev.controlledIP)\n        except Exception as e:\n            return TrafficControlRc(\n                code=ReturnCode.INVALID_IP,\n                message=\"Invalid IP {0}: {1}\".format(dev.controlledIP, e))\n\n        id = self._ip_to_id_map.get(dev.controlledIP, None)\n        shaping = self._current_shapings.get(dev.controlledIP, {}).get('tc')\n        if id is not None:\n            self._unshape_interface(\n                id,\n                self.wan,\n                dev.controlledIP,\n                shaping.settings.up,\n            )\n            self._unshape_interface(\n                id,\n                self.lan,\n                dev.controlledIP,\n                shaping.settings.down,\n            )\n            self._del_mapping(id, dev.controlledIP)\n            self.db_task.queue.put((dev.controlledIP, 'remove_shaping'))\n            self.idmanager.free(id)\n        else:\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_SESSION,\n                message=\"No session for IP {} found\".format(dev.controlledIP))\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _unshape_interface(self, mark, eth, ip, settings):\n        \"\"\"Unshape traffic for a given IP/setting on a network interface\n        \"\"\"\n        raise NotImplementedError('Subclass should implement this')\n\n    def _shape_interface(self, mark, eth, ip, shaping):\n        \"\"\"Shape traffic for a given IP\n        \"\"\"\n        raise NotImplementedError('Subclass should implement this')\n\n    def isShaped(self, dev):\n        self.logger.info(\n            \"Request isShaped for ip {0}\".format(dev.controlledIP)\n        )\n        return dev.controlledIP in self._ip_to_id_map\n\n    def getCurrentShaping(self, dev):\n        \"\"\"Get the TrafficControl object used to shape a\n            TrafficControlledDevice.\n\n        Args:\n            dev: a TrafficControlledDevice.\n\n        Returns:\n            A TrafficControl object representing the current shaping for the\n            device.\n\n        Raises:\n            A TrafficControlException if there is no TC object for that IP\n        \"\"\"\n\n        self.logger.info(\n            'Request getCurrentShaping for ip {0}'.format(dev.controlledIP)\n        )\n        shaping = self._current_shapings.get(dev.controlledIP, {}).get('tc')\n        if shaping is None:\n            raise TrafficControlException(\n                code=ReturnCode.UNKNOWN_IP,\n                message='This IP ({0}) is not being shaped'.format(\n                    dev.controlledIP\n                )\n            )\n        return shaping\n\n    def _add_mapping(self, id, tc):\n        \"\"\"Adds a mapping from id to IP address and vice versa.\n\n        It also updates the dict mapping IPs to TrafficControl configs.\n\n        Args:\n            id: the id to map.\n            tc: the TrafficControl object to map.\n        \"\"\"\n        self._id_to_ip_map[id] = tc.device.controlledIP\n        self._ip_to_id_map[tc.device.controlledIP] = id\n        self._current_shapings[tc.device.controlledIP] = {\n            'tc': tc, 'timeout': time.time() + tc.timeout}\n\n    def _del_mapping(self, id, ip):\n        \"\"\"Removes mappings from IP to id and id to IP.\n\n        Also  remove the mapping from IP to TrafficControl configs.\n        \"\"\"\n\n        try:\n            del self._id_to_ip_map[id]\n            del self._ip_to_id_map[ip]\n            del self._current_shapings[ip]\n        except KeyError:\n            self.logger.exception('Unable to remove key from dict')\n\n    def run_cmd(self, cmd):\n        self.logger.info(\"Running {}\".format(cmd))\n        return subprocess.call(shlex.split(cmd))\n\n    def _pcap_filename(self, ip, start_time):\n        return \"%s_%d.cap\" % (ip, start_time)\n\n    def _pcap_parse_filename(self, filename):\n        if filename.endswith(\".cap\"):\n            ip, start_time = filename.replace(\".cap\", \"\").split(\"_\")\n            return ip, int(start_time)\n\n    def _pcap_url(self, filename):\n        return os.path.join(self.pcap_url_base, filename)\n\n    def _pcap_full_path(self, filename):\n        return os.path.join(self.pcap_dir, filename)\n\n    def _pcap_file_size(self, filename):\n        try:\n            return int(os.path.getsize(self._pcap_full_path(filename)))\n        except OSError:\n            return 0\n\n    def _cleanup_packet_capture_procs(self):\n        '''Delete finished procs from the map'''\n        for ip, p in self.ip_to_pcap_proc_map.items():\n            if not p or p.poll() is not None:\n                del self.ip_to_pcap_proc_map[ip]\n\n    @AccessCheck\n    def startPacketCapture(self, dev, timeout=3600):\n        \"\"\"Start a tcpdump process to capture packets for an ipaddr.\n\n        The process will run until the timeout expires or stopPacketCapture()\n        is called.\n\n        Args:\n            dev: a TrafficControlledDevice.\n            timeout: int Max time for tcpdump process to run.\n\n        Returns:\n            True if process started ok, otherwise False.\n        \"\"\"\n        self.logger.info(\n            \"Request startPacketCapture for ip {0}, timeout {1}\".format(\n                dev.controlledIP, timeout))\n        start_time = time.time()\n        filename = self._pcap_filename(dev.controlledIP, start_time)\n        cmd = \"\"\"timeout {timeout!s}\n            {tcpdump} -vvv -s0 -i {eth} -w {filepath} host {ip}\"\"\".format(\n            timeout=timeout,\n            tcpdump=self.tcpdump,\n            eth=self.lan[\"name\"],\n            filepath=self._pcap_full_path(filename),\n            ip=dev.controlledIP)\n        # Daemonize set the umask to 0o27 which prevents the http proxy service\n        # from reading the file. For lack of better solution for now, we can\n        # change the umask before spawning the subprocess and then restore its\n        # original value\n        umask = os.umask(0)\n        p = Popen(shlex.split(cmd))\n        os.umask(umask)\n        if p and p.poll() is None:\n            p.pcap = PacketCapture(\n                ip=dev.controlledIP,\n                start_time=start_time,\n                file=PacketCaptureFile(\n                    name=filename,\n                    url=self._pcap_url(filename),\n                    bytes=0),\n                pid=p.pid)\n            self.ip_to_pcap_proc_map[dev.controlledIP] = p\n            return p.pcap\n        else:\n            raise PacketCaptureException(\n                message=\"Failed to start tcpdump process\")\n\n    @AccessCheck\n    def stopPacketCapture(self, dev):\n        \"\"\"Stop a tcpdump process that was started with startPacketCapture().\n\n        Args:\n           dev: a TrafficControlledDevice.\n\n        Returns:\n           The HTTP URL for the pcap file or empty string.\n        \"\"\"\n        self.logger.info(\n            \"Request stopPacketCapture for ip {0}\".format(dev.controlledIP)\n        )\n        self._cleanup_packet_capture_procs()\n        if dev.controlledIP in self.ip_to_pcap_proc_map:\n            p = self.ip_to_pcap_proc_map[dev.controlledIP]\n            p.terminate()\n            # Wait a few secs for processes to die, while cleaning up dead ones\n            max_secs = 5\n            start_time = time.time()\n            while p.poll() is None and (time.time() - start_time) < max_secs:\n                time.sleep(0.5)\n            if p.poll() is None:\n                p.kill()\n            p.pcap.file.bytes = self._pcap_file_size(p.pcap.file.name)\n            return p.pcap\n        else:\n            raise PacketCaptureException(\n                message=\"No capture proc for given ipaddr\")\n\n    def stopAllPacketCaptures(self):\n        \"\"\"Stop all running tcpdump procs.\n        \"\"\"\n        self.logger.info(\"Request stopAllPacketCaptures\")\n        self._cleanup_packet_capture_procs()\n        if self.ip_to_pcap_proc_map:\n            for p in self.ip_to_pcap_proc_map.values():\n                p.terminate()\n            # Wait a few secs for processes to die, while cleaning up dead ones\n            max_secs = 5\n            start_time = time.time()\n            while self.ip_to_pcap_proc_map and \\\n                    (time.time() - start_time) < max_secs:\n                time.sleep(0.5)\n                self._cleanup_packet_capture_procs()\n        if self.ip_to_pcap_proc_map:\n            for p in self.ip_to_pcap_proc_map.values():\n                p.kill()\n\n    def listPacketCaptures(self, dev):\n        \"\"\"List the packet captures available for a given device.\n\n        Args:\n            dev: a TrafficControlledDevice.\n\n        Returns:\n            A list of PacketCapture ojbects.\n        \"\"\"\n        ip = dev.controlledIP\n        self.logger.info(\"Request listPacketCaptures for ip {0}\".format(ip))\n        pcap_list = []\n        for filename in os.listdir(self.pcap_dir):\n            if not filename.endswith(\".cap\"):\n                continue\n            file_ip, start_time = self._pcap_parse_filename(filename)\n            if not file_ip == ip:\n                continue\n            pcap = PacketCapture(\n                ip=ip,\n                start_time=start_time,\n                file=PacketCaptureFile(\n                    name=filename,\n                    url=self._pcap_url(filename),\n                    bytes=self._pcap_file_size(filename)))\n            pcap_list.append(pcap)\n        return pcap_list\n\n    def listRunningPacketCaptures(self):\n        \"\"\"List the running packet captures.\n\n        Returns:\n           A list of PacketCapture ojbects.\n        \"\"\"\n        self.logger.info(\"Request listRunningPacketCaptures\")\n        pcap_list = []\n        self._cleanup_packet_capture_procs()\n        for ip, p in self.ip_to_pcap_proc_map.items():\n            p.pcap.file.bytes = self._pcap_file_size(p.pcap.file.name)\n            pcap_list.append(p.pcap)\n        return pcap_list\n\n    def stop_expired_shapings(self):\n        \"\"\"Stop shaping that have expired.\n        \"\"\"\n        expired_devs = [\n            attrs['tc'].device\n            for ip, attrs in self._current_shapings.iteritems()\n            if attrs['timeout'] <= time.time()\n        ]\n        for dev in expired_devs:\n            self.logger.info('Shaping for Device \"{0}\" expired'.format(dev))\n            self.logger.debug('calling stopShaping for \"{0}\"'.format(dev))\n            self.stopShaping(dev)\n\n    def requestToken(self, ip, duration):\n        \"\"\"Returns a unique, random access code.\n\n        Random token to be given to a host to control the `ip`.\n        The token validity is limited in time.\n\n        Args:\n            ip: The IP to control.\n            duration: How long the token will be valid for.\n\n        Returns:\n            An AccessToken.\n        \"\"\"\n\n        self.logger.info(\n            \"Request requestToken({0}, {1})\".format(ip, duration)\n        )\n        token = self.access_manager.generate_token(ip, duration)\n        return token\n\n    def requestRemoteControl(self, dev, accessToken):\n        \"\"\"Request to control a remote device.\n\n        Returns true if the token given is a valid token for the remote IP\n            according to the totp object stored for that IP\n\n        Args:\n            dev: The TrafficControlledDevice.\n            accessToken: The token to grant access.\n        Returns:\n            True if access is granted, False otherwise.\n        \"\"\"\n\n        self.logger.info(\n            \"Request requestControl({0}, {1})\".format(dev, accessToken)\n        )\n        access_granted = False\n        try:\n            self.access_manager.validate_token(\n                dev,\n                accessToken,\n            )\n            access_granted = True\n        except AccessTokenException:\n            self.logger.exception(\"Access Denied for request\")\n        return access_granted\n\n    def getDevicesControlledBy(self, ip):\n        \"\"\"Get the devices controlled by a given IP.\n\n        Args:\n            ip: The IP of the controlling host.\n\n        Returns:\n            A list of RemoteControlInstance.\n        \"\"\"\n        return self.access_manager.get_devices_controlled_by(ip)\n\n    def getDevicesControlling(self, ip):\n        \"\"\"Get the devices controlling a given IP.\n\n        Args:\n            ip: The IP of the controlled host.\n\n        Returns:\n            A list of RemoteControlInstance.\n        \"\"\"\n        return self.access_manager.get_devices_controlling(ip)\n"
  },
  {
    "path": "atc/atcd/atcd/AtcdVService.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport logging\nimport os\nimport sys\n\nfrom sparts.vservice import VService\n\n\nclass AtcdVService(VService):\n    def initLogging(self):\n        super(AtcdVService, self).initLogging()\n        sh = logging.handlers.SysLogHandler(address=self._syslog_address())\n        sh.setLevel(logging.DEBUG)\n        self.logger.addHandler(sh)\n        # Make sparts.tasks logging go to syslog\n        sparts_tasks_logger = logging.getLogger('sparts.tasks')\n        sparts_tasks_logger.addHandler(sh)\n\n    def _syslog_address(self):\n        address = None\n        if sys.platform == 'linux2':\n            address = '/dev/log'\n        elif sys.platform == 'darwin':\n            address = '/var/run/syslog'\n\n        if address is None or not os.path.exists(address):\n            address = ('localhost', 514)\n        return address\n"
  },
  {
    "path": "atc/atcd/atcd/__init__.py",
    "content": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/atcd/atcd/access_manager.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport datetime\nimport pyotp\nimport time\n\nfrom atc_thrift.ttypes import AccessToken\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atc_thrift.ttypes import RemoteControlInstance\n\n\ndef _dev_to_tuple(device):\n    return device.controllingIP, device.controlledIP\n\n\ndef _tuple_to_dev(tup):\n    return TrafficControlledDevice(\n        controllingIP=tup[0],\n        controlledIP=tup[1],\n    )\n\n\ndef _remote_control_instance(tup, timeout):\n    return RemoteControlInstance(\n        device=_tuple_to_dev(tup),\n        timeout=timeout,\n    )\n\n\nclass AccessTokenException(Exception):\n    pass\n\n\nclass AtcdTOTP(pyotp.TOTP):\n    def valid_until(self, for_time):\n        \"\"\"\n        Returns the time that a code will expire, given a Time object.\n\n        @param [Time] Time object\n        @return [Time] time the code that would be generated at `for_time`\n        is valid until\n        \"\"\"\n        valid_time = (self.timecode(for_time) + 1) * self.interval\n        valid_datetime = datetime.datetime.fromtimestamp(valid_time)\n        return valid_datetime\n\n\nclass AccessManager(object):\n    ACCESS_TOKEN_INTERVAL = 60\n\n    def __init__(self, secure=True):\n        self._ip_to_totp_map = {}\n        self._control_allowed = {}\n        self.secure = secure\n\n    def generate_token(self, ip, duration):\n        \"\"\"\n        takes an ip to generate an AccessToken for and a duration that the\n        remote device will be granted control of the ip once the token is used\n        \"\"\"\n        totp_dict = self._ip_to_totp_map.get(ip)\n        if totp_dict is None:\n            # Timeout changed to 60 seconds from the default 30 as it may take\n            # more than 30 sec to get the code, go to other client and enter it\n            totp = AtcdTOTP(\n                interval=self.ACCESS_TOKEN_INTERVAL,\n                s=pyotp.random_base32()\n            )\n            self._ip_to_totp_map[ip] = {\n                'totp': totp,\n                'duration': duration\n            }\n        else:\n            totp = totp_dict.get('totp')\n            if duration != totp_dict.get('duration'):\n                totp_dict['duration'] = duration\n                self._ip_to_totp_map[ip] = totp_dict\n\n        timestamp = datetime.datetime.now()\n\n        return AccessToken(\n            token=totp.at(timestamp),\n            interval=self.ACCESS_TOKEN_INTERVAL,\n            # valid_until returns time as a datetime.datetime object\n            # this converts it to a float time\n            valid_until=time.mktime(totp.valid_until(timestamp).timetuple())\n        )\n\n    def validate_token(self, dev, access_token):\n        \"\"\"\n        takes a TrafficControlDevice and an AccessToken and if that device and\n        token are a valid combo, stores the time dev.controllingIP has access\n            internally for lookup later.\n        This either returns None on success or\n            raises an AccessTokenException on failure\n        \"\"\"\n        # Shortcuts\n        # Of course you can control yourself!\n        if not (dev.controllingIP == dev.controlledIP):\n            totp_dict = self._ip_to_totp_map.get(dev.controlledIP, {})\n            totp = totp_dict.get('totp')\n            duration = totp_dict.get('duration')\n            if not (totp and duration):\n                raise AccessTokenException(\"That remote device hasn't\"\n                                           \" generated a code yet\")\n\n            if totp.verify(access_token.token):\n                timeout = time.time() + duration\n                self._control_allowed[_dev_to_tuple(dev)] = timeout\n            else:\n                raise AccessTokenException(\"Access denied for device pair\")\n\n    def access_allowed(self, dev):\n        \"\"\"\n        Decides whether or not dev.controllingIP has access to control\n        dev.controlledIP\n        @returns boolean\n        \"\"\"\n        # Non secure mode, access granted everytime\n        if not self.secure:\n            return True\n\n        if dev.controllingIP == dev.controlledIP:\n            return True\n        dev_tuple = _dev_to_tuple(dev)\n        timeout = self._control_allowed.get(dev_tuple)\n        if timeout:\n            if timeout > time.time():\n                return True\n            else:\n                del self._control_allowed[dev_tuple]\n        return False\n\n    def get_devices_controlled_by(self, ip):\n        '''\n        Implementation for atcd.getDevicesControlledBy\n        '''\n        now = time.time()\n\n        def is_valid(key, val):\n            return key[0] == ip and val > now\n\n        return [\n            _remote_control_instance(key, val)\n            for (key, val) in self._control_allowed.items()\n            if is_valid(key, val)\n        ]\n\n    def get_devices_controlling(self, ip):\n        '''\n        Implementation for atcd.getDevicesControlling\n        '''\n        now = time.time()\n\n        def is_valid(key, val):\n            return key[1] == ip and val > now\n\n        return [\n            _remote_control_instance(key, val)\n            for (key, val) in self._control_allowed.items()\n            if is_valid(key, val)\n        ]\n"
  },
  {
    "path": "atc/atcd/atcd/backends/__init__.py",
    "content": ""
  },
  {
    "path": "atc/atcd/atcd/backends/linux.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport sys\n\nfrom atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask\n\n# Pyroute stuff\nfrom pyroute2 import IPRoute\nfrom pyroute2.netlink.rtnl import TC_H_ROOT\nfrom pyroute2.netlink.rtnl import RTM_NEWTCLASS\nfrom pyroute2.netlink.rtnl import RTM_DELTCLASS\nfrom pyroute2.netlink.rtnl import RTM_NEWQDISC\nfrom pyroute2.netlink.rtnl import RTM_DELQDISC\nfrom pyroute2.netlink.rtnl import RTM_NEWTFILTER\nfrom pyroute2.netlink.rtnl import RTM_DELTFILTER\nfrom pyroute2.netlink import NetlinkError\n\n# Atc thrift files\nfrom atc_thrift.ttypes import ReturnCode\nfrom atc_thrift.ttypes import TrafficControlRc\n\n\nETH_P_IP = 0x0800\nPRIO = 1\nHANDLE_MIN = 2\nHANDLE_MAX = (2 ** 16) - 1\n\n\ndef int_to_classid(i):\n    s = \"{0:X}:{1:X}\".format(i >> 16, 0xff & i)\n    return s\n\n\nclass AtcdLinuxShaper(AtcdThriftHandlerTask):\n\n    ID_MANAGER_ID_MIN = HANDLE_MIN\n    ID_MANAGER_ID_MAX = HANDLE_MAX\n\n    def initTask(self):\n        self.ipr = IPRoute()\n        super(AtcdLinuxShaper, self).initTask()\n\n    def stop(self):\n        self._release_ipr()\n\n    def _release_ipr(self):\n        self.ipr.close()\n\n    def _links_lookup(self):\n        try:\n            self.lan['id'] = self.ipr.link_lookup(ifname=self.lan_name)[0]\n            self.wan['id'] = self.ipr.link_lookup(ifname=self.wan_name)[0]\n        except IndexError:\n            self._release_ipr()\n            msg = 'One of the following interfaces does not exist:' \\\n                ' {0}, {1}'.format(self.lan_name, self.wan_name)\n            self.logger.critical(msg)\n            raise Exception(msg)\n\n    def initialize_shaping_system(self):\n        \"\"\"Initialize Iptables and TC subsystems\n        Only call once as this will FLUSH all current\n        shapings...\n        \"\"\"\n        self.logger.info(\"Calling initialize_shaping_system\")\n        self._initialize_iptables()\n        self._initialize_tc()\n\n    def _initialize_iptables(self):\n        \"\"\"Initialize IPTables by flushing all rules in FORWARD chain\n        from mangle table.\n        \"\"\"\n        cmd = \"{0} -t mangle -F FORWARD\".format(self.iptables)\n        self.run_cmd(cmd)\n\n    def _initialize_tc_for_interface(self, eth):\n        \"\"\"Initialize TC on a given interface.\n\n        If an exception is thrown, it will be forwarded to the main loop\n        unless it can be ignored.\n\n        Args:\n            eth: the interface to flush TC on.\n\n        Raises:\n            NetlinkError: An error occured initializing TC subsystem.\n            Exception: Any other exception thrown during initialization.\n        \"\"\"\n        idx = 0x10000\n        eth_name = eth['name']\n        eth_id = eth['id']\n        try:\n            self.logger.info(\"deleting root QDisc on {0}\".format(eth_name))\n            self.ipr.tc(RTM_DELQDISC, None, eth_id, 0, parent=TC_H_ROOT)\n        except Exception as e:\n            # a (2, 'No such file or directory') can be thrown if there is\n            # nothing to delete. Ignore such error, return the error otherwise\n            if isinstance(e, NetlinkError) and e.code == 2:\n                self.logger.warning(\n                    \"could not delete root QDisc. There might \"\n                    \"have been nothing to delete\")\n            else:\n                self.logger.exception(\n                    'Initializing root Qdisc for {0}'.format(eth_name)\n                )\n                raise\n\n        try:\n            self.logger.info(\"setting root qdisc on {0}\".format(eth_name))\n            self.ipr.tc(RTM_NEWQDISC, \"htb\", eth_id, idx, default=0)\n        except Exception as e:\n            self.logger.exception(\n                'Setting root Qdisc for {0}'.format(eth_name)\n            )\n            raise\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _initialize_tc(self):\n        \"\"\"Initialize TC root qdisc on both LAN and WAN interface.\n        \"\"\"\n        for netif in [self.lan, self.wan]:\n            self._initialize_tc_for_interface(netif)\n\n    def _unset_htb_class(self, mark, eth):\n        \"\"\"Given a mark and an interface, unset the HTB class.\n\n        Args:\n            mark: The mark based on which we delete the class.\n            eth: The interface on which to delete that class id.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        ifid = eth['id']\n        idx = 0x10000 + mark\n        try:\n            self.logger.info(\n                \"deleting class on IFID {0}, classid {1}\".format(\n                    eth['name'], int_to_classid(idx)\n                )\n            )\n            self.ipr.tc(RTM_DELTCLASS, 'htb', ifid, idx)\n        except NetlinkError as e:\n            return TrafficControlRc(\n                code=ReturnCode.NETLINK_HTB_ERROR,\n                message=str(e))\n        except Exception as e:\n            self.logger.exception('_unset_htb_class')\n            exc_info = sys.exc_info()\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_HTB_ERROR,\n                message=str(exc_info))\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _set_htb_class(self, mark, eth, shaping):\n        \"\"\"Given a mark, an interface and shaping settings, set the HTB class.\n\n        Args:\n            mark: The mark based on which we create the class\n            eth: The interface on which to create that class id.\n            shaping: The shaping settings to set.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        ifid = eth['id']\n        idx = 0x10000 + mark\n        parent = 0x10000\n        self.logger.info(\n            \"create new HTB class on IFID {0}, classid {1},\"\n            \"parent {2}, rate {3}kbits\".format(\n                eth['name'], int_to_classid(idx),\n                int_to_classid(parent), shaping.rate or 2**22 - 1)\n        )\n        try:\n            self.ipr.tc(\n                RTM_NEWTCLASS, 'htb', ifid, idx,\n                parent=parent,\n                rate=\"{}kbit\".format(shaping.rate or (2**22 - 1)),\n            )\n        except NetlinkError as e:\n            return TrafficControlRc(\n                code=ReturnCode.NETLINK_HTB_ERROR,\n                message=str(e))\n        except Exception as e:\n            self.logger.exception('_set_htb_class')\n            exc_info = sys.exc_info()\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_HTB_ERROR,\n                message=str(exc_info))\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _unset_netem_qdisc(self, mark, eth):\n        \"\"\"This is not needed as deleting the HTB class is sufficient\n        to remove the netem qdisc\"\"\"\n        pass\n\n    def _set_netem_qdisc(self, mark, eth, shaping):\n        \"\"\"Given a mark, interface and shaping settings, create the NetEm\n        Qdisc.\n\n        Args:\n            mark: The mark based on which we create the Qdisc.\n            eth: The interface on which we will create the Qdisc.\n            shaping: The shaping settings for that interface.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        ifid = eth['id']\n        parent = 0x10000 + mark\n        idx = 0  # automatically assign a handleid\n        self.logger.info(\n            \"create new Netem qdisc on IFID {0}, parent {1},\"\n            \" loss {2}%, delay {3}\".format(\n                eth['name'], int_to_classid(parent),\n                shaping.loss.percentage,\n                shaping.delay.delay * 1000)\n        )\n        try:\n            self.ipr.tc(\n                RTM_NEWQDISC, 'netem', ifid, idx,\n                parent=parent,\n                loss=shaping.loss.percentage,\n                delay=shaping.delay.delay * 1000,\n                jitter=shaping.delay.jitter * 1000,\n                delay_corr=shaping.delay.correlation,\n                loss_corr=shaping.loss.correlation,\n                prob_reorder=shaping.reorder.percentage,\n                corr_reorder=shaping.reorder.correlation,\n                gap=shaping.reorder.gap,\n                prob_corrupt=shaping.corruption.percentage,\n                corr_corrupt=shaping.corruption.correlation,\n            )\n        except NetlinkError as e:\n            return TrafficControlRc(\n                code=ReturnCode.NETLINK_NETEM_ERROR,\n                message=str(e))\n        except Exception as e:\n            self.logger.exception('_set_netem_qdisc')\n            exc_info = sys.exc_info()\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_NETEM_ERROR,\n                message=str(exc_info))\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _unset_filter(self, mark, eth):\n        \"\"\"Given a mark and an interface, delete the filter.\n\n        Args:\n            mark: The mark based on which we delete the filter.\n            eth: The interface on which we delete the filter.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        ifid = eth['id']\n        parent = 0x10000\n        self.logger.info(\n            \"deleting filter on IFID {0}, handle {1:X}\".format(\n                eth['name'], mark\n            )\n        )\n        try:\n            self.ipr.tc(\n                RTM_DELTFILTER, 'fw', ifid, mark,\n                parent=parent, protocol=ETH_P_IP, prio=PRIO\n            )\n        except NetlinkError as e:\n            return TrafficControlRc(\n                code=ReturnCode.NETLINK_FW_ERROR,\n                message=str(e))\n        except Exception as e:\n            self.logger.exception('_unset_filter')\n            exc_info = sys.exc_info()\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_FW_ERROR,\n                message=str(exc_info))\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _set_filter(self, mark, eth, shaping):\n        \"\"\"Given a mark, interface and shaping settings, create a TC filter.\n\n        Args:\n            mark: The mark based on which we create the filter.\n            eth: The interface on which we create the filter.\n            shaping: The shaping associated to this interface.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        ifid = eth['id']\n        idx = 0x10000 + mark\n        parent = 0x10000\n        self.logger.info(\n            \"create new FW filter on IFID {0}, classid {1},\"\n            \" handle {2:X}, rate: {3}kbits\".format(\n                eth['name'], int_to_classid(idx), mark,\n                shaping.rate\n            )\n        )\n        try:\n            extra_args = {}\n            if not self.dont_drop_packets:\n                extra_args.update({\n                    'rate': \"{}kbit\".format(shaping.rate or 2**22 - 1),\n                    'burst': self.burst_size,\n                    'action': 'drop',\n                })\n            self.ipr.tc(RTM_NEWTFILTER, 'fw', ifid, mark,\n                        parent=parent,\n                        protocol=ETH_P_IP,\n                        prio=PRIO,\n                        classid=idx,\n                        **extra_args\n                        )\n        except NetlinkError as e:\n            return TrafficControlRc(\n                code=ReturnCode.NETLINK_FW_ERROR,\n                message=str(e))\n        except Exception as e:\n            self.logger.exception('_set_filter')\n            exc_info = sys.exc_info()\n            return TrafficControlRc(\n                code=ReturnCode.UNKNOWN_FW_ERROR,\n                message=str(exc_info))\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _unset_iptables(self, mark, eth, ip, options=None):\n        \"\"\"Given a mark, interface, IP and options, clear iptables rules.\n\n        Args:\n            mark: The mark to delete.\n            eth: The interface on which to delete the mark.\n            ip: The IP address to shape.\n            options: An array of iptables options for more specific filtering.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        if options is None or len(options) == 0:\n            options = ['']\n        for opt in options:\n            cmd = \"{0} -t mangle -D FORWARD {1} {2} -i {3} {option} \" \\\n                \"-j MARK --set-mark {4}\".format(\n                    self.iptables, \"-s\"\n                    if eth['name'] == self.lan['name'] else \"-d\",\n                    ip, eth['name'], mark, option=opt)\n            self.run_cmd(cmd)\n\n    def _set_iptables(self, mark, eth, ip, options=None):\n        \"\"\"Given a mark, interface, IP and options, create iptables rules.\n\n        Those rules will mark packets which will be filtered by TC filter and\n        put in the right shaping bucket.\n\n        Args:\n            mark: The mark to delete.\n            eth: The interface on which to delete the mark.\n            ip: The IP address to shape.\n            options: An array of iptables options for more specific filtering.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        if options is None or len(options) == 0:\n            options = ['']\n        for opt in options:\n            cmd = \"{0} -t mangle -A FORWARD {1} {2} -i {3} {option} \" \\\n                \"-j MARK --set-mark {4}\".format(\n                    self.iptables, \"-s\"\n                    if eth['name'] == self.lan['name'] else \"-d\",\n                    ip, eth['name'], mark, option=opt)\n            self.run_cmd(cmd)\n\n    def _shape_interface(self, mark, eth, ip, shaping):\n        \"\"\"Shape the traffic for a given interface.\n\n        Shape the traffic for a given IP on a given interface, given the mark\n        and the shaping settings.\n        There is a few steps to shape the traffic of an IP:\n        1. Create an HTB class that limit the throughput.\n        2. Create a NetEm QDisc that adds corruption, loss, reordering, loss\n            and delay.\n        3. Create the TC filter that will bucket packets with a given mark in\n            the right HTB class.\n        4. Set an iptables rule that mark packets going to/coming from IP\n\n        Args:\n            mark: The mark to set on IP packets.\n            eth: The network interface.\n            ip: The IP to shape traffic for.\n            shaping: The shaping setting to set.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n        self.logger.info(\n            \"Shaping ip {0} on interface {1}\".format(ip, eth['name']))\n        # HTB class\n        tcrc = self._set_htb_class(mark, eth, shaping)\n        if tcrc.code != ReturnCode.OK:\n            self.logger.error(\n                \"adding HTB class on IFID {0}, mark {1}, err: {2}\".format(\n                    eth['name'], mark, tcrc.message))\n            return tcrc\n        # NetemQdisc\n        tcrc = self._set_netem_qdisc(mark, eth, shaping)\n        if tcrc.code != ReturnCode.OK:\n            self.logger.error(\n                \"adding NetEm qdisc on IFID {0}, mark {1}, err: {2}\".format(\n                    eth['name'], mark, tcrc.message))\n            # delete class\n            self._unset_htb_class(mark, eth)\n            return tcrc\n        # filter\n        tcrc = self._set_filter(mark, eth, shaping)\n        if tcrc.code != ReturnCode.OK:\n            self.logger.error(\n                \"adding filter FW on IFID {0}, mark {1}, err: {2}\".format(\n                    eth['name'], mark, tcrc.message))\n            # delete class\n            self._unset_htb_class(mark, eth)\n            return tcrc\n        # iptables\n        self._set_iptables(mark, eth, ip, shaping.iptables_options)\n\n        return TrafficControlRc(code=ReturnCode.OK)\n\n    def _unshape_interface(self, mark, eth, ip, settings):\n        \"\"\"Unshape the traffic for a given interface.\n\n        Unshape the traffic for a given IP on a given interface, given the mark\n        and the shaping settings.\n        There is a few steps to unshape the traffic of an IP:\n        1. Remove the iptables rule.\n        2. Remove the TC filter.\n        3. Remove the HTB class.\n\n        Args:\n            mark: The mark to set on IP packets.\n            eth: The network interface.\n            ip: The IP to shape traffic for.\n            shaping: The shaping setting to set.\n\n        Returns:\n            A TrafficControlRc containing information on success/failure.\n        \"\"\"\n\n        self.logger.info(\n            \"Unshaping ip {0} on interface {1}\".format(ip, eth['name']))\n        # iptables\n        self._unset_iptables(mark, eth, ip, settings.iptables_options)\n        # filter\n        tcrc = self._unset_filter(mark, eth)\n        if tcrc.code != ReturnCode.OK:\n            self.logger.error(\n                \"deleting FW filter on IFID {0}, mark {1}, err: {2}\".format(\n                    eth['name'], mark, tcrc.message)\n            )\n            return tcrc\n        # HTB class\n        tcrc = self._unset_htb_class(mark, eth)\n        if tcrc.code != ReturnCode.OK:\n            self.logger.error(\n                \"deleting HTB class on IFID {0}, mark {1}, err: {2}\".format(\n                    eth['name'], mark, tcrc.message)\n            )\n            return tcrc\n\n        return TrafficControlRc(code=ReturnCode.OK)\n"
  },
  {
    "path": "atc/atcd/atcd/db_manager.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport logging\nimport sqlite3\n\n\nclass SQLiteManager(object):\n    \"\"\" Manage various SQLite operations for ATCd\n    \"\"\"\n\n    SHAPING_INSERT_QUERY = \\\n        'INSERT OR REPLACE INTO CurrentShapings values (?, ?, ?)'\n    SHAPING_CREATE_QUERY = \\\n        'CREATE TABLE IF NOT EXISTS CurrentShapings('\\\n        'ip VARCHAR PRIMARY KEY NOT NULL, tc_obj BLOB, timeout INT)'\n    SHAPING_TABLE_NAME = 'CurrentShapings'\n    SHAPING_IP_COL = 0\n    SHAPING_TC_COL = 1\n    SHAPING_TIMOUT_COL = 2\n\n    def __init__(self, file_name, logger=None):\n        self.logger = logger or logging.getLogger()\n        self.file_name = file_name\n        with self._get_conn() as conn:\n            conn.execute(SQLiteManager.SHAPING_CREATE_QUERY)\n        conn.close()\n\n    def get_saved_shapings(self):\n        \"\"\" Querys the db and returns a list of the\n            TrafficControl objects that are stored there.\n            returns as a list of dicts that have a key for 'tc' and 'timeout'\n        \"\"\"\n        query = 'SELECT * FROM CurrentShapings'\n        with self._get_conn() as conn:\n            results = conn.execute(query).fetchall()\n        conn.close()\n        # shapings = [{'tc': tc_obj, 'timeout': 123456}, ... ]\n        shapings = []\n        for result in results:\n            shapings.append(\n                {\n                    'tc': result[SQLiteManager.SHAPING_TC_COL],\n                    'timeout': result[SQLiteManager.SHAPING_TIMOUT_COL]\n                }\n            )\n        return shapings\n\n    def add_shaping(self, tc, timeout):\n        with self._get_conn() as conn:\n            conn.execute(\n                SQLiteManager.SHAPING_INSERT_QUERY,\n                (tc.device.controlledIP, repr(tc), timeout)\n            )\n        conn.close()\n\n    def remove_shaping(self, ip):\n        query = 'DELETE FROM CurrentShapings WHERE ip = ?'\n        with self._get_conn() as conn:\n            conn.execute(query, (ip,))\n        conn.close()\n\n    def _get_conn(self):\n        try:\n            conn = sqlite3.connect(self.file_name)\n        except sqlite3.OperationalError:\n            self.logger.error(\n                'Unable to access db file: {0}'.format(self.file_name)\n            )\n            raise\n        return conn\n"
  },
  {
    "path": "atc/atcd/atcd/idmanager.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nimport threading\n\n\nclass IdManager(object):\n    '''A class to manage disctributing ID objects'''\n    def __init__(self, first_id=0, max_id=None):\n        '''initialise the id manager class\n        A minimun and maximum ID can be provided\n        at initialisation time.'''\n        self.first_id = first_id\n        self.max_id = max_id\n        self.next_available = first_id\n        self.spares = set()\n        self.lock = threading.Lock()\n\n    def free(self, id):\n        '''return an ID to the pool of available IDs'''\n        with self.lock:\n            if id == self.next_available - 1:\n                self.next_available -= 1\n            else:\n                self.spares.add(id)\n\n    def new(self):\n        '''claim an ID from the pool of IDs, if no more IDs are available,\n        throw an exception'''\n        with self.lock:\n            try:\n                return self.spares.pop()\n            except:\n                next_avail = self.next_available\n                if self.max_id is not None and \\\n                   self.next_available > self.max_id:\n                    raise Exception(\n                        \"ID pool exhausted, max id is {0}\".format(self.max_id)\n                    )\n\n                self.next_available += 1\n                return next_avail\n"
  },
  {
    "path": "atc/atcd/atcd/scripts/__init__.py",
    "content": ""
  },
  {
    "path": "atc/atcd/atcd/scripts/runner.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n'''\nATC Daemon main file\n'''\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport sys\n\n# AtcdHandler main class\nfrom atcd.AtcdDeviceTimeoutTask import AtcdDeviceTimeoutTask\nfrom atcd.AtcdThriftHandlerTask import AtcdNBServerTask\nfrom atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask\nfrom atcd.AtcdVService import AtcdVService\n\n\ndef initialize_thrift():\n    AtcdNBServerTask.register()\n    AtcdThriftHandlerTask.factory().register()\n    AtcdDeviceTimeoutTask.register()\n\n    AtcdVService.initFromCLI()\n\n\ndef run():\n    initialize_thrift()\n    sys.exit(0)\n"
  },
  {
    "path": "atc/atcd/atcd/tools/test_secure_access.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_thrift import Atcd\nfrom atc_thrift.ttypes import TrafficControl\nfrom thrift.protocol import TBinaryProtocol\nfrom thrift.transport import TSocket, TTransport\n\nfrom atc_thrift.ttypes import Shaping\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atc_thrift.ttypes import TrafficControlSetting\n\nimport argparse\n\n\ndef getAtcClient():\n        transport = TSocket.TSocket('localhost', 9090)\n        transport = TTransport.TFramedTransport(transport)\n        transport.open()\n        protocol = TBinaryProtocol.TBinaryProtocol(transport)\n        return Atcd.Client(protocol)\n\n\ndef parse_arguments():\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\n        '--self',\n        action='store_true',\n        help='Shape for oneself?'\n    )\n    parser.add_argument(\n        '--controlling-ip',\n        default='1.1.1.1',\n        help='Controlling ip [%(default)s]'\n    )\n    parser.add_argument(\n        '--controlled-ip',\n        default='2.2.2.2',\n        help='Controlled ip [%(default)s]'\n    )\n    return parser.parse_args()\n\n\nif __name__ == '__main__':\n    options = parse_arguments()\n    client = getAtcClient()\n    dev = TrafficControlledDevice(\n        controllingIP=options.controlling_ip,\n        controlledIP=options.controlling_ip if options.self\n        else options.controlled_ip\n    )\n    settings = TrafficControlSetting(\n        up=Shaping(\n            rate=100,\n        ),\n        down=Shaping(\n            rate=200,\n        ),\n    )\n    print settings\n    tc = TrafficControl(\n        device=dev,\n        settings=settings,\n        timeout=1000,\n    )\n\n    print client.startShaping(tc)\n"
  },
  {
    "path": "atc/atcd/bin/atcd",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nfrom atcd.scripts import runner\nrunner.run()\n"
  },
  {
    "path": "atc/atcd/requirements/requirements-testing.txt",
    "content": "pytest\nmock\n"
  },
  {
    "path": "atc/atcd/requirements.txt",
    "content": "--index-url https://pypi.python.org/simple/\n\n-e .\n"
  },
  {
    "path": "atc/atcd/setup.cfg",
    "content": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/atcd/setup.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport os\nimport re\nimport sys\n\nfrom setuptools import setup\n\nreadme = open(\"README.md\", \"r\")\n\ninstall_requires = [\n    'pyroute2==0.3.3',\n    'pyotp==1.4.1',\n    'sparts==0.7.1',\n    'atc_thrift'\n]\n\ntests_require = install_requires + [\n    'pytest'\n]\n\nif sys.version < '3.3':\n    tests_require.append('mock')\n\nscripts = ['bin/atcd']\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py).group(1)\n\n\nversion = get_version('atcd')\n\nif sys.argv[-1] == 'publish':\n    if os.system(\"pip freeze | grep wheel\"):\n        print(\"wheel not installed.\\nUse `pip install wheel`.\\nExiting.\")\n        sys.exit()\n    if os.system(\"pip freeze | grep twine\"):\n        print(\"twine not installed.\\nUse `pip install twine`.\\nExiting.\")\n        sys.exit()\n    os.system(\"python setup.py sdist bdist_wheel\")\n    os.system(\"twine upload dist/*\")\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %s -m 'version %s'\" % (version, version))\n    print(\"  git push --tags\")\n    sys.exit()\n\nsetup(\n    name='atcd',\n    version=version,\n    description='ATC Daemon',\n    author='Emmanuel Bretelle',\n    author_email='chantra@fb.com',\n    url='https://github.com/facebook/augmented-traffic-control',\n    packages=['atcd',\n              'atcd.backends',\n              'atcd.scripts',\n              'atcd.tools'],\n    classifiers=['Programming Language :: Python', ],\n    long_description=readme.read(),\n    scripts=scripts,\n    install_requires=install_requires,\n    tests_require=tests_require,\n)\n"
  },
  {
    "path": "atc/atcd/tests/idmanager_test.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atcd import idmanager\nimport unittest\n\n\nclass TestIdManager(unittest.TestCase):\n    MAXID = 10\n\n    def setUp(self):\n        self.idm = idmanager.IdManager(1, TestIdManager.MAXID)\n\n    def test_assignement(self):\n        nbiters = 5\n\n        idx = self.idm.new()\n        self.assertEqual(idx, 1)\n\n        for i in range(nbiters):\n            idx = self.idm.new()\n        self.assertEqual(idx, nbiters + 1)\n\n        # return the id we allocated last\n        self.idm.free(nbiters+1)\n        # return id 2 and 5\n        self.idm.free(2)\n        self.idm.free(5)\n\n        s = set()\n        s.add(self.idm.new())\n        s.add(self.idm.new())\n        self.assertEqual(s, set([2, 5]))\n\n    def test_exhaustion(self):\n        idx = 0\n        # test that we throw an exception\n        with self.assertRaises(Exception):\n            for i in xrange(TestIdManager.MAXID + 1):\n                idx = self.idm.new()\n        self.assertEqual(idx, TestIdManager.MAXID)\n"
  },
  {
    "path": "atc/atcd/tests/test_AtcdDBQueueTask.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_thrift.ttypes import TrafficControl\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atcd.AtcdDBQueueTask import AtcdDBQueueTask\nfrom sparts.sparts import option\nfrom sparts.tests.base import SingleTaskTestCase\n\nimport mock\nimport pytest\nimport sqlite3\nimport tempfile\n\n\n@pytest.fixture\ndef atc_db_file():\n    \"\"\"return a NamedTemporyFile (tempfile.NamedTemportFile) for use\n    with testing ATC's SQLite DB features\n    \"\"\"\n    return tempfile.NamedTemporaryFile(\n        suffix='.db',\n        prefix='atc_',\n    )\n\n\nclass AtcdDBQueueTestTask(AtcdDBQueueTask):\n    sqlite_file = option(default=atc_db_file().name)\n\n\nclass TestAtcdDBQueueTask(SingleTaskTestCase):\n\n    TASK = AtcdDBQueueTestTask\n\n    def test_get_saved_shaping(self):\n        self.assertEqual(len(self.task.get_saved_shapings()), 0)\n\n    def test_execute_missing_arg(self):\n        # We silently discard the query...\n        l = self.task.get_saved_shapings()\n        self.task.execute(('obj',), 'context_unused')\n        # DB is not modified, we expect the same content\n        self.assertEqual(l, self.task.get_saved_shapings())\n\n    def test_operational_error(self):\n        # When there is a operational error, we just swallow the exception\n        tc = self._make_tc_device()\n        l = self.task.get_saved_shapings()\n        with mock.patch('atcd.db_manager.sqlite3.connect') as mock_connect:\n            mock_connect.side_effect = sqlite3.OperationalError('Op Error')\n            self.task.execute(((tc, 10), 'add_shaping'), 'context_unused')\n        self.assertEqual(l, self.task.get_saved_shapings())\n\n    def test_execute_unkown_action(self):\n        # unknown action is expected to raise an AttributeError exception\n        with pytest.raises(AttributeError):\n            self.task.execute(('obj', 'unknown_action'), 'context_unused')\n\n    def test_add_shaping_wrong_arguments(self):\n        # We expect a tc object, not a string.\n        with pytest.raises(AttributeError):\n            self.task.execute(\n                (('tc', 'timeout'), 'add_shaping'),\n                'context_unused'\n            )\n\n    def test_add_shaping_missing_arguments(self):\n        # This should raise a TypeError exception.\n        # add_shaping expects 2 arguments.\n        with pytest.raises(TypeError):\n            self.task.execute(\n                ('tc', 'add_shaping'), 'context_unused'\n            )\n\n    def test_add_shaping_correct_arguments(self):\n        # Test adding/removing a shaped device.\n        ip = '1.1.1.1'\n        tc = self._make_tc_device(ip=ip)\n        self.task.execute(((tc, 10), 'add_shaping'), 'context_unused')\n        self.assertEqual(len(self.task.get_saved_shapings()), 1)\n        self.task.execute((ip, 'remove_shaping'), 'context_unused')\n        self.assertEqual(len(self.task.get_saved_shapings()), 0)\n\n    def test_remove_shaping_not_in_db(self):\n        # When removing somehting not in DB, the number of entries\n        # stay the same.\n        ip = '1.1.1.1'\n        self.assertEqual(len(self.task.get_saved_shapings()), 0)\n        self.task.execute((ip, 'remove_shaping'), 'context_unused')\n        self.assertEqual(len(self.task.get_saved_shapings()), 0)\n\n    def _make_tc_device(self, ip='1.1.1.1'):\n        tc = TrafficControl()\n        tc.device = TrafficControlledDevice(ip, ip)\n        return tc\n"
  },
  {
    "path": "atc/atcd/tests/test_AtcdThriftHandlerTask.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n'''\nfrom sparts.tests.base import SingleTaskTestCase\nfrom atcd.AtcdThriftHandlerTask import AtcdThriftHandlerTask\n\n\nclass AtcdThriftHandlerTaskTest(SingleTaskTestCase):\n\n    TASK = AtcdThriftHandlerTask\n\n    def setUp(self):\n        super(AtcdThriftHandlerTaskTest, self).setUp()\n\n    def test_nothing(self):\n        self.assertTrue(True)\n'''\n"
  },
  {
    "path": "atc/atcd/tests/test_AtcdVService.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atcd.AtcdVService import AtcdVService\nfrom sparts.tests.base import ServiceTestCase\n\nimport mock\nimport logging\n\n\nclass AtcdVServiceTest(ServiceTestCase):\n\n    def getServiceClass(self):\n        return AtcdVService\n\n    def test_logger_use_syslog(self):\n        handlers = self.service.logger.handlers\n        self.assertTrue(\n            'SysLogHandler' in [type(h).__name__ for h in handlers]\n        )\n\n    def test_logger_spart_syslog(self):\n        handlers = logging.getLogger('sparts.tasks').handlers\n        self.assertTrue(\n            'SysLogHandler' in [type(h).__name__ for h in handlers]\n        )\n\n    @mock.patch('atcd.AtcdVService.sys')\n    @mock.patch('atcd.AtcdVService.os.path.exists')\n    def test_syslog_macosx_path_exists(self, mock_pathexists, mock_sys):\n        mock_sys.configure_mock(platform='darwin')\n        mock_pathexists.return_value = True\n        self.assertEqual(self.service._syslog_address(), '/var/run/syslog')\n\n    @mock.patch('atcd.AtcdVService.sys')\n    @mock.patch('atcd.AtcdVService.os.path.exists')\n    def test_syslog_macosx_path_dont_exists(self, mock_pathexists, mock_sys):\n        mock_sys.configure_mock(platform='darwin')\n        mock_pathexists.return_value = False\n        self.assertEqual(self.service._syslog_address(), ('localhost', 514))\n"
  },
  {
    "path": "atc/atcd/tests/test_access_manager.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport datetime\nimport pytest\nimport time\nimport unittest\n\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atcd.access_manager import AccessManager\nfrom atc_thrift.ttypes import AccessToken\nfrom atcd.access_manager import AccessTokenException\nfrom atcd.access_manager import AtcdTOTP\nfrom mock import Mock\n\nINTERVAL = 60\n\n\n@pytest.fixture\ndef control_allowed():\n    return {\n        ('1.1.1.1', '2.2.2.1'): 20,\n        ('1.1.1.2', '2.2.2.2'): 5,\n        ('1.1.1.1', '2.2.2.4'): 15,\n        ('1.1.1.1', '2.2.2.5'): 5,\n        ('1.1.1.3', '2.2.2.1'): 5,\n        ('1.1.1.4', '2.2.2.1'): 15,\n    }\n\n\n@pytest.fixture\ndef ip_to_totp_map():\n    return {\n        '2.2.2.1': {\n            'totp': AtcdTOTP(s='12345', interval=60),\n            'duration': 15,\n        },\n        '2.2.2.2': {\n            'totp': AtcdTOTP(s='12345', interval=60),\n            'duration': 5,\n        },\n    }\n\n\n@pytest.fixture\ndef am():\n    return AccessManager()\n\n\n@pytest.fixture\ndef fake_am(am, control_allowed, ip_to_totp_map):\n    am._control_allowed = control_allowed\n    am._ip_to_totp_map = ip_to_totp_map\n    return am\n\n\n@pytest.fixture\ndef fail_verify(monkeypatch):\n    monkeypatch.setattr(AtcdTOTP, 'verify', Mock(return_value=False))\n\n\n@pytest.fixture\ndef succeed_verify(monkeypatch):\n    monkeypatch.setattr(AtcdTOTP, 'verify', Mock(return_value=True))\n\n\ndef _make_device(controlling, controlled=None):\n    return TrafficControlledDevice(\n        controllingIP=controlling,\n        controlledIP=controlled\n    )\n\n\ndef _make_token(token):\n    return AccessToken(token=token)\n\n\nclass TestAtcdTOTP(unittest.TestCase):\n\n    interval = 30\n    s = 'wrn3pqx5uqxqvnqr'\n\n    def test_valid_until(self):\n        t = 1297553958\n        endtime30s = 1297553970\n        endtime10s = 1297553960\n        with Timecop(t):\n            totp = AtcdTOTP(interval=30, s=self.s)\n            dt = datetime.datetime.fromtimestamp(t)\n            self.assertEqual(\n                datetime.datetime.fromtimestamp(endtime30s),\n                totp.valid_until(dt)\n            )\n            totp = AtcdTOTP(interval=10, s=self.s)\n            dt = datetime.datetime.fromtimestamp(t)\n            self.assertEqual(\n                datetime.datetime.fromtimestamp(endtime10s),\n                totp.valid_until(dt)\n            )\n        assert True\n\n\nclass TestAccessManager():\n\n    def setup_method(self, method):\n\n        def mocktime():\n            return 10\n        self._old_time = time.time\n        time.time = mocktime\n\n    def teardown_method(self, method):\n        time.time = self._old_time\n\n    def test_generate_token(self, fake_am):\n        l = len(fake_am._ip_to_totp_map.keys())\n        fake_am.generate_token('1.1.1.1', 10)\n        assert len(fake_am._ip_to_totp_map.keys()) == l+1\n\n        fake_am.generate_token('1.1.1.1', 30)\n        assert len(fake_am._ip_to_totp_map.keys()) == l+1\n\n    def test_controlled_by_existing(self, fake_am):\n        controlling_by = fake_am.get_devices_controlled_by('1.1.1.1')\n        assert len(controlling_by) == 2\n\n    def test_controlled_by_non_existent(self, fake_am):\n        controlling_by = fake_am.get_devices_controlled_by('3.3.3.3')\n        assert len(controlling_by) == 0\n\n    def test_controlling_existing(self, fake_am):\n        controlling_by = fake_am.get_devices_controlling('2.2.2.1')\n        assert len(controlling_by) == 2\n\n    def test_controlling_non_existent(self, fake_am):\n        controlling_by = fake_am.get_devices_controlling('3.3.3.3')\n        assert len(controlling_by) == 0\n\n    def test_access_allowed_controlling_ip_none(self, fake_am):\n        # controllingIP = None\n        assert not fake_am.access_allowed(_make_device(None, '2.2.2.5'))\n        # Allowed in non-secure mode\n        fake_am.secure = False\n        assert fake_am.access_allowed(_make_device(None, '2.2.2.5'))\n\n    def test_access_allowed_valid(self, fake_am):\n        # valid entry\n        dev = TrafficControlledDevice(\n            controllingIP='1.1.1.1',\n            controlledIP='2.2.2.1'\n        )\n        assert fake_am.access_allowed(dev)\n\n    def test_access_allowed_non_existent(self, fake_am):\n        # entry does not exist\n        dev = TrafficControlledDevice(\n            controllingIP='1.1.1.1',\n            controlledIP='2.2.2.2'\n        )\n        assert not fake_am.access_allowed(dev)\n        # Allowed in non-secure mode\n        fake_am.secure = False\n        assert fake_am.access_allowed(dev)\n\n    def test_access_allowed_expired(self, fake_am):\n        # expired entry\n        dev = TrafficControlledDevice(\n            controllingIP='1.1.1.1',\n            controlledIP='2.2.2.5'\n        )\n        assert not fake_am.access_allowed(dev)\n        # Allowed in non-secure mode\n        fake_am.secure = False\n        assert fake_am.access_allowed(dev)\n\n    def test_access_allowed_self(self, fake_am):\n        # expired entry\n        dev = TrafficControlledDevice(\n            controllingIP='1.1.1.1',\n            controlledIP='1.1.1.1'\n        )\n        assert fake_am.access_allowed(dev)\n\n    def test_validate_token_valid(self, fake_am, succeed_verify):\n        fake_am.validate_token(\n            _make_device('1.1.1.1', '2.2.2.1'),\n            _make_token('12345'),\n        )\n\n    def test_validate_token_invalid(self, fake_am, fail_verify):\n        with pytest.raises(AccessTokenException) as excinfo:\n            fake_am.validate_token(\n                _make_device('1.1.1.1', '2.2.2.1'),\n                _make_token('12344'),\n            )\n        assert str(excinfo.value) == 'Access denied for device pair'\n\n    # FIXME, this is not really handling expiration properly\n    def test_validate_token_expired_valid(self, fake_am, fail_verify):\n        with pytest.raises(AccessTokenException) as excinfo:\n            fake_am.validate_token(\n                _make_device('1.1.1.2', '2.2.2.2'),\n                _make_token('12345'),\n            )\n        assert str(excinfo.value) == 'Access denied for device pair'\n\n    # FIXME, this is not really handling expiration properly\n    def test_validate_token_expired_invalid(self, fake_am, fail_verify):\n        with pytest.raises(AccessTokenException) as excinfo:\n            fake_am.validate_token(\n                _make_device('1.1.1.2', '2.2.2.2'),\n                _make_token('12344'),\n            )\n        assert str(excinfo.value) == 'Access denied for device pair'\n\n    def test_validate_token_non_existent(self, fake_am):\n        with pytest.raises(AccessTokenException) as excinfo:\n            fake_am.validate_token(\n                _make_device('1.1.1.2', '2.2.2.0'),\n                _make_token('12344'),\n            )\n        assert str(excinfo.value) == \\\n            '''That remote device hasn't generated a code yet'''\n\n\n# Directly copied from https://github.com/nathforge/pyotp/blob/master/test.py\nclass Timecop(object):\n    \"\"\"\n    Half-assed clone of timecop.rb, just enough to pass our tests.\n    \"\"\"\n\n    def __init__(self, freeze_timestamp):\n        self.freeze_timestamp = freeze_timestamp\n\n    def __enter__(self):\n        self.real_datetime = datetime.datetime\n        datetime.datetime = self.frozen_datetime()\n\n    def __exit__(self, type, value, traceback):\n        datetime.datetime = self.real_datetime\n\n    def frozen_datetime(self):\n        class FrozenDateTime(datetime.datetime):\n            @classmethod\n            def now(cls):\n                return cls.fromtimestamp(timecop.freeze_timestamp)\n\n        timecop = self\n        return FrozenDateTime\n"
  },
  {
    "path": "atc/atcd/tests/test_sqlite_manager.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport pytest\nimport sqlite3\nimport tempfile\nimport time\n\nimport atc_thrift.ttypes\nfrom atc_thrift.ttypes import Delay\nfrom atc_thrift.ttypes import Shaping\nfrom atc_thrift.ttypes import TrafficControl\nfrom atc_thrift.ttypes import TrafficControlSetting\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atcd.db_manager import SQLiteManager\n\ntest_ipaddr = '10.01.10.01'\n\n\n@pytest.fixture\ndef atc_db_file():\n    \"\"\"return a NamedTemporyFile (tempfile.NamedTemportFile) for use\n    with testing ATC's SQLite DB features\n    \"\"\"\n    return tempfile.NamedTemporaryFile(\n        suffix='.db',\n        prefix='atc_',\n    )\n\n\n@pytest.fixture\ndef dbm(atc_db_file):\n    return SQLiteManager(atc_db_file.name)\n\n\n@pytest.fixture\ndef test_shaping():\n    return TrafficControl(\n        device=TrafficControlledDevice(\n            controlledIP=test_ipaddr\n        ),\n        timeout=86400,\n        settings=TrafficControlSetting(\n            down=Shaping(\n                delay=Delay(\n                    delay=197,\n                ),\n                rate=81,\n            ),\n            up=Shaping(\n                delay=Delay(\n                    delay=197,\n                ),\n                rate=81,\n            )\n        )\n    )\n\n\n@pytest.fixture\ndef test_db(dbm, test_shaping):\n    dbm.add_shaping(test_shaping, time.time() + test_shaping.timeout)\n    return dbm\n\n\nclass TestSQLiteManager():\n\n    test_query = 'select ip,tc_obj,timeout from {0} where ip=?'.format(\n        SQLiteManager.SHAPING_TABLE_NAME\n    )\n\n    def test_sqlite_file_not_found(self):\n        with pytest.raises(sqlite3.OperationalError):\n            SQLiteManager('/this/path/should/not/exist')\n\n    def test_sqlite_init(self, dbm):\n        test_conn = sqlite3.connect(dbm.file_name)\n        sql = test_conn.execute(\n            \"select sql from sqlite_master where type='table' and name=?\",\n            (SQLiteManager.SHAPING_TABLE_NAME,)\n        ).fetchone()\n        assert SQLiteManager.SHAPING_CREATE_QUERY.replace(\n            'IF NOT EXISTS ', ''\n        ) in sql\n\n    def test_sqlite_add_shaping(self, dbm, test_shaping):\n        dbm.add_shaping(test_shaping, time.time() + test_shaping.timeout)\n        test_conn = sqlite3.connect(dbm.file_name)\n        results = test_conn.execute(self.test_query, (test_ipaddr,)).fetchone()\n        assert results[SQLiteManager.SHAPING_TC_COL] == repr(test_shaping)\n        names = [\n            'TrafficControlledDevice', 'TrafficControl', 'Shaping',\n            'TrafficControlSetting', 'Loss', 'Delay', 'Corruption', 'Reorder'\n        ]\n        globals = {name: getattr(atc_thrift.ttypes, name) for name in names}\n        tc = eval(results[SQLiteManager.SHAPING_TC_COL], globals)\n        assert tc == test_shaping\n\n    def test_sqlite_remove_shaping(self, test_db):\n        test_conn = sqlite3.connect(test_db.file_name)\n        results = test_conn.execute(self.test_query, (test_ipaddr,)).fetchone()\n        assert results\n        # results = (ip, tc_obj, timeout)\n        test_db.remove_shaping(results[0])\n        results = test_conn.execute(self.test_query, (test_ipaddr,)).fetchone()\n        assert not results\n\n    def test_sqlite_get_saved_shapings(self, test_db):\n        results = test_db.get_saved_shapings()\n        assert len(results) > 0\n        for result in results:\n            assert isinstance(result, dict)\n            assert 'tc' in result\n            assert 'timeout' in result\n        with sqlite3.connect(test_db.file_name) as test_conn:\n            test_conn.execute(\n                'DELETE FROM {0}'.format(SQLiteManager.SHAPING_TABLE_NAME)\n            )\n        results = test_db.get_saved_shapings()\n        assert results == []\n"
  },
  {
    "path": "atc/django-atc-api/MANIFEST.in",
    "content": "include README.md\n"
  },
  {
    "path": "atc/django-atc-api/README.md",
    "content": "# ATC Api\n\nATC API is a Django app that allow to bridge a REST API to ATCD's thrift API.\n\n# Setup\n\n## Requirements\n\n* [Django 1.10](https://github.com/django/django)\n* [Django REST framework 3.X](https://github.com/tomchristie/django-rest-framework)\n* [atc_thrift](../atc_thrift)\n\n## Installation\n\nThe easiest way to install `django-atc-api` is to install it directly from [pip](https://pypi.python.org/pypi).\n\n### From pip\n```bash\npip install django-atc-api\n```\n### From source\n\n```bash\n$ cd path/to/django-atc-api\npip install .\n```\n\n## Configuration\n\n1. Edit your Django project's `settings.py` and add `atc_api` and `rest_framework` to your `INSTALLED_APPS`:\n\n```python\n    INSTALLED_APPS = (\n        ...\n        'atc_api',\n        'rest_framework',\n    )\n```\n\n2. Include the `atc_api` URLconf in your Django project urls.py like this:\n\n```python\n    url(r'^api/v1/', include('atc_api.urls')),\n```\n\n3. Start the development server\n\n```bash\npython manage.py runserver 0.0.0.0:8000\n```\n\n4. Visit http://127.0.0.1:8000/api/v1/shape/ to set/unset shaping.\n\n\nSome settings like the `ATCD_HOST` and `ATCD_PORT` can be changes in your Django project'settings.py:\n\n```python\nATC_API = {\n    'ATCD_HOST': 'localhost',\n    'ATCD_PORT': 9090,\n}\n```\n\nsee [ATC api settings](atc_api/settings.py) for more details.\n\n\n# API usage\n\nLet's suppose the api is available under `/api/v1`. The core API is limited and allow to:\n\n* Getting the shaping staus of an device by GETing `/api/v1/shape/`\n* Shape a device by POSTing to `/api/v1/shape/`\n* Unshape a device by sending a DELETE request to `/api/v1/shape/`\n\n## Shaping Status\n\nTo find out if a device is shaped, you can GET `/api/v1/shape/[ip/]`\n\nIf the device is being shaped, HTTP will return 200 and the current shaping of the device.\n\nIf the device is not being shaped, HTTP will return code 404.\n\nExamples:\n\n* Check if I am being shaped (device not being shaped, HTTP code 404):\n\n```sh\n$ curl -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\n{\n  \"detail\": \"This IP (10.0.2.2) is not being shaped\"\n}\n```\n\n* Check if I am being shaped (device being shaped, HTTP code 200):\n\n```sh\n$ curl -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\n{\n  \"down\": {\n    \"rate\": 400,\n    \"loss\": {\n      \"percentage\": 5.0,\n      \"correlation\": 0.0\n    },\n    \"delay\": {\n      \"delay\": 15,\n      \"jitter\": 0,\n      \"correlation\": 0.0\n    },\n    \"corruption\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0\n    },\n    \"reorder\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0,\n      \"gap\": 0\n    }\n  },\n  \"up\": {\n    \"rate\": 200,\n    \"loss\": {\n      \"percentage\": 1.0,\n      \"correlation\": 0.0\n    },\n    \"delay\": {\n      \"delay\": 10,\n      \"jitter\": 0,\n      \"correlation\": 0.0\n    },\n    \"corruption\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0\n    },\n    \"reorder\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0,\n      \"gap\": 0\n    }\n  }\n}\n```\n\n* Check if 1.1.1.1 is being shaped (device not being shaped, HTTP code 404):\n\n```sh\n$ curl -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/1.1.1.1/\n{\n  \"detail\": \"This IP (1.1.1.1) is not being shaped\"\n}\n```\n\n## Shaping a device\n\nShaping a device is done by posting the shaping setting payload to `/api/v1/shape/[ip/]`\n\n\nExamples:\n\n* Shape my own device, 200kb up, added latency of 10ms with 1% packet loss and 400kb down with added latency of 15ms and 5% packet loss\nThis will always retun HTTP code 201 on success. If the device was already being shaped, the new setting is going to be applied and the onld one deleted.\n\nMind the (Ctrl-D)\n\n```sh\n$ curl -X POST -d '@-' -i -H 'Content-Type: application/json' -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\n{\n    \"down\": {\n        \"rate\": 400,\n        \"loss\": {\n            \"percentage\": 5.0,\n            \"correlation\": 0.0\n        },\n        \"delay\": {\n            \"delay\": 15,\n            \"jitter\": 0,\n            \"correlation\": 0.0\n        },\n        \"corruption\": {\n            \"percentage\": 0.0,\n            \"correlation\": 0.0\n        },\n        \"reorder\": {\n            \"percentage\": 0.0,\n            \"correlation\": 0.0,\n            \"gap\": 0\n        }\n    },\n    \"up\": {\n        \"rate\": 200,\n        \"loss\": {\n            \"percentage\": 1.0,\n            \"correlation\": 0.0\n        },\n        \"delay\": {\n            \"delay\": 10,\n            \"jitter\": 0,\n            \"correlation\": 0.0\n        },\n        \"corruption\": {\n            \"percentage\": 0.0,\n            \"correlation\": 0.0\n        },\n        \"reorder\": {\n            \"percentage\": 0.0,\n            \"correlation\": 0.0,\n            \"gap\": 0\n        }\n    }\n}\nCtrl-D\nHTTP/1.1 201 CREATED\nServer: gunicorn/19.2.1\nDate: Fri, 27 Feb 2015 20:02:05 GMT\nConnection: close\nTransfer-Encoding: chunked\nVary: Accept, Cookie\nContent-Type: application/json; indent=2\nAllow: GET, POST, DELETE, HEAD, OPTIONS\n\n{\n  \"down\": {\n    \"rate\": 400,\n    \"loss\": {\n      \"percentage\": 5.0,\n      \"correlation\": 0.0\n    },\n    \"delay\": {\n      \"delay\": 15,\n      \"jitter\": 0,\n      \"correlation\": 0.0\n    },\n    \"corruption\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0\n    },\n    \"reorder\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0,\n      \"gap\": 0\n    }\n  },\n  \"up\": {\n    \"rate\": 200,\n    \"loss\": {\n      \"percentage\": 1.0,\n      \"correlation\": 0.0\n    },\n    \"delay\": {\n      \"delay\": 10,\n      \"jitter\": 0,\n      \"correlation\": 0.0\n    },\n    \"corruption\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0\n    },\n    \"reorder\": {\n      \"percentage\": 0.0,\n      \"correlation\": 0.0,\n      \"gap\": 0\n    }\n  }\n}\n```\n\nor... more simply:\n\n```sh\n$ curl -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\n{\n    \"down\": {\n        \"rate\": 400, \n        \"loss\": {\n            \"percentage\": 5.0\n        }, \n        \"delay\": {\n            \"delay\": 15\n        }, \n        \"corruption\": {}, \n        \"reorder\": {}\n    }, \n    \"up\": {\n        \"rate\": 200, \n        \"loss\": {\n            \"percentage\": 1.0\n        }, \n        \"delay\": {\n            \"delay\": 10\n        }, \n        \"corruption\": {}, \n        \"reorder\": {}\n    }\n}\nCTRL-D\n... same response...\n```\n\nLikely, device 1.1.1.1 could be shaped by using URL http://127.0.0.1:8080/api/v1/shape/1.1.1.1/ instead.\n\n## Unshaping a device\n\nUnshaping a device is done by sending a DELETE request to `/api/v1/shape/[ip]/`\n\nExamples:\n\n* Unshape myself (device being shaped, HTTP code 204)\n\n```sh\n$ curl -X DELETE -i -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\nHTTP/1.1 204 NO CONTENT\nServer: gunicorn/19.2.1\nDate: Fri, 27 Feb 2015 19:46:58 GMT\nConnection: close\nVary: Accept, Cookie\nContent-Length: 0\nAllow: GET, POST, DELETE, HEAD, OPTIONS\n\n```\n\n* Unshape myself (device not being shaped, HTTP code 400):\n\n```sh\n$ curl -X DELETE -i -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/\nHTTP/1.1 400 BAD REQUEST\nServer: gunicorn/19.2.1\nDate: Fri, 27 Feb 2015 19:43:36 GMT\nConnection: close\nTransfer-Encoding: chunked\nVary: Accept, Cookie\nContent-Type: application/json; indent=2\nAllow: GET, POST, DELETE, HEAD, OPTIONS\n\n{\n  \"detail\": \"{'message': 'No session for IP 10.0.2.2 found', 'result': 12}\"\n}\n```\n\n* Unshape 1.1.1.1 (device not being shaped, HTTP code 400):\n\n```sh\n$ curl -X DELETE -i -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/shape/1.1.1.1/\nHTTP/1.1 400 BAD REQUEST\nServer: gunicorn/19.2.1\nDate: Fri, 27 Feb 2015 19:47:57 GMT\nConnection: close\nTransfer-Encoding: chunked\nVary: Accept, Cookie\nContent-Type: application/json; indent=2\nAllow: GET, POST, DELETE, HEAD, OPTIONS\n\n{\n  \"detail\": \"{'message': 'No session for IP 1.1.1.1 found', 'result': 12}\"\n}\n```\n\n## Authentication and Authorization\n\nATC employs a token-based authentication system to allow devices to securely shape others.\n\nTo use this system, the controlled device must ask for a token from ATC. Once a token is obtained,\n\nthe controlling device can post this token to ATC to authorize itself to shape the device.\n\n### Retrieving a Token\n\nUse the `/api/v1/token/` endpoint to retrieve a token.\n\nThis endpoint will use the HTTP Header `HTTP_X_REAL_IP` to generate the token.\n\nFor security reasons this is the only way to set the client IP. See [Proxy Setup](#proxy-security) below.\n\n```sh\n$ curl -i -H 'Accept: application/json; indent=2' http://127.0.0.1:8080/api/v1/token/\nHTTP/1.1 200 OK\nServer: gunicorn/19.3.0\nDate: Mon, 16 Mar 2015 19:16:42 GMT\nConnection: close\nTransfer-Encoding: chunked\nVary: Accept, Cookie\nContent-Type: application/json; indent=2\nAllow: GET, HEAD, OPTIONS\n\n{\n  \"valid_until\": 1426533420,\n  \"token\": 186032,\n  \"interval\": 60,\n  \"address\": \"10.0.2.2\"\n}\n```\n\n### \n\nOnce you have the token, authorize the controlling device using the `/api/v1/auth/ADDR` endpoint:\n\nNote the `Ctrl-D`\n\n```sh\n$ curl -i -XPOST -d '@-' -H 'Content-Type: application/json; indent=2' http://127.0.0.1:8080/api/v1/auth/10.0.2.2/\n{\n    \"token\": 186032\n}\nCtrl-D\nHTTP 200 OK\nContent-Type: application/json\nVary: Accept\nAllow: GET, POST, HEAD, OPTIONS\n\n{\n    \"controlling_ip\": \"127.0.0.1\",\n    \"controlled_ip\": \"10.0.2.2\"\n}\n```\n\n\n### <a name=\"proxy-security\"></a>Proxy Security\n\nIf you are using an HTTP proxy such as [nginx](http://nginx.org/), make sure it is configured to set the\n`HTTP_X_REAL_IP` header, or token generation will not work.\n\nOne security implication of using the `HTTP_X_REAL_IP` field to determine the client address is that the client can\nmanipulate this field to obtain a token for an arbitrary address. For example, `curl -H 'X_REAL_IP: 1.2.3.4'`.\n\nTo prevent this, ATC restricts which clients are allowed to set the `HTTP_X_REAL_IP` request header.\nThis is done by use of the `PROXY_IPS` field of the `ATC_API` dict in the django settings file:\n\n    ATC_API = {\n        'PROXY_IPS': ['1.2.3.4', '2.3.4.5'],\n    }\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/__init__.py",
    "content": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/atcd_client.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_api.settings import atc_api_settings\nfrom atc_thrift import Atcd\nfrom thrift.transport import TSocket, TTransport\nfrom thrift.protocol import TBinaryProtocol\n\n\ndef atcdClient():\n    try:\n        transport = TSocket.TSocket(\n            atc_api_settings.ATCD_HOST,\n            atc_api_settings.ATCD_PORT\n        )\n        transport = TTransport.TFramedTransport(transport)\n        transport.open()\n        protocol = TBinaryProtocol.TBinaryProtocol(transport)\n        return Atcd.Client(protocol)\n    except TTransport.TTransportException as e:\n        print 'atcdClient: %s: %s' % (e.__class__.__name__, str(e))\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/serializers.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_api.utils import get_client_ip\nfrom atc_thrift.ttypes import Corruption\nfrom atc_thrift.ttypes import Delay\nfrom atc_thrift.ttypes import Loss\nfrom atc_thrift.ttypes import Reorder\nfrom atc_thrift.ttypes import Shaping\nfrom atc_thrift.ttypes import TrafficControlledDevice\nfrom atc_thrift.ttypes import TrafficControlSetting\n\nfrom rest_framework import serializers\nfrom thrift.Thrift import TType\n\nimport socket\n\n\ndef validate_ipaddr(ipaddr):\n    try:\n        socket.inet_aton(ipaddr)\n        return True\n    except socket.error:\n        return False\n\n\nclass ThriftSerializer(serializers.Serializer):\n    # Should be set by the serializer to the concrete thrift class\n    # to be serialized.\n    _THRIFT_CLASS = None\n\n    # A map of renamed fields.\n    # Keys in the map are the names of thrift fields. Their values\n    # are the names of the serializer fields they correspond to.\n    _THRIFT_RENAMED_FIELDS = {}\n\n    def create(self, attrs):\n        args = {}\n\n        for field_tuple in self._THRIFT_CLASS.thrift_spec:\n            if not field_tuple:\n                continue\n\n            _, thrift_type, arg_name, _, default = field_tuple\n\n            f_name = arg_name\n            if arg_name in self._THRIFT_RENAMED_FIELDS:\n                f_name = self._THRIFT_RENAMED_FIELDS[arg_name]\n\n            serializer = self.fields[f_name]\n\n            if f_name not in attrs:\n                args[arg_name] = default\n                continue\n\n            if thrift_type == TType.STRUCT:\n                args[arg_name] = serializer.create(attrs[f_name])\n            else:\n                # Primitive\n                args[arg_name] = attrs[f_name]\n\n        return self._THRIFT_CLASS(**args)\n\n\nclass BaseShapingSettingSerializer(ThriftSerializer):\n    percentage = serializers.FloatField(default=0)\n    correlation = serializers.FloatField(default=0)\n\n\nclass DelaySerializer(ThriftSerializer):\n    _THRIFT_CLASS = Delay\n\n    delay = serializers.IntegerField(default=0)\n    jitter = serializers.IntegerField(default=0)\n    correlation = serializers.FloatField(default=0)\n\n\nclass LossSerializer(BaseShapingSettingSerializer):\n    _THRIFT_CLASS = Loss\n\n\nclass CorruptionSerializer(BaseShapingSettingSerializer):\n    _THRIFT_CLASS = Corruption\n\n\nclass ReorderSerializer(BaseShapingSettingSerializer):\n    _THRIFT_CLASS = Reorder\n\n    gap = serializers.IntegerField(default=0)\n\n\nclass IptablesOptionsField(serializers.Field):\n\n    def to_representation(self, data):\n        if isinstance(data, list):\n            return data\n        else:\n            msg = self.error_messages['invalid']\n            raise serializers.ValidationError(msg)\n\n    def to_internal_value(self, obj):\n        if obj:\n            return obj\n        else:\n            return []\n\n\nclass ShapingSerializer(ThriftSerializer):\n    _THRIFT_CLASS = Shaping\n\n    rate = serializers.IntegerField(default=0, allow_null=True, required=False)\n    loss = LossSerializer(default=None, allow_null=True, required=False)\n    delay = DelaySerializer(default=None, allow_null=True, required=False)\n    corruption = CorruptionSerializer(\n        default=None, allow_null=True, required=False)\n    reorder = ReorderSerializer(default=None, allow_null=True, required=False)\n    iptables_options = IptablesOptionsField(\n        default=None, allow_null=True, required=False)\n\n\nclass SettingSerializer(ThriftSerializer):\n    _THRIFT_CLASS = TrafficControlSetting\n\n    down = ShapingSerializer()\n    up = ShapingSerializer()\n\n\nclass DeviceSerializer(ThriftSerializer):\n    _THRIFT_CLASS = TrafficControlledDevice\n    _THRIFT_RENAMED_FIELDS = {\n        'controllingIP': 'client',\n        'controlledIP': 'address'\n    }\n\n    address = serializers.CharField(\n        max_length=16,\n        allow_blank=True,\n        allow_null=True,\n        default=None,\n        required=False\n    )\n    client = serializers.CharField(\n        max_length=16,\n        allow_blank=True,\n        allow_null=True,\n        default=None,\n        required=False\n    )\n\n    def validate_address(self, value):\n        # 'address' is optional, if not specified, we default to the\n        # querying IP\n        # `address` can be specified in 2 places: the URL or within the payload\n        # The payload has priority and will be accessible through `value`\n        # The value passed in the URL is accessible through the context\n\n        if value is None or (isinstance(value, str) and len(value) == 0):\n            if self.context.get('address'):\n                value = self.context['address']\n            else:\n                value = self._get_client_ip()\n        if not validate_ipaddr(value):\n            raise serializers.ValidationError(\"Invalid IP address\")\n        return value\n\n    def validate_client(self, value):\n        # 'client' should not be provided by the payload.\n        # It should always be the client IP as we get it from _get_client_ip()\n        # This is merely here so we can use the serializer.\n        return self._get_client_ip()\n\n    def _get_client_ip(self):\n        return get_client_ip(self.context['request'])\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/settings.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n'''\nSettings for ATC_API are all namespaced in the ATC_API setting.\nFor example your project's `settings.py` file might look like this:\n\nATC_API = {\n    'ATCD_HOST': 'localhost',\n    'ATCD_PORT': 9090,\n    'DEFAULT_TC_TIMEOUT': 24 * 60 * 60,\n    'PROXY_IPS': ['127.0.0.1'],\n}\n\nThis module provides the `atc_api_settings` object, that is used to access\nATC_API settings. It first check for user settings and then fall back on the\ndefaults.\n'''\n\nfrom django.conf import settings\n\nUSER_SETTINGS = getattr(settings, 'ATC_API', None)\n\nDEFAULTS = {\n    'ATCD_HOST': 'localhost',\n    'ATCD_PORT': 9090,\n    # Default timeout is a day in seconds\n    'DEFAULT_TC_TIMEOUT': 24 * 60 * 60,\n    'PROXY_IPS': ['127.0.0.1'],\n}\n\n\nclass APISettings(object):\n\n    def __init__(self, user_settings=None, defaults=None):\n        self.__user_settings = user_settings or {}\n        self.__defaults = defaults or {}\n\n    def __getattr__(self, attr):\n        if attr not in self.__defaults.keys():\n            raise AttributeError(\"Invalid API setting: '%s'\" % attr)\n\n        try:\n            # Check if user have set that key.\n            val = self.__user_settings[attr]\n        except KeyError:\n            # Use defaults otherwise.\n            val = self.__defaults[attr]\n\n        return val\n\n\natc_api_settings = APISettings(USER_SETTINGS, DEFAULTS)\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/static/js/atc-api.js",
    "content": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n\nfunction AtcRestClient (endpoint) {\n    this.endpoint = endpoint || '/api/v1/';\n    function _add_ending_slash(string) {\n        if (string[string.length -1] != '/') {\n            string += '/';\n        }\n        return string;\n    }\n\n    this.endpoint = _add_ending_slash(this.endpoint);\n\n    this.api_call = function (method, urn, callback, data) {\n        urn = _add_ending_slash(urn);\n        $.ajax({\n            url: this.endpoint + urn,\n            dataType: 'json',\n            type: method,\n            data: data && JSON.stringify(data),\n            contentType: 'application/json; charset=utf-8',\n            complete: function (xhr, status) {\n                var rc = {\n                    status: xhr.status,\n                    json: xhr.responseJSON,\n                };\n                /*\n                console.log('API status: ' + status);\n                if (status == 'success' || status == 'nocontent' || xhr.status == 404) {\n                    if (status == 'success') {\n                        rc.settings = new AtcSettings().mergeWithDefaultSettings({\n                            up: xhr.responseJSON.up,\n                            down: xhr.responseJSON.down,\n                        });\n                    } else {\n                        rc.settings = new AtcSettings().getDefaultSettings();\n                    }\n                } else {\n                    rc.detail = xhr.responseJSON.detail;\n                }\n                console.log(rc);\n                */\n                if (callback !== undefined) {\n                    callback(rc);\n                }\n            }\n        });\n    };\n}\n\n\nAtcRestClient.prototype.shape = function (callback, data) {\n    this.api_call('POST', 'shape', callback, data);\n};\n\nAtcRestClient.prototype.unshape = function (callback, data) {\n    this.api_call('DELETE', 'shape', callback);\n};\n\nAtcRestClient.prototype.getCurrentShaping = function (callback) {\n    this.api_call('GET', 'shape', callback);\n};\n\nAtcRestClient.prototype.getToken = function (callback) {\n    this.api_call('GET', 'token', callback);\n};\n\nAtcRestClient.prototype.getAuthInfo = function (callback) {\n    this.api_call('GET', 'auth', callback);\n};\n\nAtcRestClient.prototype.updateAuthInfo = function (address, data, callback) {\n    this.api_call('POST', 'auth/'.concat(address), callback, data);\n};\n\nfunction AtcSettings () {\n    this.defaults = {\n        'up': {\n            'rate': null,\n            'delay': {\n                'delay': 0,\n                'jitter': 0,\n                'correlation': 0\n            },\n            'loss': {\n                'percentage': 0,\n                'correlation': 0\n            },\n            'reorder': {\n                'percentage': 0,\n                'correlation': 0,\n                'gap': 0\n            },\n            'corruption': {\n                'percentage': 0,\n                'correlation': 0\n            },\n            'iptables_options': Array(),\n        },\n        'down': {\n            'rate': null,\n            'delay': {\n                'delay': 0,\n                'jitter': 0,\n                'correlation': 0\n            },\n            'loss': {\n                'percentage': 0,\n                'correlation': 0\n            },\n            'reorder': {\n                'percentage': 0,\n                'correlation': 0,\n                'gap': 0\n            },\n            'corruption': {\n                'percentage': 0,\n                'correlation': 0\n            },\n            'iptables_options': Array(),\n        }\n    };\n\n    this.getDefaultSettings = function () {\n        return $.extend(true, {}, this.defaults);\n    };\n\n    this.mergeWithDefaultSettings = function (data) {\n        return $.extend(true, {}, this.defaults, data);\n    };\n}\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/urls.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom django.conf.urls import url\nfrom atc_api.views import AtcApi, AuthApi, TokenApi\n\nurlpatterns = [\n    url('^shape/$', AtcApi.as_view()),\n    url('^shape/'\n        '(?P<address>[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/$',\n        AtcApi.as_view()\n        ),\n    url('^auth/$', AuthApi.as_view()),\n    url('^auth/'\n        '(?P<address>[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/$',\n        AuthApi.as_view()),\n    url('^token/$', TokenApi.as_view()),\n]\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/utils.py",
    "content": "#\n#  Copyright (c) 2015, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nfrom atc_api.settings import atc_api_settings\n\n\ndef get_client_ip(request):\n    '''\n    Return the real IP of a client even when using a proxy\n    '''\n    if 'HTTP_X_REAL_IP' in request.META:\n        if request.META['REMOTE_ADDR'] not in atc_api_settings.PROXY_IPS:\n            raise ValueError('HTTP_X_REAL_IP set by non-proxy')\n        return request.META['HTTP_X_REAL_IP']\n    else:\n        return request.META['REMOTE_ADDR']\n"
  },
  {
    "path": "atc/django-atc-api/atc_api/views.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_api.atcd_client import atcdClient\nfrom atc_api.serializers import SettingSerializer, DeviceSerializer\nfrom atc_api.settings import atc_api_settings\nfrom atc_api.utils import get_client_ip\nfrom atc_thrift.ttypes import TrafficControlException, TrafficControl\nfrom atc_thrift.ttypes import TrafficControlledDevice, AccessToken\n\nfrom functools import wraps\nfrom rest_framework.exceptions import APIException\nfrom rest_framework.exceptions import ParseError\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom rest_framework import status\n\n\nclass BadGateway(APIException):\n    status_code = 502\n    default_detail = 'Could not connect to ATC gateway.'\n\n\ndef serviced(method):\n    '''\n    A decorator to check if the service is available or not.\n    Raise a BadGateway exception on failure to connect to the atc gateway\n    '''\n    @wraps(method)\n    def decorator(cls, request, *args, **kwargs):\n        service = atcdClient()\n        if service is None:\n            raise BadGateway()\n        return method(cls, request, service, *args, **kwargs)\n    return decorator\n\n\nclass AtcApi(APIView):\n    '''\n    If `address` is not provided, we default to the client IP or forwarded IP\n    '''\n\n    @serviced\n    def get(self, request, service, address=None, format=None):\n        ''''\n        Get the current shaping for an IP. If address is None, defaults to\n        the client IP\n        @return the current shaping applied or 404 if the IP is not being\n        shaped\n        '''\n        device_serializer = DeviceSerializer(\n            data=request.data,\n            context={'request': request, 'address': address},\n        )\n        if not device_serializer.is_valid():\n            raise ParseError(detail=device_serializer.errors)\n\n        dev = device_serializer.save()\n        try:\n            tc = service.getCurrentShaping(dev)\n        except TrafficControlException as e:\n            return Response(\n                {'detail': e.message},\n                status=status.HTTP_404_NOT_FOUND,\n            )\n\n        serializer = SettingSerializer(tc.settings)\n        return Response(\n            serializer.data,\n            status=status.HTTP_200_OK\n        )\n\n    @serviced\n    def post(self, request, service, address=None, format=None):\n        ''''\n        Set shaping for an IP. If address is None, defaults to\n        the client IP\n        @return the profile that was set on success\n        '''\n        setting_serializer = SettingSerializer(data=request.data)\n        device_serializer = DeviceSerializer(\n            data=request.data,\n            context={'request': request, 'address': address},\n        )\n        if not setting_serializer.is_valid():\n            raise ParseError(detail=setting_serializer.errors)\n\n        if not device_serializer.is_valid():\n            raise ParseError(detail=device_serializer.errors)\n\n        setting = setting_serializer.save()\n        device = device_serializer.save()\n\n        tc = TrafficControl(\n            device=device,\n            settings=setting,\n            timeout=atc_api_settings.DEFAULT_TC_TIMEOUT,\n        )\n\n        try:\n            tcrc = service.startShaping(tc)\n        except TrafficControlException as e:\n            return Response(e.message, status=status.HTTP_401_UNAUTHORIZED)\n        result = {'result': tcrc.code, 'message': tcrc.message}\n        if tcrc.code:\n            raise ParseError(detail=result)\n\n        return Response(\n            setting_serializer.data,\n            status=status.HTTP_201_CREATED\n        )\n\n    @serviced\n    def delete(self, request, service, address=None, format=None):\n        '''\n        Delete the shaping for an IP, if no IP is specified, default to the\n        client IP\n        '''\n        device_serializer = DeviceSerializer(\n            data=request.data,\n            context={'request': request, 'address': address},\n        )\n        if not device_serializer.is_valid():\n            return Response(\n                device_serializer.errors,\n                status=status.HTTP_400_BAD_REQUEST,\n            )\n\n        device = device_serializer.save()\n\n        try:\n            tcrc = service.stopShaping(device)\n        except TrafficControlException as e:\n            return Response(e.message, status=status.HTTP_401_UNAUTHORIZED)\n\n        result = {'result': tcrc.code, 'message': tcrc.message}\n        if tcrc.code:\n            raise ParseError(detail=result)\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\nclass AuthApi(APIView):\n\n    @serviced\n    def get(self, request, service, address=None):\n        '''\n        Returns the addresses that the provided address is allowed to shape.\n        '''\n        if address is None:\n            address = get_client_ip(request)\n\n        controlled_ips = []\n\n        for addr in service.getDevicesControlledBy(address):\n            if addr is None:\n                break\n            controlled_ips.append({\n                'controlled_ip': addr.device.controlledIP,\n                'valid_until': addr.timeout,\n            })\n\n        data = {\n            'address': address,\n            'controlled_ips': controlled_ips,\n        }\n        return Response(data, status=status.HTTP_200_OK)\n\n    @serviced\n    def post(self, request, service, address=None):\n        '''\n        Authorizes one address to shape another address,\n        based on the provided auth token.\n        '''\n        if address is None:\n            return Response(\n                {'details': 'no address provided'},\n                status=status.HTTP_400_BAD_REQUEST\n                )\n        controlled_ip = address\n\n        controlling_ip = get_client_ip(request)\n\n        if 'token' not in request.data:\n            token = None\n        else:\n            token = AccessToken(token=request.data['token'])\n\n        dev = TrafficControlledDevice(\n            controlledIP=controlled_ip,\n            controllingIP=controlling_ip\n            )\n\n        worked = service.requestRemoteControl(dev, token)\n\n        if not worked:\n            return Response(\n                {'details': 'invalid token provided'},\n                status=status.HTTP_401_UNAUTHORIZED,\n                )\n\n        print 'Worked:', worked\n\n        data = {\n            'controlling_ip': controlling_ip,\n            'controlled_ip': controlled_ip,\n        }\n\n        return Response(data, status=status.HTTP_200_OK)\n\n\nclass TokenApi(APIView):\n\n    @serviced\n    def get(self, request, service):\n        '''\n        Returns the current authorization token for the provided address.\n        '''\n        # default duration...\n        # 3 days in seconds\n        duration = 3 * 24 * 60 * 60\n\n        if 'duration' in request.query_params:\n            duration = int(request.query_params['duration'])\n\n        address = get_client_ip(request)\n\n        stuff = service.requestToken(address, duration)\n\n        data = {\n            'token': stuff.token,\n            'interval': stuff.interval,\n            'valid_until': stuff.valid_until,\n            'address': address,\n        }\n\n        return Response(data, status=status.HTTP_200_OK)\n"
  },
  {
    "path": "atc/django-atc-api/setup.cfg",
    "content": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-api/setup.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport os\nimport re\nimport sys\n\nfrom setuptools import setup\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:\n    README = readme.read()\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py).group(1)\n\n\ndef get_packages(package):\n    \"\"\"\n    Return root package and all sub-packages.\n    \"\"\"\n    return [dirpath\n            for dirpath, dirnames, filenames in os.walk(package)\n            if os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n\ndef get_package_data(package):\n    \"\"\"\n    Return all files under the root package, that are not in a\n    package themselves.\n    \"\"\"\n    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)\n            for dirpath, dirnames, filenames in os.walk(package)\n            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n    filepaths = []\n    for base, filenames in walk:\n        filepaths.extend([os.path.join(base, filename)\n                          for filename in filenames])\n    return {package: filepaths}\n\n\nversion = get_version('atc_api')\n\nif sys.argv[-1] == 'publish':\n    if os.system(\"pip freeze | grep wheel\"):\n        print(\"wheel not installed.\\nUse `pip install wheel`.\\nExiting.\")\n        sys.exit()\n    if os.system(\"pip freeze | grep twine\"):\n        print(\"twine not installed.\\nUse `pip install twine`.\\nExiting.\")\n        sys.exit()\n    os.system(\"python setup.py sdist bdist_wheel\")\n    os.system(\"twine upload dist/*\")\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %s -m 'version %s'\" % (version, version))\n    print(\"  git push --tags\")\n    sys.exit()\n\nsetup(\n    name='django-atc-api',\n    version=version,\n    description='REST API for ATC',\n    author='Emmanuel Bretelle',\n    author_email='chantra@fb.com',\n    url='https://github.com/facebook/augmented-traffic-control',\n    packages=get_packages('atc_api'),\n    package_data=get_package_data('atc_api'),\n    classifiers=['Programming Language :: Python', ],\n    long_description=README,\n    install_requires=['atc_thrift', 'djangorestframework']\n)\n"
  },
  {
    "path": "atc/django-atc-demo-ui/MANIFEST.in",
    "content": "include README.md\ninclude requirements.txt\n"
  },
  {
    "path": "atc/django-atc-demo-ui/README.md",
    "content": "# ATC DEMO UI\n\nDjango ATC Demo UI is a Django app that allow to modify traffic shaping applied to a device via a Web UI.\n\nEven though it is a Django app, `ATC Demo UI` is mostly a [React](http://facebook.github.io/react/) application that uses [Bootstrap](http://getbootstrap.com/) to make the app responsive.\n\n## Requirements\n\n* [Django 1.10](https://github.com/django/django)\n* [atc_api](../django-atc-api)\n\n`ATC Demo UI` depends on `ATC API` so make sure you have installed and configured the [ATC API](../django-atc-api) first.\n\n## Installation\n\nThe easiest way to install `django-atc-demo-ui` is to install it directly from [pip](https://pypi.python.org/pypi).\n\n### From pip\n```bash\npip install django-atc-demo-ui\n```\n\n### From source\n```bash\ncd path/to/django-atc-demo-ui\npip install .\n```\n\n## Configuration\n\n1. Add `atc_demo_ui` and its dependencies to your `INSTALLED_APPS`' `settings.py` like this:\n```python\n    INSTALLED_APPS = (\n        ...\n        'bootstrap_themes',\n        'django_static_jquery',\n        'atc_demo_ui',\n    )\n```\n2. Include the `atc_demo_ui` URLconf in your project `urls.py` like this:\n\n    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),\n\nIf you want to have `/` redirecting to `/atc/demo_ui`, you can update `urls.py`\n```python\n...\nfrom django.views.generic.base import RedirectView\n\nurlpatterns = [\n    ...\n    ...\n    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),\n    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),\n]\n```\n\n3. Start the development server\n```bash\npython manage.py runserver 0.0.0.0:8000\n```\n\n4. Visit http://127.0.0.1:8000/atc_demo_ui to access ATC Demo UI.\n\n\nSome settings like the REST endpoint can be changed in your Dkango project'settings.py:\n\n```python\nATC_DEMO_UI = {\n    'REST_ENDPOINT': '/api/v1/',\n}\n```\n\nsee [ATC Demo UI settings](atc_demo_ui/settings.py) for more details.\n\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/__init__.py",
    "content": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/settings.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n'''\nSettings for ATC_DEMO_UI are all namespaced in the ATC_DEMO_UI setting.\nFor example your project's `settings.py` file might look like this:\n\nATC_DEMO_UI = {\n    'SHORT_TITLE': 'ATC Demo UI',\n    'TITLE': 'Augmented Traffic Control Demo UI',\n    'EMAIL': 'atc@example.com',\n    'INFO_MESSAGE': '',\n    'REST_ENDPOINT': '/api/v1/',\n    'BOOTSTRAP_VERSION': '3.3.0',\n}\n\nThis module provides the `atc_demo_ui_settings` object, that is used to access\nATC_DEMO_UI settings. It first check for user settings and then fall back on\nthe defaults.\n'''\n\nfrom django.conf import settings\n\nUSER_SETTINGS = getattr(settings, 'ATC_DEMO_UI', None)\n\nDEFAULTS = {\n    'SHORT_TITLE': 'ATC Demo UI',\n    'TITLE': 'Augmented Traffic Control Demo UI',\n    'EMAIL': 'atc@example.com',\n    'INFO_MESSAGE': '',\n    'REST_ENDPOINT': '/api/v1/',\n    'BOOTSTRAP_VERSION': '3.3.0',\n}\n\n\nclass APISettings(object):\n\n    def __init__(self, user_settings=None, defaults=None):\n        self.__user_settings = user_settings or {}\n        self.__defaults = defaults or {}\n\n    def __getattr__(self, attr):\n        if attr not in self.__defaults.keys():\n            raise AttributeError(\"Invalid API setting: '%s'\" % attr)\n\n        try:\n            # Check if user have set that key.\n            val = self.__user_settings[attr]\n        except KeyError:\n            # Use defaults otherwise.\n            val = self.__defaults[attr]\n\n        return val\n\n\natc_demo_ui_settings = APISettings(USER_SETTINGS, DEFAULTS)\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/css/atc.css",
    "content": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n#shaping_buttons button {\n    margin: 10px;\n    padding: 5px;\n}\n\n/*\nWe're not using anchors, so make sure users know they can click on panel headers\n*/\n.panel-heading {\n    cursor: pointer;\n}\n\n.error-timer {\n    text-align: right;\n}\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-auth.js",
    "content": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n\nvar TokenFrame = React.createClass({\n  getInitialState: function() {\n    this.oos_notified = false;\n    return {\n      token: null,\n      valid_until: null,\n    };\n  },\n\n  componentDidMount: function() {\n    this.getToken();\n    this.interval = setInterval(this.getToken, 3000);\n  },\n\n  componentWillUnmount: function() {\n    if (this.interval != null) {\n      clearInterval(this.interval);\n    }\n  },\n\n  getToken: function() {\n    this.props.client.getToken(function (result) {\n      if (result.status >= 200 && result.status < 300) {\n        valid_until = new Date(result.json.valid_until*1000).toLocaleTimeString();\n        if (result.json.valid_until - Math.floor(new Date().getTime() / 1000) < 0) {\n          if (!this.oos_notified) {\n            this.props.notify(\"warn\", \"The time on the ATC server is out of sync.\");\n            this.oos_notified = true;\n          }\n        }\n        this.setState({\n          token: result.json,\n        });\n      } else {\n        this.props.notify(\"error\", \"Could not fetch current token: \" + result.json);\n        this.setState({\n          token: null,\n        });\n      }\n    }.bind(this));\n  },\n\n  render: function() {\n    if (this.state.token == null) {\n      return null;\n    }\n\n    return (\n      <div className=\"col-md-6\">\n        <div>\n          <h4>This Machine&#39;s Token: <b>{this.state.token.token}</b></h4>\n          <b>Valid Until:</b> {valid_until}\n          <h4>This Machine&#39; Address: {this.state.token.address}</h4>\n        </div>\n      </div>\n    );\n  },\n});\n\nvar AuthFrame = React.createClass({\n  getInitialState: function() {\n    return {\n      auth: null,\n      token: null,\n      address: null,\n    };\n  },\n\n  componentDidMount: function() {\n    this.getAuthInfo();\n  },\n\n  updateToken: function(event) {\n    this.setState({token: event.target.value});\n  },\n\n  updateAddress: function(event) {\n    this.setState({address: event.target.value});\n  },\n\n  getAuthInfo: function() {\n    this.props.client.getAuthInfo(function (result) {\n      if (result.status >= 200 && result.status < 300) {\n        this.setState({\n          auth: result.json,\n          address: result.json.address,\n        });\n      } else {\n        this.props.notify(\"error\", \"Could not fetch auth info: \" + result.json);\n        this.setState({\n          auth: null,\n          address: null,\n        });\n      }\n    }.bind(this));\n  },\n\n  updateAuth: function() {\n    var failed = false;\n    if (this.state.address == null || this.state.address == \"\") {\n      this.props.notify(\"error\", \"You must enter an address\");\n      failed = true;\n    }\n    if (this.state.token == null || this.state.token == \"\") {\n      this.props.notify(\"error\", \"You must enter a token\");\n      failed = true;\n    }\n    if (failed) {\n      return;\n    }\n    this.props.client.updateAuthInfo(this.state.address, {token: Number(this.state.token)}, function(result) {\n      if (result.status >= 200 && result.status < 300) {\n        console.log(\"Authorizing:\", result.json);\n        this.props.notify(\"success\", \"You can now shape \" + result.json.controlled_ip);\n      } else {\n        this.props.notify(\"error\", \"Could not update auth info: \", result.json);\n      }\n    }.bind(this));\n  },\n\n  render: function() {\n    if (this.state.auth == null) {\n      return null;\n    }\n\n    var controlled_ips = null;\n    if (this.state.auth.controlled_ips.length > 0) {\n      controlled_ips = this.state.auth.controlled_ips.map(function (addr) {\n        return (\n          <li><pre><code>{addr}</code></pre></li>\n        );\n      });\n      controlled_ips = (\n        <ul>{controlled_ips}</ul>\n      );\n    } else {\n      controlled_ips = (\n        <i>No Controlled Machines</i>\n      );\n    }\n\n    return (\n      <div className=\"col-md-6\">\n        <div>\n          <h4>Machines You Can Shape:</h4>\n          {controlled_ips}\n          <p>\n          <b>Note:</b> A machine is always allowed to shape itself.\n          </p>\n\n          <h4>Authorize a New Machine:</h4>\n          <label className=\"control-label\">Address:</label>\n          <input type=\"text\" className=\"form-control\" placeholder=\"127.0.0.1\" onChange={this.updateAddress}/>\n          <label className=\"control-label\">Token:</label>\n          <input type=\"number\" className=\"form-control\" placeholder=\"12345\" onChange={this.updateToken}/>\n          <button className=\"btn btn-success\" onClick={this.updateAuth}>Authorize</button>\n        </div>\n      </div>\n    );\n  },\n});\n\nvar AuthPanel = React.createClass({\n  render: function() {\n    return (\n      <div className=\"panel-group\" id=\"accordion3\" role=\"tablist\" aria-multiselectable=\"false\">\n        <div className=\"panel panel-default\">\n          <div className=\"panel-heading\" data-toggle=\"collapse\" data-parent=\"#accordion3\" href=\"#collapseAuth\" aria-expanded=\"false\" aria-controls=\"collapseAuth\">\n              <h4 className=\"panel-title\">\n                  Authentication\n              </h4>\n          </div>\n          <div id=\"collapseAuth\" className=\"panel-collapse collapse\" role=\"tabpanel\">\n            <div className=\"panel-body\">\n\n              <div className=\"row\">\n                <AuthFrame client={this.props.client} notify={this.props.notify} />\n                <TokenFrame client={this.props.client} notify={this.props.notify} />\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n})"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-profiles.js",
    "content": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n\nvar Profile = React.createClass({\n  getInitialState: function() {\n    return {\n      name: \"\",\n    };\n  },\n\n  handleClick: function() {\n    this.props.link_state(\"settings\").requestChange(\n      new AtcSettings().mergeWithDefaultSettings(this.props.profile.content)\n    );\n  },\n\n  updateName: function(event) {\n    this.setState({name: event.target.value});\n  },\n\n  removeProfile: function() {\n    this.props.link_state(\"client\").value.delete_profile(handleAPI(this.props.refreshProfiles, this.props.notify), this.props.profile.id);\n  },\n\n  render: function () {\n    return (\n      <div className=\"list-group-item row\">\n        <span className=\"col-sm-6 text-center vcenter\"><kbd>{this.props.profile.name}</kbd></span>\n        <span className=\"col-sm-2 text-center vcenter\">{this.props.profile.content.up.rate} kbps</span>\n        <span className=\"col-sm-2 text-center vcenter\">{this.props.profile.content.down.rate} kbps</span>\n        <button className=\"col-sm-1 btn btn-info vcenter\" onClick={this.handleClick}>Select</button>\n        <button className=\"col-sm-1 btn btn-danger vcenter\" onClick={this.removeProfile}>Delete</button>\n      </div>);\n  }\n});\n\n\nvar ProfileList = React.createClass({\n  render: function() {\n    if (this.props.profiles.length == 0) {\n      return false;\n    }\n\n    var profileNodes = this.props.profiles.map(function (profile) {\n      return (\n        <Profile refreshProfiles={this.props.refreshProfiles} link_state={this.props.link_state} action='delete' profile={profile} notify={this.props.notify} />\n      );\n    }.bind(this));\n\n    return (\n      <div>\n        <h4>Existing Profiles</h4>\n        <p>\n          Select a profile from the list below to use it.\n        </p>\n        <div className=\"list-group\">\n          <div className=\"list-group-item row\">\n            <span className=\"col-sm-6 text-center vcenter\"><b>Name</b></span>\n            <span className=\"col-sm-2 text-center vcenter\"><b>Up Rate</b></span>\n            <span className=\"col-sm-2 text-center vcenter\"><b>Down Rate</b></span>\n            <span className=\"col-sm-1 text-center vcenter\"></span>\n            <span className=\"col-sm-1 text-center vcenter\"></span>\n          </div>\n\n          {profileNodes}\n        </div>\n      </div>\n    );\n  }\n});\n\n\nvar CreateProfileWidget = React.createClass({\n  getInitialState: function() {\n    return {\n      name: \"\"\n    };\n  },\n\n  updateName: function(event) {\n    this.setState({name: event.target.value});\n  },\n\n  newProfile: function() {\n    var failed = false;\n    var settings = this.props.link_state('settings').value;\n    if (settings.down.rate == null &&\n      settings.up.rate == null) {\n      this.props.notify(\"error\", \"You must enter shaping settings below.\");\n      failed = true;\n    }\n    if (this.state.name == \"\") {\n      this.props.notify(\"error\", \"You must give the new profile a name.\");\n      failed = true;\n    }\n    if (failed) {\n      return;\n    }\n\n    var addProfile = function() {\n      this.setState({\n        name: \"\",\n      });\n      this.props.refreshProfiles();\n    }.bind(this);\n\n    var profile = {\n      name: this.state.name,\n      content: settings\n    };\n    this.props.link_state(\"client\").value.new_profile(handleAPI(addProfile, this.props.notify), profile);\n  },\n\n  render: function() {\n    return (\n      <div>\n        <h4>New Profile</h4>\n        <p>\n          Enter a name and click \"Create\" to save a new profile with the settings under \"Shaping Settings\" below.\n        </p>\n        <input type=\"text\" className=\"form-control\" placeholder=\"Profile Name\" onChange={this.updateName}/>\n        <button className=\"col-sm-2 btn btn-success\" onClick={this.newProfile}>Create</button>\n      </div>\n    );\n  },\n});\n\n\nvar ProfilePanel = React.createClass({\n  render: function () {\n    return (\n      <div className=\"panel-group\" id=\"accordion1\" role=\"tablist\" aria-multiselectable=\"false\">\n        <div className=\"panel panel-default\">\n          <div className=\"panel-heading\" data-toggle=\"collapse\" data-parent=\"#accordion1\" href=\"#collapseProfiles\" aria-expanded=\"false\" aria-controls=\"collapseProfiles\">\n            <h3 className=\"panel-title\">\n              Profiles\n            </h3>\n          </div>\n          <div id=\"collapseProfiles\" className=\"panel-collapse collapse\" role=\"tabpanel\">\n            <div className=\"panel-body\">\n              <ProfileList refreshProfiles={this.props.refreshProfiles} link_state={this.props.link_state} profiles={this.props.profiles} notify={this.props.notify}/>\n\n              <CreateProfileWidget refreshProfiles={this.props.refreshProfiles} link_state={this.props.link_state} notify={this.props.notify}/>\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n});"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-shaping.js",
    "content": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n\n var ShapingButton = React.createClass({\n  render: function () {\n    button_values = [\n      {\n        message: \"ATC is not running\",\n        css: \"warning\",\n      },\n      {\n        message: \"Turn Off\",\n        css: \"danger\",\n      },\n      {\n        message: \"Turn On\",\n        css: \"primary\",\n      },\n      {\n        message: \"Update Shaping\",\n        css: \"success\",\n      },\n    ];\n\n    content = button_values[this.props.status];\n    return (\n      <button type=\"button\" id={this.props.id} className={\"btn btn-\" + content.css} disabled={this.props.status == atc_status.OFFLINE} onClick={this.props.onClick}>\n        {content.message}\n      </button>\n    );\n  }\n});\n\n\nvar LinkShapingNumberSetting = React.createClass({\n  mixins: [IdentifyableObject],\n  render: function () {\n    id = this.getIdentifier();\n    link_state = this.props.link_state(\"settings_\" + id);\n    return (\n      <div className=\"form-group\">\n        <label htmlFor={id} className=\"col-sm-3 control-label\">{this.props.text}</label>\n        <div className=\"col-sm-9\">\n          <input type=\"number\" defaultValue={link_state.value} className=\"form-control\" id={id} placeholder={this.props.placeholder} min=\"0\" max={this.props.max_value} valueLink={link_state} />\n        </div>\n      </div>\n    )\n  }\n});\n\n\nvar LinkShapingPercentSetting = React.createClass({\n  render: function () {\n    return (\n      <LinkShapingNumberSetting input_id={this.props.input_id} text={this.props.text} placeholder=\"In %\" link_state={this.props.link_state} max_value=\"100\" />\n    )\n  }\n});\n\n\nvar CollapseableInputList = React.createClass({\n  render: function () {\n    return (\n      <fieldset className=\"accordion-group\">\n        <legend>{this.props.text}</legend>\n        {this.props.children}\n      </fieldset>\n    );\n  }\n});\n\n\nvar CollapseableInputGroup = React.createClass({\n  mixins: [IdentifyableObject],\n  getInitialState: function () {\n    return {collapsed: true};\n  },\n\n  handleClick: function (e) {\n    this.setState({collapsed: !this.state.collapsed})\n  },\n\n  render: function () {\n    id = this.getIdentifier();\n    var text = this.state.collapsed ? 'Show more' : 'Show less';\n    return (\n      <div>\n        <div className=\"accordion-heading\">\n          <a className=\"accordion-toggle\" data-toggle=\"collapse\" data-target={\"#\" + id} href=\"#\" onClick={this.handleClick}>{text}</a>\n        </div>\n        <div className=\"accordion-body collapse\" id={id}>\n          <div className=\"accordion-inner\">\n            {this.props.children}\n          </div>\n        </div>\n      </div>\n    );\n  }\n});\n\n\nvar LinkShapingSettings = React.createClass({\n  render: function () {\n    d = this.props.direction;\n    return (\n      <div>\n        <h4>{capitalizeFirstLetter(d) + \"link\"}:</h4>\n        <div className=\"well\" id={d + \"_well\"}>\n          <div className=\"form-horizontal accordion\">\n            <CollapseableInputList text=\"Bandwidth\">\n              <LinkShapingNumberSetting params={[d, \"rate\"]} text=\"Rate\" placeholder=\"in kbps\" link_state={this.props.link_state} />\n            </CollapseableInputList>\n            <CollapseableInputList text=\"Latency\">\n              <LinkShapingNumberSetting params={[d, \"delay\", \"delay\"]} text=\"Delay\" placeholder=\"in ms\" link_state={this.props.link_state} />\n              <CollapseableInputGroup params={[d, \"delay\", \"collapse\"]}>\n                <LinkShapingNumberSetting params={[d, \"delay\",\"jitter\"]} text=\"Jitter\" placeholder=\"in %\" link_state={this.props.link_state} />\n                <LinkShapingNumberSetting params={[d, \"delay\", \"correlation\"]} text=\"Correlation\" placeholder=\"in %\" link_state={this.props.link_state} />\n              </CollapseableInputGroup>\n            </CollapseableInputList>\n            <CollapseableInputList text=\"Loss\">\n              <LinkShapingNumberSetting params={[d, \"loss\", \"percentage\"]} text=\"Percentage\" placeholder=\"in %\" link_state={this.props.link_state} />\n              <CollapseableInputGroup params={[d, \"loss\", \"collapse\"]}>\n                <LinkShapingNumberSetting params={[d, \"loss\", \"correlation\"]} text=\"Correlation\" placeholder=\"in %\" link_state={this.props.link_state} />\n              </CollapseableInputGroup>\n            </CollapseableInputList>\n            <CollapseableInputList text=\"Corruption\">\n              <LinkShapingNumberSetting params={[d, \"corruption\", \"percentage\"]} text=\"Percentage\" placeholder=\"in %\" link_state={this.props.link_state} />\n              <CollapseableInputGroup params={[d, \"corruption\", \"collapse\"]}>\n                <LinkShapingNumberSetting params={[d, \"corruption\", \"correlation\"]} text=\"Correlation\" placeholder=\"in %\" link_state={this.props.link_state} />\n              </CollapseableInputGroup>\n            </CollapseableInputList>\n            <CollapseableInputList text=\"Reorder\">\n              <LinkShapingNumberSetting params={[d, \"reorder\", \"percentage\"]} text=\"Percentage\" placeholder=\"in %\" link_state={this.props.link_state} />\n              <CollapseableInputGroup params={[d, \"reorder\", \"collapse\"]}>\n                <LinkShapingNumberSetting params={[d, \"reorder\", \"correlation\"]} text=\"Correlation\" placeholder=\"in %\" link_state={this.props.link_state} />\n                <LinkShapingNumberSetting params={[d, \"reorder\", \"gap\"]} text=\"Gap\" placeholder=\"integer\" link_state={this.props.link_state}/>\n              </CollapseableInputGroup>\n            </CollapseableInputList>\n          </div>\n        </div>\n      </div>\n    );\n  }\n});\n\n\nvar ShapingSettings = React.createClass({\n  render: function () {\n    return (\n      <div className=\"panel-group\" id=\"accordion2\" role=\"tablist\" aria-multiselectable=\"false\">\n        <div className=\"panel panel-default\">\n          <div className=\"panel-heading\" data-toggle=\"collapse\" data-parent=\"#accordion2\" href=\"#collapseShaping\" aria-expanded=\"false\" aria-controls=\"collapseShaping\">\n              <h4 className=\"panel-title\">\n                  Shaping Settings\n              </h4>\n          </div>\n          <div id=\"collapseShaping\" className=\"panel-collapse collapse in\" role=\"tabpanel\">\n            <div className=\"panel-body\">\n              <div className=\"row\">\n                <div className=\"col-md-6\">\n                  <LinkShapingSettings direction=\"up\" link_state={this.props.link_state} />\n                </div>\n                <div className=\"col-md-6\">\n                  <LinkShapingSettings direction=\"down\" link_state={this.props.link_state} />\n                </div>\n              </div>\n\n              <JSONView json={this.props.before} label=\"Before:\" />\n              <JSONView json={this.props.after} label=\"After:\" />\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n});"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc-utils.js",
    "content": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n\nvar JSONView = React.createClass({\n  render: function() {\n    return (\n      <div className=\"col-md-6\">\n      <h4>{this.props.label}</h4>\n      <pre>\n        { JSON.stringify(this.props.json, null, 2) }\n      </pre>\n      </div>\n    );\n  }\n});\n\n\nfunction capitalizeFirstLetter(s) {\n  return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n\n/** https://gist.github.com/NV/8622188 **/\n/**\n * RecursiveLinkStateMixin is a LinkState alternative that can update keys in\n * a dictionnary recursively.\n * You can either give it a string of keys separated by a underscore (_)\n * or a list of keys\n */\nvar RecursiveLinkStateMixin = {\n  linkState: function (path) {\n    function setPath (obj, path, value) {\n      var leaf = resolvePath(obj, path);\n      leaf.obj[leaf.key] = value;\n    }\n\n    function getPath (obj, path) {\n      var leaf = resolvePath(obj, path);\n      return leaf.obj[leaf.key];\n    }\n\n    function resolvePath (obj, keys) {\n      if (typeof keys === 'string') {\n        keys = keys.split('_');\n      }\n      var lastIndex = keys.length - 1;\n      var current = obj;\n      for (var i = 0; i < lastIndex; i++) {\n        var key = keys[i];\n        current = current[key];\n      }\n      return {\n        obj: current,\n        key: keys[lastIndex]\n      };\n    }\n\n    return {\n      value: getPath(this.state, path),\n      requestChange: function(newValue) {\n        setPath(this.state, path, newValue);\n        this.forceUpdate();\n      }.bind(this)\n    };\n  }\n};\n\n\nvar IdentifyableObject = {\n  getIdentifier: function () {\n    return this.props.params.join('_');\n  },\n};\n\n\nfunction handleAPI(callback, notify) {\n  return function(rc) {\n    /* 2XX error codes are OK */\n    if (rc.status < 300 && rc.status >= 200) {\n      if (callback !== undefined) {\n        callback(rc);\n      }  \n    } else {\n      err = false;\n      t = typeof rc.json;\n      if (t === 'undefined') {\n        err = \"Could not complete request due to server error.\"\n      } else if (t === 'string') {\n        s = rc.json;\n\n        /* trim off the first line */\n        s = s.trim().substring(s.length, s.indexOf('\\n'));\n\n        /* take the second line as the error message */\n        s = s.trim().substring(0, s.indexOf('\\n'));\n\n        err = s;\n      } else if (t === 'object') {\n        err = rc.json.detail;\n      }\n\n      if (err) {\n        notify('error', err);\n      } else {\n        console.log(\"Not sure what to do with error value \" + t + \" '\" + rc.json + \"'\");\n      }\n    }\n  }\n}"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/js/atc.js",
    "content": "/** @jsx React.DOM */\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\nvar ERROR_EXPIRY = 10000;\n\n\nvar atc_status = {\n  OFFLINE: 0,\n  ACTIVE: 1,\n  INACTIVE: 2,\n  OUTDATED: 3,\n};\n\n\nvar NOTIFICATION_TYPES = {\n  \"error\": \"danger\",\n  \"info\": \"info\",\n  \"warn\": \"warning\",\n  \"success\": \"success\",\n};\n\n\nvar NotificationPanel = React.createClass({\n  render: function () {\n    var notifyNodes = this.props.notifications.map(function(item, idx, arr) {\n      var timeout = Math.floor((item.expire_at - new Date().getTime()) / 1000)\n      var cls = \"alert alert-\" + (NOTIFICATION_TYPES[item.type] || item.type);\n      return (\n        <div className={cls} role=\"alert\">\n          <div className=\"row\">\n            <div className=\"col-md-11\">{item.message}</div>\n            <div className=\"col-md-1\">{timeout}</div>\n          </div>\n        </div>\n      );\n    });\n    if (notifyNodes.length == 0) {\n      notifyNodes = (\n        <i>No notifications.</i>\n      );\n    }\n    return (\n      <div className=\"panel-group\" id=\"accordionNotify\" role=\"tablist\" aria-multiselectable=\"false\">\n        <div className=\"panel panel-default\">\n          <div className=\"panel-heading\" data-toggle=\"collapse\" data-parent=\"#accordionNotify\" href=\"#collapseNotify\" aria-expanded=\"true\" aria-controls=\"collapseNotify\">\n            <h3 className=\"panel-title\">\n              Notifications\n            </h3>\n          </div>\n          <div id=\"collapseNotify\" className=\"panel-collapse collapse in\" role=\"tabpanel\">\n            <div className=\"panel-body\">\n              {notifyNodes}\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n});\n\n\nvar Atc = React.createClass({\n  mixins: [RecursiveLinkStateMixin],\n  getInitialState: function() {\n    return {\n      client: new AtcRestClient(this.props.endpoint),\n      settings: new AtcSettings().getDefaultSettings(),\n      current_settings: new AtcSettings().getDefaultSettings(),\n      status: atc_status.OFFLINE,\n      profiles: [],\n      notifications: [],\n    };\n  },\n\n  notify: function(type, msg) {\n    this.setState(function(state, props) {\n      return {\n        notifications: state.notifications.concat({\n          expire_at: ERROR_EXPIRY + new Date().getTime(),\n          message: msg,\n          type: type,\n        })\n      };\n    });\n  },\n\n  expireNotifications: function() {\n    this.setState(function(state, props) {\n      return {\n        notifications: state.notifications.filter(function(item, idx, arr) {\n            return item.expire_at >= new Date().getTime();\n        })\n      };\n    })\n  },\n\n  componentDidMount: function() {\n    this.getCurrentShaping();\n    /** FIXME we are calling getCurrentShaping to make sure that\n     * current_settings === settings.... let's be smarter than that.\n     */\n    this.getCurrentShaping();\n    this.getProfiles();\n    this.expiry_interval = setInterval(this.expireNotifications, 1000);\n  },\n\n  componentWillUnmount: function() {\n    if (this.expiry_interval != null) {\n      clearInterval(this.expiry_interval);\n    }\n  },\n\n  handleClick: function(e) {\n    if (e.type == \"click\") {\n      if (this.state.status == atc_status.ACTIVE) {\n        this.unsetShaping();\n      } else if (this.state.status == atc_status.INACTIVE) {\n        this.setShaping();\n      }\n    }\n  },\n\n  updateClick: function(e) {\n    if (e.type == \"click\") {\n      this.setShaping();\n    }\n  },\n\n  hasChanged: function() {\n    /* TODO: improve object comparaison e.g null == \"\", 1 == \"1\"*/\n    function objectEquals(x, y) {\n      if (typeof(x) === 'number') {\n        x = x.toString();\n      }\n      if (typeof(y) === 'number') {\n        y = y.toString();\n      }\n      if (typeof(x) != typeof(y)) {\n        return false;\n      }\n\n      if (Array.isArray(x) || Array.isArray(y)) {\n        return x.toString() === y.toString();\n      }\n\n      if (x === null && y === null) {\n        return true;\n      }\n\n      if (typeof(x) === 'object' && x !== null) {\n        x_keys = Object.keys(x);\n        y_keys = Object.keys(y);\n        if (x_keys.sort().toString() !== y_keys.sort().toString()) {\n          console.error('Object do not have the same keys: ' +\n            x_keys.sort().toString() + ' vs ' +\n            y_keys.sort().toString()\n          );\n          return false;\n        }\n        equals = true;\n        x_keys.forEach(function (key, index) {\n            equals &= objectEquals(x[key], y[key]);\n        });\n        return equals;\n      }\n      return x.toString() === y.toString();\n    }\n    return !objectEquals(this.state.settings, this.state.current_settings);\n  },\n\n  getProfiles: function() {\n    this.state.client.get_profiles(function (result) {\n      if (result.status >= 200 && result.status < 300) {\n        this.setState({\n          profiles: result.json,\n        });\n      } else {\n        this.error(result.json.detail);\n        this.setState({\n          profiles: [],\n        });\n      }\n    }.bind(this));\n  },\n\n  getCurrentShaping: function() {\n    this.state.client.getCurrentShaping(function (result) {\n      if (result.status == 404) {\n        this.setState({\n          status: atc_status.INACTIVE,\n          settings: new AtcSettings().getDefaultSettings(),\n          current_settings: new AtcSettings().getDefaultSettings(),\n        });\n      } else if (result.status >= 200 && result.status < 300) {\n        this.setState({\n          status: atc_status.ACTIVE,\n          settings: result.json,\n          current_settings: this.state.settings,\n        });\n      } else {\n        this.error(result.json.detail);\n        this.setState({\n          status: atc_status.OFFLINE,\n          settings: new AtcSettings().getDefaultSettings(),\n        });\n      }\n    }.bind(this));\n  },\n\n  unsetShaping: function() {\n    console.log('unsetShaping');\n    this.state.client.unshape(function (result) {\n      if (result.status >= 200 && result.status < 300) {\n        this.setState({\n          status: atc_status.INACTIVE,\n          settings: new AtcSettings().getDefaultSettings(),\n          current_settings: new AtcSettings().getDefaultSettings(),\n        });\n      } else if (result.status >= 500) {\n        this.notify(\"error\", result.json.detail);\n        this.setState({\n          status: atc_status.OFFLINE,\n        });\n      }\n    }.bind(this));\n  },\n\n\n  setShaping: function() {\n    console.log('setShaping');\n    this.state.client.shape(function (result) {\n      if (result.status >= 200 && result.status < 300) {\n        this.setState({\n          status: atc_status.ACTIVE,\n          settings: result.json,\n          current_settings: {down: this.state.settings.down, up: this.state.settings.up},\n        });\n      } else if (result.status == 400) {\n        for (var key in result.json) {\n          result.data[key].map(function(msg) {\n            this.notify(\"error\", key + ': ' + msg);\n          }.bind(this));\n        }\n      } else if (result.status >= 500) {\n        this.notify(\"error\", result.json.detail);\n        this.setState({\n          status: atc_status.OFFLINE,\n        });\n      }\n\n    }.bind(this), {down: this.state.settings.down, up: this.state.settings.up});\n  },\n\n  render: function () {\n    link_state = this.linkState;\n    var err_msg = \"\";\n    var update_button = false;\n    if (this.hasChanged()) {\n      update_button = <ShapingButton id=\"update_button\" status={atc_status.OUTDATED} onClick={this.updateClick} />\n    }\n    return (\n      <div>\n        <div className=\"row\">\n          <div id=\"shaping_buttons\" className=\"col-md-12 text-center\">\n            {update_button}\n            <ShapingButton id=\"shaping_button\" status={this.state.status} onClick={this.handleClick} />\n            {err_msg}\n          </div>\n        </div>\n\n        <NotificationPanel notifications={this.state.notifications} />\n        <AuthPanel client={this.state.client} notify={this.notify}/>\n        <ProfilePanel refreshProfiles={this.getProfiles} link_state={link_state} profiles={this.state.profiles} notify={this.notify} />\n        <ShapingSettings link_state={link_state} before={this.state.settings} after={this.state.current_settings} notify={this.notify} />\n      </div>\n    )\n  }\n});\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/JSXTransformer-0.13.3.js",
    "content": "/**\n * JSXTransformer v0.13.3\n */\n(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.JSXTransformer = 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){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n/* jshint browser: true */\n/* jslint evil: true */\n/*eslint-disable no-eval */\n/*eslint-disable block-scoped-var */\n\n'use strict';\n\nvar ReactTools = _dereq_('../main');\nvar inlineSourceMap = _dereq_('./inline-source-map');\n\nvar headEl;\nvar dummyAnchor;\nvar inlineScriptCount = 0;\n\n// The source-map library relies on Object.defineProperty, but IE8 doesn't\n// support it fully even with es5-sham. Indeed, es5-sham's defineProperty\n// throws when Object.prototype.__defineGetter__ is missing, so we skip building\n// the source map in that case.\nvar supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');\n\n/**\n * Run provided code through jstransform.\n *\n * @param {string} source Original source code\n * @param {object?} options Options to pass to jstransform\n * @return {object} object as returned from jstransform\n */\nfunction transformReact(source, options) {\n  options = options || {};\n\n  // Force the sourcemaps option manually. We don't want to use it if it will\n  // break (see above note about supportsAccessors). We'll only override the\n  // value here if sourceMap was specified and is truthy. This guarantees that\n  // we won't override any user intent (since this method is exposed publicly).\n  if (options.sourceMap) {\n    options.sourceMap = supportsAccessors;\n  }\n\n  // Otherwise just pass all options straight through to react-tools.\n  return ReactTools.transformWithDetails(source, options);\n}\n\n/**\n * Eval provided source after transforming it.\n *\n * @param {string} source Original source code\n * @param {object?} options Options to pass to jstransform\n */\nfunction exec(source, options) {\n  return eval(transformReact(source, options).code);\n}\n\n/**\n * This method returns a nicely formated line of code pointing to the exact\n * location of the error `e`. The line is limited in size so big lines of code\n * are also shown in a readable way.\n *\n * Example:\n * ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=\" ...\n * ^\n *\n * @param {string} code The full string of code\n * @param {Error} e The error being thrown\n * @return {string} formatted message\n * @internal\n */\nfunction createSourceCodeErrorMessage(code, e) {\n  var sourceLines = code.split('\\n');\n  // e.lineNumber is non-standard so we can't depend on its availability. If\n  // we're in a browser where it isn't supported, don't even bother trying to\n  // format anything. We may also hit a case where the line number is reported\n  // incorrectly and is outside the bounds of the actual code. Handle that too.\n  if (!e.lineNumber || e.lineNumber > sourceLines.length) {\n    return '';\n  }\n  var erroneousLine = sourceLines[e.lineNumber - 1];\n\n  // Removes any leading indenting spaces and gets the number of\n  // chars indenting the `erroneousLine`\n  var indentation = 0;\n  erroneousLine = erroneousLine.replace(/^\\s+/, function(leadingSpaces) {\n    indentation = leadingSpaces.length;\n    return '';\n  });\n\n  // Defines the number of characters that are going to show\n  // before and after the erroneous code\n  var LIMIT = 30;\n  var errorColumn = e.column - indentation;\n\n  if (errorColumn > LIMIT) {\n    erroneousLine = '... ' + erroneousLine.slice(errorColumn - LIMIT);\n    errorColumn = 4 + LIMIT;\n  }\n  if (erroneousLine.length - errorColumn > LIMIT) {\n    erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + ' ...';\n  }\n  var message = '\\n\\n' + erroneousLine + '\\n';\n  message += new Array(errorColumn - 1).join(' ') + '^';\n  return message;\n}\n\n/**\n * Actually transform the code.\n *\n * @param {string} code\n * @param {string?} url\n * @param {object?} options\n * @return {string} The transformed code.\n * @internal\n */\nfunction transformCode(code, url, options) {\n  try {\n    var transformed = transformReact(code, options);\n  } catch(e) {\n    e.message += '\\n    at ';\n    if (url) {\n      if ('fileName' in e) {\n        // We set `fileName` if it's supported by this error object and\n        // a `url` was provided.\n        // The error will correctly point to `url` in Firefox.\n        e.fileName = url;\n      }\n      e.message += url + ':' + e.lineNumber + ':' + e.columnNumber;\n    } else {\n      e.message += location.href;\n    }\n    e.message += createSourceCodeErrorMessage(code, e);\n    throw e;\n  }\n\n  if (!transformed.sourceMap) {\n    return transformed.code;\n  }\n\n  var source;\n  if (url == null) {\n    source = 'Inline JSX script';\n    inlineScriptCount++;\n    if (inlineScriptCount > 1) {\n      source += ' (' + inlineScriptCount + ')';\n    }\n  } else if (dummyAnchor) {\n    // Firefox has problems when the sourcemap source is a proper URL with a\n    // protocol and hostname, so use the pathname. We could use just the\n    // filename, but hopefully using the full path will prevent potential\n    // issues where the same filename exists in multiple directories.\n    dummyAnchor.href = url;\n    source = dummyAnchor.pathname.substr(1);\n  }\n\n  return (\n    transformed.code +\n    '\\n' +\n    inlineSourceMap(transformed.sourceMap, code, source)\n  );\n}\n\n\n/**\n * Appends a script element at the end of the <head> with the content of code,\n * after transforming it.\n *\n * @param {string} code The original source code\n * @param {string?} url Where the code came from. null if inline\n * @param {object?} options Options to pass to jstransform\n * @internal\n */\nfunction run(code, url, options) {\n  var scriptEl = document.createElement('script');\n  scriptEl.text = transformCode(code, url, options);\n  headEl.appendChild(scriptEl);\n}\n\n/**\n * Load script from the provided url and pass the content to the callback.\n *\n * @param {string} url The location of the script src\n * @param {function} callback Function to call with the content of url\n * @internal\n */\nfunction load(url, successCallback, errorCallback) {\n  var xhr;\n  xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')\n                             : new XMLHttpRequest();\n\n  // async, however scripts will be executed in the order they are in the\n  // DOM to mirror normal script loading.\n  xhr.open('GET', url, true);\n  if ('overrideMimeType' in xhr) {\n    xhr.overrideMimeType('text/plain');\n  }\n  xhr.onreadystatechange = function() {\n    if (xhr.readyState === 4) {\n      if (xhr.status === 0 || xhr.status === 200) {\n        successCallback(xhr.responseText);\n      } else {\n        errorCallback();\n        throw new Error('Could not load ' + url);\n      }\n    }\n  };\n  return xhr.send(null);\n}\n\n/**\n * Loop over provided script tags and get the content, via innerHTML if an\n * inline script, or by using XHR. Transforms are applied if needed. The scripts\n * are executed in the order they are found on the page.\n *\n * @param {array} scripts The <script> elements to load and run.\n * @internal\n */\nfunction loadScripts(scripts) {\n  var result = [];\n  var count = scripts.length;\n\n  function check() {\n    var script, i;\n\n    for (i = 0; i < count; i++) {\n      script = result[i];\n\n      if (script.loaded && !script.executed) {\n        script.executed = true;\n        run(script.content, script.url, script.options);\n      } else if (!script.loaded && !script.error && !script.async) {\n        break;\n      }\n    }\n  }\n\n  scripts.forEach(function(script, i) {\n    var options = {\n      sourceMap: true\n    };\n    if (/;harmony=true(;|$)/.test(script.type)) {\n      options.harmony = true;\n    }\n    if (/;stripTypes=true(;|$)/.test(script.type)) {\n      options.stripTypes = true;\n    }\n\n    // script.async is always true for non-javascript script tags\n    var async = script.hasAttribute('async');\n\n    if (script.src) {\n      result[i] = {\n        async: async,\n        error: false,\n        executed: false,\n        content: null,\n        loaded: false,\n        url: script.src,\n        options: options\n      };\n\n      load(script.src, function(content) {\n        result[i].loaded = true;\n        result[i].content = content;\n        check();\n      }, function() {\n        result[i].error = true;\n        check();\n      });\n    } else {\n      result[i] = {\n        async: async,\n        error: false,\n        executed: false,\n        content: script.innerHTML,\n        loaded: true,\n        url: null,\n        options: options\n      };\n    }\n  });\n\n  check();\n}\n\n/**\n * Find and run all script tags with type=\"text/jsx\".\n *\n * @internal\n */\nfunction runScripts() {\n  var scripts = document.getElementsByTagName('script');\n\n  // Array.prototype.slice cannot be used on NodeList on IE8\n  var jsxScripts = [];\n  for (var i = 0; i < scripts.length; i++) {\n    if (/^text\\/jsx(;|$)/.test(scripts.item(i).type)) {\n      jsxScripts.push(scripts.item(i));\n    }\n  }\n\n  if (jsxScripts.length < 1) {\n    return;\n  }\n\n  console.warn(\n    'You are using the in-browser JSX transformer. Be sure to precompile ' +\n    'your JSX for production - ' +\n    'http://facebook.github.io/react/docs/tooling-integration.html#jsx'\n  );\n\n  loadScripts(jsxScripts);\n}\n\n// Listen for load event if we're in a browser and then kick off finding and\n// running of scripts.\nif (typeof window !== 'undefined' && window !== null) {\n  headEl = document.getElementsByTagName('head')[0];\n  dummyAnchor = document.createElement('a');\n\n  if (window.addEventListener) {\n    window.addEventListener('DOMContentLoaded', runScripts, false);\n  } else {\n    window.attachEvent('onload', runScripts);\n  }\n}\n\nmodule.exports = {\n  transform: transformReact,\n  exec: exec\n};\n\n},{\"../main\":2,\"./inline-source-map\":41}],2:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n'use strict';\n/*eslint-disable no-undef*/\nvar visitors = _dereq_('./vendor/fbtransform/visitors');\nvar transform = _dereq_('jstransform').transform;\nvar typesSyntax = _dereq_('jstransform/visitors/type-syntax');\nvar inlineSourceMap = _dereq_('./vendor/inline-source-map');\n\nmodule.exports = {\n  transform: function(input, options) {\n    options = processOptions(options);\n    var output = innerTransform(input, options);\n    var result = output.code;\n    if (options.sourceMap) {\n      var map = inlineSourceMap(\n        output.sourceMap,\n        input,\n        options.filename\n      );\n      result += '\\n' + map;\n    }\n    return result;\n  },\n  transformWithDetails: function(input, options) {\n    options = processOptions(options);\n    var output = innerTransform(input, options);\n    var result = {};\n    result.code = output.code;\n    if (options.sourceMap) {\n      result.sourceMap = output.sourceMap.toJSON();\n    }\n    if (options.filename) {\n      result.sourceMap.sources = [options.filename];\n    }\n    return result;\n  }\n};\n\n/**\n * Only copy the values that we need. We'll do some preprocessing to account for\n * converting command line flags to options that jstransform can actually use.\n */\nfunction processOptions(opts) {\n  opts = opts || {};\n  var options = {};\n\n  options.harmony = opts.harmony;\n  options.stripTypes = opts.stripTypes;\n  options.sourceMap = opts.sourceMap;\n  options.filename = opts.sourceFilename;\n\n  if (opts.es6module) {\n    options.sourceType = 'module';\n  }\n  if (opts.nonStrictEs6module) {\n    options.sourceType = 'nonStrictModule';\n  }\n\n  // Instead of doing any fancy validation, only look for 'es3'. If we have\n  // that, then use it. Otherwise use 'es5'.\n  options.es3 = opts.target === 'es3';\n  options.es5 = !options.es3;\n\n  return options;\n}\n\nfunction innerTransform(input, options) {\n  var visitorSets = ['react'];\n  if (options.harmony) {\n    visitorSets.push('harmony');\n  }\n\n  if (options.es3) {\n    visitorSets.push('es3');\n  }\n\n  if (options.stripTypes) {\n    // Stripping types needs to happen before the other transforms\n    // unfortunately, due to bad interactions. For example,\n    // es6-rest-param-visitors conflict with stripping rest param type\n    // annotation\n    input = transform(typesSyntax.visitorList, input, options).code;\n  }\n\n  var visitorList = visitors.getVisitorsBySet(visitorSets);\n  return transform(visitorList, input, options);\n}\n\n},{\"./vendor/fbtransform/visitors\":40,\"./vendor/inline-source-map\":41,\"jstransform\":22,\"jstransform/visitors/type-syntax\":36}],3:[function(_dereq_,module,exports){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n\nvar base64 = _dereq_('base64-js')\nvar ieee754 = _dereq_('ieee754')\nvar isArray = _dereq_('is-array')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar kMaxLength = 0x3fffffff\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Note:\n *\n * - Implementation must support adding new properties to `Uint8Array` instances.\n *   Firefox 4-29 lacked support, fixed in Firefox 30+.\n *   See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *  - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *  - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *    incorrect length in some situations.\n *\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will\n * get the Object implementation, which is slower but will work correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = (function () {\n  try {\n    var buf = new ArrayBuffer(0)\n    var arr = new Uint8Array(buf)\n    arr.foo = function () { return 42 }\n    return arr.foo() === 42 && // typed array instances can be augmented\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n})()\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (subject, encoding) {\n  var self = this\n  if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n  var type = typeof subject\n  var length\n\n  if (type === 'number') {\n    length = +subject\n  } else if (type === 'string') {\n    length = Buffer.byteLength(subject, encoding)\n  } else if (type === 'object' && subject !== null) {\n    // assume object is array-like\n    if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n    length = +subject.length\n  } else {\n    throw new TypeError('must start with number, buffer, array or string')\n  }\n\n  if (length > kMaxLength) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n      kMaxLength.toString(16) + ' bytes')\n  }\n\n  if (length < 0) length = 0\n  else length >>>= 0 // coerce to uint32\n\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Preferred: Return an augmented `Uint8Array` instance for best performance\n    self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n  } else {\n    // Fallback: Return THIS instance of Buffer (created by `new`)\n    self.length = length\n    self._isBuffer = true\n  }\n\n  var i\n  if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n    // Speed optimization -- use set if we're copying from a typed array\n    self._set(subject)\n  } else if (isArrayish(subject)) {\n    // Treat array-ish objects as a byte array\n    if (Buffer.isBuffer(subject)) {\n      for (i = 0; i < length; i++) {\n        self[i] = subject.readUInt8(i)\n      }\n    } else {\n      for (i = 0; i < length; i++) {\n        self[i] = ((subject[i] % 256) + 256) % 256\n      }\n    }\n  } else if (type === 'string') {\n    self.write(subject, 0, encoding)\n  } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n    for (i = 0; i < length; i++) {\n      self[i] = 0\n    }\n  }\n\n  if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n  return self\n}\n\nfunction SlowBuffer (subject, encoding) {\n  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n  var buf = new Buffer(subject, encoding)\n  delete buf.parent\n  return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n  for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}\n  if (i !== len) {\n    x = a[i]\n    y = b[i]\n  }\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, totalLength) {\n  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  } else if (list.length === 1) {\n    return list[0]\n  }\n\n  var i\n  if (totalLength === undefined) {\n    totalLength = 0\n    for (i = 0; i < list.length; i++) {\n      totalLength += list[i].length\n    }\n  }\n\n  var buf = new Buffer(totalLength)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\nBuffer.byteLength = function byteLength (str, encoding) {\n  var ret\n  str = str + ''\n  switch (encoding || 'utf8') {\n    case 'ascii':\n    case 'binary':\n    case 'raw':\n      ret = str.length\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = str.length * 2\n      break\n    case 'hex':\n      ret = str.length >>> 1\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8ToBytes(str).length\n      break\n    case 'base64':\n      ret = base64ToBytes(str).length\n      break\n    default:\n      ret = str.length\n  }\n  return ret\n}\n\n// pre-set for values that may exist in the future\nBuffer.prototype.length = undefined\nBuffer.prototype.parent = undefined\n\n// toString(encoding, start=0, end=buffer.length)\nBuffer.prototype.toString = function toString (encoding, start, end) {\n  var loweredCase = false\n\n  start = start >>> 0\n  end = end === undefined || end === Infinity ? this.length : end >>> 0\n\n  if (!encoding) encoding = 'utf8'\n  if (start < 0) start = 0\n  if (end > this.length) end = this.length\n  if (end <= start) return ''\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'binary':\n        return binarySlice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return 0\n  return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n  else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n  byteOffset >>= 0\n\n  if (this.length === 0) return -1\n  if (byteOffset >= this.length) return -1\n\n  // Negative offsets start from the end of the buffer\n  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n  if (typeof val === 'string') {\n    if (val.length === 0) return -1 // special case: looking for empty string always fails\n    return String.prototype.indexOf.call(this, val, byteOffset)\n  }\n  if (Buffer.isBuffer(val)) {\n    return arrayIndexOf(this, val, byteOffset)\n  }\n  if (typeof val === 'number') {\n    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n    }\n    return arrayIndexOf(this, [ val ], byteOffset)\n  }\n\n  function arrayIndexOf (arr, val, byteOffset) {\n    var foundIndex = -1\n    for (var i = 0; byteOffset + i < arr.length; i++) {\n      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n        if (foundIndex === -1) foundIndex = i\n        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n      } else {\n        foundIndex = -1\n      }\n    }\n    return -1\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` will be removed in Node 0.13+\nBuffer.prototype.get = function get (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\n// `set` will be removed in Node 0.13+\nBuffer.prototype.set = function set (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) throw new Error('Invalid hex string')\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n  return charsWritten\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction utf16leWrite (buf, string, offset, length) {\n  var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n  return charsWritten\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  // Support both (string, offset, length, encoding)\n  // and the legacy (string, encoding, offset, length)\n  if (isFinite(offset)) {\n    if (!isFinite(length)) {\n      encoding = length\n      length = undefined\n    }\n  } else {  // legacy\n    var swap = encoding\n    encoding = offset\n    offset = length\n    length = swap\n  }\n\n  offset = Number(offset) || 0\n\n  if (length < 0 || offset < 0 || offset > this.length) {\n    throw new RangeError('attempt to write outside buffer bounds')\n  }\n\n  var remaining = this.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n  encoding = String(encoding || 'utf8').toLowerCase()\n\n  var ret\n  switch (encoding) {\n    case 'hex':\n      ret = hexWrite(this, string, offset, length)\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8Write(this, string, offset, length)\n      break\n    case 'ascii':\n      ret = asciiWrite(this, string, offset, length)\n      break\n    case 'binary':\n      ret = binaryWrite(this, string, offset, length)\n      break\n    case 'base64':\n      ret = base64Write(this, string, offset, length)\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = utf16leWrite(this, string, offset, length)\n      break\n    default:\n      throw new TypeError('Unknown encoding: ' + encoding)\n  }\n  return ret\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  var res = ''\n  var tmp = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    if (buf[i] <= 0x7F) {\n      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n      tmp = ''\n    } else {\n      tmp += '%' + buf[i].toString(16)\n    }\n  }\n\n  return res + decodeUtf8Char(tmp)\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  if (newBuf.length) newBuf.parent = this.parent || this\n\n  return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) >>> 0 & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  byteLength = byteLength >>> 0\n  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) >>> 0 & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = value\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = value\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = value\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = value\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = value\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) {\n    checkInt(\n      this, value, offset, byteLength,\n      Math.pow(2, 8 * byteLength - 1) - 1,\n      -Math.pow(2, 8 * byteLength - 1)\n    )\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) {\n    checkInt(\n      this, value, offset, byteLength,\n      Math.pow(2, 8 * byteLength - 1) - 1,\n      -Math.pow(2, 8 * byteLength - 1)\n    )\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = value < 0 ? 1 : 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = value\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = value\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = value\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = value\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset >>> 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = value\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (value > max || value < min) throw new RangeError('value is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('index out of range')\n  if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, target_start, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (target_start >= target.length) target_start = target.length\n  if (!target_start) target_start = 0\n  if (end > 0 && end < start) end = start\n\n  // Copy 0 bytes; we're done\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  // Fatal error conditions\n  if (target_start < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length) end = this.length\n  if (target.length - target_start < end - start) {\n    end = target.length - target_start + start\n  }\n\n  var len = end - start\n\n  if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < len; i++) {\n      target[i + target_start] = this[i + start]\n    }\n  } else {\n    target._set(this.subarray(start, start + len), target_start)\n  }\n\n  return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  if (end < start) throw new RangeError('end < start')\n\n  // Fill 0 bytes; we're done\n  if (end === start) return\n  if (this.length === 0) return\n\n  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n  var i\n  if (typeof value === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = value\n    }\n  } else {\n    var bytes = utf8ToBytes(value.toString())\n    var len = bytes.length\n    for (i = start; i < end; i++) {\n      this[i] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (Buffer.TYPED_ARRAY_SUPPORT) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1) {\n        buf[i] = this[i]\n      }\n      return buf.buffer\n    }\n  } else {\n    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n  arr.constructor = Buffer\n  arr._isBuffer = true\n\n  // save reference to original Uint8Array set method before overwriting\n  arr._set = arr.set\n\n  // deprecated, will be removed in node 0.13+\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.equals = BP.equals\n  arr.compare = BP.compare\n  arr.indexOf = BP.indexOf\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUIntLE = BP.readUIntLE\n  arr.readUIntBE = BP.readUIntBE\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readIntLE = BP.readIntLE\n  arr.readIntBE = BP.readIntBE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUIntLE = BP.writeUIntLE\n  arr.writeUIntBE = BP.writeUIntBE\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeIntLE = BP.writeIntLE\n  arr.writeIntBE = BP.writeIntBE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-z\\-]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node converts strings with length < 2 to ''\n  if (str.length < 2) return ''\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction isArrayish (subject) {\n  return isArray(subject) || Buffer.isBuffer(subject) ||\n      subject && typeof subject === 'object' &&\n      typeof subject.length === 'number'\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n  var i = 0\n\n  for (; i < length; i++) {\n    codePoint = string.charCodeAt(i)\n\n    // is surrogate component\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      // last char was a lead\n      if (leadSurrogate) {\n        // 2 leads in a row\n        if (codePoint < 0xDC00) {\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          leadSurrogate = codePoint\n          continue\n        } else {\n          // valid surrogate pair\n          codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000\n          leadSurrogate = null\n        }\n      } else {\n        // no lead yet\n\n        if (codePoint > 0xDBFF) {\n          // unexpected trail\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          // unpaired lead\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else {\n          // valid lead\n          leadSurrogate = codePoint\n          continue\n        }\n      }\n    } else if (leadSurrogate) {\n      // valid bmp char, but last char was a lead\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n      leadSurrogate = null\n    }\n\n    // encode utf8\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x200000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\nfunction decodeUtf8Char (str) {\n  try {\n    return decodeURIComponent(str)\n  } catch (err) {\n    return String.fromCharCode(0xFFFD) // UTF 8 invalid char\n  }\n}\n\n},{\"base64-js\":4,\"ieee754\":5,\"is-array\":6}],4:[function(_dereq_,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n\tvar PLUS   = '+'.charCodeAt(0)\n\tvar SLASH  = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER  = 'a'.charCodeAt(0)\n\tvar UPPER  = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t    code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t    code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],5:[function(_dereq_,module,exports){\nexports.read = function(buffer, offset, isLE, mLen, nBytes) {\n  var e, m,\n      eLen = nBytes * 8 - mLen - 1,\n      eMax = (1 << eLen) - 1,\n      eBias = eMax >> 1,\n      nBits = -7,\n      i = isLE ? (nBytes - 1) : 0,\n      d = isLE ? -1 : 1,\n      s = buffer[offset + i];\n\n  i += d;\n\n  e = s & ((1 << (-nBits)) - 1);\n  s >>= (-nBits);\n  nBits += eLen;\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n  m = e & ((1 << (-nBits)) - 1);\n  e >>= (-nBits);\n  nBits += mLen;\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n  if (e === 0) {\n    e = 1 - eBias;\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity);\n  } else {\n    m = m + Math.pow(2, mLen);\n    e = e - eBias;\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nexports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c,\n      eLen = nBytes * 8 - mLen - 1,\n      eMax = (1 << eLen) - 1,\n      eBias = eMax >> 1,\n      rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n      i = isLE ? 0 : (nBytes - 1),\n      d = isLE ? 1 : -1,\n      s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n  value = Math.abs(value);\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0;\n    e = eMax;\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2);\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--;\n      c *= 2;\n    }\n    if (e + eBias >= 1) {\n      value += rt / c;\n    } else {\n      value += rt * Math.pow(2, 1 - eBias);\n    }\n    if (value * c >= 2) {\n      e++;\n      c /= 2;\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0;\n      e = eMax;\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen);\n      e = e + eBias;\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n      e = 0;\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n  e = (e << mLen) | m;\n  eLen += mLen;\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n  buffer[offset + i - d] |= s * 128;\n};\n\n},{}],6:[function(_dereq_,module,exports){\n\n/**\n * isArray\n */\n\nvar isArray = Array.isArray;\n\n/**\n * toString\n */\n\nvar str = Object.prototype.toString;\n\n/**\n * Whether or not the given `val`\n * is an array.\n *\n * example:\n *\n *        isArray([]);\n *        // > true\n *        isArray(arguments);\n *        // > false\n *        isArray('');\n *        // > false\n *\n * @param {mixed} val\n * @return {bool}\n */\n\nmodule.exports = isArray || function (val) {\n  return !! val && '[object Array]' == str.call(val);\n};\n\n},{}],7:[function(_dereq_,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n  // if the path tries to go above the root, `up` ends up > 0\n  var up = 0;\n  for (var i = parts.length - 1; i >= 0; i--) {\n    var last = parts[i];\n    if (last === '.') {\n      parts.splice(i, 1);\n    } else if (last === '..') {\n      parts.splice(i, 1);\n      up++;\n    } else if (up) {\n      parts.splice(i, 1);\n      up--;\n    }\n  }\n\n  // if the path is allowed to go above the root, restore leading ..s\n  if (allowAboveRoot) {\n    for (; up--; up) {\n      parts.unshift('..');\n    }\n  }\n\n  return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n    /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n  return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n  var resolvedPath = '',\n      resolvedAbsolute = false;\n\n  for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n    var path = (i >= 0) ? arguments[i] : process.cwd();\n\n    // Skip empty and invalid entries\n    if (typeof path !== 'string') {\n      throw new TypeError('Arguments to path.resolve must be strings');\n    } else if (!path) {\n      continue;\n    }\n\n    resolvedPath = path + '/' + resolvedPath;\n    resolvedAbsolute = path.charAt(0) === '/';\n  }\n\n  // At this point the path should be resolved to a full absolute path, but\n  // handle relative paths to be safe (might happen when process.cwd() fails)\n\n  // Normalize the path\n  resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n    return !!p;\n  }), !resolvedAbsolute).join('/');\n\n  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n  var isAbsolute = exports.isAbsolute(path),\n      trailingSlash = substr(path, -1) === '/';\n\n  // Normalize the path\n  path = normalizeArray(filter(path.split('/'), function(p) {\n    return !!p;\n  }), !isAbsolute).join('/');\n\n  if (!path && !isAbsolute) {\n    path = '.';\n  }\n  if (path && trailingSlash) {\n    path += '/';\n  }\n\n  return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n  return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n  var paths = Array.prototype.slice.call(arguments, 0);\n  return exports.normalize(filter(paths, function(p, index) {\n    if (typeof p !== 'string') {\n      throw new TypeError('Arguments to path.join must be strings');\n    }\n    return p;\n  }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n  from = exports.resolve(from).substr(1);\n  to = exports.resolve(to).substr(1);\n\n  function trim(arr) {\n    var start = 0;\n    for (; start < arr.length; start++) {\n      if (arr[start] !== '') break;\n    }\n\n    var end = arr.length - 1;\n    for (; end >= 0; end--) {\n      if (arr[end] !== '') break;\n    }\n\n    if (start > end) return [];\n    return arr.slice(start, end - start + 1);\n  }\n\n  var fromParts = trim(from.split('/'));\n  var toParts = trim(to.split('/'));\n\n  var length = Math.min(fromParts.length, toParts.length);\n  var samePartsLength = length;\n  for (var i = 0; i < length; i++) {\n    if (fromParts[i] !== toParts[i]) {\n      samePartsLength = i;\n      break;\n    }\n  }\n\n  var outputParts = [];\n  for (var i = samePartsLength; i < fromParts.length; i++) {\n    outputParts.push('..');\n  }\n\n  outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n  return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n  var result = splitPath(path),\n      root = result[0],\n      dir = result[1];\n\n  if (!root && !dir) {\n    // No dirname whatsoever\n    return '.';\n  }\n\n  if (dir) {\n    // It has a dirname, strip trailing slash\n    dir = dir.substr(0, dir.length - 1);\n  }\n\n  return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n  var f = splitPath(path)[2];\n  // TODO: make this comparison case-insensitive on windows?\n  if (ext && f.substr(-1 * ext.length) === ext) {\n    f = f.substr(0, f.length - ext.length);\n  }\n  return f;\n};\n\n\nexports.extname = function(path) {\n  return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n    if (xs.filter) return xs.filter(f);\n    var res = [];\n    for (var i = 0; i < xs.length; i++) {\n        if (f(xs[i], i, xs)) res.push(xs[i]);\n    }\n    return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n    ? function (str, start, len) { return str.substr(start, len) }\n    : function (str, start, len) {\n        if (start < 0) start = str.length + start;\n        return str.substr(start, len);\n    }\n;\n\n}).call(this,_dereq_('_process'))\n},{\"_process\":8}],8:[function(_dereq_,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    draining = true;\n    var currentQueue;\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        var i = -1;\n        while (++i < len) {\n            currentQueue[i]();\n        }\n        len = queue.length;\n    }\n    draining = false;\n}\nprocess.nextTick = function (fun) {\n    queue.push(fun);\n    if (!draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],9:[function(_dereq_,module,exports){\n/*\n  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>\n  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>\n  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>\n  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>\n  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>\n  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>\n  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>\n  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>\n  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>\n\n  Redistribution and use in source and binary forms, with or without\n  modification, are permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n\n  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n(function (root, factory) {\n    'use strict';\n\n    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,\n    // Rhino, and plain browser loading.\n\n    /* istanbul ignore next */\n    if (typeof define === 'function' && define.amd) {\n        define(['exports'], factory);\n    } else if (typeof exports !== 'undefined') {\n        factory(exports);\n    } else {\n        factory((root.esprima = {}));\n    }\n}(this, function (exports) {\n    'use strict';\n\n    var Token,\n        TokenName,\n        FnExprTokens,\n        Syntax,\n        PropertyKind,\n        Messages,\n        Regex,\n        SyntaxTreeDelegate,\n        XHTMLEntities,\n        ClassPropertyType,\n        source,\n        strict,\n        index,\n        lineNumber,\n        lineStart,\n        length,\n        delegate,\n        lookahead,\n        state,\n        extra;\n\n    Token = {\n        BooleanLiteral: 1,\n        EOF: 2,\n        Identifier: 3,\n        Keyword: 4,\n        NullLiteral: 5,\n        NumericLiteral: 6,\n        Punctuator: 7,\n        StringLiteral: 8,\n        RegularExpression: 9,\n        Template: 10,\n        JSXIdentifier: 11,\n        JSXText: 12\n    };\n\n    TokenName = {};\n    TokenName[Token.BooleanLiteral] = 'Boolean';\n    TokenName[Token.EOF] = '<end>';\n    TokenName[Token.Identifier] = 'Identifier';\n    TokenName[Token.Keyword] = 'Keyword';\n    TokenName[Token.NullLiteral] = 'Null';\n    TokenName[Token.NumericLiteral] = 'Numeric';\n    TokenName[Token.Punctuator] = 'Punctuator';\n    TokenName[Token.StringLiteral] = 'String';\n    TokenName[Token.JSXIdentifier] = 'JSXIdentifier';\n    TokenName[Token.JSXText] = 'JSXText';\n    TokenName[Token.RegularExpression] = 'RegularExpression';\n\n    // A function following one of those tokens is an expression.\n    FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',\n                    'return', 'case', 'delete', 'throw', 'void',\n                    // assignment operators\n                    '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',\n                    '&=', '|=', '^=', ',',\n                    // binary/unary operators\n                    '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',\n                    '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',\n                    '<=', '<', '>', '!=', '!=='];\n\n    Syntax = {\n        AnyTypeAnnotation: 'AnyTypeAnnotation',\n        ArrayExpression: 'ArrayExpression',\n        ArrayPattern: 'ArrayPattern',\n        ArrayTypeAnnotation: 'ArrayTypeAnnotation',\n        ArrowFunctionExpression: 'ArrowFunctionExpression',\n        AssignmentExpression: 'AssignmentExpression',\n        BinaryExpression: 'BinaryExpression',\n        BlockStatement: 'BlockStatement',\n        BooleanTypeAnnotation: 'BooleanTypeAnnotation',\n        BreakStatement: 'BreakStatement',\n        CallExpression: 'CallExpression',\n        CatchClause: 'CatchClause',\n        ClassBody: 'ClassBody',\n        ClassDeclaration: 'ClassDeclaration',\n        ClassExpression: 'ClassExpression',\n        ClassImplements: 'ClassImplements',\n        ClassProperty: 'ClassProperty',\n        ComprehensionBlock: 'ComprehensionBlock',\n        ComprehensionExpression: 'ComprehensionExpression',\n        ConditionalExpression: 'ConditionalExpression',\n        ContinueStatement: 'ContinueStatement',\n        DebuggerStatement: 'DebuggerStatement',\n        DeclareClass: 'DeclareClass',\n        DeclareFunction: 'DeclareFunction',\n        DeclareModule: 'DeclareModule',\n        DeclareVariable: 'DeclareVariable',\n        DoWhileStatement: 'DoWhileStatement',\n        EmptyStatement: 'EmptyStatement',\n        ExportDeclaration: 'ExportDeclaration',\n        ExportBatchSpecifier: 'ExportBatchSpecifier',\n        ExportSpecifier: 'ExportSpecifier',\n        ExpressionStatement: 'ExpressionStatement',\n        ForInStatement: 'ForInStatement',\n        ForOfStatement: 'ForOfStatement',\n        ForStatement: 'ForStatement',\n        FunctionDeclaration: 'FunctionDeclaration',\n        FunctionExpression: 'FunctionExpression',\n        FunctionTypeAnnotation: 'FunctionTypeAnnotation',\n        FunctionTypeParam: 'FunctionTypeParam',\n        GenericTypeAnnotation: 'GenericTypeAnnotation',\n        Identifier: 'Identifier',\n        IfStatement: 'IfStatement',\n        ImportDeclaration: 'ImportDeclaration',\n        ImportDefaultSpecifier: 'ImportDefaultSpecifier',\n        ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',\n        ImportSpecifier: 'ImportSpecifier',\n        InterfaceDeclaration: 'InterfaceDeclaration',\n        InterfaceExtends: 'InterfaceExtends',\n        IntersectionTypeAnnotation: 'IntersectionTypeAnnotation',\n        LabeledStatement: 'LabeledStatement',\n        Literal: 'Literal',\n        LogicalExpression: 'LogicalExpression',\n        MemberExpression: 'MemberExpression',\n        MethodDefinition: 'MethodDefinition',\n        ModuleSpecifier: 'ModuleSpecifier',\n        NewExpression: 'NewExpression',\n        NullableTypeAnnotation: 'NullableTypeAnnotation',\n        NumberTypeAnnotation: 'NumberTypeAnnotation',\n        ObjectExpression: 'ObjectExpression',\n        ObjectPattern: 'ObjectPattern',\n        ObjectTypeAnnotation: 'ObjectTypeAnnotation',\n        ObjectTypeCallProperty: 'ObjectTypeCallProperty',\n        ObjectTypeIndexer: 'ObjectTypeIndexer',\n        ObjectTypeProperty: 'ObjectTypeProperty',\n        Program: 'Program',\n        Property: 'Property',\n        QualifiedTypeIdentifier: 'QualifiedTypeIdentifier',\n        ReturnStatement: 'ReturnStatement',\n        SequenceExpression: 'SequenceExpression',\n        SpreadElement: 'SpreadElement',\n        SpreadProperty: 'SpreadProperty',\n        StringLiteralTypeAnnotation: 'StringLiteralTypeAnnotation',\n        StringTypeAnnotation: 'StringTypeAnnotation',\n        SwitchCase: 'SwitchCase',\n        SwitchStatement: 'SwitchStatement',\n        TaggedTemplateExpression: 'TaggedTemplateExpression',\n        TemplateElement: 'TemplateElement',\n        TemplateLiteral: 'TemplateLiteral',\n        ThisExpression: 'ThisExpression',\n        ThrowStatement: 'ThrowStatement',\n        TupleTypeAnnotation: 'TupleTypeAnnotation',\n        TryStatement: 'TryStatement',\n        TypeAlias: 'TypeAlias',\n        TypeAnnotation: 'TypeAnnotation',\n        TypeCastExpression: 'TypeCastExpression',\n        TypeofTypeAnnotation: 'TypeofTypeAnnotation',\n        TypeParameterDeclaration: 'TypeParameterDeclaration',\n        TypeParameterInstantiation: 'TypeParameterInstantiation',\n        UnaryExpression: 'UnaryExpression',\n        UnionTypeAnnotation: 'UnionTypeAnnotation',\n        UpdateExpression: 'UpdateExpression',\n        VariableDeclaration: 'VariableDeclaration',\n        VariableDeclarator: 'VariableDeclarator',\n        VoidTypeAnnotation: 'VoidTypeAnnotation',\n        WhileStatement: 'WhileStatement',\n        WithStatement: 'WithStatement',\n        JSXIdentifier: 'JSXIdentifier',\n        JSXNamespacedName: 'JSXNamespacedName',\n        JSXMemberExpression: 'JSXMemberExpression',\n        JSXEmptyExpression: 'JSXEmptyExpression',\n        JSXExpressionContainer: 'JSXExpressionContainer',\n        JSXElement: 'JSXElement',\n        JSXClosingElement: 'JSXClosingElement',\n        JSXOpeningElement: 'JSXOpeningElement',\n        JSXAttribute: 'JSXAttribute',\n        JSXSpreadAttribute: 'JSXSpreadAttribute',\n        JSXText: 'JSXText',\n        YieldExpression: 'YieldExpression',\n        AwaitExpression: 'AwaitExpression'\n    };\n\n    PropertyKind = {\n        Data: 1,\n        Get: 2,\n        Set: 4\n    };\n\n    ClassPropertyType = {\n        'static': 'static',\n        prototype: 'prototype'\n    };\n\n    // Error messages should be identical to V8.\n    Messages = {\n        UnexpectedToken: 'Unexpected token %0',\n        UnexpectedNumber: 'Unexpected number',\n        UnexpectedString: 'Unexpected string',\n        UnexpectedIdentifier: 'Unexpected identifier',\n        UnexpectedReserved: 'Unexpected reserved word',\n        UnexpectedTemplate: 'Unexpected quasi %0',\n        UnexpectedEOS: 'Unexpected end of input',\n        NewlineAfterThrow: 'Illegal newline after throw',\n        InvalidRegExp: 'Invalid regular expression',\n        UnterminatedRegExp: 'Invalid regular expression: missing /',\n        InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n        InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',\n        InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n        MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n        NoCatchOrFinally: 'Missing catch or finally after try',\n        UnknownLabel: 'Undefined label \\'%0\\'',\n        Redeclaration: '%0 \\'%1\\' has already been declared',\n        IllegalContinue: 'Illegal continue statement',\n        IllegalBreak: 'Illegal break statement',\n        IllegalDuplicateClassProperty: 'Illegal duplicate property in class definition',\n        IllegalClassConstructorProperty: 'Illegal constructor property in class definition',\n        IllegalReturn: 'Illegal return statement',\n        IllegalSpread: 'Illegal spread element',\n        StrictModeWith: 'Strict mode code may not include a with statement',\n        StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n        StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n        StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n        StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n        ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list',\n        DefaultRestParameter: 'Rest parameter can not have a default value',\n        ElementAfterSpreadElement: 'Spread must be the final element of an element list',\n        PropertyAfterSpreadProperty: 'A rest property must be the final property of an object literal',\n        ObjectPatternAsRestParameter: 'Invalid rest parameter',\n        ObjectPatternAsSpread: 'Invalid spread argument',\n        StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n        StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n        StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n        StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n        AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n        AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n        StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n        StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n        StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n        StrictReservedWord: 'Use of future reserved word in strict mode',\n        MissingFromClause: 'Missing from clause',\n        NoAsAfterImportNamespace: 'Missing as after import *',\n        InvalidModuleSpecifier: 'Invalid module specifier',\n        IllegalImportDeclaration: 'Illegal import declaration',\n        IllegalExportDeclaration: 'Illegal export declaration',\n        NoUninitializedConst: 'Const must be initialized',\n        ComprehensionRequiresBlock: 'Comprehension must have at least one block',\n        ComprehensionError: 'Comprehension Error',\n        EachNotAllowed: 'Each is not supported',\n        InvalidJSXAttributeValue: 'JSX value should be either an expression or a quoted JSX text',\n        ExpectedJSXClosingTag: 'Expected corresponding JSX closing tag for %0',\n        AdjacentJSXElements: 'Adjacent JSX elements must be wrapped in an enclosing tag',\n        ConfusedAboutFunctionType: 'Unexpected token =>. It looks like ' +\n            'you are trying to write a function type, but you ended up ' +\n            'writing a grouped type followed by an =>, which is a syntax ' +\n            'error. Remember, function type parameters are named so function ' +\n            'types look like (name1: type1, name2: type2) => returnType. You ' +\n            'probably wrote (type1) => returnType'\n    };\n\n    // See also tools/generate-unicode-regex.py.\n    Regex = {\n        NonAsciiIdentifierStart: new RegExp('[\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\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\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\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-\\u0c33\\u0c35-\\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-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\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-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\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]'),\n        NonAsciiIdentifierPart: new RegExp('[\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0300-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u0483-\\u0487\\u048a-\\u0527\\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\\u08a2-\\u08ac\\u08e4-\\u08fe\\u0900-\\u0963\\u0966-\\u096f\\u0971-\\u0977\\u0979-\\u097f\\u0981-\\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\\u0c01-\\u0c03\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c58\\u0c59\\u0c60-\\u0c63\\u0c66-\\u0c6f\\u0c82\\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\\u0d02\\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\\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-\\u16f0\\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-\\u191c\\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\\u1b00-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1bf3\\u1c00-\\u1c37\\u1c40-\\u1c49\\u1c4d-\\u1c7d\\u1cd0-\\u1cd2\\u1cd4-\\u1cf6\\u1d00-\\u1de6\\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-\\ua697\\ua69f-\\ua6f1\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua827\\ua840-\\ua873\\ua880-\\ua8c4\\ua8d0-\\ua8d9\\ua8e0-\\ua8f7\\ua8fb\\ua900-\\ua92d\\ua930-\\ua953\\ua960-\\ua97c\\ua980-\\ua9c0\\ua9cf-\\ua9d9\\uaa00-\\uaa36\\uaa40-\\uaa4d\\uaa50-\\uaa59\\uaa60-\\uaa76\\uaa7a\\uaa7b\\uaa80-\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaef\\uaaf2-\\uaaf6\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\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-\\ufe26\\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]'),\n        LeadingZeros: new RegExp('^0+(?!$)')\n    };\n\n    // Ensure the condition is true, otherwise throw an error.\n    // This is only to have a better contract semantic, i.e. another safety net\n    // to catch a logic error. The condition shall be fulfilled in normal case.\n    // Do NOT use this to enforce a certain condition on any user input.\n\n    function assert(condition, message) {\n        /* istanbul ignore if */\n        if (!condition) {\n            throw new Error('ASSERT: ' + message);\n        }\n    }\n\n    function StringMap() {\n        this.$data = {};\n    }\n\n    StringMap.prototype.get = function (key) {\n        key = '$' + key;\n        return this.$data[key];\n    };\n\n    StringMap.prototype.set = function (key, value) {\n        key = '$' + key;\n        this.$data[key] = value;\n        return this;\n    };\n\n    StringMap.prototype.has = function (key) {\n        key = '$' + key;\n        return Object.prototype.hasOwnProperty.call(this.$data, key);\n    };\n\n    StringMap.prototype[\"delete\"] = function (key) {\n        key = '$' + key;\n        return delete this.$data[key];\n    };\n\n    function isDecimalDigit(ch) {\n        return (ch >= 48 && ch <= 57);   // 0..9\n    }\n\n    function isHexDigit(ch) {\n        return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n    }\n\n    function isOctalDigit(ch) {\n        return '01234567'.indexOf(ch) >= 0;\n    }\n\n\n    // 7.2 White Space\n\n    function isWhiteSpace(ch) {\n        return (ch === 32) ||  // space\n            (ch === 9) ||      // tab\n            (ch === 0xB) ||\n            (ch === 0xC) ||\n            (ch === 0xA0) ||\n            (ch >= 0x1680 && '\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);\n    }\n\n    // 7.3 Line Terminators\n\n    function isLineTerminator(ch) {\n        return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);\n    }\n\n    // 7.6 Identifier Names and Identifiers\n\n    function isIdentifierStart(ch) {\n        return (ch === 36) || (ch === 95) ||  // $ (dollar) and _ (underscore)\n            (ch >= 65 && ch <= 90) ||         // A..Z\n            (ch >= 97 && ch <= 122) ||        // a..z\n            (ch === 92) ||                    // \\ (backslash)\n            ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n    }\n\n    function isIdentifierPart(ch) {\n        return (ch === 36) || (ch === 95) ||  // $ (dollar) and _ (underscore)\n            (ch >= 65 && ch <= 90) ||         // A..Z\n            (ch >= 97 && ch <= 122) ||        // a..z\n            (ch >= 48 && ch <= 57) ||         // 0..9\n            (ch === 92) ||                    // \\ (backslash)\n            ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n    }\n\n    // 7.6.1.2 Future Reserved Words\n\n    function isFutureReservedWord(id) {\n        switch (id) {\n        case 'class':\n        case 'enum':\n        case 'export':\n        case 'extends':\n        case 'import':\n        case 'super':\n            return true;\n        default:\n            return false;\n        }\n    }\n\n    function isStrictModeReservedWord(id) {\n        switch (id) {\n        case 'implements':\n        case 'interface':\n        case 'package':\n        case 'private':\n        case 'protected':\n        case 'public':\n        case 'static':\n        case 'yield':\n        case 'let':\n            return true;\n        default:\n            return false;\n        }\n    }\n\n    function isRestrictedWord(id) {\n        return id === 'eval' || id === 'arguments';\n    }\n\n    // 7.6.1.1 Keywords\n\n    function isKeyword(id) {\n        if (strict && isStrictModeReservedWord(id)) {\n            return true;\n        }\n\n        // 'const' is specialized as Keyword in V8.\n        // 'yield' is only treated as a keyword in strict mode.\n        // 'let' is for compatiblity with SpiderMonkey and ES.next.\n        // Some others are from future reserved words.\n\n        switch (id.length) {\n        case 2:\n            return (id === 'if') || (id === 'in') || (id === 'do');\n        case 3:\n            return (id === 'var') || (id === 'for') || (id === 'new') ||\n                (id === 'try') || (id === 'let');\n        case 4:\n            return (id === 'this') || (id === 'else') || (id === 'case') ||\n                (id === 'void') || (id === 'with') || (id === 'enum');\n        case 5:\n            return (id === 'while') || (id === 'break') || (id === 'catch') ||\n                (id === 'throw') || (id === 'const') ||\n                (id === 'class') || (id === 'super');\n        case 6:\n            return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n                (id === 'switch') || (id === 'export') || (id === 'import');\n        case 7:\n            return (id === 'default') || (id === 'finally') || (id === 'extends');\n        case 8:\n            return (id === 'function') || (id === 'continue') || (id === 'debugger');\n        case 10:\n            return (id === 'instanceof');\n        default:\n            return false;\n        }\n    }\n\n    // 7.4 Comments\n\n    function addComment(type, value, start, end, loc) {\n        var comment;\n        assert(typeof start === 'number', 'Comment must have valid position');\n\n        // Because the way the actual token is scanned, often the comments\n        // (if any) are skipped twice during the lexical analysis.\n        // Thus, we need to skip adding a comment if the comment array already\n        // handled it.\n        if (state.lastCommentStart >= start) {\n            return;\n        }\n        state.lastCommentStart = start;\n\n        comment = {\n            type: type,\n            value: value\n        };\n        if (extra.range) {\n            comment.range = [start, end];\n        }\n        if (extra.loc) {\n            comment.loc = loc;\n        }\n        extra.comments.push(comment);\n        if (extra.attachComment) {\n            extra.leadingComments.push(comment);\n            extra.trailingComments.push(comment);\n        }\n    }\n\n    function skipSingleLineComment() {\n        var start, loc, ch, comment;\n\n        start = index - 2;\n        loc = {\n            start: {\n                line: lineNumber,\n                column: index - lineStart - 2\n            }\n        };\n\n        while (index < length) {\n            ch = source.charCodeAt(index);\n            ++index;\n            if (isLineTerminator(ch)) {\n                if (extra.comments) {\n                    comment = source.slice(start + 2, index - 1);\n                    loc.end = {\n                        line: lineNumber,\n                        column: index - lineStart - 1\n                    };\n                    addComment('Line', comment, start, index - 1, loc);\n                }\n                if (ch === 13 && source.charCodeAt(index) === 10) {\n                    ++index;\n                }\n                ++lineNumber;\n                lineStart = index;\n                return;\n            }\n        }\n\n        if (extra.comments) {\n            comment = source.slice(start + 2, index);\n            loc.end = {\n                line: lineNumber,\n                column: index - lineStart\n            };\n            addComment('Line', comment, start, index, loc);\n        }\n    }\n\n    function skipMultiLineComment() {\n        var start, loc, ch, comment;\n\n        if (extra.comments) {\n            start = index - 2;\n            loc = {\n                start: {\n                    line: lineNumber,\n                    column: index - lineStart - 2\n                }\n            };\n        }\n\n        while (index < length) {\n            ch = source.charCodeAt(index);\n            if (isLineTerminator(ch)) {\n                if (ch === 13 && source.charCodeAt(index + 1) === 10) {\n                    ++index;\n                }\n                ++lineNumber;\n                ++index;\n                lineStart = index;\n                if (index >= length) {\n                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n                }\n            } else if (ch === 42) {\n                // Block comment ends with '*/' (char #42, char #47).\n                if (source.charCodeAt(index + 1) === 47) {\n                    ++index;\n                    ++index;\n                    if (extra.comments) {\n                        comment = source.slice(start + 2, index - 2);\n                        loc.end = {\n                            line: lineNumber,\n                            column: index - lineStart\n                        };\n                        addComment('Block', comment, start, index, loc);\n                    }\n                    return;\n                }\n                ++index;\n            } else {\n                ++index;\n            }\n        }\n\n        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n    }\n\n    function skipComment() {\n        var ch;\n\n        while (index < length) {\n            ch = source.charCodeAt(index);\n\n            if (isWhiteSpace(ch)) {\n                ++index;\n            } else if (isLineTerminator(ch)) {\n                ++index;\n                if (ch === 13 && source.charCodeAt(index) === 10) {\n                    ++index;\n                }\n                ++lineNumber;\n                lineStart = index;\n            } else if (ch === 47) { // 47 is '/'\n                ch = source.charCodeAt(index + 1);\n                if (ch === 47) {\n                    ++index;\n                    ++index;\n                    skipSingleLineComment();\n                } else if (ch === 42) {  // 42 is '*'\n                    ++index;\n                    ++index;\n                    skipMultiLineComment();\n                } else {\n                    break;\n                }\n            } else {\n                break;\n            }\n        }\n    }\n\n    function scanHexEscape(prefix) {\n        var i, len, ch, code = 0;\n\n        len = (prefix === 'u') ? 4 : 2;\n        for (i = 0; i < len; ++i) {\n            if (index < length && isHexDigit(source[index])) {\n                ch = source[index++];\n                code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n            } else {\n                return '';\n            }\n        }\n        return String.fromCharCode(code);\n    }\n\n    function scanUnicodeCodePointEscape() {\n        var ch, code, cu1, cu2;\n\n        ch = source[index];\n        code = 0;\n\n        // At least, one hex digit is required.\n        if (ch === '}') {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        while (index < length) {\n            ch = source[index++];\n            if (!isHexDigit(ch)) {\n                break;\n            }\n            code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n        }\n\n        if (code > 0x10FFFF || ch !== '}') {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        // UTF-16 Encoding\n        if (code <= 0xFFFF) {\n            return String.fromCharCode(code);\n        }\n        cu1 = ((code - 0x10000) >> 10) + 0xD800;\n        cu2 = ((code - 0x10000) & 1023) + 0xDC00;\n        return String.fromCharCode(cu1, cu2);\n    }\n\n    function getEscapedIdentifier() {\n        var ch, id;\n\n        ch = source.charCodeAt(index++);\n        id = String.fromCharCode(ch);\n\n        // '\\u' (char #92, char #117) denotes an escaped character.\n        if (ch === 92) {\n            if (source.charCodeAt(index) !== 117) {\n                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n            }\n            ++index;\n            ch = scanHexEscape('u');\n            if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n            }\n            id = ch;\n        }\n\n        while (index < length) {\n            ch = source.charCodeAt(index);\n            if (!isIdentifierPart(ch)) {\n                break;\n            }\n            ++index;\n            id += String.fromCharCode(ch);\n\n            // '\\u' (char #92, char #117) denotes an escaped character.\n            if (ch === 92) {\n                id = id.substr(0, id.length - 1);\n                if (source.charCodeAt(index) !== 117) {\n                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n                }\n                ++index;\n                ch = scanHexEscape('u');\n                if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n                }\n                id += ch;\n            }\n        }\n\n        return id;\n    }\n\n    function getIdentifier() {\n        var start, ch;\n\n        start = index++;\n        while (index < length) {\n            ch = source.charCodeAt(index);\n            if (ch === 92) {\n                // Blackslash (char #92) marks Unicode escape sequence.\n                index = start;\n                return getEscapedIdentifier();\n            }\n            if (isIdentifierPart(ch)) {\n                ++index;\n            } else {\n                break;\n            }\n        }\n\n        return source.slice(start, index);\n    }\n\n    function scanIdentifier() {\n        var start, id, type;\n\n        start = index;\n\n        // Backslash (char #92) starts an escaped character.\n        id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();\n\n        // There is no keyword or literal with only one character.\n        // Thus, it must be an identifier.\n        if (id.length === 1) {\n            type = Token.Identifier;\n        } else if (isKeyword(id)) {\n            type = Token.Keyword;\n        } else if (id === 'null') {\n            type = Token.NullLiteral;\n        } else if (id === 'true' || id === 'false') {\n            type = Token.BooleanLiteral;\n        } else {\n            type = Token.Identifier;\n        }\n\n        return {\n            type: type,\n            value: id,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n\n    // 7.7 Punctuators\n\n    function scanPunctuator() {\n        var start = index,\n            code = source.charCodeAt(index),\n            code2,\n            ch1 = source[index],\n            ch2,\n            ch3,\n            ch4;\n\n        if (state.inJSXTag || state.inJSXChild) {\n            // Don't need to check for '{' and '}' as it's already handled\n            // correctly by default.\n            switch (code) {\n            case 60:  // <\n            case 62:  // >\n                ++index;\n                return {\n                    type: Token.Punctuator,\n                    value: String.fromCharCode(code),\n                    lineNumber: lineNumber,\n                    lineStart: lineStart,\n                    range: [start, index]\n                };\n            }\n        }\n\n        switch (code) {\n        // Check for most common single-character punctuators.\n        case 40:   // ( open bracket\n        case 41:   // ) close bracket\n        case 59:   // ; semicolon\n        case 44:   // , comma\n        case 123:  // { open curly brace\n        case 125:  // } close curly brace\n        case 91:   // [\n        case 93:   // ]\n        case 58:   // :\n        case 63:   // ?\n        case 126:  // ~\n            ++index;\n            if (extra.tokenize) {\n                if (code === 40) {\n                    extra.openParenToken = extra.tokens.length;\n                } else if (code === 123) {\n                    extra.openCurlyToken = extra.tokens.length;\n                }\n            }\n            return {\n                type: Token.Punctuator,\n                value: String.fromCharCode(code),\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n\n        default:\n            code2 = source.charCodeAt(index + 1);\n\n            // '=' (char #61) marks an assignment or comparison operator.\n            if (code2 === 61) {\n                switch (code) {\n                case 37:  // %\n                case 38:  // &\n                case 42:  // *:\n                case 43:  // +\n                case 45:  // -\n                case 47:  // /\n                case 60:  // <\n                case 62:  // >\n                case 94:  // ^\n                case 124: // |\n                    index += 2;\n                    return {\n                        type: Token.Punctuator,\n                        value: String.fromCharCode(code) + String.fromCharCode(code2),\n                        lineNumber: lineNumber,\n                        lineStart: lineStart,\n                        range: [start, index]\n                    };\n\n                case 33: // !\n                case 61: // =\n                    index += 2;\n\n                    // !== and ===\n                    if (source.charCodeAt(index) === 61) {\n                        ++index;\n                    }\n                    return {\n                        type: Token.Punctuator,\n                        value: source.slice(start, index),\n                        lineNumber: lineNumber,\n                        lineStart: lineStart,\n                        range: [start, index]\n                    };\n                default:\n                    break;\n                }\n            }\n            break;\n        }\n\n        // Peek more characters.\n\n        ch2 = source[index + 1];\n        ch3 = source[index + 2];\n        ch4 = source[index + 3];\n\n        // 4-character punctuator: >>>=\n\n        if (ch1 === '>' && ch2 === '>' && ch3 === '>') {\n            if (ch4 === '=') {\n                index += 4;\n                return {\n                    type: Token.Punctuator,\n                    value: '>>>=',\n                    lineNumber: lineNumber,\n                    lineStart: lineStart,\n                    range: [start, index]\n                };\n            }\n        }\n\n        // 3-character punctuators: === !== >>> <<= >>=\n\n        if (ch1 === '>' && ch2 === '>' && ch3 === '>' && !state.inType) {\n            index += 3;\n            return {\n                type: Token.Punctuator,\n                value: '>>>',\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if (ch1 === '<' && ch2 === '<' && ch3 === '=') {\n            index += 3;\n            return {\n                type: Token.Punctuator,\n                value: '<<=',\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if (ch1 === '>' && ch2 === '>' && ch3 === '=') {\n            index += 3;\n            return {\n                type: Token.Punctuator,\n                value: '>>=',\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if (ch1 === '.' && ch2 === '.' && ch3 === '.') {\n            index += 3;\n            return {\n                type: Token.Punctuator,\n                value: '...',\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        // Other 2-character punctuators: ++ -- << >> && ||\n\n        // Don't match these tokens if we're in a type, since they never can\n        // occur and can mess up types like Map<string, Array<string>>\n        if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0) && !state.inType) {\n            index += 2;\n            return {\n                type: Token.Punctuator,\n                value: ch1 + ch2,\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if (ch1 === '=' && ch2 === '>') {\n            index += 2;\n            return {\n                type: Token.Punctuator,\n                value: '=>',\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {\n            ++index;\n            return {\n                type: Token.Punctuator,\n                value: ch1,\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        if (ch1 === '.') {\n            ++index;\n            return {\n                type: Token.Punctuator,\n                value: ch1,\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n    }\n\n    // 7.8.3 Numeric Literals\n\n    function scanHexLiteral(start) {\n        var number = '';\n\n        while (index < length) {\n            if (!isHexDigit(source[index])) {\n                break;\n            }\n            number += source[index++];\n        }\n\n        if (number.length === 0) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        if (isIdentifierStart(source.charCodeAt(index))) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        return {\n            type: Token.NumericLiteral,\n            value: parseInt('0x' + number, 16),\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanBinaryLiteral(start) {\n        var ch, number;\n\n        number = '';\n\n        while (index < length) {\n            ch = source[index];\n            if (ch !== '0' && ch !== '1') {\n                break;\n            }\n            number += source[index++];\n        }\n\n        if (number.length === 0) {\n            // only 0b or 0B\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        if (index < length) {\n            ch = source.charCodeAt(index);\n            /* istanbul ignore else */\n            if (isIdentifierStart(ch) || isDecimalDigit(ch)) {\n                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n            }\n        }\n\n        return {\n            type: Token.NumericLiteral,\n            value: parseInt(number, 2),\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanOctalLiteral(prefix, start) {\n        var number, octal;\n\n        if (isOctalDigit(prefix)) {\n            octal = true;\n            number = '0' + source[index++];\n        } else {\n            octal = false;\n            ++index;\n            number = '';\n        }\n\n        while (index < length) {\n            if (!isOctalDigit(source[index])) {\n                break;\n            }\n            number += source[index++];\n        }\n\n        if (!octal && number.length === 0) {\n            // only 0o or 0O\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        return {\n            type: Token.NumericLiteral,\n            value: parseInt(number, 8),\n            octal: octal,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanNumericLiteral() {\n        var number, start, ch;\n\n        ch = source[index];\n        assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),\n            'Numeric literal must start with a decimal digit or a decimal point');\n\n        start = index;\n        number = '';\n        if (ch !== '.') {\n            number = source[index++];\n            ch = source[index];\n\n            // Hex number starts with '0x'.\n            // Octal number starts with '0'.\n            // Octal number in ES6 starts with '0o'.\n            // Binary number in ES6 starts with '0b'.\n            if (number === '0') {\n                if (ch === 'x' || ch === 'X') {\n                    ++index;\n                    return scanHexLiteral(start);\n                }\n                if (ch === 'b' || ch === 'B') {\n                    ++index;\n                    return scanBinaryLiteral(start);\n                }\n                if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {\n                    return scanOctalLiteral(ch, start);\n                }\n                // decimal number starts with '0' such as '09' is illegal.\n                if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n                }\n            }\n\n            while (isDecimalDigit(source.charCodeAt(index))) {\n                number += source[index++];\n            }\n            ch = source[index];\n        }\n\n        if (ch === '.') {\n            number += source[index++];\n            while (isDecimalDigit(source.charCodeAt(index))) {\n                number += source[index++];\n            }\n            ch = source[index];\n        }\n\n        if (ch === 'e' || ch === 'E') {\n            number += source[index++];\n\n            ch = source[index];\n            if (ch === '+' || ch === '-') {\n                number += source[index++];\n            }\n            if (isDecimalDigit(source.charCodeAt(index))) {\n                while (isDecimalDigit(source.charCodeAt(index))) {\n                    number += source[index++];\n                }\n            } else {\n                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n            }\n        }\n\n        if (isIdentifierStart(source.charCodeAt(index))) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        return {\n            type: Token.NumericLiteral,\n            value: parseFloat(number),\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    // 7.8.4 String Literals\n\n    function scanStringLiteral() {\n        var str = '', quote, start, ch, code, unescaped, restore, octal = false;\n\n        quote = source[index];\n        assert((quote === '\\'' || quote === '\"'),\n            'String literal must starts with a quote');\n\n        start = index;\n        ++index;\n\n        while (index < length) {\n            ch = source[index++];\n\n            if (ch === quote) {\n                quote = '';\n                break;\n            } else if (ch === '\\\\') {\n                ch = source[index++];\n                if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n                    switch (ch) {\n                    case 'n':\n                        str += '\\n';\n                        break;\n                    case 'r':\n                        str += '\\r';\n                        break;\n                    case 't':\n                        str += '\\t';\n                        break;\n                    case 'u':\n                    case 'x':\n                        if (source[index] === '{') {\n                            ++index;\n                            str += scanUnicodeCodePointEscape();\n                        } else {\n                            restore = index;\n                            unescaped = scanHexEscape(ch);\n                            if (unescaped) {\n                                str += unescaped;\n                            } else {\n                                index = restore;\n                                str += ch;\n                            }\n                        }\n                        break;\n                    case 'b':\n                        str += '\\b';\n                        break;\n                    case 'f':\n                        str += '\\f';\n                        break;\n                    case 'v':\n                        str += '\\x0B';\n                        break;\n\n                    default:\n                        if (isOctalDigit(ch)) {\n                            code = '01234567'.indexOf(ch);\n\n                            // \\0 is not octal escape sequence\n                            if (code !== 0) {\n                                octal = true;\n                            }\n\n                            /* istanbul ignore else */\n                            if (index < length && isOctalDigit(source[index])) {\n                                octal = true;\n                                code = code * 8 + '01234567'.indexOf(source[index++]);\n\n                                // 3 digits are only allowed when string starts\n                                // with 0, 1, 2, 3\n                                if ('0123'.indexOf(ch) >= 0 &&\n                                        index < length &&\n                                        isOctalDigit(source[index])) {\n                                    code = code * 8 + '01234567'.indexOf(source[index++]);\n                                }\n                            }\n                            str += String.fromCharCode(code);\n                        } else {\n                            str += ch;\n                        }\n                        break;\n                    }\n                } else {\n                    ++lineNumber;\n                    if (ch === '\\r' && source[index] === '\\n') {\n                        ++index;\n                    }\n                    lineStart = index;\n                }\n            } else if (isLineTerminator(ch.charCodeAt(0))) {\n                break;\n            } else {\n                str += ch;\n            }\n        }\n\n        if (quote !== '') {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        return {\n            type: Token.StringLiteral,\n            value: str,\n            octal: octal,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanTemplate() {\n        var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;\n\n        terminated = false;\n        tail = false;\n        start = index;\n\n        ++index;\n\n        while (index < length) {\n            ch = source[index++];\n            if (ch === '`') {\n                tail = true;\n                terminated = true;\n                break;\n            } else if (ch === '$') {\n                if (source[index] === '{') {\n                    ++index;\n                    terminated = true;\n                    break;\n                }\n                cooked += ch;\n            } else if (ch === '\\\\') {\n                ch = source[index++];\n                if (!isLineTerminator(ch.charCodeAt(0))) {\n                    switch (ch) {\n                    case 'n':\n                        cooked += '\\n';\n                        break;\n                    case 'r':\n                        cooked += '\\r';\n                        break;\n                    case 't':\n                        cooked += '\\t';\n                        break;\n                    case 'u':\n                    case 'x':\n                        if (source[index] === '{') {\n                            ++index;\n                            cooked += scanUnicodeCodePointEscape();\n                        } else {\n                            restore = index;\n                            unescaped = scanHexEscape(ch);\n                            if (unescaped) {\n                                cooked += unescaped;\n                            } else {\n                                index = restore;\n                                cooked += ch;\n                            }\n                        }\n                        break;\n                    case 'b':\n                        cooked += '\\b';\n                        break;\n                    case 'f':\n                        cooked += '\\f';\n                        break;\n                    case 'v':\n                        cooked += '\\v';\n                        break;\n\n                    default:\n                        if (isOctalDigit(ch)) {\n                            code = '01234567'.indexOf(ch);\n\n                            // \\0 is not octal escape sequence\n                            if (code !== 0) {\n                                octal = true;\n                            }\n\n                            /* istanbul ignore else */\n                            if (index < length && isOctalDigit(source[index])) {\n                                octal = true;\n                                code = code * 8 + '01234567'.indexOf(source[index++]);\n\n                                // 3 digits are only allowed when string starts\n                                // with 0, 1, 2, 3\n                                if ('0123'.indexOf(ch) >= 0 &&\n                                        index < length &&\n                                        isOctalDigit(source[index])) {\n                                    code = code * 8 + '01234567'.indexOf(source[index++]);\n                                }\n                            }\n                            cooked += String.fromCharCode(code);\n                        } else {\n                            cooked += ch;\n                        }\n                        break;\n                    }\n                } else {\n                    ++lineNumber;\n                    if (ch === '\\r' && source[index] === '\\n') {\n                        ++index;\n                    }\n                    lineStart = index;\n                }\n            } else if (isLineTerminator(ch.charCodeAt(0))) {\n                ++lineNumber;\n                if (ch === '\\r' && source[index] === '\\n') {\n                    ++index;\n                }\n                lineStart = index;\n                cooked += '\\n';\n            } else {\n                cooked += ch;\n            }\n        }\n\n        if (!terminated) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        return {\n            type: Token.Template,\n            value: {\n                cooked: cooked,\n                raw: source.slice(start + 1, index - ((tail) ? 1 : 2))\n            },\n            tail: tail,\n            octal: octal,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanTemplateElement(option) {\n        var startsWith, template;\n\n        lookahead = null;\n        skipComment();\n\n        startsWith = (option.head) ? '`' : '}';\n\n        if (source[index] !== startsWith) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        template = scanTemplate();\n\n        peek();\n\n        return template;\n    }\n\n    function testRegExp(pattern, flags) {\n        var tmp = pattern,\n            value;\n\n        if (flags.indexOf('u') >= 0) {\n            // Replace each astral symbol and every Unicode code point\n            // escape sequence with a single ASCII symbol to avoid throwing on\n            // regular expressions that are only valid in combination with the\n            // `/u` flag.\n            // Note: replacing with the ASCII symbol `x` might cause false\n            // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n            // perfectly valid pattern that is equivalent to `[a-b]`, but it\n            // would be replaced by `[x-b]` which throws an error.\n            tmp = tmp\n                .replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function ($0, $1) {\n                    if (parseInt($1, 16) <= 0x10FFFF) {\n                        return 'x';\n                    }\n                    throwError({}, Messages.InvalidRegExp);\n                })\n                .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n        }\n\n        // First, detect invalid regular expressions.\n        try {\n            value = new RegExp(tmp);\n        } catch (e) {\n            throwError({}, Messages.InvalidRegExp);\n        }\n\n        // Return a regular expression object for this pattern-flag pair, or\n        // `null` in case the current environment doesn't support the flags it\n        // uses.\n        try {\n            return new RegExp(pattern, flags);\n        } catch (exception) {\n            return null;\n        }\n    }\n\n    function scanRegExpBody() {\n        var ch, str, classMarker, terminated, body;\n\n        ch = source[index];\n        assert(ch === '/', 'Regular expression literal must start with a slash');\n        str = source[index++];\n\n        classMarker = false;\n        terminated = false;\n        while (index < length) {\n            ch = source[index++];\n            str += ch;\n            if (ch === '\\\\') {\n                ch = source[index++];\n                // ECMA-262 7.8.5\n                if (isLineTerminator(ch.charCodeAt(0))) {\n                    throwError({}, Messages.UnterminatedRegExp);\n                }\n                str += ch;\n            } else if (isLineTerminator(ch.charCodeAt(0))) {\n                throwError({}, Messages.UnterminatedRegExp);\n            } else if (classMarker) {\n                if (ch === ']') {\n                    classMarker = false;\n                }\n            } else {\n                if (ch === '/') {\n                    terminated = true;\n                    break;\n                } else if (ch === '[') {\n                    classMarker = true;\n                }\n            }\n        }\n\n        if (!terminated) {\n            throwError({}, Messages.UnterminatedRegExp);\n        }\n\n        // Exclude leading and trailing slash.\n        body = str.substr(1, str.length - 2);\n        return {\n            value: body,\n            literal: str\n        };\n    }\n\n    function scanRegExpFlags() {\n        var ch, str, flags, restore;\n\n        str = '';\n        flags = '';\n        while (index < length) {\n            ch = source[index];\n            if (!isIdentifierPart(ch.charCodeAt(0))) {\n                break;\n            }\n\n            ++index;\n            if (ch === '\\\\' && index < length) {\n                ch = source[index];\n                if (ch === 'u') {\n                    ++index;\n                    restore = index;\n                    ch = scanHexEscape('u');\n                    if (ch) {\n                        flags += ch;\n                        for (str += '\\\\u'; restore < index; ++restore) {\n                            str += source[restore];\n                        }\n                    } else {\n                        index = restore;\n                        flags += 'u';\n                        str += '\\\\u';\n                    }\n                    throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n                } else {\n                    str += '\\\\';\n                    throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n                }\n            } else {\n                flags += ch;\n                str += ch;\n            }\n        }\n\n        return {\n            value: flags,\n            literal: str\n        };\n    }\n\n    function scanRegExp() {\n        var start, body, flags, value;\n\n        lookahead = null;\n        skipComment();\n        start = index;\n\n        body = scanRegExpBody();\n        flags = scanRegExpFlags();\n        value = testRegExp(body.value, flags.value);\n\n        if (extra.tokenize) {\n            return {\n                type: Token.RegularExpression,\n                value: value,\n                regex: {\n                    pattern: body.value,\n                    flags: flags.value\n                },\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [start, index]\n            };\n        }\n\n        return {\n            literal: body.literal + flags.literal,\n            value: value,\n            regex: {\n                pattern: body.value,\n                flags: flags.value\n            },\n            range: [start, index]\n        };\n    }\n\n    function isIdentifierName(token) {\n        return token.type === Token.Identifier ||\n            token.type === Token.Keyword ||\n            token.type === Token.BooleanLiteral ||\n            token.type === Token.NullLiteral;\n    }\n\n    function advanceSlash() {\n        var prevToken,\n            checkToken;\n        // Using the following algorithm:\n        // https://github.com/mozilla/sweet.js/wiki/design\n        prevToken = extra.tokens[extra.tokens.length - 1];\n        if (!prevToken) {\n            // Nothing before that: it cannot be a division.\n            return scanRegExp();\n        }\n        if (prevToken.type === 'Punctuator') {\n            if (prevToken.value === ')') {\n                checkToken = extra.tokens[extra.openParenToken - 1];\n                if (checkToken &&\n                        checkToken.type === 'Keyword' &&\n                        (checkToken.value === 'if' ||\n                         checkToken.value === 'while' ||\n                         checkToken.value === 'for' ||\n                         checkToken.value === 'with')) {\n                    return scanRegExp();\n                }\n                return scanPunctuator();\n            }\n            if (prevToken.value === '}') {\n                // Dividing a function by anything makes little sense,\n                // but we have to check for that.\n                if (extra.tokens[extra.openCurlyToken - 3] &&\n                        extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n                    // Anonymous function.\n                    checkToken = extra.tokens[extra.openCurlyToken - 4];\n                    if (!checkToken) {\n                        return scanPunctuator();\n                    }\n                } else if (extra.tokens[extra.openCurlyToken - 4] &&\n                        extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n                    // Named function.\n                    checkToken = extra.tokens[extra.openCurlyToken - 5];\n                    if (!checkToken) {\n                        return scanRegExp();\n                    }\n                } else {\n                    return scanPunctuator();\n                }\n                // checkToken determines whether the function is\n                // a declaration or an expression.\n                if (FnExprTokens.indexOf(checkToken.value) >= 0) {\n                    // It is an expression.\n                    return scanPunctuator();\n                }\n                // It is a declaration.\n                return scanRegExp();\n            }\n            return scanRegExp();\n        }\n        if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n            return scanRegExp();\n        }\n        return scanPunctuator();\n    }\n\n    function advance() {\n        var ch;\n\n        if (!state.inJSXChild) {\n            skipComment();\n        }\n\n        if (index >= length) {\n            return {\n                type: Token.EOF,\n                lineNumber: lineNumber,\n                lineStart: lineStart,\n                range: [index, index]\n            };\n        }\n\n        if (state.inJSXChild) {\n            return advanceJSXChild();\n        }\n\n        ch = source.charCodeAt(index);\n\n        // Very common: ( and ) and ;\n        if (ch === 40 || ch === 41 || ch === 58) {\n            return scanPunctuator();\n        }\n\n        // String literal starts with single quote (#39) or double quote (#34).\n        if (ch === 39 || ch === 34) {\n            if (state.inJSXTag) {\n                return scanJSXStringLiteral();\n            }\n            return scanStringLiteral();\n        }\n\n        if (state.inJSXTag && isJSXIdentifierStart(ch)) {\n            return scanJSXIdentifier();\n        }\n\n        if (ch === 96) {\n            return scanTemplate();\n        }\n        if (isIdentifierStart(ch)) {\n            return scanIdentifier();\n        }\n\n        // Dot (.) char #46 can also start a floating-point number, hence the need\n        // to check the next character.\n        if (ch === 46) {\n            if (isDecimalDigit(source.charCodeAt(index + 1))) {\n                return scanNumericLiteral();\n            }\n            return scanPunctuator();\n        }\n\n        if (isDecimalDigit(ch)) {\n            return scanNumericLiteral();\n        }\n\n        // Slash (/) char #47 can also start a regex.\n        if (extra.tokenize && ch === 47) {\n            return advanceSlash();\n        }\n\n        return scanPunctuator();\n    }\n\n    function lex() {\n        var token;\n\n        token = lookahead;\n        index = token.range[1];\n        lineNumber = token.lineNumber;\n        lineStart = token.lineStart;\n\n        lookahead = advance();\n\n        index = token.range[1];\n        lineNumber = token.lineNumber;\n        lineStart = token.lineStart;\n\n        return token;\n    }\n\n    function peek() {\n        var pos, line, start;\n\n        pos = index;\n        line = lineNumber;\n        start = lineStart;\n        lookahead = advance();\n        index = pos;\n        lineNumber = line;\n        lineStart = start;\n    }\n\n    function lookahead2() {\n        var adv, pos, line, start, result;\n\n        // If we are collecting the tokens, don't grab the next one yet.\n        /* istanbul ignore next */\n        adv = (typeof extra.advance === 'function') ? extra.advance : advance;\n\n        pos = index;\n        line = lineNumber;\n        start = lineStart;\n\n        // Scan for the next immediate token.\n        /* istanbul ignore if */\n        if (lookahead === null) {\n            lookahead = adv();\n        }\n        index = lookahead.range[1];\n        lineNumber = lookahead.lineNumber;\n        lineStart = lookahead.lineStart;\n\n        // Grab the token right after.\n        result = adv();\n        index = pos;\n        lineNumber = line;\n        lineStart = start;\n\n        return result;\n    }\n\n    function rewind(token) {\n        index = token.range[0];\n        lineNumber = token.lineNumber;\n        lineStart = token.lineStart;\n        lookahead = token;\n    }\n\n    function markerCreate() {\n        if (!extra.loc && !extra.range) {\n            return undefined;\n        }\n        skipComment();\n        return {offset: index, line: lineNumber, col: index - lineStart};\n    }\n\n    function markerCreatePreserveWhitespace() {\n        if (!extra.loc && !extra.range) {\n            return undefined;\n        }\n        return {offset: index, line: lineNumber, col: index - lineStart};\n    }\n\n    function processComment(node) {\n        var lastChild,\n            trailingComments,\n            bottomRight = extra.bottomRightStack,\n            last = bottomRight[bottomRight.length - 1];\n\n        if (node.type === Syntax.Program) {\n            /* istanbul ignore else */\n            if (node.body.length > 0) {\n                return;\n            }\n        }\n\n        if (extra.trailingComments.length > 0) {\n            if (extra.trailingComments[0].range[0] >= node.range[1]) {\n                trailingComments = extra.trailingComments;\n                extra.trailingComments = [];\n            } else {\n                extra.trailingComments.length = 0;\n            }\n        } else {\n            if (last && last.trailingComments && last.trailingComments[0].range[0] >= node.range[1]) {\n                trailingComments = last.trailingComments;\n                delete last.trailingComments;\n            }\n        }\n\n        // Eating the stack.\n        if (last) {\n            while (last && last.range[0] >= node.range[0]) {\n                lastChild = last;\n                last = bottomRight.pop();\n            }\n        }\n\n        if (lastChild) {\n            if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) {\n                node.leadingComments = lastChild.leadingComments;\n                delete lastChild.leadingComments;\n            }\n        } else if (extra.leadingComments.length > 0 && extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) {\n            node.leadingComments = extra.leadingComments;\n            extra.leadingComments = [];\n        }\n\n        if (trailingComments) {\n            node.trailingComments = trailingComments;\n        }\n\n        bottomRight.push(node);\n    }\n\n    function markerApply(marker, node) {\n        if (extra.range) {\n            node.range = [marker.offset, index];\n        }\n        if (extra.loc) {\n            node.loc = {\n                start: {\n                    line: marker.line,\n                    column: marker.col\n                },\n                end: {\n                    line: lineNumber,\n                    column: index - lineStart\n                }\n            };\n            node = delegate.postProcess(node);\n        }\n        if (extra.attachComment) {\n            processComment(node);\n        }\n        return node;\n    }\n\n    SyntaxTreeDelegate = {\n\n        name: 'SyntaxTree',\n\n        postProcess: function (node) {\n            return node;\n        },\n\n        createArrayExpression: function (elements) {\n            return {\n                type: Syntax.ArrayExpression,\n                elements: elements\n            };\n        },\n\n        createAssignmentExpression: function (operator, left, right) {\n            return {\n                type: Syntax.AssignmentExpression,\n                operator: operator,\n                left: left,\n                right: right\n            };\n        },\n\n        createBinaryExpression: function (operator, left, right) {\n            var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :\n                        Syntax.BinaryExpression;\n            return {\n                type: type,\n                operator: operator,\n                left: left,\n                right: right\n            };\n        },\n\n        createBlockStatement: function (body) {\n            return {\n                type: Syntax.BlockStatement,\n                body: body\n            };\n        },\n\n        createBreakStatement: function (label) {\n            return {\n                type: Syntax.BreakStatement,\n                label: label\n            };\n        },\n\n        createCallExpression: function (callee, args) {\n            return {\n                type: Syntax.CallExpression,\n                callee: callee,\n                'arguments': args\n            };\n        },\n\n        createCatchClause: function (param, body) {\n            return {\n                type: Syntax.CatchClause,\n                param: param,\n                body: body\n            };\n        },\n\n        createConditionalExpression: function (test, consequent, alternate) {\n            return {\n                type: Syntax.ConditionalExpression,\n                test: test,\n                consequent: consequent,\n                alternate: alternate\n            };\n        },\n\n        createContinueStatement: function (label) {\n            return {\n                type: Syntax.ContinueStatement,\n                label: label\n            };\n        },\n\n        createDebuggerStatement: function () {\n            return {\n                type: Syntax.DebuggerStatement\n            };\n        },\n\n        createDoWhileStatement: function (body, test) {\n            return {\n                type: Syntax.DoWhileStatement,\n                body: body,\n                test: test\n            };\n        },\n\n        createEmptyStatement: function () {\n            return {\n                type: Syntax.EmptyStatement\n            };\n        },\n\n        createExpressionStatement: function (expression) {\n            return {\n                type: Syntax.ExpressionStatement,\n                expression: expression\n            };\n        },\n\n        createForStatement: function (init, test, update, body) {\n            return {\n                type: Syntax.ForStatement,\n                init: init,\n                test: test,\n                update: update,\n                body: body\n            };\n        },\n\n        createForInStatement: function (left, right, body) {\n            return {\n                type: Syntax.ForInStatement,\n                left: left,\n                right: right,\n                body: body,\n                each: false\n            };\n        },\n\n        createForOfStatement: function (left, right, body) {\n            return {\n                type: Syntax.ForOfStatement,\n                left: left,\n                right: right,\n                body: body\n            };\n        },\n\n        createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,\n                                             isAsync, returnType, typeParameters) {\n            var funDecl = {\n                type: Syntax.FunctionDeclaration,\n                id: id,\n                params: params,\n                defaults: defaults,\n                body: body,\n                rest: rest,\n                generator: generator,\n                expression: expression,\n                returnType: returnType,\n                typeParameters: typeParameters\n            };\n\n            if (isAsync) {\n                funDecl.async = true;\n            }\n\n            return funDecl;\n        },\n\n        createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,\n                                            isAsync, returnType, typeParameters) {\n            var funExpr = {\n                type: Syntax.FunctionExpression,\n                id: id,\n                params: params,\n                defaults: defaults,\n                body: body,\n                rest: rest,\n                generator: generator,\n                expression: expression,\n                returnType: returnType,\n                typeParameters: typeParameters\n            };\n\n            if (isAsync) {\n                funExpr.async = true;\n            }\n\n            return funExpr;\n        },\n\n        createIdentifier: function (name) {\n            return {\n                type: Syntax.Identifier,\n                name: name,\n                // Only here to initialize the shape of the object to ensure\n                // that the 'typeAnnotation' key is ordered before others that\n                // are added later (like 'loc' and 'range'). This just helps\n                // keep the shape of Identifier nodes consistent with everything\n                // else.\n                typeAnnotation: undefined,\n                optional: undefined\n            };\n        },\n\n        createTypeAnnotation: function (typeAnnotation) {\n            return {\n                type: Syntax.TypeAnnotation,\n                typeAnnotation: typeAnnotation\n            };\n        },\n\n        createTypeCast: function (expression, typeAnnotation) {\n            return {\n                type: Syntax.TypeCastExpression,\n                expression: expression,\n                typeAnnotation: typeAnnotation\n            };\n        },\n\n        createFunctionTypeAnnotation: function (params, returnType, rest, typeParameters) {\n            return {\n                type: Syntax.FunctionTypeAnnotation,\n                params: params,\n                returnType: returnType,\n                rest: rest,\n                typeParameters: typeParameters\n            };\n        },\n\n        createFunctionTypeParam: function (name, typeAnnotation, optional) {\n            return {\n                type: Syntax.FunctionTypeParam,\n                name: name,\n                typeAnnotation: typeAnnotation,\n                optional: optional\n            };\n        },\n\n        createNullableTypeAnnotation: function (typeAnnotation) {\n            return {\n                type: Syntax.NullableTypeAnnotation,\n                typeAnnotation: typeAnnotation\n            };\n        },\n\n        createArrayTypeAnnotation: function (elementType) {\n            return {\n                type: Syntax.ArrayTypeAnnotation,\n                elementType: elementType\n            };\n        },\n\n        createGenericTypeAnnotation: function (id, typeParameters) {\n            return {\n                type: Syntax.GenericTypeAnnotation,\n                id: id,\n                typeParameters: typeParameters\n            };\n        },\n\n        createQualifiedTypeIdentifier: function (qualification, id) {\n            return {\n                type: Syntax.QualifiedTypeIdentifier,\n                qualification: qualification,\n                id: id\n            };\n        },\n\n        createTypeParameterDeclaration: function (params) {\n            return {\n                type: Syntax.TypeParameterDeclaration,\n                params: params\n            };\n        },\n\n        createTypeParameterInstantiation: function (params) {\n            return {\n                type: Syntax.TypeParameterInstantiation,\n                params: params\n            };\n        },\n\n        createAnyTypeAnnotation: function () {\n            return {\n                type: Syntax.AnyTypeAnnotation\n            };\n        },\n\n        createBooleanTypeAnnotation: function () {\n            return {\n                type: Syntax.BooleanTypeAnnotation\n            };\n        },\n\n        createNumberTypeAnnotation: function () {\n            return {\n                type: Syntax.NumberTypeAnnotation\n            };\n        },\n\n        createStringTypeAnnotation: function () {\n            return {\n                type: Syntax.StringTypeAnnotation\n            };\n        },\n\n        createStringLiteralTypeAnnotation: function (token) {\n            return {\n                type: Syntax.StringLiteralTypeAnnotation,\n                value: token.value,\n                raw: source.slice(token.range[0], token.range[1])\n            };\n        },\n\n        createVoidTypeAnnotation: function () {\n            return {\n                type: Syntax.VoidTypeAnnotation\n            };\n        },\n\n        createTypeofTypeAnnotation: function (argument) {\n            return {\n                type: Syntax.TypeofTypeAnnotation,\n                argument: argument\n            };\n        },\n\n        createTupleTypeAnnotation: function (types) {\n            return {\n                type: Syntax.TupleTypeAnnotation,\n                types: types\n            };\n        },\n\n        createObjectTypeAnnotation: function (properties, indexers, callProperties) {\n            return {\n                type: Syntax.ObjectTypeAnnotation,\n                properties: properties,\n                indexers: indexers,\n                callProperties: callProperties\n            };\n        },\n\n        createObjectTypeIndexer: function (id, key, value, isStatic) {\n            return {\n                type: Syntax.ObjectTypeIndexer,\n                id: id,\n                key: key,\n                value: value,\n                \"static\": isStatic\n            };\n        },\n\n        createObjectTypeCallProperty: function (value, isStatic) {\n            return {\n                type: Syntax.ObjectTypeCallProperty,\n                value: value,\n                \"static\": isStatic\n            };\n        },\n\n        createObjectTypeProperty: function (key, value, optional, isStatic) {\n            return {\n                type: Syntax.ObjectTypeProperty,\n                key: key,\n                value: value,\n                optional: optional,\n                \"static\": isStatic\n            };\n        },\n\n        createUnionTypeAnnotation: function (types) {\n            return {\n                type: Syntax.UnionTypeAnnotation,\n                types: types\n            };\n        },\n\n        createIntersectionTypeAnnotation: function (types) {\n            return {\n                type: Syntax.IntersectionTypeAnnotation,\n                types: types\n            };\n        },\n\n        createTypeAlias: function (id, typeParameters, right) {\n            return {\n                type: Syntax.TypeAlias,\n                id: id,\n                typeParameters: typeParameters,\n                right: right\n            };\n        },\n\n        createInterface: function (id, typeParameters, body, extended) {\n            return {\n                type: Syntax.InterfaceDeclaration,\n                id: id,\n                typeParameters: typeParameters,\n                body: body,\n                \"extends\": extended\n            };\n        },\n\n        createInterfaceExtends: function (id, typeParameters) {\n            return {\n                type: Syntax.InterfaceExtends,\n                id: id,\n                typeParameters: typeParameters\n            };\n        },\n\n        createDeclareFunction: function (id) {\n            return {\n                type: Syntax.DeclareFunction,\n                id: id\n            };\n        },\n\n        createDeclareVariable: function (id) {\n            return {\n                type: Syntax.DeclareVariable,\n                id: id\n            };\n        },\n\n        createDeclareModule: function (id, body) {\n            return {\n                type: Syntax.DeclareModule,\n                id: id,\n                body: body\n            };\n        },\n\n        createJSXAttribute: function (name, value) {\n            return {\n                type: Syntax.JSXAttribute,\n                name: name,\n                value: value || null\n            };\n        },\n\n        createJSXSpreadAttribute: function (argument) {\n            return {\n                type: Syntax.JSXSpreadAttribute,\n                argument: argument\n            };\n        },\n\n        createJSXIdentifier: function (name) {\n            return {\n                type: Syntax.JSXIdentifier,\n                name: name\n            };\n        },\n\n        createJSXNamespacedName: function (namespace, name) {\n            return {\n                type: Syntax.JSXNamespacedName,\n                namespace: namespace,\n                name: name\n            };\n        },\n\n        createJSXMemberExpression: function (object, property) {\n            return {\n                type: Syntax.JSXMemberExpression,\n                object: object,\n                property: property\n            };\n        },\n\n        createJSXElement: function (openingElement, closingElement, children) {\n            return {\n                type: Syntax.JSXElement,\n                openingElement: openingElement,\n                closingElement: closingElement,\n                children: children\n            };\n        },\n\n        createJSXEmptyExpression: function () {\n            return {\n                type: Syntax.JSXEmptyExpression\n            };\n        },\n\n        createJSXExpressionContainer: function (expression) {\n            return {\n                type: Syntax.JSXExpressionContainer,\n                expression: expression\n            };\n        },\n\n        createJSXOpeningElement: function (name, attributes, selfClosing) {\n            return {\n                type: Syntax.JSXOpeningElement,\n                name: name,\n                selfClosing: selfClosing,\n                attributes: attributes\n            };\n        },\n\n        createJSXClosingElement: function (name) {\n            return {\n                type: Syntax.JSXClosingElement,\n                name: name\n            };\n        },\n\n        createIfStatement: function (test, consequent, alternate) {\n            return {\n                type: Syntax.IfStatement,\n                test: test,\n                consequent: consequent,\n                alternate: alternate\n            };\n        },\n\n        createLabeledStatement: function (label, body) {\n            return {\n                type: Syntax.LabeledStatement,\n                label: label,\n                body: body\n            };\n        },\n\n        createLiteral: function (token) {\n            var object = {\n                type: Syntax.Literal,\n                value: token.value,\n                raw: source.slice(token.range[0], token.range[1])\n            };\n            if (token.regex) {\n                object.regex = token.regex;\n            }\n            return object;\n        },\n\n        createMemberExpression: function (accessor, object, property) {\n            return {\n                type: Syntax.MemberExpression,\n                computed: accessor === '[',\n                object: object,\n                property: property\n            };\n        },\n\n        createNewExpression: function (callee, args) {\n            return {\n                type: Syntax.NewExpression,\n                callee: callee,\n                'arguments': args\n            };\n        },\n\n        createObjectExpression: function (properties) {\n            return {\n                type: Syntax.ObjectExpression,\n                properties: properties\n            };\n        },\n\n        createPostfixExpression: function (operator, argument) {\n            return {\n                type: Syntax.UpdateExpression,\n                operator: operator,\n                argument: argument,\n                prefix: false\n            };\n        },\n\n        createProgram: function (body) {\n            return {\n                type: Syntax.Program,\n                body: body\n            };\n        },\n\n        createProperty: function (kind, key, value, method, shorthand, computed) {\n            return {\n                type: Syntax.Property,\n                key: key,\n                value: value,\n                kind: kind,\n                method: method,\n                shorthand: shorthand,\n                computed: computed\n            };\n        },\n\n        createReturnStatement: function (argument) {\n            return {\n                type: Syntax.ReturnStatement,\n                argument: argument\n            };\n        },\n\n        createSequenceExpression: function (expressions) {\n            return {\n                type: Syntax.SequenceExpression,\n                expressions: expressions\n            };\n        },\n\n        createSwitchCase: function (test, consequent) {\n            return {\n                type: Syntax.SwitchCase,\n                test: test,\n                consequent: consequent\n            };\n        },\n\n        createSwitchStatement: function (discriminant, cases) {\n            return {\n                type: Syntax.SwitchStatement,\n                discriminant: discriminant,\n                cases: cases\n            };\n        },\n\n        createThisExpression: function () {\n            return {\n                type: Syntax.ThisExpression\n            };\n        },\n\n        createThrowStatement: function (argument) {\n            return {\n                type: Syntax.ThrowStatement,\n                argument: argument\n            };\n        },\n\n        createTryStatement: function (block, guardedHandlers, handlers, finalizer) {\n            return {\n                type: Syntax.TryStatement,\n                block: block,\n                guardedHandlers: guardedHandlers,\n                handlers: handlers,\n                finalizer: finalizer\n            };\n        },\n\n        createUnaryExpression: function (operator, argument) {\n            if (operator === '++' || operator === '--') {\n                return {\n                    type: Syntax.UpdateExpression,\n                    operator: operator,\n                    argument: argument,\n                    prefix: true\n                };\n            }\n            return {\n                type: Syntax.UnaryExpression,\n                operator: operator,\n                argument: argument,\n                prefix: true\n            };\n        },\n\n        createVariableDeclaration: function (declarations, kind) {\n            return {\n                type: Syntax.VariableDeclaration,\n                declarations: declarations,\n                kind: kind\n            };\n        },\n\n        createVariableDeclarator: function (id, init) {\n            return {\n                type: Syntax.VariableDeclarator,\n                id: id,\n                init: init\n            };\n        },\n\n        createWhileStatement: function (test, body) {\n            return {\n                type: Syntax.WhileStatement,\n                test: test,\n                body: body\n            };\n        },\n\n        createWithStatement: function (object, body) {\n            return {\n                type: Syntax.WithStatement,\n                object: object,\n                body: body\n            };\n        },\n\n        createTemplateElement: function (value, tail) {\n            return {\n                type: Syntax.TemplateElement,\n                value: value,\n                tail: tail\n            };\n        },\n\n        createTemplateLiteral: function (quasis, expressions) {\n            return {\n                type: Syntax.TemplateLiteral,\n                quasis: quasis,\n                expressions: expressions\n            };\n        },\n\n        createSpreadElement: function (argument) {\n            return {\n                type: Syntax.SpreadElement,\n                argument: argument\n            };\n        },\n\n        createSpreadProperty: function (argument) {\n            return {\n                type: Syntax.SpreadProperty,\n                argument: argument\n            };\n        },\n\n        createTaggedTemplateExpression: function (tag, quasi) {\n            return {\n                type: Syntax.TaggedTemplateExpression,\n                tag: tag,\n                quasi: quasi\n            };\n        },\n\n        createArrowFunctionExpression: function (params, defaults, body, rest, expression, isAsync) {\n            var arrowExpr = {\n                type: Syntax.ArrowFunctionExpression,\n                id: null,\n                params: params,\n                defaults: defaults,\n                body: body,\n                rest: rest,\n                generator: false,\n                expression: expression\n            };\n\n            if (isAsync) {\n                arrowExpr.async = true;\n            }\n\n            return arrowExpr;\n        },\n\n        createMethodDefinition: function (propertyType, kind, key, value, computed) {\n            return {\n                type: Syntax.MethodDefinition,\n                key: key,\n                value: value,\n                kind: kind,\n                'static': propertyType === ClassPropertyType[\"static\"],\n                computed: computed\n            };\n        },\n\n        createClassProperty: function (key, typeAnnotation, computed, isStatic) {\n            return {\n                type: Syntax.ClassProperty,\n                key: key,\n                typeAnnotation: typeAnnotation,\n                computed: computed,\n                \"static\": isStatic\n            };\n        },\n\n        createClassBody: function (body) {\n            return {\n                type: Syntax.ClassBody,\n                body: body\n            };\n        },\n\n        createClassImplements: function (id, typeParameters) {\n            return {\n                type: Syntax.ClassImplements,\n                id: id,\n                typeParameters: typeParameters\n            };\n        },\n\n        createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {\n            return {\n                type: Syntax.ClassExpression,\n                id: id,\n                superClass: superClass,\n                body: body,\n                typeParameters: typeParameters,\n                superTypeParameters: superTypeParameters,\n                \"implements\": implemented\n            };\n        },\n\n        createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {\n            return {\n                type: Syntax.ClassDeclaration,\n                id: id,\n                superClass: superClass,\n                body: body,\n                typeParameters: typeParameters,\n                superTypeParameters: superTypeParameters,\n                \"implements\": implemented\n            };\n        },\n\n        createModuleSpecifier: function (token) {\n            return {\n                type: Syntax.ModuleSpecifier,\n                value: token.value,\n                raw: source.slice(token.range[0], token.range[1])\n            };\n        },\n\n        createExportSpecifier: function (id, name) {\n            return {\n                type: Syntax.ExportSpecifier,\n                id: id,\n                name: name\n            };\n        },\n\n        createExportBatchSpecifier: function () {\n            return {\n                type: Syntax.ExportBatchSpecifier\n            };\n        },\n\n        createImportDefaultSpecifier: function (id) {\n            return {\n                type: Syntax.ImportDefaultSpecifier,\n                id: id\n            };\n        },\n\n        createImportNamespaceSpecifier: function (id) {\n            return {\n                type: Syntax.ImportNamespaceSpecifier,\n                id: id\n            };\n        },\n\n        createExportDeclaration: function (isDefault, declaration, specifiers, src) {\n            return {\n                type: Syntax.ExportDeclaration,\n                'default': !!isDefault,\n                declaration: declaration,\n                specifiers: specifiers,\n                source: src\n            };\n        },\n\n        createImportSpecifier: function (id, name) {\n            return {\n                type: Syntax.ImportSpecifier,\n                id: id,\n                name: name\n            };\n        },\n\n        createImportDeclaration: function (specifiers, src, isType) {\n            return {\n                type: Syntax.ImportDeclaration,\n                specifiers: specifiers,\n                source: src,\n                isType: isType\n            };\n        },\n\n        createYieldExpression: function (argument, dlg) {\n            return {\n                type: Syntax.YieldExpression,\n                argument: argument,\n                delegate: dlg\n            };\n        },\n\n        createAwaitExpression: function (argument) {\n            return {\n                type: Syntax.AwaitExpression,\n                argument: argument\n            };\n        },\n\n        createComprehensionExpression: function (filter, blocks, body) {\n            return {\n                type: Syntax.ComprehensionExpression,\n                filter: filter,\n                blocks: blocks,\n                body: body\n            };\n        }\n\n    };\n\n    // Return true if there is a line terminator before the next token.\n\n    function peekLineTerminator() {\n        var pos, line, start, found;\n\n        pos = index;\n        line = lineNumber;\n        start = lineStart;\n        skipComment();\n        found = lineNumber !== line;\n        index = pos;\n        lineNumber = line;\n        lineStart = start;\n\n        return found;\n    }\n\n    // Throw an exception\n\n    function throwError(token, messageFormat) {\n        var error,\n            args = Array.prototype.slice.call(arguments, 2),\n            msg = messageFormat.replace(\n                /%(\\d)/g,\n                function (whole, idx) {\n                    assert(idx < args.length, 'Message reference must be in range');\n                    return args[idx];\n                }\n            );\n\n        if (typeof token.lineNumber === 'number') {\n            error = new Error('Line ' + token.lineNumber + ': ' + msg);\n            error.index = token.range[0];\n            error.lineNumber = token.lineNumber;\n            error.column = token.range[0] - lineStart + 1;\n        } else {\n            error = new Error('Line ' + lineNumber + ': ' + msg);\n            error.index = index;\n            error.lineNumber = lineNumber;\n            error.column = index - lineStart + 1;\n        }\n\n        error.description = msg;\n        throw error;\n    }\n\n    function throwErrorTolerant() {\n        try {\n            throwError.apply(null, arguments);\n        } catch (e) {\n            if (extra.errors) {\n                extra.errors.push(e);\n            } else {\n                throw e;\n            }\n        }\n    }\n\n\n    // Throw an exception because of the token.\n\n    function throwUnexpected(token) {\n        if (token.type === Token.EOF) {\n            throwError(token, Messages.UnexpectedEOS);\n        }\n\n        if (token.type === Token.NumericLiteral) {\n            throwError(token, Messages.UnexpectedNumber);\n        }\n\n        if (token.type === Token.StringLiteral || token.type === Token.JSXText) {\n            throwError(token, Messages.UnexpectedString);\n        }\n\n        if (token.type === Token.Identifier) {\n            throwError(token, Messages.UnexpectedIdentifier);\n        }\n\n        if (token.type === Token.Keyword) {\n            if (isFutureReservedWord(token.value)) {\n                throwError(token, Messages.UnexpectedReserved);\n            } else if (strict && isStrictModeReservedWord(token.value)) {\n                throwErrorTolerant(token, Messages.StrictReservedWord);\n                return;\n            }\n            throwError(token, Messages.UnexpectedToken, token.value);\n        }\n\n        if (token.type === Token.Template) {\n            throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n        }\n\n        // BooleanLiteral, NullLiteral, or Punctuator.\n        throwError(token, Messages.UnexpectedToken, token.value);\n    }\n\n    // Expect the next token to match the specified punctuator.\n    // If not, an exception will be thrown.\n\n    function expect(value) {\n        var token = lex();\n        if (token.type !== Token.Punctuator || token.value !== value) {\n            throwUnexpected(token);\n        }\n    }\n\n    // Expect the next token to match the specified keyword.\n    // If not, an exception will be thrown.\n\n    function expectKeyword(keyword, contextual) {\n        var token = lex();\n        if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n                token.value !== keyword) {\n            throwUnexpected(token);\n        }\n    }\n\n    // Expect the next token to match the specified contextual keyword.\n    // If not, an exception will be thrown.\n\n    function expectContextualKeyword(keyword) {\n        return expectKeyword(keyword, true);\n    }\n\n    // Return true if the next token matches the specified punctuator.\n\n    function match(value) {\n        return lookahead.type === Token.Punctuator && lookahead.value === value;\n    }\n\n    // Return true if the next token matches the specified keyword\n\n    function matchKeyword(keyword, contextual) {\n        var expectedType = contextual ? Token.Identifier : Token.Keyword;\n        return lookahead.type === expectedType && lookahead.value === keyword;\n    }\n\n    // Return true if the next token matches the specified contextual keyword\n\n    function matchContextualKeyword(keyword) {\n        return matchKeyword(keyword, true);\n    }\n\n    // Return true if the next token is an assignment operator\n\n    function matchAssign() {\n        var op;\n\n        if (lookahead.type !== Token.Punctuator) {\n            return false;\n        }\n        op = lookahead.value;\n        return op === '=' ||\n            op === '*=' ||\n            op === '/=' ||\n            op === '%=' ||\n            op === '+=' ||\n            op === '-=' ||\n            op === '<<=' ||\n            op === '>>=' ||\n            op === '>>>=' ||\n            op === '&=' ||\n            op === '^=' ||\n            op === '|=';\n    }\n\n    // Note that 'yield' is treated as a keyword in strict mode, but a\n    // contextual keyword (identifier) in non-strict mode, so we need to\n    // use matchKeyword('yield', false) and matchKeyword('yield', true)\n    // (i.e. matchContextualKeyword) appropriately.\n    function matchYield() {\n        return state.yieldAllowed && matchKeyword('yield', !strict);\n    }\n\n    function matchAsync() {\n        var backtrackToken = lookahead, matches = false;\n\n        if (matchContextualKeyword('async')) {\n            lex(); // Make sure peekLineTerminator() starts after 'async'.\n            matches = !peekLineTerminator();\n            rewind(backtrackToken); // Revert the lex().\n        }\n\n        return matches;\n    }\n\n    function matchAwait() {\n        return state.awaitAllowed && matchContextualKeyword('await');\n    }\n\n    function consumeSemicolon() {\n        var line, oldIndex = index, oldLineNumber = lineNumber,\n            oldLineStart = lineStart, oldLookahead = lookahead;\n\n        // Catch the very common case first: immediately a semicolon (char #59).\n        if (source.charCodeAt(index) === 59) {\n            lex();\n            return;\n        }\n\n        line = lineNumber;\n        skipComment();\n        if (lineNumber !== line) {\n            index = oldIndex;\n            lineNumber = oldLineNumber;\n            lineStart = oldLineStart;\n            lookahead = oldLookahead;\n            return;\n        }\n\n        if (match(';')) {\n            lex();\n            return;\n        }\n\n        if (lookahead.type !== Token.EOF && !match('}')) {\n            throwUnexpected(lookahead);\n        }\n    }\n\n    // Return true if provided expression is LeftHandSideExpression\n\n    function isLeftHandSide(expr) {\n        return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;\n    }\n\n    function isAssignableLeftHandSide(expr) {\n        return isLeftHandSide(expr) || expr.type === Syntax.ObjectPattern || expr.type === Syntax.ArrayPattern;\n    }\n\n    // 11.1.4 Array Initialiser\n\n    function parseArrayInitialiser() {\n        var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true,\n            marker = markerCreate();\n\n        expect('[');\n        while (!match(']')) {\n            if (lookahead.value === 'for' &&\n                    lookahead.type === Token.Keyword) {\n                if (!possiblecomprehension) {\n                    throwError({}, Messages.ComprehensionError);\n                }\n                matchKeyword('for');\n                tmp = parseForStatement({ignoreBody: true});\n                tmp.of = tmp.type === Syntax.ForOfStatement;\n                tmp.type = Syntax.ComprehensionBlock;\n                if (tmp.left.kind) { // can't be let or const\n                    throwError({}, Messages.ComprehensionError);\n                }\n                blocks.push(tmp);\n            } else if (lookahead.value === 'if' &&\n                           lookahead.type === Token.Keyword) {\n                if (!possiblecomprehension) {\n                    throwError({}, Messages.ComprehensionError);\n                }\n                expectKeyword('if');\n                expect('(');\n                filter = parseExpression();\n                expect(')');\n            } else if (lookahead.value === ',' &&\n                           lookahead.type === Token.Punctuator) {\n                possiblecomprehension = false; // no longer allowed.\n                lex();\n                elements.push(null);\n            } else {\n                tmp = parseSpreadOrAssignmentExpression();\n                elements.push(tmp);\n                if (tmp && tmp.type === Syntax.SpreadElement) {\n                    if (!match(']')) {\n                        throwError({}, Messages.ElementAfterSpreadElement);\n                    }\n                } else if (!(match(']') || matchKeyword('for') || matchKeyword('if'))) {\n                    expect(','); // this lexes.\n                    possiblecomprehension = false;\n                }\n            }\n        }\n\n        expect(']');\n\n        if (filter && !blocks.length) {\n            throwError({}, Messages.ComprehensionRequiresBlock);\n        }\n\n        if (blocks.length) {\n            if (elements.length !== 1) {\n                throwError({}, Messages.ComprehensionError);\n            }\n            return markerApply(marker, delegate.createComprehensionExpression(filter, blocks, elements[0]));\n        }\n        return markerApply(marker, delegate.createArrayExpression(elements));\n    }\n\n    // 11.1.5 Object Initialiser\n\n    function parsePropertyFunction(options) {\n        var previousStrict, previousYieldAllowed, previousAwaitAllowed,\n            params, defaults, body, marker = markerCreate();\n\n        previousStrict = strict;\n        previousYieldAllowed = state.yieldAllowed;\n        state.yieldAllowed = options.generator;\n        previousAwaitAllowed = state.awaitAllowed;\n        state.awaitAllowed = options.async;\n        params = options.params || [];\n        defaults = options.defaults || [];\n\n        body = parseConciseBody();\n        if (options.name && strict && isRestrictedWord(params[0].name)) {\n            throwErrorTolerant(options.name, Messages.StrictParamName);\n        }\n        strict = previousStrict;\n        state.yieldAllowed = previousYieldAllowed;\n        state.awaitAllowed = previousAwaitAllowed;\n\n        return markerApply(marker, delegate.createFunctionExpression(\n            null,\n            params,\n            defaults,\n            body,\n            options.rest || null,\n            options.generator,\n            body.type !== Syntax.BlockStatement,\n            options.async,\n            options.returnType,\n            options.typeParameters\n        ));\n    }\n\n\n    function parsePropertyMethodFunction(options) {\n        var previousStrict, tmp, method;\n\n        previousStrict = strict;\n        strict = true;\n\n        tmp = parseParams();\n\n        if (tmp.stricted) {\n            throwErrorTolerant(tmp.stricted, tmp.message);\n        }\n\n        method = parsePropertyFunction({\n            params: tmp.params,\n            defaults: tmp.defaults,\n            rest: tmp.rest,\n            generator: options.generator,\n            async: options.async,\n            returnType: tmp.returnType,\n            typeParameters: options.typeParameters\n        });\n\n        strict = previousStrict;\n\n        return method;\n    }\n\n\n    function parseObjectPropertyKey() {\n        var marker = markerCreate(),\n            token = lex(),\n            propertyKey,\n            result;\n\n        // Note: This function is called only from parseObjectProperty(), where\n        // EOF and Punctuator tokens are already filtered out.\n\n        if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {\n            if (strict && token.octal) {\n                throwErrorTolerant(token, Messages.StrictOctalLiteral);\n            }\n            return markerApply(marker, delegate.createLiteral(token));\n        }\n\n        if (token.type === Token.Punctuator && token.value === '[') {\n            // For computed properties we should skip the [ and ], and\n            // capture in marker only the assignment expression itself.\n            marker = markerCreate();\n            propertyKey = parseAssignmentExpression();\n            result = markerApply(marker, propertyKey);\n            expect(']');\n            return result;\n        }\n\n        return markerApply(marker, delegate.createIdentifier(token.value));\n    }\n\n    function parseObjectProperty() {\n        var token, key, id, param, computed,\n            marker = markerCreate(), returnType, typeParameters;\n\n        token = lookahead;\n        computed = (token.value === '[' && token.type === Token.Punctuator);\n\n        if (token.type === Token.Identifier || computed || matchAsync()) {\n            id = parseObjectPropertyKey();\n\n            if (match(':')) {\n                lex();\n\n                return markerApply(\n                    marker,\n                    delegate.createProperty(\n                        'init',\n                        id,\n                        parseAssignmentExpression(),\n                        false,\n                        false,\n                        computed\n                    )\n                );\n            }\n\n            if (match('(') || match('<')) {\n                if (match('<')) {\n                    typeParameters = parseTypeParameterDeclaration();\n                }\n                return markerApply(\n                    marker,\n                    delegate.createProperty(\n                        'init',\n                        id,\n                        parsePropertyMethodFunction({\n                            generator: false,\n                            async: false,\n                            typeParameters: typeParameters\n                        }),\n                        true,\n                        false,\n                        computed\n                    )\n                );\n            }\n\n            // Property Assignment: Getter and Setter.\n\n            if (token.value === 'get') {\n                computed = (lookahead.value === '[');\n                key = parseObjectPropertyKey();\n\n                expect('(');\n                expect(')');\n                if (match(':')) {\n                    returnType = parseTypeAnnotation();\n                }\n\n                return markerApply(\n                    marker,\n                    delegate.createProperty(\n                        'get',\n                        key,\n                        parsePropertyFunction({\n                            generator: false,\n                            async: false,\n                            returnType: returnType\n                        }),\n                        false,\n                        false,\n                        computed\n                    )\n                );\n            }\n\n            if (token.value === 'set') {\n                computed = (lookahead.value === '[');\n                key = parseObjectPropertyKey();\n\n                expect('(');\n                token = lookahead;\n                param = [ parseTypeAnnotatableIdentifier() ];\n                expect(')');\n                if (match(':')) {\n                    returnType = parseTypeAnnotation();\n                }\n\n                return markerApply(\n                    marker,\n                    delegate.createProperty(\n                        'set',\n                        key,\n                        parsePropertyFunction({\n                            params: param,\n                            generator: false,\n                            async: false,\n                            name: token,\n                            returnType: returnType\n                        }),\n                        false,\n                        false,\n                        computed\n                    )\n                );\n            }\n\n            if (token.value === 'async') {\n                computed = (lookahead.value === '[');\n                key = parseObjectPropertyKey();\n\n                if (match('<')) {\n                    typeParameters = parseTypeParameterDeclaration();\n                }\n\n                return markerApply(\n                    marker,\n                    delegate.createProperty(\n                        'init',\n                        key,\n                        parsePropertyMethodFunction({\n                            generator: false,\n                            async: true,\n                            typeParameters: typeParameters\n                        }),\n                        true,\n                        false,\n                        computed\n                    )\n                );\n            }\n\n            if (computed) {\n                // Computed properties can only be used with full notation.\n                throwUnexpected(lookahead);\n            }\n\n            return markerApply(\n                marker,\n                delegate.createProperty('init', id, id, false, true, false)\n            );\n        }\n\n        if (token.type === Token.EOF || token.type === Token.Punctuator) {\n            if (!match('*')) {\n                throwUnexpected(token);\n            }\n            lex();\n\n            computed = (lookahead.type === Token.Punctuator && lookahead.value === '[');\n\n            id = parseObjectPropertyKey();\n\n            if (match('<')) {\n                typeParameters = parseTypeParameterDeclaration();\n            }\n\n            if (!match('(')) {\n                throwUnexpected(lex());\n            }\n\n            return markerApply(marker, delegate.createProperty(\n                'init',\n                id,\n                parsePropertyMethodFunction({\n                    generator: true,\n                    typeParameters: typeParameters\n                }),\n                true,\n                false,\n                computed\n            ));\n        }\n        key = parseObjectPropertyKey();\n        if (match(':')) {\n            lex();\n            return markerApply(marker, delegate.createProperty('init', key, parseAssignmentExpression(), false, false, false));\n        }\n        if (match('(') || match('<')) {\n            if (match('<')) {\n                typeParameters = parseTypeParameterDeclaration();\n            }\n            return markerApply(marker, delegate.createProperty(\n                'init',\n                key,\n                parsePropertyMethodFunction({\n                    generator: false,\n                    typeParameters: typeParameters\n                }),\n                true,\n                false,\n                false\n            ));\n        }\n        throwUnexpected(lex());\n    }\n\n    function parseObjectSpreadProperty() {\n        var marker = markerCreate();\n        expect('...');\n        return markerApply(marker, delegate.createSpreadProperty(parseAssignmentExpression()));\n    }\n\n    function getFieldName(key) {\n        var toString = String;\n        if (key.type === Syntax.Identifier) {\n            return key.name;\n        }\n        return toString(key.value);\n    }\n\n    function parseObjectInitialiser() {\n        var properties = [], property, name, kind, storedKind, map = new StringMap(),\n            marker = markerCreate(), toString = String;\n\n        expect('{');\n\n        while (!match('}')) {\n            if (match('...')) {\n                property = parseObjectSpreadProperty();\n            } else {\n                property = parseObjectProperty();\n\n                if (property.key.type === Syntax.Identifier) {\n                    name = property.key.name;\n                } else {\n                    name = toString(property.key.value);\n                }\n                kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n                if (map.has(name)) {\n                    storedKind = map.get(name);\n                    if (storedKind === PropertyKind.Data) {\n                        if (strict && kind === PropertyKind.Data) {\n                            throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n                        } else if (kind !== PropertyKind.Data) {\n                            throwErrorTolerant({}, Messages.AccessorDataProperty);\n                        }\n                    } else {\n                        if (kind === PropertyKind.Data) {\n                            throwErrorTolerant({}, Messages.AccessorDataProperty);\n                        } else if (storedKind & kind) {\n                            throwErrorTolerant({}, Messages.AccessorGetSet);\n                        }\n                    }\n                    map.set(name, storedKind | kind);\n                } else {\n                    map.set(name, kind);\n                }\n            }\n\n            properties.push(property);\n\n            if (!match('}')) {\n                expect(',');\n            }\n        }\n\n        expect('}');\n\n        return markerApply(marker, delegate.createObjectExpression(properties));\n    }\n\n    function parseTemplateElement(option) {\n        var marker = markerCreate(),\n            token = scanTemplateElement(option);\n        if (strict && token.octal) {\n            throwError(token, Messages.StrictOctalLiteral);\n        }\n        return markerApply(marker, delegate.createTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail));\n    }\n\n    function parseTemplateLiteral() {\n        var quasi, quasis, expressions, marker = markerCreate();\n\n        quasi = parseTemplateElement({ head: true });\n        quasis = [ quasi ];\n        expressions = [];\n\n        while (!quasi.tail) {\n            expressions.push(parseExpression());\n            quasi = parseTemplateElement({ head: false });\n            quasis.push(quasi);\n        }\n\n        return markerApply(marker, delegate.createTemplateLiteral(quasis, expressions));\n    }\n\n    // 11.1.6 The Grouping Operator\n\n    function parseGroupExpression() {\n        var expr, marker, typeAnnotation;\n\n        expect('(');\n\n        ++state.parenthesizedCount;\n\n        marker = markerCreate();\n\n        expr = parseExpression();\n\n        if (match(':')) {\n            typeAnnotation = parseTypeAnnotation();\n            expr = markerApply(marker, delegate.createTypeCast(\n                expr,\n                typeAnnotation\n            ));\n        }\n\n        expect(')');\n\n        return expr;\n    }\n\n    function matchAsyncFuncExprOrDecl() {\n        var token;\n\n        if (matchAsync()) {\n            token = lookahead2();\n            if (token.type === Token.Keyword && token.value === 'function') {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    // 11.1 Primary Expressions\n\n    function parsePrimaryExpression() {\n        var marker, type, token, expr;\n\n        type = lookahead.type;\n\n        if (type === Token.Identifier) {\n            marker = markerCreate();\n            return markerApply(marker, delegate.createIdentifier(lex().value));\n        }\n\n        if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n            if (strict && lookahead.octal) {\n                throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n            }\n            marker = markerCreate();\n            return markerApply(marker, delegate.createLiteral(lex()));\n        }\n\n        if (type === Token.Keyword) {\n            if (matchKeyword('this')) {\n                marker = markerCreate();\n                lex();\n                return markerApply(marker, delegate.createThisExpression());\n            }\n\n            if (matchKeyword('function')) {\n                return parseFunctionExpression();\n            }\n\n            if (matchKeyword('class')) {\n                return parseClassExpression();\n            }\n\n            if (matchKeyword('super')) {\n                marker = markerCreate();\n                lex();\n                return markerApply(marker, delegate.createIdentifier('super'));\n            }\n        }\n\n        if (type === Token.BooleanLiteral) {\n            marker = markerCreate();\n            token = lex();\n            token.value = (token.value === 'true');\n            return markerApply(marker, delegate.createLiteral(token));\n        }\n\n        if (type === Token.NullLiteral) {\n            marker = markerCreate();\n            token = lex();\n            token.value = null;\n            return markerApply(marker, delegate.createLiteral(token));\n        }\n\n        if (match('[')) {\n            return parseArrayInitialiser();\n        }\n\n        if (match('{')) {\n            return parseObjectInitialiser();\n        }\n\n        if (match('(')) {\n            return parseGroupExpression();\n        }\n\n        if (match('/') || match('/=')) {\n            marker = markerCreate();\n            expr = delegate.createLiteral(scanRegExp());\n            peek();\n            return markerApply(marker, expr);\n        }\n\n        if (type === Token.Template) {\n            return parseTemplateLiteral();\n        }\n\n        if (match('<')) {\n            return parseJSXElement();\n        }\n\n        throwUnexpected(lex());\n    }\n\n    // 11.2 Left-Hand-Side Expressions\n\n    function parseArguments() {\n        var args = [], arg;\n\n        expect('(');\n\n        if (!match(')')) {\n            while (index < length) {\n                arg = parseSpreadOrAssignmentExpression();\n                args.push(arg);\n\n                if (match(')')) {\n                    break;\n                } else if (arg.type === Syntax.SpreadElement) {\n                    throwError({}, Messages.ElementAfterSpreadElement);\n                }\n\n                expect(',');\n            }\n        }\n\n        expect(')');\n\n        return args;\n    }\n\n    function parseSpreadOrAssignmentExpression() {\n        if (match('...')) {\n            var marker = markerCreate();\n            lex();\n            return markerApply(marker, delegate.createSpreadElement(parseAssignmentExpression()));\n        }\n        return parseAssignmentExpression();\n    }\n\n    function parseNonComputedProperty() {\n        var marker = markerCreate(),\n            token = lex();\n\n        if (!isIdentifierName(token)) {\n            throwUnexpected(token);\n        }\n\n        return markerApply(marker, delegate.createIdentifier(token.value));\n    }\n\n    function parseNonComputedMember() {\n        expect('.');\n\n        return parseNonComputedProperty();\n    }\n\n    function parseComputedMember() {\n        var expr;\n\n        expect('[');\n\n        expr = parseExpression();\n\n        expect(']');\n\n        return expr;\n    }\n\n    function parseNewExpression() {\n        var callee, args, marker = markerCreate();\n\n        expectKeyword('new');\n        callee = parseLeftHandSideExpression();\n        args = match('(') ? parseArguments() : [];\n\n        return markerApply(marker, delegate.createNewExpression(callee, args));\n    }\n\n    function parseLeftHandSideExpressionAllowCall() {\n        var expr, args, marker = markerCreate();\n\n        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();\n\n        while (match('.') || match('[') || match('(') || lookahead.type === Token.Template) {\n            if (match('(')) {\n                args = parseArguments();\n                expr = markerApply(marker, delegate.createCallExpression(expr, args));\n            } else if (match('[')) {\n                expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));\n            } else if (match('.')) {\n                expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));\n            } else {\n                expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));\n            }\n        }\n\n        return expr;\n    }\n\n    function parseLeftHandSideExpression() {\n        var expr, marker = markerCreate();\n\n        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();\n\n        while (match('.') || match('[') || lookahead.type === Token.Template) {\n            if (match('[')) {\n                expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));\n            } else if (match('.')) {\n                expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));\n            } else {\n                expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));\n            }\n        }\n\n        return expr;\n    }\n\n    // 11.3 Postfix Expressions\n\n    function parsePostfixExpression() {\n        var marker = markerCreate(),\n            expr = parseLeftHandSideExpressionAllowCall(),\n            token;\n\n        if (lookahead.type !== Token.Punctuator) {\n            return expr;\n        }\n\n        if ((match('++') || match('--')) && !peekLineTerminator()) {\n            // 11.3.1, 11.3.2\n            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {\n                throwErrorTolerant({}, Messages.StrictLHSPostfix);\n            }\n\n            if (!isLeftHandSide(expr)) {\n                throwError({}, Messages.InvalidLHSInAssignment);\n            }\n\n            token = lex();\n            expr = markerApply(marker, delegate.createPostfixExpression(token.value, expr));\n        }\n\n        return expr;\n    }\n\n    // 11.4 Unary Operators\n\n    function parseUnaryExpression() {\n        var marker, token, expr;\n\n        if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n            return parsePostfixExpression();\n        }\n\n        if (match('++') || match('--')) {\n            marker = markerCreate();\n            token = lex();\n            expr = parseUnaryExpression();\n            // 11.4.4, 11.4.5\n            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {\n                throwErrorTolerant({}, Messages.StrictLHSPrefix);\n            }\n\n            if (!isLeftHandSide(expr)) {\n                throwError({}, Messages.InvalidLHSInAssignment);\n            }\n\n            return markerApply(marker, delegate.createUnaryExpression(token.value, expr));\n        }\n\n        if (match('+') || match('-') || match('~') || match('!')) {\n            marker = markerCreate();\n            token = lex();\n            expr = parseUnaryExpression();\n            return markerApply(marker, delegate.createUnaryExpression(token.value, expr));\n        }\n\n        if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n            marker = markerCreate();\n            token = lex();\n            expr = parseUnaryExpression();\n            expr = markerApply(marker, delegate.createUnaryExpression(token.value, expr));\n            if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {\n                throwErrorTolerant({}, Messages.StrictDelete);\n            }\n            return expr;\n        }\n\n        return parsePostfixExpression();\n    }\n\n    function binaryPrecedence(token, allowIn) {\n        var prec = 0;\n\n        if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\n            return 0;\n        }\n\n        switch (token.value) {\n        case '||':\n            prec = 1;\n            break;\n\n        case '&&':\n            prec = 2;\n            break;\n\n        case '|':\n            prec = 3;\n            break;\n\n        case '^':\n            prec = 4;\n            break;\n\n        case '&':\n            prec = 5;\n            break;\n\n        case '==':\n        case '!=':\n        case '===':\n        case '!==':\n            prec = 6;\n            break;\n\n        case '<':\n        case '>':\n        case '<=':\n        case '>=':\n        case 'instanceof':\n            prec = 7;\n            break;\n\n        case 'in':\n            prec = allowIn ? 7 : 0;\n            break;\n\n        case '<<':\n        case '>>':\n        case '>>>':\n            prec = 8;\n            break;\n\n        case '+':\n        case '-':\n            prec = 9;\n            break;\n\n        case '*':\n        case '/':\n        case '%':\n            prec = 11;\n            break;\n\n        default:\n            break;\n        }\n\n        return prec;\n    }\n\n    // 11.5 Multiplicative Operators\n    // 11.6 Additive Operators\n    // 11.7 Bitwise Shift Operators\n    // 11.8 Relational Operators\n    // 11.9 Equality Operators\n    // 11.10 Binary Bitwise Operators\n    // 11.11 Binary Logical Operators\n\n    function parseBinaryExpression() {\n        var expr, token, prec, previousAllowIn, stack, right, operator, left, i,\n            marker, markers;\n\n        previousAllowIn = state.allowIn;\n        state.allowIn = true;\n\n        marker = markerCreate();\n        left = parseUnaryExpression();\n\n        token = lookahead;\n        prec = binaryPrecedence(token, previousAllowIn);\n        if (prec === 0) {\n            return left;\n        }\n        token.prec = prec;\n        lex();\n\n        markers = [marker, markerCreate()];\n        right = parseUnaryExpression();\n\n        stack = [left, token, right];\n\n        while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {\n\n            // Reduce: make a binary expression from the three topmost entries.\n            while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {\n                right = stack.pop();\n                operator = stack.pop().value;\n                left = stack.pop();\n                expr = delegate.createBinaryExpression(operator, left, right);\n                markers.pop();\n                marker = markers.pop();\n                markerApply(marker, expr);\n                stack.push(expr);\n                markers.push(marker);\n            }\n\n            // Shift.\n            token = lex();\n            token.prec = prec;\n            stack.push(token);\n            markers.push(markerCreate());\n            expr = parseUnaryExpression();\n            stack.push(expr);\n        }\n\n        state.allowIn = previousAllowIn;\n\n        // Final reduce to clean-up the stack.\n        i = stack.length - 1;\n        expr = stack[i];\n        markers.pop();\n        while (i > 1) {\n            expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n            i -= 2;\n            marker = markers.pop();\n            markerApply(marker, expr);\n        }\n\n        return expr;\n    }\n\n\n    // 11.12 Conditional Operator\n\n    function parseConditionalExpression() {\n        var expr, previousAllowIn, consequent, alternate, marker = markerCreate();\n        expr = parseBinaryExpression();\n\n        if (match('?')) {\n            lex();\n            previousAllowIn = state.allowIn;\n            state.allowIn = true;\n            consequent = parseAssignmentExpression();\n            state.allowIn = previousAllowIn;\n            expect(':');\n            alternate = parseAssignmentExpression();\n\n            expr = markerApply(marker, delegate.createConditionalExpression(expr, consequent, alternate));\n        }\n\n        return expr;\n    }\n\n    // 11.13 Assignment Operators\n\n    // 12.14.5 AssignmentPattern\n\n    function reinterpretAsAssignmentBindingPattern(expr) {\n        var i, len, property, element;\n\n        if (expr.type === Syntax.ObjectExpression) {\n            expr.type = Syntax.ObjectPattern;\n            for (i = 0, len = expr.properties.length; i < len; i += 1) {\n                property = expr.properties[i];\n                if (property.type === Syntax.SpreadProperty) {\n                    if (i < len - 1) {\n                        throwError({}, Messages.PropertyAfterSpreadProperty);\n                    }\n                    reinterpretAsAssignmentBindingPattern(property.argument);\n                } else {\n                    if (property.kind !== 'init') {\n                        throwError({}, Messages.InvalidLHSInAssignment);\n                    }\n                    reinterpretAsAssignmentBindingPattern(property.value);\n                }\n            }\n        } else if (expr.type === Syntax.ArrayExpression) {\n            expr.type = Syntax.ArrayPattern;\n            for (i = 0, len = expr.elements.length; i < len; i += 1) {\n                element = expr.elements[i];\n                /* istanbul ignore else */\n                if (element) {\n                    reinterpretAsAssignmentBindingPattern(element);\n                }\n            }\n        } else if (expr.type === Syntax.Identifier) {\n            if (isRestrictedWord(expr.name)) {\n                throwError({}, Messages.InvalidLHSInAssignment);\n            }\n        } else if (expr.type === Syntax.SpreadElement) {\n            reinterpretAsAssignmentBindingPattern(expr.argument);\n            if (expr.argument.type === Syntax.ObjectPattern) {\n                throwError({}, Messages.ObjectPatternAsSpread);\n            }\n        } else {\n            /* istanbul ignore else */\n            if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {\n                throwError({}, Messages.InvalidLHSInAssignment);\n            }\n        }\n    }\n\n    // 13.2.3 BindingPattern\n\n    function reinterpretAsDestructuredParameter(options, expr) {\n        var i, len, property, element;\n\n        if (expr.type === Syntax.ObjectExpression) {\n            expr.type = Syntax.ObjectPattern;\n            for (i = 0, len = expr.properties.length; i < len; i += 1) {\n                property = expr.properties[i];\n                if (property.type === Syntax.SpreadProperty) {\n                    if (i < len - 1) {\n                        throwError({}, Messages.PropertyAfterSpreadProperty);\n                    }\n                    reinterpretAsDestructuredParameter(options, property.argument);\n                } else {\n                    if (property.kind !== 'init') {\n                        throwError({}, Messages.InvalidLHSInFormalsList);\n                    }\n                    reinterpretAsDestructuredParameter(options, property.value);\n                }\n            }\n        } else if (expr.type === Syntax.ArrayExpression) {\n            expr.type = Syntax.ArrayPattern;\n            for (i = 0, len = expr.elements.length; i < len; i += 1) {\n                element = expr.elements[i];\n                if (element) {\n                    reinterpretAsDestructuredParameter(options, element);\n                }\n            }\n        } else if (expr.type === Syntax.Identifier) {\n            validateParam(options, expr, expr.name);\n        } else if (expr.type === Syntax.SpreadElement) {\n            // BindingRestElement only allows BindingIdentifier\n            if (expr.argument.type !== Syntax.Identifier) {\n                throwError({}, Messages.InvalidLHSInFormalsList);\n            }\n            validateParam(options, expr.argument, expr.argument.name);\n        } else {\n            throwError({}, Messages.InvalidLHSInFormalsList);\n        }\n    }\n\n    function reinterpretAsCoverFormalsList(expressions) {\n        var i, len, param, params, defaults, defaultCount, options, rest;\n\n        params = [];\n        defaults = [];\n        defaultCount = 0;\n        rest = null;\n        options = {\n            paramSet: new StringMap()\n        };\n\n        for (i = 0, len = expressions.length; i < len; i += 1) {\n            param = expressions[i];\n            if (param.type === Syntax.Identifier) {\n                params.push(param);\n                defaults.push(null);\n                validateParam(options, param, param.name);\n            } else if (param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression) {\n                reinterpretAsDestructuredParameter(options, param);\n                params.push(param);\n                defaults.push(null);\n            } else if (param.type === Syntax.SpreadElement) {\n                assert(i === len - 1, 'It is guaranteed that SpreadElement is last element by parseExpression');\n                if (param.argument.type !== Syntax.Identifier) {\n                    throwError({}, Messages.InvalidLHSInFormalsList);\n                }\n                reinterpretAsDestructuredParameter(options, param.argument);\n                rest = param.argument;\n            } else if (param.type === Syntax.AssignmentExpression) {\n                params.push(param.left);\n                defaults.push(param.right);\n                ++defaultCount;\n                validateParam(options, param.left, param.left.name);\n            } else {\n                return null;\n            }\n        }\n\n        if (options.message === Messages.StrictParamDupe) {\n            throwError(\n                strict ? options.stricted : options.firstRestricted,\n                options.message\n            );\n        }\n\n        if (defaultCount === 0) {\n            defaults = [];\n        }\n\n        return {\n            params: params,\n            defaults: defaults,\n            rest: rest,\n            stricted: options.stricted,\n            firstRestricted: options.firstRestricted,\n            message: options.message\n        };\n    }\n\n    function parseArrowFunctionExpression(options, marker) {\n        var previousStrict, previousYieldAllowed, previousAwaitAllowed, body;\n\n        expect('=>');\n\n        previousStrict = strict;\n        previousYieldAllowed = state.yieldAllowed;\n        state.yieldAllowed = false;\n        previousAwaitAllowed = state.awaitAllowed;\n        state.awaitAllowed = !!options.async;\n        body = parseConciseBody();\n\n        if (strict && options.firstRestricted) {\n            throwError(options.firstRestricted, options.message);\n        }\n        if (strict && options.stricted) {\n            throwErrorTolerant(options.stricted, options.message);\n        }\n\n        strict = previousStrict;\n        state.yieldAllowed = previousYieldAllowed;\n        state.awaitAllowed = previousAwaitAllowed;\n\n        return markerApply(marker, delegate.createArrowFunctionExpression(\n            options.params,\n            options.defaults,\n            body,\n            options.rest,\n            body.type !== Syntax.BlockStatement,\n            !!options.async\n        ));\n    }\n\n    function parseAssignmentExpression() {\n        var marker, expr, token, params, oldParenthesizedCount,\n            startsWithParen = false, backtrackToken = lookahead,\n            possiblyAsync = false;\n\n        if (matchYield()) {\n            return parseYieldExpression();\n        }\n\n        if (matchAwait()) {\n            return parseAwaitExpression();\n        }\n\n        oldParenthesizedCount = state.parenthesizedCount;\n\n        marker = markerCreate();\n\n        if (matchAsyncFuncExprOrDecl()) {\n            return parseFunctionExpression();\n        }\n\n        if (matchAsync()) {\n            // We can't be completely sure that this 'async' token is\n            // actually a contextual keyword modifying a function\n            // expression, so we might have to un-lex() it later by\n            // calling rewind(backtrackToken).\n            possiblyAsync = true;\n            lex();\n        }\n\n        if (match('(')) {\n            token = lookahead2();\n            if ((token.type === Token.Punctuator && token.value === ')') || token.value === '...') {\n                params = parseParams();\n                if (!match('=>')) {\n                    throwUnexpected(lex());\n                }\n                params.async = possiblyAsync;\n                return parseArrowFunctionExpression(params, marker);\n            }\n            startsWithParen = true;\n        }\n\n        token = lookahead;\n\n        // If the 'async' keyword is not followed by a '(' character or an\n        // identifier, then it can't be an arrow function modifier, and we\n        // should interpret it as a normal identifer.\n        if (possiblyAsync && !match('(') && token.type !== Token.Identifier) {\n            possiblyAsync = false;\n            rewind(backtrackToken);\n        }\n\n        expr = parseConditionalExpression();\n\n        if (match('=>') &&\n                (state.parenthesizedCount === oldParenthesizedCount ||\n                state.parenthesizedCount === (oldParenthesizedCount + 1))) {\n            if (expr.type === Syntax.Identifier) {\n                params = reinterpretAsCoverFormalsList([ expr ]);\n            } else if (expr.type === Syntax.AssignmentExpression ||\n                    expr.type === Syntax.ArrayExpression ||\n                    expr.type === Syntax.ObjectExpression) {\n                if (!startsWithParen) {\n                    throwUnexpected(lex());\n                }\n                params = reinterpretAsCoverFormalsList([ expr ]);\n            } else if (expr.type === Syntax.SequenceExpression) {\n                params = reinterpretAsCoverFormalsList(expr.expressions);\n            }\n            if (params) {\n                params.async = possiblyAsync;\n                return parseArrowFunctionExpression(params, marker);\n            }\n        }\n\n        // If we haven't returned by now, then the 'async' keyword was not\n        // a function modifier, and we should rewind and interpret it as a\n        // normal identifier.\n        if (possiblyAsync) {\n            possiblyAsync = false;\n            rewind(backtrackToken);\n            expr = parseConditionalExpression();\n        }\n\n        if (matchAssign()) {\n            // 11.13.1\n            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {\n                throwErrorTolerant(token, Messages.StrictLHSAssignment);\n            }\n\n            // ES.next draf 11.13 Runtime Semantics step 1\n            if (match('=') && (expr.type === Syntax.ObjectExpression || expr.type === Syntax.ArrayExpression)) {\n                reinterpretAsAssignmentBindingPattern(expr);\n            } else if (!isLeftHandSide(expr)) {\n                throwError({}, Messages.InvalidLHSInAssignment);\n            }\n\n            expr = markerApply(marker, delegate.createAssignmentExpression(lex().value, expr, parseAssignmentExpression()));\n        }\n\n        return expr;\n    }\n\n    // 11.14 Comma Operator\n\n    function parseExpression() {\n        var marker, expr, expressions, sequence, spreadFound;\n\n        marker = markerCreate();\n        expr = parseAssignmentExpression();\n        expressions = [ expr ];\n\n        if (match(',')) {\n            while (index < length) {\n                if (!match(',')) {\n                    break;\n                }\n\n                lex();\n                expr = parseSpreadOrAssignmentExpression();\n                expressions.push(expr);\n\n                if (expr.type === Syntax.SpreadElement) {\n                    spreadFound = true;\n                    if (!match(')')) {\n                        throwError({}, Messages.ElementAfterSpreadElement);\n                    }\n                    break;\n                }\n            }\n\n            sequence = markerApply(marker, delegate.createSequenceExpression(expressions));\n        }\n\n        if (spreadFound && lookahead2().value !== '=>') {\n            throwError({}, Messages.IllegalSpread);\n        }\n\n        return sequence || expr;\n    }\n\n    // 12.1 Block\n\n    function parseStatementList() {\n        var list = [],\n            statement;\n\n        while (index < length) {\n            if (match('}')) {\n                break;\n            }\n            statement = parseSourceElement();\n            if (typeof statement === 'undefined') {\n                break;\n            }\n            list.push(statement);\n        }\n\n        return list;\n    }\n\n    function parseBlock() {\n        var block, marker = markerCreate();\n\n        expect('{');\n\n        block = parseStatementList();\n\n        expect('}');\n\n        return markerApply(marker, delegate.createBlockStatement(block));\n    }\n\n    // 12.2 Variable Statement\n\n    function parseTypeParameterDeclaration() {\n        var marker = markerCreate(), paramTypes = [];\n\n        expect('<');\n        while (!match('>')) {\n            paramTypes.push(parseTypeAnnotatableIdentifier());\n            if (!match('>')) {\n                expect(',');\n            }\n        }\n        expect('>');\n\n        return markerApply(marker, delegate.createTypeParameterDeclaration(\n            paramTypes\n        ));\n    }\n\n    function parseTypeParameterInstantiation() {\n        var marker = markerCreate(), oldInType = state.inType, paramTypes = [];\n\n        state.inType = true;\n\n        expect('<');\n        while (!match('>')) {\n            paramTypes.push(parseType());\n            if (!match('>')) {\n                expect(',');\n            }\n        }\n        expect('>');\n\n        state.inType = oldInType;\n\n        return markerApply(marker, delegate.createTypeParameterInstantiation(\n            paramTypes\n        ));\n    }\n\n    function parseObjectTypeIndexer(marker, isStatic) {\n        var id, key, value;\n\n        expect('[');\n        id = parseObjectPropertyKey();\n        expect(':');\n        key = parseType();\n        expect(']');\n        expect(':');\n        value = parseType();\n\n        return markerApply(marker, delegate.createObjectTypeIndexer(\n            id,\n            key,\n            value,\n            isStatic\n        ));\n    }\n\n    function parseObjectTypeMethodish(marker) {\n        var params = [], rest = null, returnType, typeParameters = null;\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        expect('(');\n        while (lookahead.type === Token.Identifier) {\n            params.push(parseFunctionTypeParam());\n            if (!match(')')) {\n                expect(',');\n            }\n        }\n\n        if (match('...')) {\n            lex();\n            rest = parseFunctionTypeParam();\n        }\n        expect(')');\n        expect(':');\n        returnType = parseType();\n\n        return markerApply(marker, delegate.createFunctionTypeAnnotation(\n            params,\n            returnType,\n            rest,\n            typeParameters\n        ));\n    }\n\n    function parseObjectTypeMethod(marker, isStatic, key) {\n        var optional = false, value;\n        value = parseObjectTypeMethodish(marker);\n\n        return markerApply(marker, delegate.createObjectTypeProperty(\n            key,\n            value,\n            optional,\n            isStatic\n        ));\n    }\n\n    function parseObjectTypeCallProperty(marker, isStatic) {\n        var valueMarker = markerCreate();\n        return markerApply(marker, delegate.createObjectTypeCallProperty(\n            parseObjectTypeMethodish(valueMarker),\n            isStatic\n        ));\n    }\n\n    function parseObjectType(allowStatic) {\n        var callProperties = [], indexers = [], marker, optional = false,\n            properties = [], propertyKey, propertyTypeAnnotation,\n            token, isStatic, matchStatic;\n\n        expect('{');\n\n        while (!match('}')) {\n            marker = markerCreate();\n            matchStatic =\n                   strict\n                   ? matchKeyword('static')\n                   : matchContextualKeyword('static');\n\n            if (allowStatic && matchStatic) {\n                token = lex();\n                isStatic = true;\n            }\n\n            if (match('[')) {\n                indexers.push(parseObjectTypeIndexer(marker, isStatic));\n            } else if (match('(') || match('<')) {\n                callProperties.push(parseObjectTypeCallProperty(marker, allowStatic));\n            } else {\n                if (isStatic && match(':')) {\n                    propertyKey = markerApply(marker, delegate.createIdentifier(token));\n                    throwErrorTolerant(token, Messages.StrictReservedWord);\n                } else {\n                    propertyKey = parseObjectPropertyKey();\n                }\n                if (match('<') || match('(')) {\n                    // This is a method property\n                    properties.push(parseObjectTypeMethod(marker, isStatic, propertyKey));\n                } else {\n                    if (match('?')) {\n                        lex();\n                        optional = true;\n                    }\n                    expect(':');\n                    propertyTypeAnnotation = parseType();\n                    properties.push(markerApply(marker, delegate.createObjectTypeProperty(\n                        propertyKey,\n                        propertyTypeAnnotation,\n                        optional,\n                        isStatic\n                    )));\n                }\n            }\n\n            if (match(';')) {\n                lex();\n            } else if (!match('}')) {\n                throwUnexpected(lookahead);\n            }\n        }\n\n        expect('}');\n\n        return delegate.createObjectTypeAnnotation(\n            properties,\n            indexers,\n            callProperties\n        );\n    }\n\n    function parseGenericType() {\n        var marker = markerCreate(),\n            typeParameters = null, typeIdentifier;\n\n        typeIdentifier = parseVariableIdentifier();\n\n        while (match('.')) {\n            expect('.');\n            typeIdentifier = markerApply(marker, delegate.createQualifiedTypeIdentifier(\n                typeIdentifier,\n                parseVariableIdentifier()\n            ));\n        }\n\n        if (match('<')) {\n            typeParameters = parseTypeParameterInstantiation();\n        }\n\n        return markerApply(marker, delegate.createGenericTypeAnnotation(\n            typeIdentifier,\n            typeParameters\n        ));\n    }\n\n    function parseVoidType() {\n        var marker = markerCreate();\n        expectKeyword('void');\n        return markerApply(marker, delegate.createVoidTypeAnnotation());\n    }\n\n    function parseTypeofType() {\n        var argument, marker = markerCreate();\n        expectKeyword('typeof');\n        argument = parsePrimaryType();\n        return markerApply(marker, delegate.createTypeofTypeAnnotation(\n            argument\n        ));\n    }\n\n    function parseTupleType() {\n        var marker = markerCreate(), types = [];\n        expect('[');\n        // We allow trailing commas\n        while (index < length && !match(']')) {\n            types.push(parseType());\n            if (match(']')) {\n                break;\n            }\n            expect(',');\n        }\n        expect(']');\n        return markerApply(marker, delegate.createTupleTypeAnnotation(\n            types\n        ));\n    }\n\n    function parseFunctionTypeParam() {\n        var marker = markerCreate(), name, optional = false, typeAnnotation;\n        name = parseVariableIdentifier();\n        if (match('?')) {\n            lex();\n            optional = true;\n        }\n        expect(':');\n        typeAnnotation = parseType();\n        return markerApply(marker, delegate.createFunctionTypeParam(\n            name,\n            typeAnnotation,\n            optional\n        ));\n    }\n\n    function parseFunctionTypeParams() {\n        var ret = { params: [], rest: null };\n        while (lookahead.type === Token.Identifier) {\n            ret.params.push(parseFunctionTypeParam());\n            if (!match(')')) {\n                expect(',');\n            }\n        }\n\n        if (match('...')) {\n            lex();\n            ret.rest = parseFunctionTypeParam();\n        }\n        return ret;\n    }\n\n    // The parsing of types roughly parallels the parsing of expressions, and\n    // primary types are kind of like primary expressions...they're the\n    // primitives with which other types are constructed.\n    function parsePrimaryType() {\n        var params = null, returnType = null,\n            marker = markerCreate(), rest = null, tmp,\n            typeParameters, token, type, isGroupedType = false;\n\n        switch (lookahead.type) {\n        case Token.Identifier:\n            switch (lookahead.value) {\n            case 'any':\n                lex();\n                return markerApply(marker, delegate.createAnyTypeAnnotation());\n            case 'bool':  // fallthrough\n            case 'boolean':\n                lex();\n                return markerApply(marker, delegate.createBooleanTypeAnnotation());\n            case 'number':\n                lex();\n                return markerApply(marker, delegate.createNumberTypeAnnotation());\n            case 'string':\n                lex();\n                return markerApply(marker, delegate.createStringTypeAnnotation());\n            }\n            return markerApply(marker, parseGenericType());\n        case Token.Punctuator:\n            switch (lookahead.value) {\n            case '{':\n                return markerApply(marker, parseObjectType());\n            case '[':\n                return parseTupleType();\n            case '<':\n                typeParameters = parseTypeParameterDeclaration();\n                expect('(');\n                tmp = parseFunctionTypeParams();\n                params = tmp.params;\n                rest = tmp.rest;\n                expect(')');\n\n                expect('=>');\n\n                returnType = parseType();\n\n                return markerApply(marker, delegate.createFunctionTypeAnnotation(\n                    params,\n                    returnType,\n                    rest,\n                    typeParameters\n                ));\n            case '(':\n                lex();\n                // Check to see if this is actually a grouped type\n                if (!match(')') && !match('...')) {\n                    if (lookahead.type === Token.Identifier) {\n                        token = lookahead2();\n                        isGroupedType = token.value !== '?' && token.value !== ':';\n                    } else {\n                        isGroupedType = true;\n                    }\n                }\n\n                if (isGroupedType) {\n                    type = parseType();\n                    expect(')');\n\n                    // If we see a => next then someone was probably confused about\n                    // function types, so we can provide a better error message\n                    if (match('=>')) {\n                        throwError({}, Messages.ConfusedAboutFunctionType);\n                    }\n\n                    return type;\n                }\n\n                tmp = parseFunctionTypeParams();\n                params = tmp.params;\n                rest = tmp.rest;\n\n                expect(')');\n\n                expect('=>');\n\n                returnType = parseType();\n\n                return markerApply(marker, delegate.createFunctionTypeAnnotation(\n                    params,\n                    returnType,\n                    rest,\n                    null /* typeParameters */\n                ));\n            }\n            break;\n        case Token.Keyword:\n            switch (lookahead.value) {\n            case 'void':\n                return markerApply(marker, parseVoidType());\n            case 'typeof':\n                return markerApply(marker, parseTypeofType());\n            }\n            break;\n        case Token.StringLiteral:\n            token = lex();\n            if (token.octal) {\n                throwError(token, Messages.StrictOctalLiteral);\n            }\n            return markerApply(marker, delegate.createStringLiteralTypeAnnotation(\n                token\n            ));\n        }\n\n        throwUnexpected(lookahead);\n    }\n\n    function parsePostfixType() {\n        var marker = markerCreate(), t = parsePrimaryType();\n        if (match('[')) {\n            expect('[');\n            expect(']');\n            return markerApply(marker, delegate.createArrayTypeAnnotation(t));\n        }\n        return t;\n    }\n\n    function parsePrefixType() {\n        var marker = markerCreate();\n        if (match('?')) {\n            lex();\n            return markerApply(marker, delegate.createNullableTypeAnnotation(\n                parsePrefixType()\n            ));\n        }\n        return parsePostfixType();\n    }\n\n\n    function parseIntersectionType() {\n        var marker = markerCreate(), type, types;\n        type = parsePrefixType();\n        types = [type];\n        while (match('&')) {\n            lex();\n            types.push(parsePrefixType());\n        }\n\n        return types.length === 1 ?\n                type :\n                markerApply(marker, delegate.createIntersectionTypeAnnotation(\n                    types\n                ));\n    }\n\n    function parseUnionType() {\n        var marker = markerCreate(), type, types;\n        type = parseIntersectionType();\n        types = [type];\n        while (match('|')) {\n            lex();\n            types.push(parseIntersectionType());\n        }\n        return types.length === 1 ?\n                type :\n                markerApply(marker, delegate.createUnionTypeAnnotation(\n                    types\n                ));\n    }\n\n    function parseType() {\n        var oldInType = state.inType, type;\n        state.inType = true;\n\n        type = parseUnionType();\n\n        state.inType = oldInType;\n        return type;\n    }\n\n    function parseTypeAnnotation() {\n        var marker = markerCreate(), type;\n\n        expect(':');\n        type = parseType();\n\n        return markerApply(marker, delegate.createTypeAnnotation(type));\n    }\n\n    function parseVariableIdentifier() {\n        var marker = markerCreate(),\n            token = lex();\n\n        if (token.type !== Token.Identifier) {\n            throwUnexpected(token);\n        }\n\n        return markerApply(marker, delegate.createIdentifier(token.value));\n    }\n\n    function parseTypeAnnotatableIdentifier(requireTypeAnnotation, canBeOptionalParam) {\n        var marker = markerCreate(),\n            ident = parseVariableIdentifier(),\n            isOptionalParam = false;\n\n        if (canBeOptionalParam && match('?')) {\n            expect('?');\n            isOptionalParam = true;\n        }\n\n        if (requireTypeAnnotation || match(':')) {\n            ident.typeAnnotation = parseTypeAnnotation();\n            ident = markerApply(marker, ident);\n        }\n\n        if (isOptionalParam) {\n            ident.optional = true;\n            ident = markerApply(marker, ident);\n        }\n\n        return ident;\n    }\n\n    function parseVariableDeclaration(kind) {\n        var id,\n            marker = markerCreate(),\n            init = null,\n            typeAnnotationMarker = markerCreate();\n        if (match('{')) {\n            id = parseObjectInitialiser();\n            reinterpretAsAssignmentBindingPattern(id);\n            if (match(':')) {\n                id.typeAnnotation = parseTypeAnnotation();\n                markerApply(typeAnnotationMarker, id);\n            }\n        } else if (match('[')) {\n            id = parseArrayInitialiser();\n            reinterpretAsAssignmentBindingPattern(id);\n            if (match(':')) {\n                id.typeAnnotation = parseTypeAnnotation();\n                markerApply(typeAnnotationMarker, id);\n            }\n        } else {\n            /* istanbul ignore next */\n            id = state.allowKeyword ? parseNonComputedProperty() : parseTypeAnnotatableIdentifier();\n            // 12.2.1\n            if (strict && isRestrictedWord(id.name)) {\n                throwErrorTolerant({}, Messages.StrictVarName);\n            }\n        }\n\n        if (kind === 'const') {\n            if (!match('=')) {\n                throwError({}, Messages.NoUninitializedConst);\n            }\n            expect('=');\n            init = parseAssignmentExpression();\n        } else if (match('=')) {\n            lex();\n            init = parseAssignmentExpression();\n        }\n\n        return markerApply(marker, delegate.createVariableDeclarator(id, init));\n    }\n\n    function parseVariableDeclarationList(kind) {\n        var list = [];\n\n        do {\n            list.push(parseVariableDeclaration(kind));\n            if (!match(',')) {\n                break;\n            }\n            lex();\n        } while (index < length);\n\n        return list;\n    }\n\n    function parseVariableStatement() {\n        var declarations, marker = markerCreate();\n\n        expectKeyword('var');\n\n        declarations = parseVariableDeclarationList();\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createVariableDeclaration(declarations, 'var'));\n    }\n\n    // kind may be `const` or `let`\n    // Both are experimental and not in the specification yet.\n    // see http://wiki.ecmascript.org/doku.php?id=harmony:const\n    // and http://wiki.ecmascript.org/doku.php?id=harmony:let\n    function parseConstLetDeclaration(kind) {\n        var declarations, marker = markerCreate();\n\n        expectKeyword(kind);\n\n        declarations = parseVariableDeclarationList(kind);\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n    }\n\n    // people.mozilla.org/~jorendorff/es6-draft.html\n\n    function parseModuleSpecifier() {\n        var marker = markerCreate(),\n            specifier;\n\n        if (lookahead.type !== Token.StringLiteral) {\n            throwError({}, Messages.InvalidModuleSpecifier);\n        }\n        specifier = delegate.createModuleSpecifier(lookahead);\n        lex();\n        return markerApply(marker, specifier);\n    }\n\n    function parseExportBatchSpecifier() {\n        var marker = markerCreate();\n        expect('*');\n        return markerApply(marker, delegate.createExportBatchSpecifier());\n    }\n\n    function parseExportSpecifier() {\n        var id, name = null, marker = markerCreate(), from;\n        if (matchKeyword('default')) {\n            lex();\n            id = markerApply(marker, delegate.createIdentifier('default'));\n            // export {default} from \"something\";\n        } else {\n            id = parseVariableIdentifier();\n        }\n        if (matchContextualKeyword('as')) {\n            lex();\n            name = parseNonComputedProperty();\n        }\n\n        return markerApply(marker, delegate.createExportSpecifier(id, name));\n    }\n\n    function parseExportDeclaration() {\n        var declaration = null,\n            possibleIdentifierToken, sourceElement,\n            isExportFromIdentifier,\n            src = null, specifiers = [],\n            marker = markerCreate();\n\n        expectKeyword('export');\n\n        if (matchKeyword('default')) {\n            // covers:\n            // export default ...\n            lex();\n            if (matchKeyword('function') || matchKeyword('class')) {\n                possibleIdentifierToken = lookahead2();\n                if (isIdentifierName(possibleIdentifierToken)) {\n                    // covers:\n                    // export default function foo () {}\n                    // export default class foo {}\n                    sourceElement = parseSourceElement();\n                    return markerApply(marker, delegate.createExportDeclaration(true, sourceElement, [sourceElement.id], null));\n                }\n                // covers:\n                // export default function () {}\n                // export default class {}\n                switch (lookahead.value) {\n                case 'class':\n                    return markerApply(marker, delegate.createExportDeclaration(true, parseClassExpression(), [], null));\n                case 'function':\n                    return markerApply(marker, delegate.createExportDeclaration(true, parseFunctionExpression(), [], null));\n                }\n            }\n\n            if (matchContextualKeyword('from')) {\n                throwError({}, Messages.UnexpectedToken, lookahead.value);\n            }\n\n            // covers:\n            // export default {};\n            // export default [];\n            if (match('{')) {\n                declaration = parseObjectInitialiser();\n            } else if (match('[')) {\n                declaration = parseArrayInitialiser();\n            } else {\n                declaration = parseAssignmentExpression();\n            }\n            consumeSemicolon();\n            return markerApply(marker, delegate.createExportDeclaration(true, declaration, [], null));\n        }\n\n        // non-default export\n        if (lookahead.type === Token.Keyword || matchContextualKeyword('type')) {\n            // covers:\n            // export var f = 1;\n            switch (lookahead.value) {\n            case 'type':\n            case 'let':\n            case 'const':\n            case 'var':\n            case 'class':\n            case 'function':\n                return markerApply(marker, delegate.createExportDeclaration(false, parseSourceElement(), specifiers, null));\n            }\n        }\n\n        if (match('*')) {\n            // covers:\n            // export * from \"foo\";\n            specifiers.push(parseExportBatchSpecifier());\n\n            if (!matchContextualKeyword('from')) {\n                throwError({}, lookahead.value ?\n                        Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n            }\n            lex();\n            src = parseModuleSpecifier();\n            consumeSemicolon();\n\n            return markerApply(marker, delegate.createExportDeclaration(false, null, specifiers, src));\n        }\n\n        expect('{');\n        if (!match('}')) {\n            do {\n                isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');\n                specifiers.push(parseExportSpecifier());\n            } while (match(',') && lex());\n        }\n        expect('}');\n\n        if (matchContextualKeyword('from')) {\n            // covering:\n            // export {default} from \"foo\";\n            // export {foo} from \"foo\";\n            lex();\n            src = parseModuleSpecifier();\n            consumeSemicolon();\n        } else if (isExportFromIdentifier) {\n            // covering:\n            // export {default}; // missing fromClause\n            throwError({}, lookahead.value ?\n                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n        } else {\n            // cover\n            // export {foo};\n            consumeSemicolon();\n        }\n        return markerApply(marker, delegate.createExportDeclaration(false, declaration, specifiers, src));\n    }\n\n\n    function parseImportSpecifier() {\n        // import {<foo as bar>} ...;\n        var id, name = null, marker = markerCreate();\n\n        id = parseNonComputedProperty();\n        if (matchContextualKeyword('as')) {\n            lex();\n            name = parseVariableIdentifier();\n        }\n\n        return markerApply(marker, delegate.createImportSpecifier(id, name));\n    }\n\n    function parseNamedImports() {\n        var specifiers = [];\n        // {foo, bar as bas}\n        expect('{');\n        if (!match('}')) {\n            do {\n                specifiers.push(parseImportSpecifier());\n            } while (match(',') && lex());\n        }\n        expect('}');\n        return specifiers;\n    }\n\n    function parseImportDefaultSpecifier() {\n        // import <foo> ...;\n        var id, marker = markerCreate();\n\n        id = parseNonComputedProperty();\n\n        return markerApply(marker, delegate.createImportDefaultSpecifier(id));\n    }\n\n    function parseImportNamespaceSpecifier() {\n        // import <* as foo> ...;\n        var id, marker = markerCreate();\n\n        expect('*');\n        if (!matchContextualKeyword('as')) {\n            throwError({}, Messages.NoAsAfterImportNamespace);\n        }\n        lex();\n        id = parseNonComputedProperty();\n\n        return markerApply(marker, delegate.createImportNamespaceSpecifier(id));\n    }\n\n    function parseImportDeclaration() {\n        var specifiers, src, marker = markerCreate(), isType = false, token2;\n\n        expectKeyword('import');\n\n        if (matchContextualKeyword('type')) {\n            token2 = lookahead2();\n            if ((token2.type === Token.Identifier && token2.value !== 'from') ||\n                    (token2.type === Token.Punctuator &&\n                        (token2.value === '{' || token2.value === '*'))) {\n                isType = true;\n                lex();\n            }\n        }\n\n        specifiers = [];\n\n        if (lookahead.type === Token.StringLiteral) {\n            // covers:\n            // import \"foo\";\n            src = parseModuleSpecifier();\n            consumeSemicolon();\n            return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));\n        }\n\n        if (!matchKeyword('default') && isIdentifierName(lookahead)) {\n            // covers:\n            // import foo\n            // import foo, ...\n            specifiers.push(parseImportDefaultSpecifier());\n            if (match(',')) {\n                lex();\n            }\n        }\n        if (match('*')) {\n            // covers:\n            // import foo, * as foo\n            // import * as foo\n            specifiers.push(parseImportNamespaceSpecifier());\n        } else if (match('{')) {\n            // covers:\n            // import foo, {bar}\n            // import {bar}\n            specifiers = specifiers.concat(parseNamedImports());\n        }\n\n        if (!matchContextualKeyword('from')) {\n            throwError({}, lookahead.value ?\n                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n        }\n        lex();\n        src = parseModuleSpecifier();\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));\n    }\n\n    // 12.3 Empty Statement\n\n    function parseEmptyStatement() {\n        var marker = markerCreate();\n        expect(';');\n        return markerApply(marker, delegate.createEmptyStatement());\n    }\n\n    // 12.4 Expression Statement\n\n    function parseExpressionStatement() {\n        var marker = markerCreate(), expr = parseExpression();\n        consumeSemicolon();\n        return markerApply(marker, delegate.createExpressionStatement(expr));\n    }\n\n    // 12.5 If statement\n\n    function parseIfStatement() {\n        var test, consequent, alternate, marker = markerCreate();\n\n        expectKeyword('if');\n\n        expect('(');\n\n        test = parseExpression();\n\n        expect(')');\n\n        consequent = parseStatement();\n\n        if (matchKeyword('else')) {\n            lex();\n            alternate = parseStatement();\n        } else {\n            alternate = null;\n        }\n\n        return markerApply(marker, delegate.createIfStatement(test, consequent, alternate));\n    }\n\n    // 12.6 Iteration Statements\n\n    function parseDoWhileStatement() {\n        var body, test, oldInIteration, marker = markerCreate();\n\n        expectKeyword('do');\n\n        oldInIteration = state.inIteration;\n        state.inIteration = true;\n\n        body = parseStatement();\n\n        state.inIteration = oldInIteration;\n\n        expectKeyword('while');\n\n        expect('(');\n\n        test = parseExpression();\n\n        expect(')');\n\n        if (match(';')) {\n            lex();\n        }\n\n        return markerApply(marker, delegate.createDoWhileStatement(body, test));\n    }\n\n    function parseWhileStatement() {\n        var test, body, oldInIteration, marker = markerCreate();\n\n        expectKeyword('while');\n\n        expect('(');\n\n        test = parseExpression();\n\n        expect(')');\n\n        oldInIteration = state.inIteration;\n        state.inIteration = true;\n\n        body = parseStatement();\n\n        state.inIteration = oldInIteration;\n\n        return markerApply(marker, delegate.createWhileStatement(test, body));\n    }\n\n    function parseForVariableDeclaration() {\n        var marker = markerCreate(),\n            token = lex(),\n            declarations = parseVariableDeclarationList();\n\n        return markerApply(marker, delegate.createVariableDeclaration(declarations, token.value));\n    }\n\n    function parseForStatement(opts) {\n        var init, test, update, left, right, body, operator, oldInIteration,\n            marker = markerCreate();\n        init = test = update = null;\n        expectKeyword('for');\n\n        // http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators&s=each\n        if (matchContextualKeyword('each')) {\n            throwError({}, Messages.EachNotAllowed);\n        }\n\n        expect('(');\n\n        if (match(';')) {\n            lex();\n        } else {\n            if (matchKeyword('var') || matchKeyword('let') || matchKeyword('const')) {\n                state.allowIn = false;\n                init = parseForVariableDeclaration();\n                state.allowIn = true;\n\n                if (init.declarations.length === 1) {\n                    if (matchKeyword('in') || matchContextualKeyword('of')) {\n                        operator = lookahead;\n                        if (!((operator.value === 'in' || init.kind !== 'var') && init.declarations[0].init)) {\n                            lex();\n                            left = init;\n                            right = parseExpression();\n                            init = null;\n                        }\n                    }\n                }\n            } else {\n                state.allowIn = false;\n                init = parseExpression();\n                state.allowIn = true;\n\n                if (matchContextualKeyword('of')) {\n                    operator = lex();\n                    left = init;\n                    right = parseExpression();\n                    init = null;\n                } else if (matchKeyword('in')) {\n                    // LeftHandSideExpression\n                    if (!isAssignableLeftHandSide(init)) {\n                        throwError({}, Messages.InvalidLHSInForIn);\n                    }\n                    operator = lex();\n                    left = init;\n                    right = parseExpression();\n                    init = null;\n                }\n            }\n\n            if (typeof left === 'undefined') {\n                expect(';');\n            }\n        }\n\n        if (typeof left === 'undefined') {\n\n            if (!match(';')) {\n                test = parseExpression();\n            }\n            expect(';');\n\n            if (!match(')')) {\n                update = parseExpression();\n            }\n        }\n\n        expect(')');\n\n        oldInIteration = state.inIteration;\n        state.inIteration = true;\n\n        if (!(opts !== undefined && opts.ignoreBody)) {\n            body = parseStatement();\n        }\n\n        state.inIteration = oldInIteration;\n\n        if (typeof left === 'undefined') {\n            return markerApply(marker, delegate.createForStatement(init, test, update, body));\n        }\n\n        if (operator.value === 'in') {\n            return markerApply(marker, delegate.createForInStatement(left, right, body));\n        }\n        return markerApply(marker, delegate.createForOfStatement(left, right, body));\n    }\n\n    // 12.7 The continue statement\n\n    function parseContinueStatement() {\n        var label = null, marker = markerCreate();\n\n        expectKeyword('continue');\n\n        // Optimize the most common form: 'continue;'.\n        if (source.charCodeAt(index) === 59) {\n            lex();\n\n            if (!state.inIteration) {\n                throwError({}, Messages.IllegalContinue);\n            }\n\n            return markerApply(marker, delegate.createContinueStatement(null));\n        }\n\n        if (peekLineTerminator()) {\n            if (!state.inIteration) {\n                throwError({}, Messages.IllegalContinue);\n            }\n\n            return markerApply(marker, delegate.createContinueStatement(null));\n        }\n\n        if (lookahead.type === Token.Identifier) {\n            label = parseVariableIdentifier();\n\n            if (!state.labelSet.has(label.name)) {\n                throwError({}, Messages.UnknownLabel, label.name);\n            }\n        }\n\n        consumeSemicolon();\n\n        if (label === null && !state.inIteration) {\n            throwError({}, Messages.IllegalContinue);\n        }\n\n        return markerApply(marker, delegate.createContinueStatement(label));\n    }\n\n    // 12.8 The break statement\n\n    function parseBreakStatement() {\n        var label = null, marker = markerCreate();\n\n        expectKeyword('break');\n\n        // Catch the very common case first: immediately a semicolon (char #59).\n        if (source.charCodeAt(index) === 59) {\n            lex();\n\n            if (!(state.inIteration || state.inSwitch)) {\n                throwError({}, Messages.IllegalBreak);\n            }\n\n            return markerApply(marker, delegate.createBreakStatement(null));\n        }\n\n        if (peekLineTerminator()) {\n            if (!(state.inIteration || state.inSwitch)) {\n                throwError({}, Messages.IllegalBreak);\n            }\n\n            return markerApply(marker, delegate.createBreakStatement(null));\n        }\n\n        if (lookahead.type === Token.Identifier) {\n            label = parseVariableIdentifier();\n\n            if (!state.labelSet.has(label.name)) {\n                throwError({}, Messages.UnknownLabel, label.name);\n            }\n        }\n\n        consumeSemicolon();\n\n        if (label === null && !(state.inIteration || state.inSwitch)) {\n            throwError({}, Messages.IllegalBreak);\n        }\n\n        return markerApply(marker, delegate.createBreakStatement(label));\n    }\n\n    // 12.9 The return statement\n\n    function parseReturnStatement() {\n        var argument = null, marker = markerCreate();\n\n        expectKeyword('return');\n\n        if (!state.inFunctionBody) {\n            throwErrorTolerant({}, Messages.IllegalReturn);\n        }\n\n        // 'return' followed by a space and an identifier is very common.\n        if (source.charCodeAt(index) === 32) {\n            if (isIdentifierStart(source.charCodeAt(index + 1))) {\n                argument = parseExpression();\n                consumeSemicolon();\n                return markerApply(marker, delegate.createReturnStatement(argument));\n            }\n        }\n\n        if (peekLineTerminator()) {\n            return markerApply(marker, delegate.createReturnStatement(null));\n        }\n\n        if (!match(';')) {\n            if (!match('}') && lookahead.type !== Token.EOF) {\n                argument = parseExpression();\n            }\n        }\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createReturnStatement(argument));\n    }\n\n    // 12.10 The with statement\n\n    function parseWithStatement() {\n        var object, body, marker = markerCreate();\n\n        if (strict) {\n            throwErrorTolerant({}, Messages.StrictModeWith);\n        }\n\n        expectKeyword('with');\n\n        expect('(');\n\n        object = parseExpression();\n\n        expect(')');\n\n        body = parseStatement();\n\n        return markerApply(marker, delegate.createWithStatement(object, body));\n    }\n\n    // 12.10 The swith statement\n\n    function parseSwitchCase() {\n        var test,\n            consequent = [],\n            sourceElement,\n            marker = markerCreate();\n\n        if (matchKeyword('default')) {\n            lex();\n            test = null;\n        } else {\n            expectKeyword('case');\n            test = parseExpression();\n        }\n        expect(':');\n\n        while (index < length) {\n            if (match('}') || matchKeyword('default') || matchKeyword('case')) {\n                break;\n            }\n            sourceElement = parseSourceElement();\n            if (typeof sourceElement === 'undefined') {\n                break;\n            }\n            consequent.push(sourceElement);\n        }\n\n        return markerApply(marker, delegate.createSwitchCase(test, consequent));\n    }\n\n    function parseSwitchStatement() {\n        var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate();\n\n        expectKeyword('switch');\n\n        expect('(');\n\n        discriminant = parseExpression();\n\n        expect(')');\n\n        expect('{');\n\n        cases = [];\n\n        if (match('}')) {\n            lex();\n            return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));\n        }\n\n        oldInSwitch = state.inSwitch;\n        state.inSwitch = true;\n        defaultFound = false;\n\n        while (index < length) {\n            if (match('}')) {\n                break;\n            }\n            clause = parseSwitchCase();\n            if (clause.test === null) {\n                if (defaultFound) {\n                    throwError({}, Messages.MultipleDefaultsInSwitch);\n                }\n                defaultFound = true;\n            }\n            cases.push(clause);\n        }\n\n        state.inSwitch = oldInSwitch;\n\n        expect('}');\n\n        return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));\n    }\n\n    // 12.13 The throw statement\n\n    function parseThrowStatement() {\n        var argument, marker = markerCreate();\n\n        expectKeyword('throw');\n\n        if (peekLineTerminator()) {\n            throwError({}, Messages.NewlineAfterThrow);\n        }\n\n        argument = parseExpression();\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createThrowStatement(argument));\n    }\n\n    // 12.14 The try statement\n\n    function parseCatchClause() {\n        var param, body, marker = markerCreate();\n\n        expectKeyword('catch');\n\n        expect('(');\n        if (match(')')) {\n            throwUnexpected(lookahead);\n        }\n\n        param = parseExpression();\n        // 12.14.1\n        if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {\n            throwErrorTolerant({}, Messages.StrictCatchVariable);\n        }\n\n        expect(')');\n        body = parseBlock();\n        return markerApply(marker, delegate.createCatchClause(param, body));\n    }\n\n    function parseTryStatement() {\n        var block, handlers = [], finalizer = null, marker = markerCreate();\n\n        expectKeyword('try');\n\n        block = parseBlock();\n\n        if (matchKeyword('catch')) {\n            handlers.push(parseCatchClause());\n        }\n\n        if (matchKeyword('finally')) {\n            lex();\n            finalizer = parseBlock();\n        }\n\n        if (handlers.length === 0 && !finalizer) {\n            throwError({}, Messages.NoCatchOrFinally);\n        }\n\n        return markerApply(marker, delegate.createTryStatement(block, [], handlers, finalizer));\n    }\n\n    // 12.15 The debugger statement\n\n    function parseDebuggerStatement() {\n        var marker = markerCreate();\n        expectKeyword('debugger');\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createDebuggerStatement());\n    }\n\n    // 12 Statements\n\n    function parseStatement() {\n        var type = lookahead.type,\n            marker,\n            expr,\n            labeledBody;\n\n        if (type === Token.EOF) {\n            throwUnexpected(lookahead);\n        }\n\n        if (type === Token.Punctuator) {\n            switch (lookahead.value) {\n            case ';':\n                return parseEmptyStatement();\n            case '{':\n                return parseBlock();\n            case '(':\n                return parseExpressionStatement();\n            default:\n                break;\n            }\n        }\n\n        if (type === Token.Keyword) {\n            switch (lookahead.value) {\n            case 'break':\n                return parseBreakStatement();\n            case 'continue':\n                return parseContinueStatement();\n            case 'debugger':\n                return parseDebuggerStatement();\n            case 'do':\n                return parseDoWhileStatement();\n            case 'for':\n                return parseForStatement();\n            case 'function':\n                return parseFunctionDeclaration();\n            case 'class':\n                return parseClassDeclaration();\n            case 'if':\n                return parseIfStatement();\n            case 'return':\n                return parseReturnStatement();\n            case 'switch':\n                return parseSwitchStatement();\n            case 'throw':\n                return parseThrowStatement();\n            case 'try':\n                return parseTryStatement();\n            case 'var':\n                return parseVariableStatement();\n            case 'while':\n                return parseWhileStatement();\n            case 'with':\n                return parseWithStatement();\n            default:\n                break;\n            }\n        }\n\n        if (matchAsyncFuncExprOrDecl()) {\n            return parseFunctionDeclaration();\n        }\n\n        marker = markerCreate();\n        expr = parseExpression();\n\n        // 12.12 Labelled Statements\n        if ((expr.type === Syntax.Identifier) && match(':')) {\n            lex();\n\n            if (state.labelSet.has(expr.name)) {\n                throwError({}, Messages.Redeclaration, 'Label', expr.name);\n            }\n\n            state.labelSet.set(expr.name, true);\n            labeledBody = parseStatement();\n            state.labelSet[\"delete\"](expr.name);\n            return markerApply(marker, delegate.createLabeledStatement(expr, labeledBody));\n        }\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createExpressionStatement(expr));\n    }\n\n    // 13 Function Definition\n\n    function parseConciseBody() {\n        if (match('{')) {\n            return parseFunctionSourceElements();\n        }\n        return parseAssignmentExpression();\n    }\n\n    function parseFunctionSourceElements() {\n        var sourceElement, sourceElements = [], token, directive, firstRestricted,\n            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,\n            marker = markerCreate();\n\n        expect('{');\n\n        while (index < length) {\n            if (lookahead.type !== Token.StringLiteral) {\n                break;\n            }\n            token = lookahead;\n\n            sourceElement = parseSourceElement();\n            sourceElements.push(sourceElement);\n            if (sourceElement.expression.type !== Syntax.Literal) {\n                // this is not directive\n                break;\n            }\n            directive = source.slice(token.range[0] + 1, token.range[1] - 1);\n            if (directive === 'use strict') {\n                strict = true;\n                if (firstRestricted) {\n                    throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n                }\n            } else {\n                if (!firstRestricted && token.octal) {\n                    firstRestricted = token;\n                }\n            }\n        }\n\n        oldLabelSet = state.labelSet;\n        oldInIteration = state.inIteration;\n        oldInSwitch = state.inSwitch;\n        oldInFunctionBody = state.inFunctionBody;\n        oldParenthesizedCount = state.parenthesizedCount;\n\n        state.labelSet = new StringMap();\n        state.inIteration = false;\n        state.inSwitch = false;\n        state.inFunctionBody = true;\n        state.parenthesizedCount = 0;\n\n        while (index < length) {\n            if (match('}')) {\n                break;\n            }\n            sourceElement = parseSourceElement();\n            if (typeof sourceElement === 'undefined') {\n                break;\n            }\n            sourceElements.push(sourceElement);\n        }\n\n        expect('}');\n\n        state.labelSet = oldLabelSet;\n        state.inIteration = oldInIteration;\n        state.inSwitch = oldInSwitch;\n        state.inFunctionBody = oldInFunctionBody;\n        state.parenthesizedCount = oldParenthesizedCount;\n\n        return markerApply(marker, delegate.createBlockStatement(sourceElements));\n    }\n\n    function validateParam(options, param, name) {\n        if (strict) {\n            if (isRestrictedWord(name)) {\n                options.stricted = param;\n                options.message = Messages.StrictParamName;\n            }\n            if (options.paramSet.has(name)) {\n                options.stricted = param;\n                options.message = Messages.StrictParamDupe;\n            }\n        } else if (!options.firstRestricted) {\n            if (isRestrictedWord(name)) {\n                options.firstRestricted = param;\n                options.message = Messages.StrictParamName;\n            } else if (isStrictModeReservedWord(name)) {\n                options.firstRestricted = param;\n                options.message = Messages.StrictReservedWord;\n            } else if (options.paramSet.has(name)) {\n                options.firstRestricted = param;\n                options.message = Messages.StrictParamDupe;\n            }\n        }\n        options.paramSet.set(name, true);\n    }\n\n    function parseParam(options) {\n        var marker, token, rest, param, def;\n\n        token = lookahead;\n        if (token.value === '...') {\n            token = lex();\n            rest = true;\n        }\n\n        if (match('[')) {\n            marker = markerCreate();\n            param = parseArrayInitialiser();\n            reinterpretAsDestructuredParameter(options, param);\n            if (match(':')) {\n                param.typeAnnotation = parseTypeAnnotation();\n                markerApply(marker, param);\n            }\n        } else if (match('{')) {\n            marker = markerCreate();\n            if (rest) {\n                throwError({}, Messages.ObjectPatternAsRestParameter);\n            }\n            param = parseObjectInitialiser();\n            reinterpretAsDestructuredParameter(options, param);\n            if (match(':')) {\n                param.typeAnnotation = parseTypeAnnotation();\n                markerApply(marker, param);\n            }\n        } else {\n            param =\n                rest\n                ? parseTypeAnnotatableIdentifier(\n                    false, /* requireTypeAnnotation */\n                    false /* canBeOptionalParam */\n                )\n                : parseTypeAnnotatableIdentifier(\n                    false, /* requireTypeAnnotation */\n                    true /* canBeOptionalParam */\n                );\n\n            validateParam(options, token, token.value);\n        }\n\n        if (match('=')) {\n            if (rest) {\n                throwErrorTolerant(lookahead, Messages.DefaultRestParameter);\n            }\n            lex();\n            def = parseAssignmentExpression();\n            ++options.defaultCount;\n        }\n\n        if (rest) {\n            if (!match(')')) {\n                throwError({}, Messages.ParameterAfterRestParameter);\n            }\n            options.rest = param;\n            return false;\n        }\n\n        options.params.push(param);\n        options.defaults.push(def);\n        return !match(')');\n    }\n\n    function parseParams(firstRestricted) {\n        var options, marker = markerCreate();\n\n        options = {\n            params: [],\n            defaultCount: 0,\n            defaults: [],\n            rest: null,\n            firstRestricted: firstRestricted\n        };\n\n        expect('(');\n\n        if (!match(')')) {\n            options.paramSet = new StringMap();\n            while (index < length) {\n                if (!parseParam(options)) {\n                    break;\n                }\n                expect(',');\n            }\n        }\n\n        expect(')');\n\n        if (options.defaultCount === 0) {\n            options.defaults = [];\n        }\n\n        if (match(':')) {\n            options.returnType = parseTypeAnnotation();\n        }\n\n        return markerApply(marker, options);\n    }\n\n    function parseFunctionDeclaration() {\n        var id, body, token, tmp, firstRestricted, message, generator, isAsync,\n            previousStrict, previousYieldAllowed, previousAwaitAllowed,\n            marker = markerCreate(), typeParameters;\n\n        isAsync = false;\n        if (matchAsync()) {\n            lex();\n            isAsync = true;\n        }\n\n        expectKeyword('function');\n\n        generator = false;\n        if (match('*')) {\n            lex();\n            generator = true;\n        }\n\n        token = lookahead;\n\n        id = parseVariableIdentifier();\n\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        if (strict) {\n            if (isRestrictedWord(token.value)) {\n                throwErrorTolerant(token, Messages.StrictFunctionName);\n            }\n        } else {\n            if (isRestrictedWord(token.value)) {\n                firstRestricted = token;\n                message = Messages.StrictFunctionName;\n            } else if (isStrictModeReservedWord(token.value)) {\n                firstRestricted = token;\n                message = Messages.StrictReservedWord;\n            }\n        }\n\n        tmp = parseParams(firstRestricted);\n        firstRestricted = tmp.firstRestricted;\n        if (tmp.message) {\n            message = tmp.message;\n        }\n\n        previousStrict = strict;\n        previousYieldAllowed = state.yieldAllowed;\n        state.yieldAllowed = generator;\n        previousAwaitAllowed = state.awaitAllowed;\n        state.awaitAllowed = isAsync;\n\n        body = parseFunctionSourceElements();\n\n        if (strict && firstRestricted) {\n            throwError(firstRestricted, message);\n        }\n        if (strict && tmp.stricted) {\n            throwErrorTolerant(tmp.stricted, message);\n        }\n        strict = previousStrict;\n        state.yieldAllowed = previousYieldAllowed;\n        state.awaitAllowed = previousAwaitAllowed;\n\n        return markerApply(\n            marker,\n            delegate.createFunctionDeclaration(\n                id,\n                tmp.params,\n                tmp.defaults,\n                body,\n                tmp.rest,\n                generator,\n                false,\n                isAsync,\n                tmp.returnType,\n                typeParameters\n            )\n        );\n    }\n\n    function parseFunctionExpression() {\n        var token, id = null, firstRestricted, message, tmp, body, generator, isAsync,\n            previousStrict, previousYieldAllowed, previousAwaitAllowed,\n            marker = markerCreate(), typeParameters;\n\n        isAsync = false;\n        if (matchAsync()) {\n            lex();\n            isAsync = true;\n        }\n\n        expectKeyword('function');\n\n        generator = false;\n\n        if (match('*')) {\n            lex();\n            generator = true;\n        }\n\n        if (!match('(')) {\n            if (!match('<')) {\n                token = lookahead;\n                id = parseVariableIdentifier();\n\n                if (strict) {\n                    if (isRestrictedWord(token.value)) {\n                        throwErrorTolerant(token, Messages.StrictFunctionName);\n                    }\n                } else {\n                    if (isRestrictedWord(token.value)) {\n                        firstRestricted = token;\n                        message = Messages.StrictFunctionName;\n                    } else if (isStrictModeReservedWord(token.value)) {\n                        firstRestricted = token;\n                        message = Messages.StrictReservedWord;\n                    }\n                }\n            }\n\n            if (match('<')) {\n                typeParameters = parseTypeParameterDeclaration();\n            }\n        }\n\n        tmp = parseParams(firstRestricted);\n        firstRestricted = tmp.firstRestricted;\n        if (tmp.message) {\n            message = tmp.message;\n        }\n\n        previousStrict = strict;\n        previousYieldAllowed = state.yieldAllowed;\n        state.yieldAllowed = generator;\n        previousAwaitAllowed = state.awaitAllowed;\n        state.awaitAllowed = isAsync;\n\n        body = parseFunctionSourceElements();\n\n        if (strict && firstRestricted) {\n            throwError(firstRestricted, message);\n        }\n        if (strict && tmp.stricted) {\n            throwErrorTolerant(tmp.stricted, message);\n        }\n        strict = previousStrict;\n        state.yieldAllowed = previousYieldAllowed;\n        state.awaitAllowed = previousAwaitAllowed;\n\n        return markerApply(\n            marker,\n            delegate.createFunctionExpression(\n                id,\n                tmp.params,\n                tmp.defaults,\n                body,\n                tmp.rest,\n                generator,\n                false,\n                isAsync,\n                tmp.returnType,\n                typeParameters\n            )\n        );\n    }\n\n    function parseYieldExpression() {\n        var delegateFlag, expr, marker = markerCreate();\n\n        expectKeyword('yield', !strict);\n\n        delegateFlag = false;\n        if (match('*')) {\n            lex();\n            delegateFlag = true;\n        }\n\n        expr = parseAssignmentExpression();\n\n        return markerApply(marker, delegate.createYieldExpression(expr, delegateFlag));\n    }\n\n    function parseAwaitExpression() {\n        var expr, marker = markerCreate();\n        expectContextualKeyword('await');\n        expr = parseAssignmentExpression();\n        return markerApply(marker, delegate.createAwaitExpression(expr));\n    }\n\n    // 14 Functions and classes\n\n    // 14.1 Functions is defined above (13 in ES5)\n    // 14.2 Arrow Functions Definitions is defined in (7.3 assignments)\n\n    // 14.3 Method Definitions\n    // 14.3.7\n    function specialMethod(methodDefinition) {\n        return methodDefinition.kind === 'get' ||\n               methodDefinition.kind === 'set' ||\n               methodDefinition.value.generator;\n    }\n\n    function parseMethodDefinition(key, isStatic, generator, computed) {\n        var token, param, propType,\n            isAsync, typeParameters, tokenValue, returnType;\n\n        propType = isStatic ? ClassPropertyType[\"static\"] : ClassPropertyType.prototype;\n\n        if (generator) {\n            return delegate.createMethodDefinition(\n                propType,\n                '',\n                key,\n                parsePropertyMethodFunction({ generator: true }),\n                computed\n            );\n        }\n\n        tokenValue = key.type === 'Identifier' && key.name;\n\n        if (tokenValue === 'get' && !match('(')) {\n            key = parseObjectPropertyKey();\n\n            expect('(');\n            expect(')');\n            if (match(':')) {\n                returnType = parseTypeAnnotation();\n            }\n            return delegate.createMethodDefinition(\n                propType,\n                'get',\n                key,\n                parsePropertyFunction({ generator: false, returnType: returnType }),\n                computed\n            );\n        }\n        if (tokenValue === 'set' && !match('(')) {\n            key = parseObjectPropertyKey();\n\n            expect('(');\n            token = lookahead;\n            param = [ parseTypeAnnotatableIdentifier() ];\n            expect(')');\n            if (match(':')) {\n                returnType = parseTypeAnnotation();\n            }\n            return delegate.createMethodDefinition(\n                propType,\n                'set',\n                key,\n                parsePropertyFunction({\n                    params: param,\n                    generator: false,\n                    name: token,\n                    returnType: returnType\n                }),\n                computed\n            );\n        }\n\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        isAsync = tokenValue === 'async' && !match('(');\n        if (isAsync) {\n            key = parseObjectPropertyKey();\n        }\n\n        return delegate.createMethodDefinition(\n            propType,\n            '',\n            key,\n            parsePropertyMethodFunction({\n                generator: false,\n                async: isAsync,\n                typeParameters: typeParameters\n            }),\n            computed\n        );\n    }\n\n    function parseClassProperty(key, computed, isStatic) {\n        var typeAnnotation;\n\n        typeAnnotation = parseTypeAnnotation();\n        expect(';');\n\n        return delegate.createClassProperty(\n            key,\n            typeAnnotation,\n            computed,\n            isStatic\n        );\n    }\n\n    function parseClassElement() {\n        var computed = false, generator = false, key, marker = markerCreate(),\n            isStatic = false, possiblyOpenBracketToken;\n        if (match(';')) {\n            lex();\n            return undefined;\n        }\n\n        if (lookahead.value === 'static') {\n            lex();\n            isStatic = true;\n        }\n\n        if (match('*')) {\n            lex();\n            generator = true;\n        }\n\n        possiblyOpenBracketToken = lookahead;\n        if (matchContextualKeyword('get') || matchContextualKeyword('set')) {\n            possiblyOpenBracketToken = lookahead2();\n        }\n\n        if (possiblyOpenBracketToken.type === Token.Punctuator\n                && possiblyOpenBracketToken.value === '[') {\n            computed = true;\n        }\n\n        key = parseObjectPropertyKey();\n\n        if (!generator && lookahead.value === ':') {\n            return markerApply(marker, parseClassProperty(key, computed, isStatic));\n        }\n\n        return markerApply(marker, parseMethodDefinition(\n            key,\n            isStatic,\n            generator,\n            computed\n        ));\n    }\n\n    function parseClassBody() {\n        var classElement, classElements = [], existingProps = {},\n            marker = markerCreate(), propName, propType;\n\n        existingProps[ClassPropertyType[\"static\"]] = new StringMap();\n        existingProps[ClassPropertyType.prototype] = new StringMap();\n\n        expect('{');\n\n        while (index < length) {\n            if (match('}')) {\n                break;\n            }\n            classElement = parseClassElement(existingProps);\n\n            if (typeof classElement !== 'undefined') {\n                classElements.push(classElement);\n\n                propName = !classElement.computed && getFieldName(classElement.key);\n                if (propName !== false) {\n                    propType = classElement[\"static\"] ?\n                                ClassPropertyType[\"static\"] :\n                                ClassPropertyType.prototype;\n\n                    if (classElement.type === Syntax.MethodDefinition) {\n                        if (propName === 'constructor' && !classElement[\"static\"]) {\n                            if (specialMethod(classElement)) {\n                                throwError(classElement, Messages.IllegalClassConstructorProperty);\n                            }\n                            if (existingProps[ClassPropertyType.prototype].has('constructor')) {\n                                throwError(classElement.key, Messages.IllegalDuplicateClassProperty);\n                            }\n                        }\n                        existingProps[propType].set(propName, true);\n                    }\n                }\n            }\n        }\n\n        expect('}');\n\n        return markerApply(marker, delegate.createClassBody(classElements));\n    }\n\n    function parseClassImplements() {\n        var id, implemented = [], marker, typeParameters;\n        if (strict) {\n            expectKeyword('implements');\n        } else {\n            expectContextualKeyword('implements');\n        }\n        while (index < length) {\n            marker = markerCreate();\n            id = parseVariableIdentifier();\n            if (match('<')) {\n                typeParameters = parseTypeParameterInstantiation();\n            } else {\n                typeParameters = null;\n            }\n            implemented.push(markerApply(marker, delegate.createClassImplements(\n                id,\n                typeParameters\n            )));\n            if (!match(',')) {\n                break;\n            }\n            expect(',');\n        }\n        return implemented;\n    }\n\n    function parseClassExpression() {\n        var id, implemented, previousYieldAllowed, superClass = null,\n            superTypeParameters, marker = markerCreate(), typeParameters,\n            matchImplements;\n\n        expectKeyword('class');\n\n        matchImplements =\n                strict\n                ? matchKeyword('implements')\n                : matchContextualKeyword('implements');\n\n        if (!matchKeyword('extends') && !matchImplements && !match('{')) {\n            id = parseVariableIdentifier();\n        }\n\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        if (matchKeyword('extends')) {\n            expectKeyword('extends');\n            previousYieldAllowed = state.yieldAllowed;\n            state.yieldAllowed = false;\n            superClass = parseLeftHandSideExpressionAllowCall();\n            if (match('<')) {\n                superTypeParameters = parseTypeParameterInstantiation();\n            }\n            state.yieldAllowed = previousYieldAllowed;\n        }\n\n        if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {\n            implemented = parseClassImplements();\n        }\n\n        return markerApply(marker, delegate.createClassExpression(\n            id,\n            superClass,\n            parseClassBody(),\n            typeParameters,\n            superTypeParameters,\n            implemented\n        ));\n    }\n\n    function parseClassDeclaration() {\n        var id, implemented, previousYieldAllowed, superClass = null,\n            superTypeParameters, marker = markerCreate(), typeParameters;\n\n        expectKeyword('class');\n\n        id = parseVariableIdentifier();\n\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        if (matchKeyword('extends')) {\n            expectKeyword('extends');\n            previousYieldAllowed = state.yieldAllowed;\n            state.yieldAllowed = false;\n            superClass = parseLeftHandSideExpressionAllowCall();\n            if (match('<')) {\n                superTypeParameters = parseTypeParameterInstantiation();\n            }\n            state.yieldAllowed = previousYieldAllowed;\n        }\n\n        if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {\n            implemented = parseClassImplements();\n        }\n\n        return markerApply(marker, delegate.createClassDeclaration(\n            id,\n            superClass,\n            parseClassBody(),\n            typeParameters,\n            superTypeParameters,\n            implemented\n        ));\n    }\n\n    // 15 Program\n\n    function parseSourceElement() {\n        var token;\n        if (lookahead.type === Token.Keyword) {\n            switch (lookahead.value) {\n            case 'const':\n            case 'let':\n                return parseConstLetDeclaration(lookahead.value);\n            case 'function':\n                return parseFunctionDeclaration();\n            case 'export':\n                throwErrorTolerant({}, Messages.IllegalExportDeclaration);\n                return parseExportDeclaration();\n            case 'import':\n                throwErrorTolerant({}, Messages.IllegalImportDeclaration);\n                return parseImportDeclaration();\n            case 'interface':\n                if (lookahead2().type === Token.Identifier) {\n                    return parseInterface();\n                }\n                return parseStatement();\n            default:\n                return parseStatement();\n            }\n        }\n\n        if (matchContextualKeyword('type')\n                && lookahead2().type === Token.Identifier) {\n            return parseTypeAlias();\n        }\n\n        if (matchContextualKeyword('interface')\n                && lookahead2().type === Token.Identifier) {\n            return parseInterface();\n        }\n\n        if (matchContextualKeyword('declare')) {\n            token = lookahead2();\n            if (token.type === Token.Keyword) {\n                switch (token.value) {\n                case 'class':\n                    return parseDeclareClass();\n                case 'function':\n                    return parseDeclareFunction();\n                case 'var':\n                    return parseDeclareVariable();\n                }\n            } else if (token.type === Token.Identifier\n                    && token.value === 'module') {\n                return parseDeclareModule();\n            }\n        }\n\n        if (lookahead.type !== Token.EOF) {\n            return parseStatement();\n        }\n    }\n\n    function parseProgramElement() {\n        var isModule = extra.sourceType === 'module' || extra.sourceType === 'nonStrictModule';\n\n        if (isModule && lookahead.type === Token.Keyword) {\n            switch (lookahead.value) {\n            case 'export':\n                return parseExportDeclaration();\n            case 'import':\n                return parseImportDeclaration();\n            }\n        }\n\n        return parseSourceElement();\n    }\n\n    function parseProgramElements() {\n        var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n        while (index < length) {\n            token = lookahead;\n            if (token.type !== Token.StringLiteral) {\n                break;\n            }\n\n            sourceElement = parseProgramElement();\n            sourceElements.push(sourceElement);\n            if (sourceElement.expression.type !== Syntax.Literal) {\n                // this is not directive\n                break;\n            }\n            directive = source.slice(token.range[0] + 1, token.range[1] - 1);\n            if (directive === 'use strict') {\n                strict = true;\n                if (firstRestricted) {\n                    throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n                }\n            } else {\n                if (!firstRestricted && token.octal) {\n                    firstRestricted = token;\n                }\n            }\n        }\n\n        while (index < length) {\n            sourceElement = parseProgramElement();\n            if (typeof sourceElement === 'undefined') {\n                break;\n            }\n            sourceElements.push(sourceElement);\n        }\n        return sourceElements;\n    }\n\n    function parseProgram() {\n        var body, marker = markerCreate();\n        strict = extra.sourceType === 'module';\n        peek();\n        body = parseProgramElements();\n        return markerApply(marker, delegate.createProgram(body));\n    }\n\n    // 16 JSX\n\n    XHTMLEntities = {\n        quot: '\\u0022',\n        amp: '&',\n        apos: '\\u0027',\n        lt: '<',\n        gt: '>',\n        nbsp: '\\u00A0',\n        iexcl: '\\u00A1',\n        cent: '\\u00A2',\n        pound: '\\u00A3',\n        curren: '\\u00A4',\n        yen: '\\u00A5',\n        brvbar: '\\u00A6',\n        sect: '\\u00A7',\n        uml: '\\u00A8',\n        copy: '\\u00A9',\n        ordf: '\\u00AA',\n        laquo: '\\u00AB',\n        not: '\\u00AC',\n        shy: '\\u00AD',\n        reg: '\\u00AE',\n        macr: '\\u00AF',\n        deg: '\\u00B0',\n        plusmn: '\\u00B1',\n        sup2: '\\u00B2',\n        sup3: '\\u00B3',\n        acute: '\\u00B4',\n        micro: '\\u00B5',\n        para: '\\u00B6',\n        middot: '\\u00B7',\n        cedil: '\\u00B8',\n        sup1: '\\u00B9',\n        ordm: '\\u00BA',\n        raquo: '\\u00BB',\n        frac14: '\\u00BC',\n        frac12: '\\u00BD',\n        frac34: '\\u00BE',\n        iquest: '\\u00BF',\n        Agrave: '\\u00C0',\n        Aacute: '\\u00C1',\n        Acirc: '\\u00C2',\n        Atilde: '\\u00C3',\n        Auml: '\\u00C4',\n        Aring: '\\u00C5',\n        AElig: '\\u00C6',\n        Ccedil: '\\u00C7',\n        Egrave: '\\u00C8',\n        Eacute: '\\u00C9',\n        Ecirc: '\\u00CA',\n        Euml: '\\u00CB',\n        Igrave: '\\u00CC',\n        Iacute: '\\u00CD',\n        Icirc: '\\u00CE',\n        Iuml: '\\u00CF',\n        ETH: '\\u00D0',\n        Ntilde: '\\u00D1',\n        Ograve: '\\u00D2',\n        Oacute: '\\u00D3',\n        Ocirc: '\\u00D4',\n        Otilde: '\\u00D5',\n        Ouml: '\\u00D6',\n        times: '\\u00D7',\n        Oslash: '\\u00D8',\n        Ugrave: '\\u00D9',\n        Uacute: '\\u00DA',\n        Ucirc: '\\u00DB',\n        Uuml: '\\u00DC',\n        Yacute: '\\u00DD',\n        THORN: '\\u00DE',\n        szlig: '\\u00DF',\n        agrave: '\\u00E0',\n        aacute: '\\u00E1',\n        acirc: '\\u00E2',\n        atilde: '\\u00E3',\n        auml: '\\u00E4',\n        aring: '\\u00E5',\n        aelig: '\\u00E6',\n        ccedil: '\\u00E7',\n        egrave: '\\u00E8',\n        eacute: '\\u00E9',\n        ecirc: '\\u00EA',\n        euml: '\\u00EB',\n        igrave: '\\u00EC',\n        iacute: '\\u00ED',\n        icirc: '\\u00EE',\n        iuml: '\\u00EF',\n        eth: '\\u00F0',\n        ntilde: '\\u00F1',\n        ograve: '\\u00F2',\n        oacute: '\\u00F3',\n        ocirc: '\\u00F4',\n        otilde: '\\u00F5',\n        ouml: '\\u00F6',\n        divide: '\\u00F7',\n        oslash: '\\u00F8',\n        ugrave: '\\u00F9',\n        uacute: '\\u00FA',\n        ucirc: '\\u00FB',\n        uuml: '\\u00FC',\n        yacute: '\\u00FD',\n        thorn: '\\u00FE',\n        yuml: '\\u00FF',\n        OElig: '\\u0152',\n        oelig: '\\u0153',\n        Scaron: '\\u0160',\n        scaron: '\\u0161',\n        Yuml: '\\u0178',\n        fnof: '\\u0192',\n        circ: '\\u02C6',\n        tilde: '\\u02DC',\n        Alpha: '\\u0391',\n        Beta: '\\u0392',\n        Gamma: '\\u0393',\n        Delta: '\\u0394',\n        Epsilon: '\\u0395',\n        Zeta: '\\u0396',\n        Eta: '\\u0397',\n        Theta: '\\u0398',\n        Iota: '\\u0399',\n        Kappa: '\\u039A',\n        Lambda: '\\u039B',\n        Mu: '\\u039C',\n        Nu: '\\u039D',\n        Xi: '\\u039E',\n        Omicron: '\\u039F',\n        Pi: '\\u03A0',\n        Rho: '\\u03A1',\n        Sigma: '\\u03A3',\n        Tau: '\\u03A4',\n        Upsilon: '\\u03A5',\n        Phi: '\\u03A6',\n        Chi: '\\u03A7',\n        Psi: '\\u03A8',\n        Omega: '\\u03A9',\n        alpha: '\\u03B1',\n        beta: '\\u03B2',\n        gamma: '\\u03B3',\n        delta: '\\u03B4',\n        epsilon: '\\u03B5',\n        zeta: '\\u03B6',\n        eta: '\\u03B7',\n        theta: '\\u03B8',\n        iota: '\\u03B9',\n        kappa: '\\u03BA',\n        lambda: '\\u03BB',\n        mu: '\\u03BC',\n        nu: '\\u03BD',\n        xi: '\\u03BE',\n        omicron: '\\u03BF',\n        pi: '\\u03C0',\n        rho: '\\u03C1',\n        sigmaf: '\\u03C2',\n        sigma: '\\u03C3',\n        tau: '\\u03C4',\n        upsilon: '\\u03C5',\n        phi: '\\u03C6',\n        chi: '\\u03C7',\n        psi: '\\u03C8',\n        omega: '\\u03C9',\n        thetasym: '\\u03D1',\n        upsih: '\\u03D2',\n        piv: '\\u03D6',\n        ensp: '\\u2002',\n        emsp: '\\u2003',\n        thinsp: '\\u2009',\n        zwnj: '\\u200C',\n        zwj: '\\u200D',\n        lrm: '\\u200E',\n        rlm: '\\u200F',\n        ndash: '\\u2013',\n        mdash: '\\u2014',\n        lsquo: '\\u2018',\n        rsquo: '\\u2019',\n        sbquo: '\\u201A',\n        ldquo: '\\u201C',\n        rdquo: '\\u201D',\n        bdquo: '\\u201E',\n        dagger: '\\u2020',\n        Dagger: '\\u2021',\n        bull: '\\u2022',\n        hellip: '\\u2026',\n        permil: '\\u2030',\n        prime: '\\u2032',\n        Prime: '\\u2033',\n        lsaquo: '\\u2039',\n        rsaquo: '\\u203A',\n        oline: '\\u203E',\n        frasl: '\\u2044',\n        euro: '\\u20AC',\n        image: '\\u2111',\n        weierp: '\\u2118',\n        real: '\\u211C',\n        trade: '\\u2122',\n        alefsym: '\\u2135',\n        larr: '\\u2190',\n        uarr: '\\u2191',\n        rarr: '\\u2192',\n        darr: '\\u2193',\n        harr: '\\u2194',\n        crarr: '\\u21B5',\n        lArr: '\\u21D0',\n        uArr: '\\u21D1',\n        rArr: '\\u21D2',\n        dArr: '\\u21D3',\n        hArr: '\\u21D4',\n        forall: '\\u2200',\n        part: '\\u2202',\n        exist: '\\u2203',\n        empty: '\\u2205',\n        nabla: '\\u2207',\n        isin: '\\u2208',\n        notin: '\\u2209',\n        ni: '\\u220B',\n        prod: '\\u220F',\n        sum: '\\u2211',\n        minus: '\\u2212',\n        lowast: '\\u2217',\n        radic: '\\u221A',\n        prop: '\\u221D',\n        infin: '\\u221E',\n        ang: '\\u2220',\n        and: '\\u2227',\n        or: '\\u2228',\n        cap: '\\u2229',\n        cup: '\\u222A',\n        'int': '\\u222B',\n        there4: '\\u2234',\n        sim: '\\u223C',\n        cong: '\\u2245',\n        asymp: '\\u2248',\n        ne: '\\u2260',\n        equiv: '\\u2261',\n        le: '\\u2264',\n        ge: '\\u2265',\n        sub: '\\u2282',\n        sup: '\\u2283',\n        nsub: '\\u2284',\n        sube: '\\u2286',\n        supe: '\\u2287',\n        oplus: '\\u2295',\n        otimes: '\\u2297',\n        perp: '\\u22A5',\n        sdot: '\\u22C5',\n        lceil: '\\u2308',\n        rceil: '\\u2309',\n        lfloor: '\\u230A',\n        rfloor: '\\u230B',\n        lang: '\\u2329',\n        rang: '\\u232A',\n        loz: '\\u25CA',\n        spades: '\\u2660',\n        clubs: '\\u2663',\n        hearts: '\\u2665',\n        diams: '\\u2666'\n    };\n\n    function getQualifiedJSXName(object) {\n        if (object.type === Syntax.JSXIdentifier) {\n            return object.name;\n        }\n        if (object.type === Syntax.JSXNamespacedName) {\n            return object.namespace.name + ':' + object.name.name;\n        }\n        /* istanbul ignore else */\n        if (object.type === Syntax.JSXMemberExpression) {\n            return (\n                getQualifiedJSXName(object.object) + '.' +\n                getQualifiedJSXName(object.property)\n            );\n        }\n        /* istanbul ignore next */\n        throwUnexpected(object);\n    }\n\n    function isJSXIdentifierStart(ch) {\n        // exclude backslash (\\)\n        return (ch !== 92) && isIdentifierStart(ch);\n    }\n\n    function isJSXIdentifierPart(ch) {\n        // exclude backslash (\\) and add hyphen (-)\n        return (ch !== 92) && (ch === 45 || isIdentifierPart(ch));\n    }\n\n    function scanJSXIdentifier() {\n        var ch, start, value = '';\n\n        start = index;\n        while (index < length) {\n            ch = source.charCodeAt(index);\n            if (!isJSXIdentifierPart(ch)) {\n                break;\n            }\n            value += source[index++];\n        }\n\n        return {\n            type: Token.JSXIdentifier,\n            value: value,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanJSXEntity() {\n        var ch, str = '', start = index, count = 0, code;\n        ch = source[index];\n        assert(ch === '&', 'Entity must start with an ampersand');\n        index++;\n        while (index < length && count++ < 10) {\n            ch = source[index++];\n            if (ch === ';') {\n                break;\n            }\n            str += ch;\n        }\n\n        // Well-formed entity (ending was found).\n        if (ch === ';') {\n            // Numeric entity.\n            if (str[0] === '#') {\n                if (str[1] === 'x') {\n                    code = +('0' + str.substr(1));\n                } else {\n                    // Removing leading zeros in order to avoid treating as octal in old browsers.\n                    code = +str.substr(1).replace(Regex.LeadingZeros, '');\n                }\n\n                if (!isNaN(code)) {\n                    return String.fromCharCode(code);\n                }\n            /* istanbul ignore else */\n            } else if (XHTMLEntities[str]) {\n                return XHTMLEntities[str];\n            }\n        }\n\n        // Treat non-entity sequences as regular text.\n        index = start + 1;\n        return '&';\n    }\n\n    function scanJSXText(stopChars) {\n        var ch, str = '', start;\n        start = index;\n        while (index < length) {\n            ch = source[index];\n            if (stopChars.indexOf(ch) !== -1) {\n                break;\n            }\n            if (ch === '&') {\n                str += scanJSXEntity();\n            } else {\n                index++;\n                if (ch === '\\r' && source[index] === '\\n') {\n                    str += ch;\n                    ch = source[index];\n                    index++;\n                }\n                if (isLineTerminator(ch.charCodeAt(0))) {\n                    ++lineNumber;\n                    lineStart = index;\n                }\n                str += ch;\n            }\n        }\n        return {\n            type: Token.JSXText,\n            value: str,\n            lineNumber: lineNumber,\n            lineStart: lineStart,\n            range: [start, index]\n        };\n    }\n\n    function scanJSXStringLiteral() {\n        var innerToken, quote, start;\n\n        quote = source[index];\n        assert((quote === '\\'' || quote === '\"'),\n            'String literal must starts with a quote');\n\n        start = index;\n        ++index;\n\n        innerToken = scanJSXText([quote]);\n\n        if (quote !== source[index]) {\n            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n        }\n\n        ++index;\n\n        innerToken.range = [start, index];\n\n        return innerToken;\n    }\n\n    /**\n     * Between JSX opening and closing tags (e.g. <foo>HERE</foo>), anything that\n     * is not another JSX tag and is not an expression wrapped by {} is text.\n     */\n    function advanceJSXChild() {\n        var ch = source.charCodeAt(index);\n\n        // '<' 60, '>' 62, '{' 123, '}' 125\n        if (ch !== 60 && ch !== 62 && ch !== 123 && ch !== 125) {\n            return scanJSXText(['<', '>', '{', '}']);\n        }\n\n        return scanPunctuator();\n    }\n\n    function parseJSXIdentifier() {\n        var token, marker = markerCreate();\n\n        if (lookahead.type !== Token.JSXIdentifier) {\n            throwUnexpected(lookahead);\n        }\n\n        token = lex();\n        return markerApply(marker, delegate.createJSXIdentifier(token.value));\n    }\n\n    function parseJSXNamespacedName() {\n        var namespace, name, marker = markerCreate();\n\n        namespace = parseJSXIdentifier();\n        expect(':');\n        name = parseJSXIdentifier();\n\n        return markerApply(marker, delegate.createJSXNamespacedName(namespace, name));\n    }\n\n    function parseJSXMemberExpression() {\n        var marker = markerCreate(),\n            expr = parseJSXIdentifier();\n\n        while (match('.')) {\n            lex();\n            expr = markerApply(marker, delegate.createJSXMemberExpression(expr, parseJSXIdentifier()));\n        }\n\n        return expr;\n    }\n\n    function parseJSXElementName() {\n        if (lookahead2().value === ':') {\n            return parseJSXNamespacedName();\n        }\n        if (lookahead2().value === '.') {\n            return parseJSXMemberExpression();\n        }\n\n        return parseJSXIdentifier();\n    }\n\n    function parseJSXAttributeName() {\n        if (lookahead2().value === ':') {\n            return parseJSXNamespacedName();\n        }\n\n        return parseJSXIdentifier();\n    }\n\n    function parseJSXAttributeValue() {\n        var value, marker;\n        if (match('{')) {\n            value = parseJSXExpressionContainer();\n            if (value.expression.type === Syntax.JSXEmptyExpression) {\n                throwError(\n                    value,\n                    'JSX attributes must only be assigned a non-empty ' +\n                        'expression'\n                );\n            }\n        } else if (match('<')) {\n            value = parseJSXElement();\n        } else if (lookahead.type === Token.JSXText) {\n            marker = markerCreate();\n            value = markerApply(marker, delegate.createLiteral(lex()));\n        } else {\n            throwError({}, Messages.InvalidJSXAttributeValue);\n        }\n        return value;\n    }\n\n    function parseJSXEmptyExpression() {\n        var marker = markerCreatePreserveWhitespace();\n        while (source.charAt(index) !== '}') {\n            index++;\n        }\n        return markerApply(marker, delegate.createJSXEmptyExpression());\n    }\n\n    function parseJSXExpressionContainer() {\n        var expression, origInJSXChild, origInJSXTag, marker = markerCreate();\n\n        origInJSXChild = state.inJSXChild;\n        origInJSXTag = state.inJSXTag;\n        state.inJSXChild = false;\n        state.inJSXTag = false;\n\n        expect('{');\n\n        if (match('}')) {\n            expression = parseJSXEmptyExpression();\n        } else {\n            expression = parseExpression();\n        }\n\n        state.inJSXChild = origInJSXChild;\n        state.inJSXTag = origInJSXTag;\n\n        expect('}');\n\n        return markerApply(marker, delegate.createJSXExpressionContainer(expression));\n    }\n\n    function parseJSXSpreadAttribute() {\n        var expression, origInJSXChild, origInJSXTag, marker = markerCreate();\n\n        origInJSXChild = state.inJSXChild;\n        origInJSXTag = state.inJSXTag;\n        state.inJSXChild = false;\n        state.inJSXTag = false;\n\n        expect('{');\n        expect('...');\n\n        expression = parseAssignmentExpression();\n\n        state.inJSXChild = origInJSXChild;\n        state.inJSXTag = origInJSXTag;\n\n        expect('}');\n\n        return markerApply(marker, delegate.createJSXSpreadAttribute(expression));\n    }\n\n    function parseJSXAttribute() {\n        var name, marker;\n\n        if (match('{')) {\n            return parseJSXSpreadAttribute();\n        }\n\n        marker = markerCreate();\n\n        name = parseJSXAttributeName();\n\n        // HTML empty attribute\n        if (match('=')) {\n            lex();\n            return markerApply(marker, delegate.createJSXAttribute(name, parseJSXAttributeValue()));\n        }\n\n        return markerApply(marker, delegate.createJSXAttribute(name));\n    }\n\n    function parseJSXChild() {\n        var token, marker;\n        if (match('{')) {\n            token = parseJSXExpressionContainer();\n        } else if (lookahead.type === Token.JSXText) {\n            marker = markerCreatePreserveWhitespace();\n            token = markerApply(marker, delegate.createLiteral(lex()));\n        } else if (match('<')) {\n            token = parseJSXElement();\n        } else {\n            throwUnexpected(lookahead);\n        }\n        return token;\n    }\n\n    function parseJSXClosingElement() {\n        var name, origInJSXChild, origInJSXTag, marker = markerCreate();\n        origInJSXChild = state.inJSXChild;\n        origInJSXTag = state.inJSXTag;\n        state.inJSXChild = false;\n        state.inJSXTag = true;\n        expect('<');\n        expect('/');\n        name = parseJSXElementName();\n        // Because advance() (called by lex() called by expect()) expects there\n        // to be a valid token after >, it needs to know whether to look for a\n        // standard JS token or an JSX text node\n        state.inJSXChild = origInJSXChild;\n        state.inJSXTag = origInJSXTag;\n        expect('>');\n        return markerApply(marker, delegate.createJSXClosingElement(name));\n    }\n\n    function parseJSXOpeningElement() {\n        var name, attributes = [], selfClosing = false, origInJSXChild, origInJSXTag, marker = markerCreate();\n\n        origInJSXChild = state.inJSXChild;\n        origInJSXTag = state.inJSXTag;\n        state.inJSXChild = false;\n        state.inJSXTag = true;\n\n        expect('<');\n\n        name = parseJSXElementName();\n\n        while (index < length &&\n                lookahead.value !== '/' &&\n                lookahead.value !== '>') {\n            attributes.push(parseJSXAttribute());\n        }\n\n        state.inJSXTag = origInJSXTag;\n\n        if (lookahead.value === '/') {\n            expect('/');\n            // Because advance() (called by lex() called by expect()) expects\n            // there to be a valid token after >, it needs to know whether to\n            // look for a standard JS token or an JSX text node\n            state.inJSXChild = origInJSXChild;\n            expect('>');\n            selfClosing = true;\n        } else {\n            state.inJSXChild = true;\n            expect('>');\n        }\n        return markerApply(marker, delegate.createJSXOpeningElement(name, attributes, selfClosing));\n    }\n\n    function parseJSXElement() {\n        var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate();\n\n        origInJSXChild = state.inJSXChild;\n        origInJSXTag = state.inJSXTag;\n        openingElement = parseJSXOpeningElement();\n\n        if (!openingElement.selfClosing) {\n            while (index < length) {\n                state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because </ should not be considered in the child\n                if (lookahead.value === '<' && lookahead2().value === '/') {\n                    break;\n                }\n                state.inJSXChild = true;\n                children.push(parseJSXChild());\n            }\n            state.inJSXChild = origInJSXChild;\n            state.inJSXTag = origInJSXTag;\n            closingElement = parseJSXClosingElement();\n            if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {\n                throwError({}, Messages.ExpectedJSXClosingTag, getQualifiedJSXName(openingElement.name));\n            }\n        }\n\n        // When (erroneously) writing two adjacent tags like\n        //\n        //     var x = <div>one</div><div>two</div>;\n        //\n        // the default error message is a bit incomprehensible. Since it's\n        // rarely (never?) useful to write a less-than sign after an JSX\n        // element, we disallow it here in the parser in order to provide a\n        // better error message. (In the rare case that the less-than operator\n        // was intended, the left tag can be wrapped in parentheses.)\n        if (!origInJSXChild && match('<')) {\n            throwError(lookahead, Messages.AdjacentJSXElements);\n        }\n\n        return markerApply(marker, delegate.createJSXElement(openingElement, closingElement, children));\n    }\n\n    function parseTypeAlias() {\n        var id, marker = markerCreate(), typeParameters = null, right;\n        expectContextualKeyword('type');\n        id = parseVariableIdentifier();\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n        expect('=');\n        right = parseType();\n        consumeSemicolon();\n        return markerApply(marker, delegate.createTypeAlias(id, typeParameters, right));\n    }\n\n    function parseInterfaceExtends() {\n        var marker = markerCreate(), id, typeParameters = null;\n\n        id = parseVariableIdentifier();\n        if (match('<')) {\n            typeParameters = parseTypeParameterInstantiation();\n        }\n\n        return markerApply(marker, delegate.createInterfaceExtends(\n            id,\n            typeParameters\n        ));\n    }\n\n    function parseInterfaceish(marker, allowStatic) {\n        var body, bodyMarker, extended = [], id,\n            typeParameters = null;\n\n        id = parseVariableIdentifier();\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n\n        if (matchKeyword('extends')) {\n            expectKeyword('extends');\n\n            while (index < length) {\n                extended.push(parseInterfaceExtends());\n                if (!match(',')) {\n                    break;\n                }\n                expect(',');\n            }\n        }\n\n        bodyMarker = markerCreate();\n        body = markerApply(bodyMarker, parseObjectType(allowStatic));\n\n        return markerApply(marker, delegate.createInterface(\n            id,\n            typeParameters,\n            body,\n            extended\n        ));\n    }\n\n    function parseInterface() {\n        var marker = markerCreate();\n\n        if (strict) {\n            expectKeyword('interface');\n        } else {\n            expectContextualKeyword('interface');\n        }\n\n        return parseInterfaceish(marker, /* allowStatic */false);\n    }\n\n    function parseDeclareClass() {\n        var marker = markerCreate(), ret;\n        expectContextualKeyword('declare');\n        expectKeyword('class');\n\n        ret = parseInterfaceish(marker, /* allowStatic */true);\n        ret.type = Syntax.DeclareClass;\n        return ret;\n    }\n\n    function parseDeclareFunction() {\n        var id, idMarker,\n            marker = markerCreate(), params, returnType, rest, tmp,\n            typeParameters = null, value, valueMarker;\n\n        expectContextualKeyword('declare');\n        expectKeyword('function');\n        idMarker = markerCreate();\n        id = parseVariableIdentifier();\n\n        valueMarker = markerCreate();\n        if (match('<')) {\n            typeParameters = parseTypeParameterDeclaration();\n        }\n        expect('(');\n        tmp = parseFunctionTypeParams();\n        params = tmp.params;\n        rest = tmp.rest;\n        expect(')');\n\n        expect(':');\n        returnType = parseType();\n\n        value = markerApply(valueMarker, delegate.createFunctionTypeAnnotation(\n            params,\n            returnType,\n            rest,\n            typeParameters\n        ));\n\n        id.typeAnnotation = markerApply(valueMarker, delegate.createTypeAnnotation(\n            value\n        ));\n        markerApply(idMarker, id);\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createDeclareFunction(\n            id\n        ));\n    }\n\n    function parseDeclareVariable() {\n        var id, marker = markerCreate();\n        expectContextualKeyword('declare');\n        expectKeyword('var');\n        id = parseTypeAnnotatableIdentifier();\n\n        consumeSemicolon();\n\n        return markerApply(marker, delegate.createDeclareVariable(\n            id\n        ));\n    }\n\n    function parseDeclareModule() {\n        var body = [], bodyMarker, id, idMarker, marker = markerCreate(), token;\n        expectContextualKeyword('declare');\n        expectContextualKeyword('module');\n\n        if (lookahead.type === Token.StringLiteral) {\n            if (strict && lookahead.octal) {\n                throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n            }\n            idMarker = markerCreate();\n            id = markerApply(idMarker, delegate.createLiteral(lex()));\n        } else {\n            id = parseVariableIdentifier();\n        }\n\n        bodyMarker = markerCreate();\n        expect('{');\n        while (index < length && !match('}')) {\n            token = lookahead2();\n            switch (token.value) {\n            case 'class':\n                body.push(parseDeclareClass());\n                break;\n            case 'function':\n                body.push(parseDeclareFunction());\n                break;\n            case 'var':\n                body.push(parseDeclareVariable());\n                break;\n            default:\n                throwUnexpected(lookahead);\n            }\n        }\n        expect('}');\n\n        return markerApply(marker, delegate.createDeclareModule(\n            id,\n            markerApply(bodyMarker, delegate.createBlockStatement(body))\n        ));\n    }\n\n    function collectToken() {\n        var loc, token, range, value, entry;\n\n        /* istanbul ignore else */\n        if (!state.inJSXChild) {\n            skipComment();\n        }\n\n        loc = {\n            start: {\n                line: lineNumber,\n                column: index - lineStart\n            }\n        };\n\n        token = extra.advance();\n        loc.end = {\n            line: lineNumber,\n            column: index - lineStart\n        };\n\n        if (token.type !== Token.EOF) {\n            range = [token.range[0], token.range[1]];\n            value = source.slice(token.range[0], token.range[1]);\n            entry = {\n                type: TokenName[token.type],\n                value: value,\n                range: range,\n                loc: loc\n            };\n            if (token.regex) {\n                entry.regex = {\n                    pattern: token.regex.pattern,\n                    flags: token.regex.flags\n                };\n            }\n            extra.tokens.push(entry);\n        }\n\n        return token;\n    }\n\n    function collectRegex() {\n        var pos, loc, regex, token;\n\n        skipComment();\n\n        pos = index;\n        loc = {\n            start: {\n                line: lineNumber,\n                column: index - lineStart\n            }\n        };\n\n        regex = extra.scanRegExp();\n        loc.end = {\n            line: lineNumber,\n            column: index - lineStart\n        };\n\n        if (!extra.tokenize) {\n            /* istanbul ignore next */\n            // Pop the previous token, which is likely '/' or '/='\n            if (extra.tokens.length > 0) {\n                token = extra.tokens[extra.tokens.length - 1];\n                if (token.range[0] === pos && token.type === 'Punctuator') {\n                    if (token.value === '/' || token.value === '/=') {\n                        extra.tokens.pop();\n                    }\n                }\n            }\n\n            extra.tokens.push({\n                type: 'RegularExpression',\n                value: regex.literal,\n                regex: regex.regex,\n                range: [pos, index],\n                loc: loc\n            });\n        }\n\n        return regex;\n    }\n\n    function filterTokenLocation() {\n        var i, entry, token, tokens = [];\n\n        for (i = 0; i < extra.tokens.length; ++i) {\n            entry = extra.tokens[i];\n            token = {\n                type: entry.type,\n                value: entry.value\n            };\n            if (entry.regex) {\n                token.regex = {\n                    pattern: entry.regex.pattern,\n                    flags: entry.regex.flags\n                };\n            }\n            if (extra.range) {\n                token.range = entry.range;\n            }\n            if (extra.loc) {\n                token.loc = entry.loc;\n            }\n            tokens.push(token);\n        }\n\n        extra.tokens = tokens;\n    }\n\n    function patch() {\n        if (typeof extra.tokens !== 'undefined') {\n            extra.advance = advance;\n            extra.scanRegExp = scanRegExp;\n\n            advance = collectToken;\n            scanRegExp = collectRegex;\n        }\n    }\n\n    function unpatch() {\n        if (typeof extra.scanRegExp === 'function') {\n            advance = extra.advance;\n            scanRegExp = extra.scanRegExp;\n        }\n    }\n\n    // This is used to modify the delegate.\n\n    function extend(object, properties) {\n        var entry, result = {};\n\n        for (entry in object) {\n            /* istanbul ignore else */\n            if (object.hasOwnProperty(entry)) {\n                result[entry] = object[entry];\n            }\n        }\n\n        for (entry in properties) {\n            /* istanbul ignore else */\n            if (properties.hasOwnProperty(entry)) {\n                result[entry] = properties[entry];\n            }\n        }\n\n        return result;\n    }\n\n    function tokenize(code, options) {\n        var toString,\n            token,\n            tokens;\n\n        toString = String;\n        if (typeof code !== 'string' && !(code instanceof String)) {\n            code = toString(code);\n        }\n\n        delegate = SyntaxTreeDelegate;\n        source = code;\n        index = 0;\n        lineNumber = (source.length > 0) ? 1 : 0;\n        lineStart = 0;\n        length = source.length;\n        lookahead = null;\n        state = {\n            allowKeyword: true,\n            allowIn: true,\n            labelSet: new StringMap(),\n            inFunctionBody: false,\n            inIteration: false,\n            inSwitch: false,\n            lastCommentStart: -1\n        };\n\n        extra = {};\n\n        // Options matching.\n        options = options || {};\n\n        // Of course we collect tokens here.\n        options.tokens = true;\n        extra.tokens = [];\n        extra.tokenize = true;\n        // The following two fields are necessary to compute the Regex tokens.\n        extra.openParenToken = -1;\n        extra.openCurlyToken = -1;\n\n        extra.range = (typeof options.range === 'boolean') && options.range;\n        extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n        if (typeof options.comment === 'boolean' && options.comment) {\n            extra.comments = [];\n        }\n        if (typeof options.tolerant === 'boolean' && options.tolerant) {\n            extra.errors = [];\n        }\n\n        patch();\n\n        try {\n            peek();\n            if (lookahead.type === Token.EOF) {\n                return extra.tokens;\n            }\n\n            token = lex();\n            while (lookahead.type !== Token.EOF) {\n                try {\n                    token = lex();\n                } catch (lexError) {\n                    token = lookahead;\n                    if (extra.errors) {\n                        extra.errors.push(lexError);\n                        // We have to break on the first error\n                        // to avoid infinite loops.\n                        break;\n                    } else {\n                        throw lexError;\n                    }\n                }\n            }\n\n            filterTokenLocation();\n            tokens = extra.tokens;\n            if (typeof extra.comments !== 'undefined') {\n                tokens.comments = extra.comments;\n            }\n            if (typeof extra.errors !== 'undefined') {\n                tokens.errors = extra.errors;\n            }\n        } catch (e) {\n            throw e;\n        } finally {\n            unpatch();\n            extra = {};\n        }\n        return tokens;\n    }\n\n    function parse(code, options) {\n        var program, toString;\n\n        toString = String;\n        if (typeof code !== 'string' && !(code instanceof String)) {\n            code = toString(code);\n        }\n\n        delegate = SyntaxTreeDelegate;\n        source = code;\n        index = 0;\n        lineNumber = (source.length > 0) ? 1 : 0;\n        lineStart = 0;\n        length = source.length;\n        lookahead = null;\n        state = {\n            allowKeyword: false,\n            allowIn: true,\n            labelSet: new StringMap(),\n            parenthesizedCount: 0,\n            inFunctionBody: false,\n            inIteration: false,\n            inSwitch: false,\n            inJSXChild: false,\n            inJSXTag: false,\n            inType: false,\n            lastCommentStart: -1,\n            yieldAllowed: false,\n            awaitAllowed: false\n        };\n\n        extra = {};\n        if (typeof options !== 'undefined') {\n            extra.range = (typeof options.range === 'boolean') && options.range;\n            extra.loc = (typeof options.loc === 'boolean') && options.loc;\n            extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;\n\n            if (extra.loc && options.source !== null && options.source !== undefined) {\n                delegate = extend(delegate, {\n                    'postProcess': function (node) {\n                        node.loc.source = toString(options.source);\n                        return node;\n                    }\n                });\n            }\n\n            extra.sourceType = options.sourceType;\n            if (typeof options.tokens === 'boolean' && options.tokens) {\n                extra.tokens = [];\n            }\n            if (typeof options.comment === 'boolean' && options.comment) {\n                extra.comments = [];\n            }\n            if (typeof options.tolerant === 'boolean' && options.tolerant) {\n                extra.errors = [];\n            }\n            if (extra.attachComment) {\n                extra.range = true;\n                extra.comments = [];\n                extra.bottomRightStack = [];\n                extra.trailingComments = [];\n                extra.leadingComments = [];\n            }\n        }\n\n        patch();\n        try {\n            program = parseProgram();\n            if (typeof extra.comments !== 'undefined') {\n                program.comments = extra.comments;\n            }\n            if (typeof extra.tokens !== 'undefined') {\n                filterTokenLocation();\n                program.tokens = extra.tokens;\n            }\n            if (typeof extra.errors !== 'undefined') {\n                program.errors = extra.errors;\n            }\n        } catch (e) {\n            throw e;\n        } finally {\n            unpatch();\n            extra = {};\n        }\n\n        return program;\n    }\n\n    // Sync with *.json manifests.\n    exports.version = '13001.1001.0-dev-harmony-fb';\n\n    exports.tokenize = tokenize;\n\n    exports.parse = parse;\n\n    // Deep copy.\n   /* istanbul ignore next */\n    exports.Syntax = (function () {\n        var name, types = {};\n\n        if (typeof Object.create === 'function') {\n            types = Object.create(null);\n        }\n\n        for (name in Syntax) {\n            if (Syntax.hasOwnProperty(name)) {\n                types[name] = Syntax[name];\n            }\n        }\n\n        if (typeof Object.freeze === 'function') {\n            Object.freeze(types);\n        }\n\n        return types;\n    }());\n\n}));\n/* vim: set sw=4 ts=4 et tw=80 : */\n\n},{}],10:[function(_dereq_,module,exports){\nvar Base62 = (function (my) {\n  my.chars = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"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\"]\n\n  my.encode = function(i){\n    if (i === 0) {return '0'}\n    var s = ''\n    while (i > 0) {\n      s = this.chars[i % 62] + s\n      i = Math.floor(i/62)\n    }\n    return s\n  };\n  my.decode = function(a,b,c,d){\n    for (\n      b = c = (\n        a === (/\\W|_|^$/.test(a += \"\") || a)\n      ) - 1;\n      d = a.charCodeAt(c++);\n    )\n    b = b * 62 + d - [, 48, 29, 87][d >> 5];\n    return b\n  };\n\n  return my;\n}({}));\n\nmodule.exports = Base62\n},{}],11:[function(_dereq_,module,exports){\n/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = _dereq_('./source-map/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = _dereq_('./source-map/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = _dereq_('./source-map/source-node').SourceNode;\n\n},{\"./source-map/source-map-consumer\":16,\"./source-map/source-map-generator\":17,\"./source-map/source-node\":18}],12:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var util = _dereq_('./util');\n\n  /**\n   * A data structure which is a combination of an array and a set. Adding a new\n   * member is O(1), testing for membership is O(1), and finding the index of an\n   * element is O(1). Removing elements from the set is not supported. Only\n   * strings are supported for membership.\n   */\n  function ArraySet() {\n    this._array = [];\n    this._set = {};\n  }\n\n  /**\n   * Static method for creating ArraySet instances from an existing array.\n   */\n  ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n    var set = new ArraySet();\n    for (var i = 0, len = aArray.length; i < len; i++) {\n      set.add(aArray[i], aAllowDuplicates);\n    }\n    return set;\n  };\n\n  /**\n   * Add the given string to this set.\n   *\n   * @param String aStr\n   */\n  ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n    var isDuplicate = this.has(aStr);\n    var idx = this._array.length;\n    if (!isDuplicate || aAllowDuplicates) {\n      this._array.push(aStr);\n    }\n    if (!isDuplicate) {\n      this._set[util.toSetString(aStr)] = idx;\n    }\n  };\n\n  /**\n   * Is the given string a member of this set?\n   *\n   * @param String aStr\n   */\n  ArraySet.prototype.has = function ArraySet_has(aStr) {\n    return Object.prototype.hasOwnProperty.call(this._set,\n                                                util.toSetString(aStr));\n  };\n\n  /**\n   * What is the index of the given string in the array?\n   *\n   * @param String aStr\n   */\n  ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n    if (this.has(aStr)) {\n      return this._set[util.toSetString(aStr)];\n    }\n    throw new Error('\"' + aStr + '\" is not in the set.');\n  };\n\n  /**\n   * What is the element at the given index?\n   *\n   * @param Number aIdx\n   */\n  ArraySet.prototype.at = function ArraySet_at(aIdx) {\n    if (aIdx >= 0 && aIdx < this._array.length) {\n      return this._array[aIdx];\n    }\n    throw new Error('No element indexed by ' + aIdx);\n  };\n\n  /**\n   * Returns the array representation of this set (which has the proper indices\n   * indicated by indexOf). Note that this is a copy of the internal array used\n   * for storing the members so that no one can mess with internal state.\n   */\n  ArraySet.prototype.toArray = function ArraySet_toArray() {\n    return this._array.slice();\n  };\n\n  exports.ArraySet = ArraySet;\n\n});\n\n},{\"./util\":19,\"amdefine\":20}],13:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n *  * Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *  * Redistributions in binary form must reproduce the above\n *    copyright notice, this list of conditions and the following\n *    disclaimer in the documentation and/or other materials provided\n *    with the distribution.\n *  * Neither the name of Google Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var base64 = _dereq_('./base64');\n\n  // A single base 64 digit can contain 6 bits of data. For the base 64 variable\n  // length quantities we use in the source map spec, the first bit is the sign,\n  // the next four bits are the actual value, and the 6th bit is the\n  // continuation bit. The continuation bit tells us whether there are more\n  // digits in this value following this digit.\n  //\n  //   Continuation\n  //   |    Sign\n  //   |    |\n  //   V    V\n  //   101011\n\n  var VLQ_BASE_SHIFT = 5;\n\n  // binary: 100000\n  var VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n  // binary: 011111\n  var VLQ_BASE_MASK = VLQ_BASE - 1;\n\n  // binary: 100000\n  var VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n  /**\n   * Converts from a two-complement value to a value where the sign bit is\n   * is placed in the least significant bit.  For example, as decimals:\n   *   1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n   *   2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n   */\n  function toVLQSigned(aValue) {\n    return aValue < 0\n      ? ((-aValue) << 1) + 1\n      : (aValue << 1) + 0;\n  }\n\n  /**\n   * Converts to a two-complement value from a value where the sign bit is\n   * is placed in the least significant bit.  For example, as decimals:\n   *   2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n   *   4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n   */\n  function fromVLQSigned(aValue) {\n    var isNegative = (aValue & 1) === 1;\n    var shifted = aValue >> 1;\n    return isNegative\n      ? -shifted\n      : shifted;\n  }\n\n  /**\n   * Returns the base 64 VLQ encoded value.\n   */\n  exports.encode = function base64VLQ_encode(aValue) {\n    var encoded = \"\";\n    var digit;\n\n    var vlq = toVLQSigned(aValue);\n\n    do {\n      digit = vlq & VLQ_BASE_MASK;\n      vlq >>>= VLQ_BASE_SHIFT;\n      if (vlq > 0) {\n        // There are still more digits in this value, so we must make sure the\n        // continuation bit is marked.\n        digit |= VLQ_CONTINUATION_BIT;\n      }\n      encoded += base64.encode(digit);\n    } while (vlq > 0);\n\n    return encoded;\n  };\n\n  /**\n   * Decodes the next base 64 VLQ value from the given string and returns the\n   * value and the rest of the string.\n   */\n  exports.decode = function base64VLQ_decode(aStr) {\n    var i = 0;\n    var strLen = aStr.length;\n    var result = 0;\n    var shift = 0;\n    var continuation, digit;\n\n    do {\n      if (i >= strLen) {\n        throw new Error(\"Expected more digits in base 64 VLQ value.\");\n      }\n      digit = base64.decode(aStr.charAt(i++));\n      continuation = !!(digit & VLQ_CONTINUATION_BIT);\n      digit &= VLQ_BASE_MASK;\n      result = result + (digit << shift);\n      shift += VLQ_BASE_SHIFT;\n    } while (continuation);\n\n    return {\n      value: fromVLQSigned(result),\n      rest: aStr.slice(i)\n    };\n  };\n\n});\n\n},{\"./base64\":14,\"amdefine\":20}],14:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var charToIntMap = {};\n  var intToCharMap = {};\n\n  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n    .split('')\n    .forEach(function (ch, index) {\n      charToIntMap[ch] = index;\n      intToCharMap[index] = ch;\n    });\n\n  /**\n   * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n   */\n  exports.encode = function base64_encode(aNumber) {\n    if (aNumber in intToCharMap) {\n      return intToCharMap[aNumber];\n    }\n    throw new TypeError(\"Must be between 0 and 63: \" + aNumber);\n  };\n\n  /**\n   * Decode a single base 64 digit to an integer.\n   */\n  exports.decode = function base64_decode(aChar) {\n    if (aChar in charToIntMap) {\n      return charToIntMap[aChar];\n    }\n    throw new TypeError(\"Not a valid base 64 digit: \" + aChar);\n  };\n\n});\n\n},{\"amdefine\":20}],15:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  /**\n   * Recursive implementation of binary search.\n   *\n   * @param aLow Indices here and lower do not contain the needle.\n   * @param aHigh Indices here and higher do not contain the needle.\n   * @param aNeedle The element being searched for.\n   * @param aHaystack The non-empty array being searched.\n   * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n   */\n  function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {\n    // This function terminates when one of the following is true:\n    //\n    //   1. We find the exact element we are looking for.\n    //\n    //   2. We did not find the exact element, but we can return the next\n    //      closest element that is less than that element.\n    //\n    //   3. We did not find the exact element, and there is no next-closest\n    //      element which is less than the one we are searching for, so we\n    //      return null.\n    var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n    var cmp = aCompare(aNeedle, aHaystack[mid], true);\n    if (cmp === 0) {\n      // Found the element we are looking for.\n      return aHaystack[mid];\n    }\n    else if (cmp > 0) {\n      // aHaystack[mid] is greater than our needle.\n      if (aHigh - mid > 1) {\n        // The element is in the upper half.\n        return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare);\n      }\n      // We did not find an exact match, return the next closest one\n      // (termination case 2).\n      return aHaystack[mid];\n    }\n    else {\n      // aHaystack[mid] is less than our needle.\n      if (mid - aLow > 1) {\n        // The element is in the lower half.\n        return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare);\n      }\n      // The exact needle element was not found in this haystack. Determine if\n      // we are in termination case (2) or (3) and return the appropriate thing.\n      return aLow < 0\n        ? null\n        : aHaystack[aLow];\n    }\n  }\n\n  /**\n   * This is an implementation of binary search which will always try and return\n   * the next lowest value checked if there is no exact hit. This is because\n   * mappings between original and generated line/col pairs are single points,\n   * and there is an implicit region between each of them, so a miss just means\n   * that you aren't on the very start of a region.\n   *\n   * @param aNeedle The element you are looking for.\n   * @param aHaystack The array that is being searched.\n   * @param aCompare A function which takes the needle and an element in the\n   *     array and returns -1, 0, or 1 depending on whether the needle is less\n   *     than, equal to, or greater than the element, respectively.\n   */\n  exports.search = function search(aNeedle, aHaystack, aCompare) {\n    return aHaystack.length > 0\n      ? recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare)\n      : null;\n  };\n\n});\n\n},{\"amdefine\":20}],16:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var util = _dereq_('./util');\n  var binarySearch = _dereq_('./binary-search');\n  var ArraySet = _dereq_('./array-set').ArraySet;\n  var base64VLQ = _dereq_('./base64-vlq');\n\n  /**\n   * A SourceMapConsumer instance represents a parsed source map which we can\n   * query for information about the original file positions by giving it a file\n   * position in the generated source.\n   *\n   * The only parameter is the raw source map (either as a JSON string, or\n   * already parsed to an object). According to the spec, source maps have the\n   * following attributes:\n   *\n   *   - version: Which version of the source map spec this map is following.\n   *   - sources: An array of URLs to the original source files.\n   *   - names: An array of identifiers which can be referrenced by individual mappings.\n   *   - sourceRoot: Optional. The URL root from which all sources are relative.\n   *   - sourcesContent: Optional. An array of contents of the original source files.\n   *   - mappings: A string of base64 VLQs which contain the actual mappings.\n   *   - file: The generated file this source map is associated with.\n   *\n   * Here is an example source map, taken from the source map spec[0]:\n   *\n   *     {\n   *       version : 3,\n   *       file: \"out.js\",\n   *       sourceRoot : \"\",\n   *       sources: [\"foo.js\", \"bar.js\"],\n   *       names: [\"src\", \"maps\", \"are\", \"fun\"],\n   *       mappings: \"AA,AB;;ABCDE;\"\n   *     }\n   *\n   * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n   */\n  function SourceMapConsumer(aSourceMap) {\n    var sourceMap = aSourceMap;\n    if (typeof aSourceMap === 'string') {\n      sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n    }\n\n    var version = util.getArg(sourceMap, 'version');\n    var sources = util.getArg(sourceMap, 'sources');\n    // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n    // requires the array) to play nice here.\n    var names = util.getArg(sourceMap, 'names', []);\n    var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n    var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n    var mappings = util.getArg(sourceMap, 'mappings');\n    var file = util.getArg(sourceMap, 'file', null);\n\n    // Once again, Sass deviates from the spec and supplies the version as a\n    // string rather than a number, so we use loose equality checking here.\n    if (version != this._version) {\n      throw new Error('Unsupported version: ' + version);\n    }\n\n    // Pass `true` below to allow duplicate names and sources. While source maps\n    // are intended to be compressed and deduplicated, the TypeScript compiler\n    // sometimes generates source maps with duplicates in them. See Github issue\n    // #72 and bugzil.la/889492.\n    this._names = ArraySet.fromArray(names, true);\n    this._sources = ArraySet.fromArray(sources, true);\n\n    this.sourceRoot = sourceRoot;\n    this.sourcesContent = sourcesContent;\n    this._mappings = mappings;\n    this.file = file;\n  }\n\n  /**\n   * Create a SourceMapConsumer from a SourceMapGenerator.\n   *\n   * @param SourceMapGenerator aSourceMap\n   *        The source map that will be consumed.\n   * @returns SourceMapConsumer\n   */\n  SourceMapConsumer.fromSourceMap =\n    function SourceMapConsumer_fromSourceMap(aSourceMap) {\n      var smc = Object.create(SourceMapConsumer.prototype);\n\n      smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n      smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n      smc.sourceRoot = aSourceMap._sourceRoot;\n      smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n                                                              smc.sourceRoot);\n      smc.file = aSourceMap._file;\n\n      smc.__generatedMappings = aSourceMap._mappings.slice()\n        .sort(util.compareByGeneratedPositions);\n      smc.__originalMappings = aSourceMap._mappings.slice()\n        .sort(util.compareByOriginalPositions);\n\n      return smc;\n    };\n\n  /**\n   * The version of the source mapping spec that we are consuming.\n   */\n  SourceMapConsumer.prototype._version = 3;\n\n  /**\n   * The list of original sources.\n   */\n  Object.defineProperty(SourceMapConsumer.prototype, 'sources', {\n    get: function () {\n      return this._sources.toArray().map(function (s) {\n        return this.sourceRoot ? util.join(this.sourceRoot, s) : s;\n      }, this);\n    }\n  });\n\n  // `__generatedMappings` and `__originalMappings` are arrays that hold the\n  // parsed mapping coordinates from the source map's \"mappings\" attribute. They\n  // are lazily instantiated, accessed via the `_generatedMappings` and\n  // `_originalMappings` getters respectively, and we only parse the mappings\n  // and create these arrays once queried for a source location. We jump through\n  // these hoops because there can be many thousands of mappings, and parsing\n  // them is expensive, so we only want to do it if we must.\n  //\n  // Each object in the arrays is of the form:\n  //\n  //     {\n  //       generatedLine: The line number in the generated code,\n  //       generatedColumn: The column number in the generated code,\n  //       source: The path to the original source file that generated this\n  //               chunk of code,\n  //       originalLine: The line number in the original source that\n  //                     corresponds to this chunk of generated code,\n  //       originalColumn: The column number in the original source that\n  //                       corresponds to this chunk of generated code,\n  //       name: The name of the original symbol which generated this chunk of\n  //             code.\n  //     }\n  //\n  // All properties except for `generatedLine` and `generatedColumn` can be\n  // `null`.\n  //\n  // `_generatedMappings` is ordered by the generated positions.\n  //\n  // `_originalMappings` is ordered by the original positions.\n\n  SourceMapConsumer.prototype.__generatedMappings = null;\n  Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n    get: function () {\n      if (!this.__generatedMappings) {\n        this.__generatedMappings = [];\n        this.__originalMappings = [];\n        this._parseMappings(this._mappings, this.sourceRoot);\n      }\n\n      return this.__generatedMappings;\n    }\n  });\n\n  SourceMapConsumer.prototype.__originalMappings = null;\n  Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n    get: function () {\n      if (!this.__originalMappings) {\n        this.__generatedMappings = [];\n        this.__originalMappings = [];\n        this._parseMappings(this._mappings, this.sourceRoot);\n      }\n\n      return this.__originalMappings;\n    }\n  });\n\n  /**\n   * Parse the mappings in a string in to a data structure which we can easily\n   * query (the ordered arrays in the `this.__generatedMappings` and\n   * `this.__originalMappings` properties).\n   */\n  SourceMapConsumer.prototype._parseMappings =\n    function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n      var generatedLine = 1;\n      var previousGeneratedColumn = 0;\n      var previousOriginalLine = 0;\n      var previousOriginalColumn = 0;\n      var previousSource = 0;\n      var previousName = 0;\n      var mappingSeparator = /^[,;]/;\n      var str = aStr;\n      var mapping;\n      var temp;\n\n      while (str.length > 0) {\n        if (str.charAt(0) === ';') {\n          generatedLine++;\n          str = str.slice(1);\n          previousGeneratedColumn = 0;\n        }\n        else if (str.charAt(0) === ',') {\n          str = str.slice(1);\n        }\n        else {\n          mapping = {};\n          mapping.generatedLine = generatedLine;\n\n          // Generated column.\n          temp = base64VLQ.decode(str);\n          mapping.generatedColumn = previousGeneratedColumn + temp.value;\n          previousGeneratedColumn = mapping.generatedColumn;\n          str = temp.rest;\n\n          if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {\n            // Original source.\n            temp = base64VLQ.decode(str);\n            mapping.source = this._sources.at(previousSource + temp.value);\n            previousSource += temp.value;\n            str = temp.rest;\n            if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {\n              throw new Error('Found a source, but no line and column');\n            }\n\n            // Original line.\n            temp = base64VLQ.decode(str);\n            mapping.originalLine = previousOriginalLine + temp.value;\n            previousOriginalLine = mapping.originalLine;\n            // Lines are stored 0-based\n            mapping.originalLine += 1;\n            str = temp.rest;\n            if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {\n              throw new Error('Found a source and line, but no column');\n            }\n\n            // Original column.\n            temp = base64VLQ.decode(str);\n            mapping.originalColumn = previousOriginalColumn + temp.value;\n            previousOriginalColumn = mapping.originalColumn;\n            str = temp.rest;\n\n            if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {\n              // Original name.\n              temp = base64VLQ.decode(str);\n              mapping.name = this._names.at(previousName + temp.value);\n              previousName += temp.value;\n              str = temp.rest;\n            }\n          }\n\n          this.__generatedMappings.push(mapping);\n          if (typeof mapping.originalLine === 'number') {\n            this.__originalMappings.push(mapping);\n          }\n        }\n      }\n\n      this.__originalMappings.sort(util.compareByOriginalPositions);\n    };\n\n  /**\n   * Find the mapping that best matches the hypothetical \"needle\" mapping that\n   * we are searching for in the given \"haystack\" of mappings.\n   */\n  SourceMapConsumer.prototype._findMapping =\n    function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n                                           aColumnName, aComparator) {\n      // To return the position we are searching for, we must first find the\n      // mapping for the given position and then return the opposite position it\n      // points to. Because the mappings are sorted, we can use binary search to\n      // find the best mapping.\n\n      if (aNeedle[aLineName] <= 0) {\n        throw new TypeError('Line must be greater than or equal to 1, got '\n                            + aNeedle[aLineName]);\n      }\n      if (aNeedle[aColumnName] < 0) {\n        throw new TypeError('Column must be greater than or equal to 0, got '\n                            + aNeedle[aColumnName]);\n      }\n\n      return binarySearch.search(aNeedle, aMappings, aComparator);\n    };\n\n  /**\n   * Returns the original source, line, and column information for the generated\n   * source's line and column positions provided. The only argument is an object\n   * with the following properties:\n   *\n   *   - line: The line number in the generated source.\n   *   - column: The column number in the generated source.\n   *\n   * and an object is returned with the following properties:\n   *\n   *   - source: The original source file, or null.\n   *   - line: The line number in the original source, or null.\n   *   - column: The column number in the original source, or null.\n   *   - name: The original identifier, or null.\n   */\n  SourceMapConsumer.prototype.originalPositionFor =\n    function SourceMapConsumer_originalPositionFor(aArgs) {\n      var needle = {\n        generatedLine: util.getArg(aArgs, 'line'),\n        generatedColumn: util.getArg(aArgs, 'column')\n      };\n\n      var mapping = this._findMapping(needle,\n                                      this._generatedMappings,\n                                      \"generatedLine\",\n                                      \"generatedColumn\",\n                                      util.compareByGeneratedPositions);\n\n      if (mapping) {\n        var source = util.getArg(mapping, 'source', null);\n        if (source && this.sourceRoot) {\n          source = util.join(this.sourceRoot, source);\n        }\n        return {\n          source: source,\n          line: util.getArg(mapping, 'originalLine', null),\n          column: util.getArg(mapping, 'originalColumn', null),\n          name: util.getArg(mapping, 'name', null)\n        };\n      }\n\n      return {\n        source: null,\n        line: null,\n        column: null,\n        name: null\n      };\n    };\n\n  /**\n   * Returns the original source content. The only argument is the url of the\n   * original source file. Returns null if no original source content is\n   * availible.\n   */\n  SourceMapConsumer.prototype.sourceContentFor =\n    function SourceMapConsumer_sourceContentFor(aSource) {\n      if (!this.sourcesContent) {\n        return null;\n      }\n\n      if (this.sourceRoot) {\n        aSource = util.relative(this.sourceRoot, aSource);\n      }\n\n      if (this._sources.has(aSource)) {\n        return this.sourcesContent[this._sources.indexOf(aSource)];\n      }\n\n      var url;\n      if (this.sourceRoot\n          && (url = util.urlParse(this.sourceRoot))) {\n        // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n        // many users. We can help them out when they expect file:// URIs to\n        // behave like it would if they were running a local HTTP server. See\n        // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n        var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n        if (url.scheme == \"file\"\n            && this._sources.has(fileUriAbsPath)) {\n          return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n        }\n\n        if ((!url.path || url.path == \"/\")\n            && this._sources.has(\"/\" + aSource)) {\n          return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n        }\n      }\n\n      throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n    };\n\n  /**\n   * Returns the generated line and column information for the original source,\n   * line, and column positions provided. The only argument is an object with\n   * the following properties:\n   *\n   *   - source: The filename of the original source.\n   *   - line: The line number in the original source.\n   *   - column: The column number in the original source.\n   *\n   * and an object is returned with the following properties:\n   *\n   *   - line: The line number in the generated source, or null.\n   *   - column: The column number in the generated source, or null.\n   */\n  SourceMapConsumer.prototype.generatedPositionFor =\n    function SourceMapConsumer_generatedPositionFor(aArgs) {\n      var needle = {\n        source: util.getArg(aArgs, 'source'),\n        originalLine: util.getArg(aArgs, 'line'),\n        originalColumn: util.getArg(aArgs, 'column')\n      };\n\n      if (this.sourceRoot) {\n        needle.source = util.relative(this.sourceRoot, needle.source);\n      }\n\n      var mapping = this._findMapping(needle,\n                                      this._originalMappings,\n                                      \"originalLine\",\n                                      \"originalColumn\",\n                                      util.compareByOriginalPositions);\n\n      if (mapping) {\n        return {\n          line: util.getArg(mapping, 'generatedLine', null),\n          column: util.getArg(mapping, 'generatedColumn', null)\n        };\n      }\n\n      return {\n        line: null,\n        column: null\n      };\n    };\n\n  SourceMapConsumer.GENERATED_ORDER = 1;\n  SourceMapConsumer.ORIGINAL_ORDER = 2;\n\n  /**\n   * Iterate over each mapping between an original source/line/column and a\n   * generated line/column in this source map.\n   *\n   * @param Function aCallback\n   *        The function that is called with each mapping.\n   * @param Object aContext\n   *        Optional. If specified, this object will be the value of `this` every\n   *        time that `aCallback` is called.\n   * @param aOrder\n   *        Either `SourceMapConsumer.GENERATED_ORDER` or\n   *        `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n   *        iterate over the mappings sorted by the generated file's line/column\n   *        order or the original's source/line/column order, respectively. Defaults to\n   *        `SourceMapConsumer.GENERATED_ORDER`.\n   */\n  SourceMapConsumer.prototype.eachMapping =\n    function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n      var context = aContext || null;\n      var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n      var mappings;\n      switch (order) {\n      case SourceMapConsumer.GENERATED_ORDER:\n        mappings = this._generatedMappings;\n        break;\n      case SourceMapConsumer.ORIGINAL_ORDER:\n        mappings = this._originalMappings;\n        break;\n      default:\n        throw new Error(\"Unknown order of iteration.\");\n      }\n\n      var sourceRoot = this.sourceRoot;\n      mappings.map(function (mapping) {\n        var source = mapping.source;\n        if (source && sourceRoot) {\n          source = util.join(sourceRoot, source);\n        }\n        return {\n          source: source,\n          generatedLine: mapping.generatedLine,\n          generatedColumn: mapping.generatedColumn,\n          originalLine: mapping.originalLine,\n          originalColumn: mapping.originalColumn,\n          name: mapping.name\n        };\n      }).forEach(aCallback, context);\n    };\n\n  exports.SourceMapConsumer = SourceMapConsumer;\n\n});\n\n},{\"./array-set\":12,\"./base64-vlq\":13,\"./binary-search\":15,\"./util\":19,\"amdefine\":20}],17:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var base64VLQ = _dereq_('./base64-vlq');\n  var util = _dereq_('./util');\n  var ArraySet = _dereq_('./array-set').ArraySet;\n\n  /**\n   * An instance of the SourceMapGenerator represents a source map which is\n   * being built incrementally. To create a new one, you must pass an object\n   * with the following properties:\n   *\n   *   - file: The filename of the generated source.\n   *   - sourceRoot: An optional root for all URLs in this source map.\n   */\n  function SourceMapGenerator(aArgs) {\n    this._file = util.getArg(aArgs, 'file');\n    this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n    this._sources = new ArraySet();\n    this._names = new ArraySet();\n    this._mappings = [];\n    this._sourcesContents = null;\n  }\n\n  SourceMapGenerator.prototype._version = 3;\n\n  /**\n   * Creates a new SourceMapGenerator based on a SourceMapConsumer\n   *\n   * @param aSourceMapConsumer The SourceMap.\n   */\n  SourceMapGenerator.fromSourceMap =\n    function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n      var sourceRoot = aSourceMapConsumer.sourceRoot;\n      var generator = new SourceMapGenerator({\n        file: aSourceMapConsumer.file,\n        sourceRoot: sourceRoot\n      });\n      aSourceMapConsumer.eachMapping(function (mapping) {\n        var newMapping = {\n          generated: {\n            line: mapping.generatedLine,\n            column: mapping.generatedColumn\n          }\n        };\n\n        if (mapping.source) {\n          newMapping.source = mapping.source;\n          if (sourceRoot) {\n            newMapping.source = util.relative(sourceRoot, newMapping.source);\n          }\n\n          newMapping.original = {\n            line: mapping.originalLine,\n            column: mapping.originalColumn\n          };\n\n          if (mapping.name) {\n            newMapping.name = mapping.name;\n          }\n        }\n\n        generator.addMapping(newMapping);\n      });\n      aSourceMapConsumer.sources.forEach(function (sourceFile) {\n        var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n        if (content) {\n          generator.setSourceContent(sourceFile, content);\n        }\n      });\n      return generator;\n    };\n\n  /**\n   * Add a single mapping from original source line and column to the generated\n   * source's line and column for this source map being created. The mapping\n   * object should have the following properties:\n   *\n   *   - generated: An object with the generated line and column positions.\n   *   - original: An object with the original line and column positions.\n   *   - source: The original source file (relative to the sourceRoot).\n   *   - name: An optional original token name for this mapping.\n   */\n  SourceMapGenerator.prototype.addMapping =\n    function SourceMapGenerator_addMapping(aArgs) {\n      var generated = util.getArg(aArgs, 'generated');\n      var original = util.getArg(aArgs, 'original', null);\n      var source = util.getArg(aArgs, 'source', null);\n      var name = util.getArg(aArgs, 'name', null);\n\n      this._validateMapping(generated, original, source, name);\n\n      if (source && !this._sources.has(source)) {\n        this._sources.add(source);\n      }\n\n      if (name && !this._names.has(name)) {\n        this._names.add(name);\n      }\n\n      this._mappings.push({\n        generatedLine: generated.line,\n        generatedColumn: generated.column,\n        originalLine: original != null && original.line,\n        originalColumn: original != null && original.column,\n        source: source,\n        name: name\n      });\n    };\n\n  /**\n   * Set the source content for a source file.\n   */\n  SourceMapGenerator.prototype.setSourceContent =\n    function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n      var source = aSourceFile;\n      if (this._sourceRoot) {\n        source = util.relative(this._sourceRoot, source);\n      }\n\n      if (aSourceContent !== null) {\n        // Add the source content to the _sourcesContents map.\n        // Create a new _sourcesContents map if the property is null.\n        if (!this._sourcesContents) {\n          this._sourcesContents = {};\n        }\n        this._sourcesContents[util.toSetString(source)] = aSourceContent;\n      } else {\n        // Remove the source file from the _sourcesContents map.\n        // If the _sourcesContents map is empty, set the property to null.\n        delete this._sourcesContents[util.toSetString(source)];\n        if (Object.keys(this._sourcesContents).length === 0) {\n          this._sourcesContents = null;\n        }\n      }\n    };\n\n  /**\n   * Applies the mappings of a sub-source-map for a specific source file to the\n   * source map being generated. Each mapping to the supplied source file is\n   * rewritten using the supplied source map. Note: The resolution for the\n   * resulting mappings is the minimium of this map and the supplied map.\n   *\n   * @param aSourceMapConsumer The source map to be applied.\n   * @param aSourceFile Optional. The filename of the source file.\n   *        If omitted, SourceMapConsumer's file property will be used.\n   */\n  SourceMapGenerator.prototype.applySourceMap =\n    function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {\n      // If aSourceFile is omitted, we will use the file property of the SourceMap\n      if (!aSourceFile) {\n        aSourceFile = aSourceMapConsumer.file;\n      }\n      var sourceRoot = this._sourceRoot;\n      // Make \"aSourceFile\" relative if an absolute Url is passed.\n      if (sourceRoot) {\n        aSourceFile = util.relative(sourceRoot, aSourceFile);\n      }\n      // Applying the SourceMap can add and remove items from the sources and\n      // the names array.\n      var newSources = new ArraySet();\n      var newNames = new ArraySet();\n\n      // Find mappings for the \"aSourceFile\"\n      this._mappings.forEach(function (mapping) {\n        if (mapping.source === aSourceFile && mapping.originalLine) {\n          // Check if it can be mapped by the source map, then update the mapping.\n          var original = aSourceMapConsumer.originalPositionFor({\n            line: mapping.originalLine,\n            column: mapping.originalColumn\n          });\n          if (original.source !== null) {\n            // Copy mapping\n            if (sourceRoot) {\n              mapping.source = util.relative(sourceRoot, original.source);\n            } else {\n              mapping.source = original.source;\n            }\n            mapping.originalLine = original.line;\n            mapping.originalColumn = original.column;\n            if (original.name !== null && mapping.name !== null) {\n              // Only use the identifier name if it's an identifier\n              // in both SourceMaps\n              mapping.name = original.name;\n            }\n          }\n        }\n\n        var source = mapping.source;\n        if (source && !newSources.has(source)) {\n          newSources.add(source);\n        }\n\n        var name = mapping.name;\n        if (name && !newNames.has(name)) {\n          newNames.add(name);\n        }\n\n      }, this);\n      this._sources = newSources;\n      this._names = newNames;\n\n      // Copy sourcesContents of applied map.\n      aSourceMapConsumer.sources.forEach(function (sourceFile) {\n        var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n        if (content) {\n          if (sourceRoot) {\n            sourceFile = util.relative(sourceRoot, sourceFile);\n          }\n          this.setSourceContent(sourceFile, content);\n        }\n      }, this);\n    };\n\n  /**\n   * A mapping can have one of the three levels of data:\n   *\n   *   1. Just the generated position.\n   *   2. The Generated position, original position, and original source.\n   *   3. Generated and original position, original source, as well as a name\n   *      token.\n   *\n   * To maintain consistency, we validate that any new mapping being added falls\n   * in to one of these categories.\n   */\n  SourceMapGenerator.prototype._validateMapping =\n    function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n                                                aName) {\n      if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n          && aGenerated.line > 0 && aGenerated.column >= 0\n          && !aOriginal && !aSource && !aName) {\n        // Case 1.\n        return;\n      }\n      else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n               && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n               && aGenerated.line > 0 && aGenerated.column >= 0\n               && aOriginal.line > 0 && aOriginal.column >= 0\n               && aSource) {\n        // Cases 2 and 3.\n        return;\n      }\n      else {\n        throw new Error('Invalid mapping: ' + JSON.stringify({\n          generated: aGenerated,\n          source: aSource,\n          orginal: aOriginal,\n          name: aName\n        }));\n      }\n    };\n\n  /**\n   * Serialize the accumulated mappings in to the stream of base 64 VLQs\n   * specified by the source map format.\n   */\n  SourceMapGenerator.prototype._serializeMappings =\n    function SourceMapGenerator_serializeMappings() {\n      var previousGeneratedColumn = 0;\n      var previousGeneratedLine = 1;\n      var previousOriginalColumn = 0;\n      var previousOriginalLine = 0;\n      var previousName = 0;\n      var previousSource = 0;\n      var result = '';\n      var mapping;\n\n      // The mappings must be guaranteed to be in sorted order before we start\n      // serializing them or else the generated line numbers (which are defined\n      // via the ';' separators) will be all messed up. Note: it might be more\n      // performant to maintain the sorting as we insert them, rather than as we\n      // serialize them, but the big O is the same either way.\n      this._mappings.sort(util.compareByGeneratedPositions);\n\n      for (var i = 0, len = this._mappings.length; i < len; i++) {\n        mapping = this._mappings[i];\n\n        if (mapping.generatedLine !== previousGeneratedLine) {\n          previousGeneratedColumn = 0;\n          while (mapping.generatedLine !== previousGeneratedLine) {\n            result += ';';\n            previousGeneratedLine++;\n          }\n        }\n        else {\n          if (i > 0) {\n            if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) {\n              continue;\n            }\n            result += ',';\n          }\n        }\n\n        result += base64VLQ.encode(mapping.generatedColumn\n                                   - previousGeneratedColumn);\n        previousGeneratedColumn = mapping.generatedColumn;\n\n        if (mapping.source) {\n          result += base64VLQ.encode(this._sources.indexOf(mapping.source)\n                                     - previousSource);\n          previousSource = this._sources.indexOf(mapping.source);\n\n          // lines are stored 0-based in SourceMap spec version 3\n          result += base64VLQ.encode(mapping.originalLine - 1\n                                     - previousOriginalLine);\n          previousOriginalLine = mapping.originalLine - 1;\n\n          result += base64VLQ.encode(mapping.originalColumn\n                                     - previousOriginalColumn);\n          previousOriginalColumn = mapping.originalColumn;\n\n          if (mapping.name) {\n            result += base64VLQ.encode(this._names.indexOf(mapping.name)\n                                       - previousName);\n            previousName = this._names.indexOf(mapping.name);\n          }\n        }\n      }\n\n      return result;\n    };\n\n  SourceMapGenerator.prototype._generateSourcesContent =\n    function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n      return aSources.map(function (source) {\n        if (!this._sourcesContents) {\n          return null;\n        }\n        if (aSourceRoot) {\n          source = util.relative(aSourceRoot, source);\n        }\n        var key = util.toSetString(source);\n        return Object.prototype.hasOwnProperty.call(this._sourcesContents,\n                                                    key)\n          ? this._sourcesContents[key]\n          : null;\n      }, this);\n    };\n\n  /**\n   * Externalize the source map.\n   */\n  SourceMapGenerator.prototype.toJSON =\n    function SourceMapGenerator_toJSON() {\n      var map = {\n        version: this._version,\n        file: this._file,\n        sources: this._sources.toArray(),\n        names: this._names.toArray(),\n        mappings: this._serializeMappings()\n      };\n      if (this._sourceRoot) {\n        map.sourceRoot = this._sourceRoot;\n      }\n      if (this._sourcesContents) {\n        map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n      }\n\n      return map;\n    };\n\n  /**\n   * Render the source map being generated to a string.\n   */\n  SourceMapGenerator.prototype.toString =\n    function SourceMapGenerator_toString() {\n      return JSON.stringify(this);\n    };\n\n  exports.SourceMapGenerator = SourceMapGenerator;\n\n});\n\n},{\"./array-set\":12,\"./base64-vlq\":13,\"./util\":19,\"amdefine\":20}],18:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  var SourceMapGenerator = _dereq_('./source-map-generator').SourceMapGenerator;\n  var util = _dereq_('./util');\n\n  /**\n   * SourceNodes provide a way to abstract over interpolating/concatenating\n   * snippets of generated JavaScript source code while maintaining the line and\n   * column information associated with the original source code.\n   *\n   * @param aLine The original line number.\n   * @param aColumn The original column number.\n   * @param aSource The original source's filename.\n   * @param aChunks Optional. An array of strings which are snippets of\n   *        generated JS, or other SourceNodes.\n   * @param aName The original identifier.\n   */\n  function SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n    this.children = [];\n    this.sourceContents = {};\n    this.line = aLine === undefined ? null : aLine;\n    this.column = aColumn === undefined ? null : aColumn;\n    this.source = aSource === undefined ? null : aSource;\n    this.name = aName === undefined ? null : aName;\n    if (aChunks != null) this.add(aChunks);\n  }\n\n  /**\n   * Creates a SourceNode from generated code and a SourceMapConsumer.\n   *\n   * @param aGeneratedCode The generated code\n   * @param aSourceMapConsumer The SourceMap for the generated code\n   */\n  SourceNode.fromStringWithSourceMap =\n    function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {\n      // The SourceNode we want to fill with the generated code\n      // and the SourceMap\n      var node = new SourceNode();\n\n      // The generated code\n      // Processed fragments are removed from this array.\n      var remainingLines = aGeneratedCode.split('\\n');\n\n      // We need to remember the position of \"remainingLines\"\n      var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n      // The generate SourceNodes we need a code range.\n      // To extract it current and last mapping is used.\n      // Here we store the last mapping.\n      var lastMapping = null;\n\n      aSourceMapConsumer.eachMapping(function (mapping) {\n        if (lastMapping === null) {\n          // We add the generated code until the first mapping\n          // to the SourceNode without any mapping.\n          // Each line is added as separate string.\n          while (lastGeneratedLine < mapping.generatedLine) {\n            node.add(remainingLines.shift() + \"\\n\");\n            lastGeneratedLine++;\n          }\n          if (lastGeneratedColumn < mapping.generatedColumn) {\n            var nextLine = remainingLines[0];\n            node.add(nextLine.substr(0, mapping.generatedColumn));\n            remainingLines[0] = nextLine.substr(mapping.generatedColumn);\n            lastGeneratedColumn = mapping.generatedColumn;\n          }\n        } else {\n          // We add the code from \"lastMapping\" to \"mapping\":\n          // First check if there is a new line in between.\n          if (lastGeneratedLine < mapping.generatedLine) {\n            var code = \"\";\n            // Associate full lines with \"lastMapping\"\n            do {\n              code += remainingLines.shift() + \"\\n\";\n              lastGeneratedLine++;\n              lastGeneratedColumn = 0;\n            } while (lastGeneratedLine < mapping.generatedLine);\n            // When we reached the correct line, we add code until we\n            // reach the correct column too.\n            if (lastGeneratedColumn < mapping.generatedColumn) {\n              var nextLine = remainingLines[0];\n              code += nextLine.substr(0, mapping.generatedColumn);\n              remainingLines[0] = nextLine.substr(mapping.generatedColumn);\n              lastGeneratedColumn = mapping.generatedColumn;\n            }\n            // Create the SourceNode.\n            addMappingWithCode(lastMapping, code);\n          } else {\n            // There is no new line in between.\n            // Associate the code between \"lastGeneratedColumn\" and\n            // \"mapping.generatedColumn\" with \"lastMapping\"\n            var nextLine = remainingLines[0];\n            var code = nextLine.substr(0, mapping.generatedColumn -\n                                          lastGeneratedColumn);\n            remainingLines[0] = nextLine.substr(mapping.generatedColumn -\n                                                lastGeneratedColumn);\n            lastGeneratedColumn = mapping.generatedColumn;\n            addMappingWithCode(lastMapping, code);\n          }\n        }\n        lastMapping = mapping;\n      }, this);\n      // We have processed all mappings.\n      // Associate the remaining code in the current line with \"lastMapping\"\n      // and add the remaining lines without any mapping\n      addMappingWithCode(lastMapping, remainingLines.join(\"\\n\"));\n\n      // Copy sourcesContent into SourceNode\n      aSourceMapConsumer.sources.forEach(function (sourceFile) {\n        var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n        if (content) {\n          node.setSourceContent(sourceFile, content);\n        }\n      });\n\n      return node;\n\n      function addMappingWithCode(mapping, code) {\n        if (mapping === null || mapping.source === undefined) {\n          node.add(code);\n        } else {\n          node.add(new SourceNode(mapping.originalLine,\n                                  mapping.originalColumn,\n                                  mapping.source,\n                                  code,\n                                  mapping.name));\n        }\n      }\n    };\n\n  /**\n   * Add a chunk of generated JS to this source node.\n   *\n   * @param aChunk A string snippet of generated JS code, another instance of\n   *        SourceNode, or an array where each member is one of those things.\n   */\n  SourceNode.prototype.add = function SourceNode_add(aChunk) {\n    if (Array.isArray(aChunk)) {\n      aChunk.forEach(function (chunk) {\n        this.add(chunk);\n      }, this);\n    }\n    else if (aChunk instanceof SourceNode || typeof aChunk === \"string\") {\n      if (aChunk) {\n        this.children.push(aChunk);\n      }\n    }\n    else {\n      throw new TypeError(\n        \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n      );\n    }\n    return this;\n  };\n\n  /**\n   * Add a chunk of generated JS to the beginning of this source node.\n   *\n   * @param aChunk A string snippet of generated JS code, another instance of\n   *        SourceNode, or an array where each member is one of those things.\n   */\n  SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n    if (Array.isArray(aChunk)) {\n      for (var i = aChunk.length-1; i >= 0; i--) {\n        this.prepend(aChunk[i]);\n      }\n    }\n    else if (aChunk instanceof SourceNode || typeof aChunk === \"string\") {\n      this.children.unshift(aChunk);\n    }\n    else {\n      throw new TypeError(\n        \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n      );\n    }\n    return this;\n  };\n\n  /**\n   * Walk over the tree of JS snippets in this node and its children. The\n   * walking function is called once for each snippet of JS and is passed that\n   * snippet and the its original associated source's line/column location.\n   *\n   * @param aFn The traversal function.\n   */\n  SourceNode.prototype.walk = function SourceNode_walk(aFn) {\n    var chunk;\n    for (var i = 0, len = this.children.length; i < len; i++) {\n      chunk = this.children[i];\n      if (chunk instanceof SourceNode) {\n        chunk.walk(aFn);\n      }\n      else {\n        if (chunk !== '') {\n          aFn(chunk, { source: this.source,\n                       line: this.line,\n                       column: this.column,\n                       name: this.name });\n        }\n      }\n    }\n  };\n\n  /**\n   * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n   * each of `this.children`.\n   *\n   * @param aSep The separator.\n   */\n  SourceNode.prototype.join = function SourceNode_join(aSep) {\n    var newChildren;\n    var i;\n    var len = this.children.length;\n    if (len > 0) {\n      newChildren = [];\n      for (i = 0; i < len-1; i++) {\n        newChildren.push(this.children[i]);\n        newChildren.push(aSep);\n      }\n      newChildren.push(this.children[i]);\n      this.children = newChildren;\n    }\n    return this;\n  };\n\n  /**\n   * Call String.prototype.replace on the very right-most source snippet. Useful\n   * for trimming whitespace from the end of a source node, etc.\n   *\n   * @param aPattern The pattern to replace.\n   * @param aReplacement The thing to replace the pattern with.\n   */\n  SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n    var lastChild = this.children[this.children.length - 1];\n    if (lastChild instanceof SourceNode) {\n      lastChild.replaceRight(aPattern, aReplacement);\n    }\n    else if (typeof lastChild === 'string') {\n      this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n    }\n    else {\n      this.children.push(''.replace(aPattern, aReplacement));\n    }\n    return this;\n  };\n\n  /**\n   * Set the source content for a source file. This will be added to the SourceMapGenerator\n   * in the sourcesContent field.\n   *\n   * @param aSourceFile The filename of the source file\n   * @param aSourceContent The content of the source file\n   */\n  SourceNode.prototype.setSourceContent =\n    function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n      this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n    };\n\n  /**\n   * Walk over the tree of SourceNodes. The walking function is called for each\n   * source file content and is passed the filename and source content.\n   *\n   * @param aFn The traversal function.\n   */\n  SourceNode.prototype.walkSourceContents =\n    function SourceNode_walkSourceContents(aFn) {\n      for (var i = 0, len = this.children.length; i < len; i++) {\n        if (this.children[i] instanceof SourceNode) {\n          this.children[i].walkSourceContents(aFn);\n        }\n      }\n\n      var sources = Object.keys(this.sourceContents);\n      for (var i = 0, len = sources.length; i < len; i++) {\n        aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n      }\n    };\n\n  /**\n   * Return the string representation of this source node. Walks over the tree\n   * and concatenates all the various snippets together to one string.\n   */\n  SourceNode.prototype.toString = function SourceNode_toString() {\n    var str = \"\";\n    this.walk(function (chunk) {\n      str += chunk;\n    });\n    return str;\n  };\n\n  /**\n   * Returns the string representation of this source node along with a source\n   * map.\n   */\n  SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n    var generated = {\n      code: \"\",\n      line: 1,\n      column: 0\n    };\n    var map = new SourceMapGenerator(aArgs);\n    var sourceMappingActive = false;\n    var lastOriginalSource = null;\n    var lastOriginalLine = null;\n    var lastOriginalColumn = null;\n    var lastOriginalName = null;\n    this.walk(function (chunk, original) {\n      generated.code += chunk;\n      if (original.source !== null\n          && original.line !== null\n          && original.column !== null) {\n        if(lastOriginalSource !== original.source\n           || lastOriginalLine !== original.line\n           || lastOriginalColumn !== original.column\n           || lastOriginalName !== original.name) {\n          map.addMapping({\n            source: original.source,\n            original: {\n              line: original.line,\n              column: original.column\n            },\n            generated: {\n              line: generated.line,\n              column: generated.column\n            },\n            name: original.name\n          });\n        }\n        lastOriginalSource = original.source;\n        lastOriginalLine = original.line;\n        lastOriginalColumn = original.column;\n        lastOriginalName = original.name;\n        sourceMappingActive = true;\n      } else if (sourceMappingActive) {\n        map.addMapping({\n          generated: {\n            line: generated.line,\n            column: generated.column\n          }\n        });\n        lastOriginalSource = null;\n        sourceMappingActive = false;\n      }\n      chunk.split('').forEach(function (ch) {\n        if (ch === '\\n') {\n          generated.line++;\n          generated.column = 0;\n        } else {\n          generated.column++;\n        }\n      });\n    });\n    this.walkSourceContents(function (sourceFile, sourceContent) {\n      map.setSourceContent(sourceFile, sourceContent);\n    });\n\n    return { code: generated.code, map: map };\n  };\n\n  exports.SourceNode = SourceNode;\n\n});\n\n},{\"./source-map-generator\":17,\"./util\":19,\"amdefine\":20}],19:[function(_dereq_,module,exports){\n/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nif (typeof define !== 'function') {\n    var define = _dereq_('amdefine')(module, _dereq_);\n}\ndefine(function (_dereq_, exports, module) {\n\n  /**\n   * This is a helper function for getting values from parameter/options\n   * objects.\n   *\n   * @param args The object we are extracting values from\n   * @param name The name of the property we are getting.\n   * @param defaultValue An optional value to return if the property is missing\n   * from the object. If this is not specified and the property is missing, an\n   * error will be thrown.\n   */\n  function getArg(aArgs, aName, aDefaultValue) {\n    if (aName in aArgs) {\n      return aArgs[aName];\n    } else if (arguments.length === 3) {\n      return aDefaultValue;\n    } else {\n      throw new Error('\"' + aName + '\" is a required argument.');\n    }\n  }\n  exports.getArg = getArg;\n\n  var urlRegexp = /([\\w+\\-.]+):\\/\\/((\\w+:\\w+)@)?([\\w.]+)?(:(\\d+))?(\\S+)?/;\n  var dataUrlRegexp = /^data:.+\\,.+/;\n\n  function urlParse(aUrl) {\n    var match = aUrl.match(urlRegexp);\n    if (!match) {\n      return null;\n    }\n    return {\n      scheme: match[1],\n      auth: match[3],\n      host: match[4],\n      port: match[6],\n      path: match[7]\n    };\n  }\n  exports.urlParse = urlParse;\n\n  function urlGenerate(aParsedUrl) {\n    var url = aParsedUrl.scheme + \"://\";\n    if (aParsedUrl.auth) {\n      url += aParsedUrl.auth + \"@\"\n    }\n    if (aParsedUrl.host) {\n      url += aParsedUrl.host;\n    }\n    if (aParsedUrl.port) {\n      url += \":\" + aParsedUrl.port\n    }\n    if (aParsedUrl.path) {\n      url += aParsedUrl.path;\n    }\n    return url;\n  }\n  exports.urlGenerate = urlGenerate;\n\n  function join(aRoot, aPath) {\n    var url;\n\n    if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {\n      return aPath;\n    }\n\n    if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) {\n      url.path = aPath;\n      return urlGenerate(url);\n    }\n\n    return aRoot.replace(/\\/$/, '') + '/' + aPath;\n  }\n  exports.join = join;\n\n  /**\n   * Because behavior goes wacky when you set `__proto__` on objects, we\n   * have to prefix all the strings in our set with an arbitrary character.\n   *\n   * See https://github.com/mozilla/source-map/pull/31 and\n   * https://github.com/mozilla/source-map/issues/30\n   *\n   * @param String aStr\n   */\n  function toSetString(aStr) {\n    return '$' + aStr;\n  }\n  exports.toSetString = toSetString;\n\n  function fromSetString(aStr) {\n    return aStr.substr(1);\n  }\n  exports.fromSetString = fromSetString;\n\n  function relative(aRoot, aPath) {\n    aRoot = aRoot.replace(/\\/$/, '');\n\n    var url = urlParse(aRoot);\n    if (aPath.charAt(0) == \"/\" && url && url.path == \"/\") {\n      return aPath.slice(1);\n    }\n\n    return aPath.indexOf(aRoot + '/') === 0\n      ? aPath.substr(aRoot.length + 1)\n      : aPath;\n  }\n  exports.relative = relative;\n\n  function strcmp(aStr1, aStr2) {\n    var s1 = aStr1 || \"\";\n    var s2 = aStr2 || \"\";\n    return (s1 > s2) - (s1 < s2);\n  }\n\n  /**\n   * Comparator between two mappings where the original positions are compared.\n   *\n   * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n   * mappings with the same original source/line/column, but different generated\n   * line and column the same. Useful when searching for a mapping with a\n   * stubbed out mapping.\n   */\n  function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n    var cmp;\n\n    cmp = strcmp(mappingA.source, mappingB.source);\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.originalLine - mappingB.originalLine;\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.originalColumn - mappingB.originalColumn;\n    if (cmp || onlyCompareOriginal) {\n      return cmp;\n    }\n\n    cmp = strcmp(mappingA.name, mappingB.name);\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.generatedLine - mappingB.generatedLine;\n    if (cmp) {\n      return cmp;\n    }\n\n    return mappingA.generatedColumn - mappingB.generatedColumn;\n  };\n  exports.compareByOriginalPositions = compareByOriginalPositions;\n\n  /**\n   * Comparator between two mappings where the generated positions are\n   * compared.\n   *\n   * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n   * mappings with the same generated line and column, but different\n   * source/name/original line and column the same. Useful when searching for a\n   * mapping with a stubbed out mapping.\n   */\n  function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {\n    var cmp;\n\n    cmp = mappingA.generatedLine - mappingB.generatedLine;\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n    if (cmp || onlyCompareGenerated) {\n      return cmp;\n    }\n\n    cmp = strcmp(mappingA.source, mappingB.source);\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.originalLine - mappingB.originalLine;\n    if (cmp) {\n      return cmp;\n    }\n\n    cmp = mappingA.originalColumn - mappingB.originalColumn;\n    if (cmp) {\n      return cmp;\n    }\n\n    return strcmp(mappingA.name, mappingB.name);\n  };\n  exports.compareByGeneratedPositions = compareByGeneratedPositions;\n\n});\n\n},{\"amdefine\":20}],20:[function(_dereq_,module,exports){\n(function (process,__filename){\n/** vim: et:ts=4:sw=4:sts=4\n * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/amdefine for details\n */\n\n/*jslint node: true */\n/*global module, process */\n'use strict';\n\n/**\n * Creates a define for node.\n * @param {Object} module the \"module\" object that is defined by Node for the\n * current module.\n * @param {Function} [requireFn]. Node's require function for the current module.\n * It only needs to be passed in Node versions before 0.5, when module.require\n * did not exist.\n * @returns {Function} a define function that is usable for the current node\n * module.\n */\nfunction amdefine(module, requireFn) {\n    'use strict';\n    var defineCache = {},\n        loaderCache = {},\n        alreadyCalled = false,\n        path = _dereq_('path'),\n        makeRequire, stringRequire;\n\n    /**\n     * Trims the . and .. from an array of path segments.\n     * It will keep a leading path segment if a .. will become\n     * the first path segment, to help with module name lookups,\n     * which act like paths, but can be remapped. But the end result,\n     * all paths that use this function should look normalized.\n     * NOTE: this method MODIFIES the input array.\n     * @param {Array} ary the array of path segments.\n     */\n    function trimDots(ary) {\n        var i, part;\n        for (i = 0; ary[i]; i+= 1) {\n            part = ary[i];\n            if (part === '.') {\n                ary.splice(i, 1);\n                i -= 1;\n            } else if (part === '..') {\n                if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {\n                    //End of the line. Keep at least one non-dot\n                    //path segment at the front so it can be mapped\n                    //correctly to disk. Otherwise, there is likely\n                    //no path mapping for a path starting with '..'.\n                    //This can still fail, but catches the most reasonable\n                    //uses of ..\n                    break;\n                } else if (i > 0) {\n                    ary.splice(i - 1, 2);\n                    i -= 2;\n                }\n            }\n        }\n    }\n\n    function normalize(name, baseName) {\n        var baseParts;\n\n        //Adjust any relative paths.\n        if (name && name.charAt(0) === '.') {\n            //If have a base name, try to normalize against it,\n            //otherwise, assume it is a top-level require that will\n            //be relative to baseUrl in the end.\n            if (baseName) {\n                baseParts = baseName.split('/');\n                baseParts = baseParts.slice(0, baseParts.length - 1);\n                baseParts = baseParts.concat(name.split('/'));\n                trimDots(baseParts);\n                name = baseParts.join('/');\n            }\n        }\n\n        return name;\n    }\n\n    /**\n     * Create the normalize() function passed to a loader plugin's\n     * normalize method.\n     */\n    function makeNormalize(relName) {\n        return function (name) {\n            return normalize(name, relName);\n        };\n    }\n\n    function makeLoad(id) {\n        function load(value) {\n            loaderCache[id] = value;\n        }\n\n        load.fromText = function (id, text) {\n            //This one is difficult because the text can/probably uses\n            //define, and any relative paths and requires should be relative\n            //to that id was it would be found on disk. But this would require\n            //bootstrapping a module/require fairly deeply from node core.\n            //Not sure how best to go about that yet.\n            throw new Error('amdefine does not implement load.fromText');\n        };\n\n        return load;\n    }\n\n    makeRequire = function (systemRequire, exports, module, relId) {\n        function amdRequire(deps, callback) {\n            if (typeof deps === 'string') {\n                //Synchronous, single module require('')\n                return stringRequire(systemRequire, exports, module, deps, relId);\n            } else {\n                //Array of dependencies with a callback.\n\n                //Convert the dependencies to modules.\n                deps = deps.map(function (depName) {\n                    return stringRequire(systemRequire, exports, module, depName, relId);\n                });\n\n                //Wait for next tick to call back the require call.\n                process.nextTick(function () {\n                    callback.apply(null, deps);\n                });\n            }\n        }\n\n        amdRequire.toUrl = function (filePath) {\n            if (filePath.indexOf('.') === 0) {\n                return normalize(filePath, path.dirname(module.filename));\n            } else {\n                return filePath;\n            }\n        };\n\n        return amdRequire;\n    };\n\n    //Favor explicit value, passed in if the module wants to support Node 0.4.\n    requireFn = requireFn || function req() {\n        return module.require.apply(module, arguments);\n    };\n\n    function runFactory(id, deps, factory) {\n        var r, e, m, result;\n\n        if (id) {\n            e = loaderCache[id] = {};\n            m = {\n                id: id,\n                uri: __filename,\n                exports: e\n            };\n            r = makeRequire(requireFn, e, m, id);\n        } else {\n            //Only support one define call per file\n            if (alreadyCalled) {\n                throw new Error('amdefine with no module ID cannot be called more than once per file.');\n            }\n            alreadyCalled = true;\n\n            //Use the real variables from node\n            //Use module.exports for exports, since\n            //the exports in here is amdefine exports.\n            e = module.exports;\n            m = module;\n            r = makeRequire(requireFn, e, m, module.id);\n        }\n\n        //If there are dependencies, they are strings, so need\n        //to convert them to dependency values.\n        if (deps) {\n            deps = deps.map(function (depName) {\n                return r(depName);\n            });\n        }\n\n        //Call the factory with the right dependencies.\n        if (typeof factory === 'function') {\n            result = factory.apply(m.exports, deps);\n        } else {\n            result = factory;\n        }\n\n        if (result !== undefined) {\n            m.exports = result;\n            if (id) {\n                loaderCache[id] = m.exports;\n            }\n        }\n    }\n\n    stringRequire = function (systemRequire, exports, module, id, relId) {\n        //Split the ID by a ! so that\n        var index = id.indexOf('!'),\n            originalId = id,\n            prefix, plugin;\n\n        if (index === -1) {\n            id = normalize(id, relId);\n\n            //Straight module lookup. If it is one of the special dependencies,\n            //deal with it, otherwise, delegate to node.\n            if (id === 'require') {\n                return makeRequire(systemRequire, exports, module, relId);\n            } else if (id === 'exports') {\n                return exports;\n            } else if (id === 'module') {\n                return module;\n            } else if (loaderCache.hasOwnProperty(id)) {\n                return loaderCache[id];\n            } else if (defineCache[id]) {\n                runFactory.apply(null, defineCache[id]);\n                return loaderCache[id];\n            } else {\n                if(systemRequire) {\n                    return systemRequire(originalId);\n                } else {\n                    throw new Error('No module with ID: ' + id);\n                }\n            }\n        } else {\n            //There is a plugin in play.\n            prefix = id.substring(0, index);\n            id = id.substring(index + 1, id.length);\n\n            plugin = stringRequire(systemRequire, exports, module, prefix, relId);\n\n            if (plugin.normalize) {\n                id = plugin.normalize(id, makeNormalize(relId));\n            } else {\n                //Normalize the ID normally.\n                id = normalize(id, relId);\n            }\n\n            if (loaderCache[id]) {\n                return loaderCache[id];\n            } else {\n                plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});\n\n                return loaderCache[id];\n            }\n        }\n    };\n\n    //Create a define function specific to the module asking for amdefine.\n    function define(id, deps, factory) {\n        if (Array.isArray(id)) {\n            factory = deps;\n            deps = id;\n            id = undefined;\n        } else if (typeof id !== 'string') {\n            factory = id;\n            id = deps = undefined;\n        }\n\n        if (deps && !Array.isArray(deps)) {\n            factory = deps;\n            deps = undefined;\n        }\n\n        if (!deps) {\n            deps = ['require', 'exports', 'module'];\n        }\n\n        //Set up properties for this module. If an ID, then use\n        //internal cache. If no ID, then use the external variables\n        //for this node module.\n        if (id) {\n            //Put the module in deep freeze until there is a\n            //require call for it.\n            defineCache[id] = [id, deps, factory];\n        } else {\n            runFactory(id, deps, factory);\n        }\n    }\n\n    //define.require, which has access to all the values in the\n    //cache. Useful for AMD modules that all have IDs in the file,\n    //but need to finally export a value to node based on one of those\n    //IDs.\n    define.require = function (id) {\n        if (loaderCache[id]) {\n            return loaderCache[id];\n        }\n\n        if (defineCache[id]) {\n            runFactory.apply(null, defineCache[id]);\n            return loaderCache[id];\n        }\n    };\n\n    define.amd = {};\n\n    return define;\n}\n\nmodule.exports = amdefine;\n\n}).call(this,_dereq_('_process'),\"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js\")\n},{\"_process\":8,\"path\":7}],21:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar docblockRe = /^\\s*(\\/\\*\\*(.|\\r?\\n)*?\\*\\/)/;\nvar ltrimRe = /^\\s*/;\n/**\n * @param {String} contents\n * @return {String}\n */\nfunction extract(contents) {\n  var match = contents.match(docblockRe);\n  if (match) {\n    return match[0].replace(ltrimRe, '') || '';\n  }\n  return '';\n}\n\n\nvar commentStartRe = /^\\/\\*\\*?/;\nvar commentEndRe = /\\*+\\/$/;\nvar wsRe = /[\\t ]+/g;\nvar stringStartRe = /(\\r?\\n|^) *\\*/g;\nvar multilineRe = /(?:^|\\r?\\n) *(@[^\\r\\n]*?) *\\r?\\n *([^@\\r\\n\\s][^@\\r\\n]+?) *\\r?\\n/g;\nvar propertyRe = /(?:^|\\r?\\n) *@(\\S+) *([^\\r\\n]*)/g;\n\n/**\n * @param {String} contents\n * @return {Array}\n */\nfunction parse(docblock) {\n  docblock = docblock\n    .replace(commentStartRe, '')\n    .replace(commentEndRe, '')\n    .replace(wsRe, ' ')\n    .replace(stringStartRe, '$1');\n\n  // Normalize multi-line directives\n  var prev = '';\n  while (prev != docblock) {\n    prev = docblock;\n    docblock = docblock.replace(multilineRe, \"\\n$1 $2\\n\");\n  }\n  docblock = docblock.trim();\n\n  var result = [];\n  var match;\n  while (match = propertyRe.exec(docblock)) {\n    result.push([match[1], match[2]]);\n  }\n\n  return result;\n}\n\n/**\n * Same as parse but returns an object of prop: value instead of array of paris\n * If a property appers more than once the last one will be returned\n *\n * @param {String} contents\n * @return {Object}\n */\nfunction parseAsObject(docblock) {\n  var pairs = parse(docblock);\n  var result = {};\n  for (var i = 0; i < pairs.length; i++) {\n    result[pairs[i][0]] = pairs[i][1];\n  }\n  return result;\n}\n\n\nexports.extract = extract;\nexports.parse = parse;\nexports.parseAsObject = parseAsObject;\n\n},{}],22:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/*jslint node: true*/\n\"use strict\";\n\nvar esprima = _dereq_('esprima-fb');\nvar utils = _dereq_('./utils');\n\nvar getBoundaryNode = utils.getBoundaryNode;\nvar declareIdentInScope = utils.declareIdentInLocalScope;\nvar initScopeMetadata = utils.initScopeMetadata;\nvar Syntax = esprima.Syntax;\n\n/**\n * @param {object} node\n * @param {object} parentNode\n * @return {boolean}\n */\nfunction _nodeIsClosureScopeBoundary(node, parentNode) {\n  if (node.type === Syntax.Program) {\n    return true;\n  }\n\n  var parentIsFunction =\n    parentNode.type === Syntax.FunctionDeclaration\n    || parentNode.type === Syntax.FunctionExpression\n    || parentNode.type === Syntax.ArrowFunctionExpression;\n\n  var parentIsCurlylessArrowFunc =\n    parentNode.type === Syntax.ArrowFunctionExpression\n    && node === parentNode.body;\n\n  return parentIsFunction\n         && (node.type === Syntax.BlockStatement || parentIsCurlylessArrowFunc);\n}\n\nfunction _nodeIsBlockScopeBoundary(node, parentNode) {\n  if (node.type === Syntax.Program) {\n    return false;\n  }\n\n  return node.type === Syntax.BlockStatement\n         && parentNode.type === Syntax.CatchClause;\n}\n\n/**\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction traverse(node, path, state) {\n  /*jshint -W004*/\n  // Create a scope stack entry if this is the first node we've encountered in\n  // its local scope\n  var startIndex = null;\n  var parentNode = path[0];\n  if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {\n    if (_nodeIsClosureScopeBoundary(node, parentNode)) {\n      var scopeIsStrict = state.scopeIsStrict;\n      if (!scopeIsStrict\n          && (node.type === Syntax.BlockStatement\n              || node.type === Syntax.Program)) {\n          scopeIsStrict =\n            node.body.length > 0\n            && node.body[0].type === Syntax.ExpressionStatement\n            && node.body[0].expression.type === Syntax.Literal\n            && node.body[0].expression.value === 'use strict';\n      }\n\n      if (node.type === Syntax.Program) {\n        startIndex = state.g.buffer.length;\n        state = utils.updateState(state, {\n          scopeIsStrict: scopeIsStrict\n        });\n      } else {\n        startIndex = state.g.buffer.length + 1;\n        state = utils.updateState(state, {\n          localScope: {\n            parentNode: parentNode,\n            parentScope: state.localScope,\n            identifiers: {},\n            tempVarIndex: 0,\n            tempVars: []\n          },\n          scopeIsStrict: scopeIsStrict\n        });\n\n        // All functions have an implicit 'arguments' object in scope\n        declareIdentInScope('arguments', initScopeMetadata(node), state);\n\n        // Include function arg identifiers in the scope boundaries of the\n        // function\n        if (parentNode.params.length > 0) {\n          var param;\n          var metadata = initScopeMetadata(parentNode, path.slice(1), path[0]);\n          for (var i = 0; i < parentNode.params.length; i++) {\n            param = parentNode.params[i];\n            if (param.type === Syntax.Identifier) {\n              declareIdentInScope(param.name, metadata, state);\n            }\n          }\n        }\n\n        // Include rest arg identifiers in the scope boundaries of their\n        // functions\n        if (parentNode.rest) {\n          var metadata = initScopeMetadata(\n            parentNode,\n            path.slice(1),\n            path[0]\n          );\n          declareIdentInScope(parentNode.rest.name, metadata, state);\n        }\n\n        // Named FunctionExpressions scope their name within the body block of\n        // themselves only\n        if (parentNode.type === Syntax.FunctionExpression && parentNode.id) {\n          var metaData =\n            initScopeMetadata(parentNode, path.parentNodeslice, parentNode);\n          declareIdentInScope(parentNode.id.name, metaData, state);\n        }\n      }\n\n      // Traverse and find all local identifiers in this closure first to\n      // account for function/variable declaration hoisting\n      collectClosureIdentsAndTraverse(node, path, state);\n    }\n\n    if (_nodeIsBlockScopeBoundary(node, parentNode)) {\n      startIndex = state.g.buffer.length;\n      state = utils.updateState(state, {\n        localScope: {\n          parentNode: parentNode,\n          parentScope: state.localScope,\n          identifiers: {},\n          tempVarIndex: 0,\n          tempVars: []\n        }\n      });\n\n      if (parentNode.type === Syntax.CatchClause) {\n        var metadata = initScopeMetadata(\n          parentNode,\n          path.slice(1),\n          parentNode\n        );\n        declareIdentInScope(parentNode.param.name, metadata, state);\n      }\n      collectBlockIdentsAndTraverse(node, path, state);\n    }\n  }\n\n  // Only catchup() before and after traversing a child node\n  function traverser(node, path, state) {\n    node.range && utils.catchup(node.range[0], state);\n    traverse(node, path, state);\n    node.range && utils.catchup(node.range[1], state);\n  }\n\n  utils.analyzeAndTraverse(walker, traverser, node, path, state);\n\n  // Inject temp variables into the scope.\n  if (startIndex !== null) {\n    utils.injectTempVarDeclarations(state, startIndex);\n  }\n}\n\nfunction collectClosureIdentsAndTraverse(node, path, state) {\n  utils.analyzeAndTraverse(\n    visitLocalClosureIdentifiers,\n    collectClosureIdentsAndTraverse,\n    node,\n    path,\n    state\n  );\n}\n\nfunction collectBlockIdentsAndTraverse(node, path, state) {\n  utils.analyzeAndTraverse(\n    visitLocalBlockIdentifiers,\n    collectBlockIdentsAndTraverse,\n    node,\n    path,\n    state\n  );\n}\n\nfunction visitLocalClosureIdentifiers(node, path, state) {\n  var metaData;\n  switch (node.type) {\n    case Syntax.ArrowFunctionExpression:\n    case Syntax.FunctionExpression:\n      // Function expressions don't get their names (if there is one) added to\n      // the closure scope they're defined in\n      return false;\n    case Syntax.ClassDeclaration:\n    case Syntax.ClassExpression:\n    case Syntax.FunctionDeclaration:\n      if (node.id) {\n        metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);\n        declareIdentInScope(node.id.name, metaData, state);\n      }\n      return false;\n    case Syntax.VariableDeclarator:\n      // Variables have function-local scope\n      if (path[0].kind === 'var') {\n        metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);\n        declareIdentInScope(node.id.name, metaData, state);\n      }\n      break;\n  }\n}\n\nfunction visitLocalBlockIdentifiers(node, path, state) {\n  // TODO: Support 'let' here...maybe...one day...or something...\n  if (node.type === Syntax.CatchClause) {\n    return false;\n  }\n}\n\nfunction walker(node, path, state) {\n  var visitors = state.g.visitors;\n  for (var i = 0; i < visitors.length; i++) {\n    if (visitors[i].test(node, path, state)) {\n      return visitors[i](traverse, node, path, state);\n    }\n  }\n}\n\nvar _astCache = {};\n\nfunction getAstForSource(source, options) {\n  if (_astCache[source] && !options.disableAstCache) {\n    return _astCache[source];\n  }\n  var ast = esprima.parse(source, {\n    comment: true,\n    loc: true,\n    range: true,\n    sourceType: options.sourceType\n  });\n  if (!options.disableAstCache) {\n    _astCache[source] = ast;\n  }\n  return ast;\n}\n\n/**\n * Applies all available transformations to the source\n * @param {array} visitors\n * @param {string} source\n * @param {?object} options\n * @return {object}\n */\nfunction transform(visitors, source, options) {\n  options = options || {};\n  var ast;\n  try {\n    ast = getAstForSource(source, options);\n    } catch (e) {\n    e.message = 'Parse Error: ' + e.message;\n    throw e;\n  }\n  var state = utils.createState(source, ast, options);\n  state.g.visitors = visitors;\n\n  if (options.sourceMap) {\n    var SourceMapGenerator = _dereq_('source-map').SourceMapGenerator;\n    state.g.sourceMap = new SourceMapGenerator({file: options.filename || 'transformed.js'});\n  }\n\n  traverse(ast, [], state);\n  utils.catchup(source.length, state);\n\n  var ret = {code: state.g.buffer, extra: state.g.extra};\n  if (options.sourceMap) {\n    ret.sourceMap = state.g.sourceMap;\n    ret.sourceMapFilename =  options.filename || 'source.js';\n  }\n  return ret;\n}\n\nexports.transform = transform;\nexports.Syntax = Syntax;\n\n},{\"./utils\":23,\"esprima-fb\":9,\"source-map\":11}],23:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/*jslint node: true*/\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar leadingIndentRegexp = /(^|\\n)( {2}|\\t)/g;\nvar nonWhiteRegexp = /(\\S)/g;\n\n/**\n * A `state` object represents the state of the parser. It has \"local\" and\n * \"global\" parts. Global contains parser position, source, etc. Local contains\n * scope based properties like current class name. State should contain all the\n * info required for transformation. It's the only mandatory object that is\n * being passed to every function in transform chain.\n *\n * @param  {string} source\n * @param  {object} transformOptions\n * @return {object}\n */\nfunction createState(source, rootNode, transformOptions) {\n  return {\n    /**\n     * A tree representing the current local scope (and its lexical scope chain)\n     * Useful for tracking identifiers from parent scopes, etc.\n     * @type {Object}\n     */\n    localScope: {\n      parentNode: rootNode,\n      parentScope: null,\n      identifiers: {},\n      tempVarIndex: 0,\n      tempVars: []\n    },\n    /**\n     * The name (and, if applicable, expression) of the super class\n     * @type {Object}\n     */\n    superClass: null,\n    /**\n     * The namespace to use when munging identifiers\n     * @type {String}\n     */\n    mungeNamespace: '',\n    /**\n     * Ref to the node for the current MethodDefinition\n     * @type {Object}\n     */\n    methodNode: null,\n    /**\n     * Ref to the node for the FunctionExpression of the enclosing\n     * MethodDefinition\n     * @type {Object}\n     */\n    methodFuncNode: null,\n    /**\n     * Name of the enclosing class\n     * @type {String}\n     */\n    className: null,\n    /**\n     * Whether we're currently within a `strict` scope\n     * @type {Bool}\n     */\n    scopeIsStrict: null,\n    /**\n     * Indentation offset\n     * @type {Number}\n     */\n    indentBy: 0,\n    /**\n     * Global state (not affected by updateState)\n     * @type {Object}\n     */\n    g: {\n      /**\n       * A set of general options that transformations can consider while doing\n       * a transformation:\n       *\n       * - minify\n       *   Specifies that transformation steps should do their best to minify\n       *   the output source when possible. This is useful for places where\n       *   minification optimizations are possible with higher-level context\n       *   info than what jsxmin can provide.\n       *\n       *   For example, the ES6 class transform will minify munged private\n       *   variables if this flag is set.\n       */\n      opts: transformOptions,\n      /**\n       * Current position in the source code\n       * @type {Number}\n       */\n      position: 0,\n      /**\n       * Auxiliary data to be returned by transforms\n       * @type {Object}\n       */\n      extra: {},\n      /**\n       * Buffer containing the result\n       * @type {String}\n       */\n      buffer: '',\n      /**\n       * Source that is being transformed\n       * @type {String}\n       */\n      source: source,\n\n      /**\n       * Cached parsed docblock (see getDocblock)\n       * @type {object}\n       */\n      docblock: null,\n\n      /**\n       * Whether the thing was used\n       * @type {Boolean}\n       */\n      tagNamespaceUsed: false,\n\n      /**\n       * If using bolt xjs transformation\n       * @type {Boolean}\n       */\n      isBolt: undefined,\n\n      /**\n       * Whether to record source map (expensive) or not\n       * @type {SourceMapGenerator|null}\n       */\n      sourceMap: null,\n\n      /**\n       * Filename of the file being processed. Will be returned as a source\n       * attribute in the source map\n       */\n      sourceMapFilename: 'source.js',\n\n      /**\n       * Only when source map is used: last line in the source for which\n       * source map was generated\n       * @type {Number}\n       */\n      sourceLine: 1,\n\n      /**\n       * Only when source map is used: last line in the buffer for which\n       * source map was generated\n       * @type {Number}\n       */\n      bufferLine: 1,\n\n      /**\n       * The top-level Program AST for the original file.\n       */\n      originalProgramAST: null,\n\n      sourceColumn: 0,\n      bufferColumn: 0\n    }\n  };\n}\n\n/**\n * Updates a copy of a given state with \"update\" and returns an updated state.\n *\n * @param  {object} state\n * @param  {object} update\n * @return {object}\n */\nfunction updateState(state, update) {\n  var ret = Object.create(state);\n  Object.keys(update).forEach(function(updatedKey) {\n    ret[updatedKey] = update[updatedKey];\n  });\n  return ret;\n}\n\n/**\n * Given a state fill the resulting buffer from the original source up to\n * the end\n *\n * @param {number} end\n * @param {object} state\n * @param {?function} contentTransformer Optional callback to transform newly\n *                                       added content.\n */\nfunction catchup(end, state, contentTransformer) {\n  if (end < state.g.position) {\n    // cannot move backwards\n    return;\n  }\n  var source = state.g.source.substring(state.g.position, end);\n  var transformed = updateIndent(source, state);\n  if (state.g.sourceMap && transformed) {\n    // record where we are\n    state.g.sourceMap.addMapping({\n      generated: { line: state.g.bufferLine, column: state.g.bufferColumn },\n      original: { line: state.g.sourceLine, column: state.g.sourceColumn },\n      source: state.g.sourceMapFilename\n    });\n\n    // record line breaks in transformed source\n    var sourceLines = source.split('\\n');\n    var transformedLines = transformed.split('\\n');\n    // Add line break mappings between last known mapping and the end of the\n    // added piece. So for the code piece\n    //  (foo, bar);\n    // > var x = 2;\n    // > var b = 3;\n    //   var c =\n    // only add lines marked with \">\": 2, 3.\n    for (var i = 1; i < sourceLines.length - 1; i++) {\n      state.g.sourceMap.addMapping({\n        generated: { line: state.g.bufferLine, column: 0 },\n        original: { line: state.g.sourceLine, column: 0 },\n        source: state.g.sourceMapFilename\n      });\n      state.g.sourceLine++;\n      state.g.bufferLine++;\n    }\n    // offset for the last piece\n    if (sourceLines.length > 1) {\n      state.g.sourceLine++;\n      state.g.bufferLine++;\n      state.g.sourceColumn = 0;\n      state.g.bufferColumn = 0;\n    }\n    state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;\n    state.g.bufferColumn +=\n      transformedLines[transformedLines.length - 1].length;\n  }\n  state.g.buffer +=\n    contentTransformer ? contentTransformer(transformed) : transformed;\n  state.g.position = end;\n}\n\n/**\n * Returns original source for an AST node.\n * @param {object} node\n * @param {object} state\n * @return {string}\n */\nfunction getNodeSourceText(node, state) {\n  return state.g.source.substring(node.range[0], node.range[1]);\n}\n\nfunction _replaceNonWhite(value) {\n  return value.replace(nonWhiteRegexp, ' ');\n}\n\n/**\n * Removes all non-whitespace characters\n */\nfunction _stripNonWhite(value) {\n  return value.replace(nonWhiteRegexp, '');\n}\n\n/**\n * Finds the position of the next instance of the specified syntactic char in\n * the pending source.\n *\n * NOTE: This will skip instances of the specified char if they sit inside a\n *       comment body.\n *\n * NOTE: This function also assumes that the buffer's current position is not\n *       already within a comment or a string. This is rarely the case since all\n *       of the buffer-advancement utility methods tend to be used on syntactic\n *       nodes' range values -- but it's a small gotcha that's worth mentioning.\n */\nfunction getNextSyntacticCharOffset(char, state) {\n  var pendingSource = state.g.source.substring(state.g.position);\n  var pendingSourceLines = pendingSource.split('\\n');\n\n  var charOffset = 0;\n  var line;\n  var withinBlockComment = false;\n  var withinString = false;\n  lineLoop: while ((line = pendingSourceLines.shift()) !== undefined) {\n    var lineEndPos = charOffset + line.length;\n    charLoop: for (; charOffset < lineEndPos; charOffset++) {\n      var currChar = pendingSource[charOffset];\n      if (currChar === '\"' || currChar === '\\'') {\n        withinString = !withinString;\n        continue charLoop;\n      } else if (withinString) {\n        continue charLoop;\n      } else if (charOffset + 1 < lineEndPos) {\n        var nextTwoChars = currChar + line[charOffset + 1];\n        if (nextTwoChars === '//') {\n          charOffset = lineEndPos + 1;\n          continue lineLoop;\n        } else if (nextTwoChars === '/*') {\n          withinBlockComment = true;\n          charOffset += 1;\n          continue charLoop;\n        } else if (nextTwoChars === '*/') {\n          withinBlockComment = false;\n          charOffset += 1;\n          continue charLoop;\n        }\n      }\n\n      if (!withinBlockComment && currChar === char) {\n        return charOffset + state.g.position;\n      }\n    }\n\n    // Account for '\\n'\n    charOffset++;\n    withinString = false;\n  }\n\n  throw new Error('`' + char + '` not found!');\n}\n\n/**\n * Catches up as `catchup` but replaces non-whitespace chars with spaces.\n */\nfunction catchupWhiteOut(end, state) {\n  catchup(end, state, _replaceNonWhite);\n}\n\n/**\n * Catches up as `catchup` but removes all non-whitespace characters.\n */\nfunction catchupWhiteSpace(end, state) {\n  catchup(end, state, _stripNonWhite);\n}\n\n/**\n * Removes all non-newline characters\n */\nvar reNonNewline = /[^\\n]/g;\nfunction stripNonNewline(value) {\n  return value.replace(reNonNewline, function() {\n    return '';\n  });\n}\n\n/**\n * Catches up as `catchup` but removes all non-newline characters.\n *\n * Equivalent to appending as many newlines as there are in the original source\n * between the current position and `end`.\n */\nfunction catchupNewlines(end, state) {\n  catchup(end, state, stripNonNewline);\n}\n\n\n/**\n * Same as catchup but does not touch the buffer\n *\n * @param  {number} end\n * @param  {object} state\n */\nfunction move(end, state) {\n  // move the internal cursors\n  if (state.g.sourceMap) {\n    if (end < state.g.position) {\n      state.g.position = 0;\n      state.g.sourceLine = 1;\n      state.g.sourceColumn = 0;\n    }\n\n    var source = state.g.source.substring(state.g.position, end);\n    var sourceLines = source.split('\\n');\n    if (sourceLines.length > 1) {\n      state.g.sourceLine += sourceLines.length - 1;\n      state.g.sourceColumn = 0;\n    }\n    state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;\n  }\n  state.g.position = end;\n}\n\n/**\n * Appends a string of text to the buffer\n *\n * @param {string} str\n * @param {object} state\n */\nfunction append(str, state) {\n  if (state.g.sourceMap && str) {\n    state.g.sourceMap.addMapping({\n      generated: { line: state.g.bufferLine, column: state.g.bufferColumn },\n      original: { line: state.g.sourceLine, column: state.g.sourceColumn },\n      source: state.g.sourceMapFilename\n    });\n    var transformedLines = str.split('\\n');\n    if (transformedLines.length > 1) {\n      state.g.bufferLine += transformedLines.length - 1;\n      state.g.bufferColumn = 0;\n    }\n    state.g.bufferColumn +=\n      transformedLines[transformedLines.length - 1].length;\n  }\n  state.g.buffer += str;\n}\n\n/**\n * Update indent using state.indentBy property. Indent is measured in\n * double spaces. Updates a single line only.\n *\n * @param {string} str\n * @param {object} state\n * @return {string}\n */\nfunction updateIndent(str, state) {\n  /*jshint -W004*/\n  var indentBy = state.indentBy;\n  if (indentBy < 0) {\n    for (var i = 0; i < -indentBy; i++) {\n      str = str.replace(leadingIndentRegexp, '$1');\n    }\n  } else {\n    for (var i = 0; i < indentBy; i++) {\n      str = str.replace(leadingIndentRegexp, '$1$2$2');\n    }\n  }\n  return str;\n}\n\n/**\n * Calculates indent from the beginning of the line until \"start\" or the first\n * character before start.\n * @example\n *   \"  foo.bar()\"\n *         ^\n *       start\n *   indent will be \"  \"\n *\n * @param  {number} start\n * @param  {object} state\n * @return {string}\n */\nfunction indentBefore(start, state) {\n  var end = start;\n  start = start - 1;\n\n  while (start > 0 && state.g.source[start] != '\\n') {\n    if (!state.g.source[start].match(/[ \\t]/)) {\n      end = start;\n    }\n    start--;\n  }\n  return state.g.source.substring(start + 1, end);\n}\n\nfunction getDocblock(state) {\n  if (!state.g.docblock) {\n    var docblock = _dereq_('./docblock');\n    state.g.docblock =\n      docblock.parseAsObject(docblock.extract(state.g.source));\n  }\n  return state.g.docblock;\n}\n\nfunction identWithinLexicalScope(identName, state, stopBeforeNode) {\n  var currScope = state.localScope;\n  while (currScope) {\n    if (currScope.identifiers[identName] !== undefined) {\n      return true;\n    }\n\n    if (stopBeforeNode && currScope.parentNode === stopBeforeNode) {\n      break;\n    }\n\n    currScope = currScope.parentScope;\n  }\n  return false;\n}\n\nfunction identInLocalScope(identName, state) {\n  return state.localScope.identifiers[identName] !== undefined;\n}\n\n/**\n * @param {object} boundaryNode\n * @param {?array} path\n * @return {?object} node\n */\nfunction initScopeMetadata(boundaryNode, path, node) {\n  return {\n    boundaryNode: boundaryNode,\n    bindingPath: path,\n    bindingNode: node\n  };\n}\n\nfunction declareIdentInLocalScope(identName, metaData, state) {\n  state.localScope.identifiers[identName] = {\n    boundaryNode: metaData.boundaryNode,\n    path: metaData.bindingPath,\n    node: metaData.bindingNode,\n    state: Object.create(state)\n  };\n}\n\nfunction getLexicalBindingMetadata(identName, state) {\n  var currScope = state.localScope;\n  while (currScope) {\n    if (currScope.identifiers[identName] !== undefined) {\n      return currScope.identifiers[identName];\n    }\n\n    currScope = currScope.parentScope;\n  }\n}\n\nfunction getLocalBindingMetadata(identName, state) {\n  return state.localScope.identifiers[identName];\n}\n\n/**\n * Apply the given analyzer function to the current node. If the analyzer\n * doesn't return false, traverse each child of the current node using the given\n * traverser function.\n *\n * @param {function} analyzer\n * @param {function} traverser\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction analyzeAndTraverse(analyzer, traverser, node, path, state) {\n  if (node.type) {\n    if (analyzer(node, path, state) === false) {\n      return;\n    }\n    path.unshift(node);\n  }\n\n  getOrderedChildren(node).forEach(function(child) {\n    traverser(child, path, state);\n  });\n\n  node.type && path.shift();\n}\n\n/**\n * It is crucial that we traverse in order, or else catchup() on a later\n * node that is processed out of order can move the buffer past a node\n * that we haven't handled yet, preventing us from modifying that node.\n *\n * This can happen when a node has multiple properties containing children.\n * For example, XJSElement nodes have `openingElement`, `closingElement` and\n * `children`. If we traverse `openingElement`, then `closingElement`, then\n * when we get to `children`, the buffer has already caught up to the end of\n * the closing element, after the children.\n *\n * This is basically a Schwartzian transform. Collects an array of children,\n * each one represented as [child, startIndex]; sorts the array by start\n * index; then traverses the children in that order.\n */\nfunction getOrderedChildren(node) {\n  var queue = [];\n  for (var key in node) {\n    if (node.hasOwnProperty(key)) {\n      enqueueNodeWithStartIndex(queue, node[key]);\n    }\n  }\n  queue.sort(function(a, b) { return a[1] - b[1]; });\n  return queue.map(function(pair) { return pair[0]; });\n}\n\n/**\n * Helper function for analyzeAndTraverse which queues up all of the children\n * of the given node.\n *\n * Children can also be found in arrays, so we basically want to merge all of\n * those arrays together so we can sort them and then traverse the children\n * in order.\n *\n * One example is the Program node. It contains `body` and `comments`, both\n * arrays. Lexographically, comments are interspersed throughout the body\n * nodes, but esprima's AST groups them together.\n */\nfunction enqueueNodeWithStartIndex(queue, node) {\n  if (typeof node !== 'object' || node === null) {\n    return;\n  }\n  if (node.range) {\n    queue.push([node, node.range[0]]);\n  } else if (Array.isArray(node)) {\n    for (var ii = 0; ii < node.length; ii++) {\n      enqueueNodeWithStartIndex(queue, node[ii]);\n    }\n  }\n}\n\n/**\n * Checks whether a node or any of its sub-nodes contains\n * a syntactic construct of the passed type.\n * @param {object} node - AST node to test.\n * @param {string} type - node type to lookup.\n */\nfunction containsChildOfType(node, type) {\n  return containsChildMatching(node, function(node) {\n    return node.type === type;\n  });\n}\n\nfunction containsChildMatching(node, matcher) {\n  var foundMatchingChild = false;\n  function nodeTypeAnalyzer(node) {\n    if (matcher(node) === true) {\n      foundMatchingChild = true;\n      return false;\n    }\n  }\n  function nodeTypeTraverser(child, path, state) {\n    if (!foundMatchingChild) {\n      foundMatchingChild = containsChildMatching(child, matcher);\n    }\n  }\n  analyzeAndTraverse(\n    nodeTypeAnalyzer,\n    nodeTypeTraverser,\n    node,\n    []\n  );\n  return foundMatchingChild;\n}\n\nvar scopeTypes = {};\nscopeTypes[Syntax.ArrowFunctionExpression] = true;\nscopeTypes[Syntax.FunctionExpression] = true;\nscopeTypes[Syntax.FunctionDeclaration] = true;\nscopeTypes[Syntax.Program] = true;\n\nfunction getBoundaryNode(path) {\n  for (var ii = 0; ii < path.length; ++ii) {\n    if (scopeTypes[path[ii].type]) {\n      return path[ii];\n    }\n  }\n  throw new Error(\n    'Expected to find a node with one of the following types in path:\\n' +\n    JSON.stringify(Object.keys(scopeTypes))\n  );\n}\n\nfunction getTempVar(tempVarIndex) {\n  return '$__' + tempVarIndex;\n}\n\nfunction injectTempVar(state) {\n  var tempVar = '$__' + (state.localScope.tempVarIndex++);\n  state.localScope.tempVars.push(tempVar);\n  return tempVar;\n}\n\nfunction injectTempVarDeclarations(state, index) {\n  if (state.localScope.tempVars.length) {\n    state.g.buffer =\n      state.g.buffer.slice(0, index) +\n      'var ' + state.localScope.tempVars.join(', ') + ';' +\n      state.g.buffer.slice(index);\n    state.localScope.tempVars = [];\n  }\n}\n\nexports.analyzeAndTraverse = analyzeAndTraverse;\nexports.append = append;\nexports.catchup = catchup;\nexports.catchupNewlines = catchupNewlines;\nexports.catchupWhiteOut = catchupWhiteOut;\nexports.catchupWhiteSpace = catchupWhiteSpace;\nexports.containsChildMatching = containsChildMatching;\nexports.containsChildOfType = containsChildOfType;\nexports.createState = createState;\nexports.declareIdentInLocalScope = declareIdentInLocalScope;\nexports.getBoundaryNode = getBoundaryNode;\nexports.getDocblock = getDocblock;\nexports.getLexicalBindingMetadata = getLexicalBindingMetadata;\nexports.getLocalBindingMetadata = getLocalBindingMetadata;\nexports.getNextSyntacticCharOffset = getNextSyntacticCharOffset;\nexports.getNodeSourceText = getNodeSourceText;\nexports.getOrderedChildren = getOrderedChildren;\nexports.getTempVar = getTempVar;\nexports.identInLocalScope = identInLocalScope;\nexports.identWithinLexicalScope = identWithinLexicalScope;\nexports.indentBefore = indentBefore;\nexports.initScopeMetadata = initScopeMetadata;\nexports.injectTempVar = injectTempVar;\nexports.injectTempVarDeclarations = injectTempVarDeclarations;\nexports.move = move;\nexports.scopeTypes = scopeTypes;\nexports.updateIndent = updateIndent;\nexports.updateState = updateState;\n\n},{\"./docblock\":21,\"esprima-fb\":9}],24:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*global exports:true*/\n\n/**\n * Desugars ES6 Arrow functions to ES3 function expressions.\n * If the function contains `this` expression -- automatically\n * binds the function to current value of `this`.\n *\n * Single parameter, simple expression:\n *\n * [1, 2, 3].map(x => x * x);\n *\n * [1, 2, 3].map(function(x) { return x * x; });\n *\n * Several parameters, complex block:\n *\n * this.users.forEach((user, idx) => {\n *   return this.isActive(idx) && this.send(user);\n * });\n *\n * this.users.forEach(function(user, idx) {\n *   return this.isActive(idx) && this.send(user);\n * }.bind(this));\n *\n */\nvar restParamVisitors = _dereq_('./es6-rest-param-visitors');\nvar destructuringVisitors = _dereq_('./es6-destructuring-visitors');\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\n/**\n * @public\n */\nfunction visitArrowFunction(traverse, node, path, state) {\n  var notInExpression = (path[0].type === Syntax.ExpressionStatement);\n\n  // Wrap a function into a grouping operator, if it's not\n  // in the expression position.\n  if (notInExpression) {\n    utils.append('(', state);\n  }\n\n  utils.append('function', state);\n  renderParams(traverse, node, path, state);\n\n  // Skip arrow.\n  utils.catchupWhiteSpace(node.body.range[0], state);\n\n  var renderBody = node.body.type == Syntax.BlockStatement\n    ? renderStatementBody\n    : renderExpressionBody;\n\n  path.unshift(node);\n  renderBody(traverse, node, path, state);\n  path.shift();\n\n  // Bind the function only if `this` value is used\n  // inside it or inside any sub-expression.\n  var containsBindingSyntax =\n    utils.containsChildMatching(node.body, function(node) {\n      return node.type === Syntax.ThisExpression\n             || (node.type === Syntax.Identifier\n                 && node.name === \"super\");\n    });\n\n  if (containsBindingSyntax) {\n    utils.append('.bind(this)', state);\n  }\n\n  utils.catchupWhiteSpace(node.range[1], state);\n\n  // Close wrapper if not in the expression.\n  if (notInExpression) {\n    utils.append(')', state);\n  }\n\n  return false;\n}\n\nfunction renderParams(traverse, node, path, state) {\n  // To preserve inline typechecking directives, we\n  // distinguish between parens-free and paranthesized single param.\n  if (isParensFreeSingleParam(node, state) || !node.params.length) {\n    utils.append('(', state);\n  }\n  if (node.params.length !== 0) {\n    path.unshift(node);\n    traverse(node.params, path, state);\n    path.unshift();\n  }\n  utils.append(')', state);\n}\n\nfunction isParensFreeSingleParam(node, state) {\n  return node.params.length === 1 &&\n    state.g.source[state.g.position] !== '(';\n}\n\nfunction renderExpressionBody(traverse, node, path, state) {\n  // Wrap simple expression bodies into a block\n  // with explicit return statement.\n  utils.append('{', state);\n\n  // Special handling of rest param.\n  if (node.rest) {\n    utils.append(\n      restParamVisitors.renderRestParamSetup(node, state),\n      state\n    );\n  }\n\n  // Special handling of destructured params.\n  destructuringVisitors.renderDestructuredComponents(\n    node,\n    utils.updateState(state, {\n      localScope: {\n        parentNode: state.parentNode,\n        parentScope: state.parentScope,\n        identifiers: state.identifiers,\n        tempVarIndex: 0\n      }\n    })\n  );\n\n  utils.append('return ', state);\n  renderStatementBody(traverse, node, path, state);\n  utils.append(';}', state);\n}\n\nfunction renderStatementBody(traverse, node, path, state) {\n  traverse(node.body, path, state);\n  utils.catchup(node.body.range[1], state);\n}\n\nvisitArrowFunction.test = function(node, path, state) {\n  return node.type === Syntax.ArrowFunctionExpression;\n};\n\nexports.visitorList = [\n  visitArrowFunction\n];\n\n\n},{\"../src/utils\":23,\"./es6-destructuring-visitors\":27,\"./es6-rest-param-visitors\":30,\"esprima-fb\":9}],25:[function(_dereq_,module,exports){\n/**\n * Copyright 2004-present Facebook. All Rights Reserved.\n */\n/*global exports:true*/\n\n/**\n * Implements ES6 call spread.\n *\n * instance.method(a, b, c, ...d)\n *\n * instance.method.apply(instance, [a, b, c].concat(d))\n *\n */\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\nfunction process(traverse, node, path, state) {\n  utils.move(node.range[0], state);\n  traverse(node, path, state);\n  utils.catchup(node.range[1], state);\n}\n\nfunction visitCallSpread(traverse, node, path, state) {\n  utils.catchup(node.range[0], state);\n\n  if (node.type === Syntax.NewExpression) {\n    // Input  = new Set(1, 2, ...list)\n    // Output = new (Function.prototype.bind.apply(Set, [null, 1, 2].concat(list)))\n    utils.append('new (Function.prototype.bind.apply(', state);\n    process(traverse, node.callee, path, state);\n  } else if (node.callee.type === Syntax.MemberExpression) {\n    // Input  = get().fn(1, 2, ...more)\n    // Output = (_ = get()).fn.apply(_, [1, 2].apply(more))\n    var tempVar = utils.injectTempVar(state);\n    utils.append('(' + tempVar + ' = ', state);\n    process(traverse, node.callee.object, path, state);\n    utils.append(')', state);\n    if (node.callee.property.type === Syntax.Identifier) {\n      utils.append('.', state);\n      process(traverse, node.callee.property, path, state);\n    } else {\n      utils.append('[', state);\n      process(traverse, node.callee.property, path, state);\n      utils.append(']', state);\n    }\n    utils.append('.apply(' + tempVar, state);\n  } else {\n    // Input  = max(1, 2, ...list)\n    // Output = max.apply(null, [1, 2].concat(list))\n    var needsToBeWrappedInParenthesis =\n      node.callee.type === Syntax.FunctionDeclaration ||\n      node.callee.type === Syntax.FunctionExpression;\n    if (needsToBeWrappedInParenthesis) {\n      utils.append('(', state);\n    }\n    process(traverse, node.callee, path, state);\n    if (needsToBeWrappedInParenthesis) {\n      utils.append(')', state);\n    }\n    utils.append('.apply(null', state);\n  }\n  utils.append(', ', state);\n\n  var args = node.arguments.slice();\n  var spread = args.pop();\n  if (args.length || node.type === Syntax.NewExpression) {\n    utils.append('[', state);\n    if (node.type === Syntax.NewExpression) {\n      utils.append('null' + (args.length ? ', ' : ''), state);\n    }\n    while (args.length) {\n      var arg = args.shift();\n      utils.move(arg.range[0], state);\n      traverse(arg, path, state);\n      if (args.length) {\n        utils.catchup(args[0].range[0], state);\n      } else {\n        utils.catchup(arg.range[1], state);\n      }\n    }\n    utils.append('].concat(', state);\n    process(traverse, spread.argument, path, state);\n    utils.append(')', state);\n  } else {\n    process(traverse, spread.argument, path, state);\n  }\n  utils.append(node.type === Syntax.NewExpression ? '))' : ')', state);\n\n  utils.move(node.range[1], state);\n  return false;\n}\n\nvisitCallSpread.test = function(node, path, state) {\n  return (\n    (\n      node.type === Syntax.CallExpression ||\n      node.type === Syntax.NewExpression\n    ) &&\n    node.arguments.length > 0 &&\n    node.arguments[node.arguments.length - 1].type === Syntax.SpreadElement\n  );\n};\n\nexports.visitorList = [\n  visitCallSpread\n];\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],26:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node:true*/\n\n/**\n * @typechecks\n */\n'use strict';\n\nvar base62 = _dereq_('base62');\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\nvar reservedWordsHelper = _dereq_('./reserved-words-helper');\n\nvar declareIdentInLocalScope = utils.declareIdentInLocalScope;\nvar initScopeMetadata = utils.initScopeMetadata;\n\nvar SUPER_PROTO_IDENT_PREFIX = '____SuperProtoOf';\n\nvar _anonClassUUIDCounter = 0;\nvar _mungedSymbolMaps = {};\n\nfunction resetSymbols() {\n  _anonClassUUIDCounter = 0;\n  _mungedSymbolMaps = {};\n}\n\n/**\n * Used to generate a unique class for use with code-gens for anonymous class\n * expressions.\n *\n * @param {object} state\n * @return {string}\n */\nfunction _generateAnonymousClassName(state) {\n  var mungeNamespace = state.mungeNamespace || '';\n  return '____Class' + mungeNamespace + base62.encode(_anonClassUUIDCounter++);\n}\n\n/**\n * Given an identifier name, munge it using the current state's mungeNamespace.\n *\n * @param {string} identName\n * @param {object} state\n * @return {string}\n */\nfunction _getMungedName(identName, state) {\n  var mungeNamespace = state.mungeNamespace;\n  var shouldMinify = state.g.opts.minify;\n\n  if (shouldMinify) {\n    if (!_mungedSymbolMaps[mungeNamespace]) {\n      _mungedSymbolMaps[mungeNamespace] = {\n        symbolMap: {},\n        identUUIDCounter: 0\n      };\n    }\n\n    var symbolMap = _mungedSymbolMaps[mungeNamespace].symbolMap;\n    if (!symbolMap[identName]) {\n      symbolMap[identName] =\n        base62.encode(_mungedSymbolMaps[mungeNamespace].identUUIDCounter++);\n    }\n    identName = symbolMap[identName];\n  }\n  return '$' + mungeNamespace + identName;\n}\n\n/**\n * Extracts super class information from a class node.\n *\n * Information includes name of the super class and/or the expression string\n * (if extending from an expression)\n *\n * @param {object} node\n * @param {object} state\n * @return {object}\n */\nfunction _getSuperClassInfo(node, state) {\n  var ret = {\n    name: null,\n    expression: null\n  };\n  if (node.superClass) {\n    if (node.superClass.type === Syntax.Identifier) {\n      ret.name = node.superClass.name;\n    } else {\n      // Extension from an expression\n      ret.name = _generateAnonymousClassName(state);\n      ret.expression = state.g.source.substring(\n        node.superClass.range[0],\n        node.superClass.range[1]\n      );\n    }\n  }\n  return ret;\n}\n\n/**\n * Used with .filter() to find the constructor method in a list of\n * MethodDefinition nodes.\n *\n * @param {object} classElement\n * @return {boolean}\n */\nfunction _isConstructorMethod(classElement) {\n  return classElement.type === Syntax.MethodDefinition &&\n         classElement.key.type === Syntax.Identifier &&\n         classElement.key.name === 'constructor';\n}\n\n/**\n * @param {object} node\n * @param {object} state\n * @return {boolean}\n */\nfunction _shouldMungeIdentifier(node, state) {\n  return (\n    !!state.methodFuncNode &&\n    !utils.getDocblock(state).hasOwnProperty('preventMunge') &&\n    /^_(?!_)/.test(node.name)\n  );\n}\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitClassMethod(traverse, node, path, state) {\n  if (!state.g.opts.es5 && (node.kind === 'get' || node.kind === 'set')) {\n    throw new Error(\n      'This transform does not support ' + node.kind + 'ter methods for ES6 ' +\n      'classes. (line: ' + node.loc.start.line + ', col: ' +\n      node.loc.start.column + ')'\n    );\n  }\n  state = utils.updateState(state, {\n    methodNode: node\n  });\n  utils.catchup(node.range[0], state);\n  path.unshift(node);\n  traverse(node.value, path, state);\n  path.shift();\n  return false;\n}\nvisitClassMethod.test = function(node, path, state) {\n  return node.type === Syntax.MethodDefinition;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitClassFunctionExpression(traverse, node, path, state) {\n  var methodNode = path[0];\n  var isGetter = methodNode.kind === 'get';\n  var isSetter = methodNode.kind === 'set';\n\n  state = utils.updateState(state, {\n    methodFuncNode: node\n  });\n\n  if (methodNode.key.name === 'constructor') {\n    utils.append('function ' + state.className, state);\n  } else {\n    var methodAccessorComputed = false;\n    var methodAccessor;\n    var prototypeOrStatic = methodNode[\"static\"] ? '' : '.prototype';\n    var objectAccessor = state.className + prototypeOrStatic;\n\n    if (methodNode.key.type === Syntax.Identifier) {\n      // foo() {}\n      methodAccessor = methodNode.key.name;\n      if (_shouldMungeIdentifier(methodNode.key, state)) {\n        methodAccessor = _getMungedName(methodAccessor, state);\n      }\n      if (isGetter || isSetter) {\n        methodAccessor = JSON.stringify(methodAccessor);\n      } else if (reservedWordsHelper.isReservedWord(methodAccessor)) {\n        methodAccessorComputed = true;\n        methodAccessor = JSON.stringify(methodAccessor);\n      }\n    } else if (methodNode.key.type === Syntax.Literal) {\n      // 'foo bar'() {}  | get 'foo bar'() {} | set 'foo bar'() {}\n      methodAccessor = JSON.stringify(methodNode.key.value);\n      methodAccessorComputed = true;\n    }\n\n    if (isSetter || isGetter) {\n      utils.append(\n        'Object.defineProperty(' +\n          objectAccessor + ',' +\n          methodAccessor + ',' +\n          '{configurable:true,' +\n          methodNode.kind + ':function',\n        state\n      );\n    } else {\n      if (state.g.opts.es3) {\n        if (methodAccessorComputed) {\n          methodAccessor = '[' + methodAccessor + ']';\n        } else {\n          methodAccessor = '.' + methodAccessor;\n        }\n        utils.append(\n          objectAccessor +\n          methodAccessor + '=function' + (node.generator ? '*' : ''),\n          state\n        );\n      } else {\n        if (!methodAccessorComputed) {\n          methodAccessor = JSON.stringify(methodAccessor);\n        }\n        utils.append(\n          'Object.defineProperty(' +\n            objectAccessor + ',' +\n            methodAccessor + ',' +\n            '{writable:true,configurable:true,' +\n            'value:function' + (node.generator ? '*' : ''),\n          state\n        );\n      }\n    }\n  }\n  utils.move(methodNode.key.range[1], state);\n  utils.append('(', state);\n\n  var params = node.params;\n  if (params.length > 0) {\n    utils.catchupNewlines(params[0].range[0], state);\n    for (var i = 0; i < params.length; i++) {\n      utils.catchup(node.params[i].range[0], state);\n      path.unshift(node);\n      traverse(params[i], path, state);\n      path.shift();\n    }\n  }\n\n  var closingParenPosition = utils.getNextSyntacticCharOffset(')', state);\n  utils.catchupWhiteSpace(closingParenPosition, state);\n\n  var openingBracketPosition = utils.getNextSyntacticCharOffset('{', state);\n  utils.catchup(openingBracketPosition + 1, state);\n\n  if (!state.scopeIsStrict) {\n    utils.append('\"use strict\";', state);\n    state = utils.updateState(state, {\n      scopeIsStrict: true\n    });\n  }\n  utils.move(node.body.range[0] + '{'.length, state);\n\n  path.unshift(node);\n  traverse(node.body, path, state);\n  path.shift();\n  utils.catchup(node.body.range[1], state);\n\n  if (methodNode.key.name !== 'constructor') {\n    if (isGetter || isSetter || !state.g.opts.es3) {\n      utils.append('})', state);\n    }\n    utils.append(';', state);\n  }\n  return false;\n}\nvisitClassFunctionExpression.test = function(node, path, state) {\n  return node.type === Syntax.FunctionExpression\n         && path[0].type === Syntax.MethodDefinition;\n};\n\nfunction visitClassMethodParam(traverse, node, path, state) {\n  var paramName = node.name;\n  if (_shouldMungeIdentifier(node, state)) {\n    paramName = _getMungedName(node.name, state);\n  }\n  utils.append(paramName, state);\n  utils.move(node.range[1], state);\n}\nvisitClassMethodParam.test = function(node, path, state) {\n  if (!path[0] || !path[1]) {\n    return;\n  }\n\n  var parentFuncExpr = path[0];\n  var parentClassMethod = path[1];\n\n  return parentFuncExpr.type === Syntax.FunctionExpression\n         && parentClassMethod.type === Syntax.MethodDefinition\n         && node.type === Syntax.Identifier;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction _renderClassBody(traverse, node, path, state) {\n  var className = state.className;\n  var superClass = state.superClass;\n\n  // Set up prototype of constructor on same line as `extends` for line-number\n  // preservation. This relies on function-hoisting if a constructor function is\n  // defined in the class body.\n  if (superClass.name) {\n    // If the super class is an expression, we need to memoize the output of the\n    // expression into the generated class name variable and use that to refer\n    // to the super class going forward. Example:\n    //\n    //   class Foo extends mixin(Bar, Baz) {}\n    //     --transforms to--\n    //   function Foo() {} var ____Class0Blah = mixin(Bar, Baz);\n    if (superClass.expression !== null) {\n      utils.append(\n        'var ' + superClass.name + '=' + superClass.expression + ';',\n        state\n      );\n    }\n\n    var keyName = superClass.name + '____Key';\n    var keyNameDeclarator = '';\n    if (!utils.identWithinLexicalScope(keyName, state)) {\n      keyNameDeclarator = 'var ';\n      declareIdentInLocalScope(keyName, initScopeMetadata(node), state);\n    }\n    utils.append(\n      'for(' + keyNameDeclarator + keyName + ' in ' + superClass.name + '){' +\n        'if(' + superClass.name + '.hasOwnProperty(' + keyName + ')){' +\n          className + '[' + keyName + ']=' +\n            superClass.name + '[' + keyName + '];' +\n        '}' +\n      '}',\n      state\n    );\n\n    var superProtoIdentStr = SUPER_PROTO_IDENT_PREFIX + superClass.name;\n    if (!utils.identWithinLexicalScope(superProtoIdentStr, state)) {\n      utils.append(\n        'var ' + superProtoIdentStr + '=' + superClass.name + '===null?' +\n        'null:' + superClass.name + '.prototype;',\n        state\n      );\n      declareIdentInLocalScope(superProtoIdentStr, initScopeMetadata(node), state);\n    }\n\n    utils.append(\n      className + '.prototype=Object.create(' + superProtoIdentStr + ');',\n      state\n    );\n    utils.append(\n      className + '.prototype.constructor=' + className + ';',\n      state\n    );\n    utils.append(\n      className + '.__superConstructor__=' + superClass.name + ';',\n      state\n    );\n  }\n\n  // If there's no constructor method specified in the class body, create an\n  // empty constructor function at the top (same line as the class keyword)\n  if (!node.body.body.filter(_isConstructorMethod).pop()) {\n    utils.append('function ' + className + '(){', state);\n    if (!state.scopeIsStrict) {\n      utils.append('\"use strict\";', state);\n    }\n    if (superClass.name) {\n      utils.append(\n        'if(' + superClass.name + '!==null){' +\n        superClass.name + '.apply(this,arguments);}',\n        state\n      );\n    }\n    utils.append('}', state);\n  }\n\n  utils.move(node.body.range[0] + '{'.length, state);\n  traverse(node.body, path, state);\n  utils.catchupWhiteSpace(node.range[1], state);\n}\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitClassDeclaration(traverse, node, path, state) {\n  var className = node.id.name;\n  var superClass = _getSuperClassInfo(node, state);\n\n  state = utils.updateState(state, {\n    mungeNamespace: className,\n    className: className,\n    superClass: superClass\n  });\n\n  _renderClassBody(traverse, node, path, state);\n\n  return false;\n}\nvisitClassDeclaration.test = function(node, path, state) {\n  return node.type === Syntax.ClassDeclaration;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitClassExpression(traverse, node, path, state) {\n  var className = node.id && node.id.name || _generateAnonymousClassName(state);\n  var superClass = _getSuperClassInfo(node, state);\n\n  utils.append('(function(){', state);\n\n  state = utils.updateState(state, {\n    mungeNamespace: className,\n    className: className,\n    superClass: superClass\n  });\n\n  _renderClassBody(traverse, node, path, state);\n\n  utils.append('return ' + className + ';})()', state);\n  return false;\n}\nvisitClassExpression.test = function(node, path, state) {\n  return node.type === Syntax.ClassExpression;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitPrivateIdentifier(traverse, node, path, state) {\n  utils.append(_getMungedName(node.name, state), state);\n  utils.move(node.range[1], state);\n}\nvisitPrivateIdentifier.test = function(node, path, state) {\n  if (node.type === Syntax.Identifier && _shouldMungeIdentifier(node, state)) {\n    // Always munge non-computed properties of MemberExpressions\n    // (a la preventing access of properties of unowned objects)\n    if (path[0].type === Syntax.MemberExpression && path[0].object !== node\n        && path[0].computed === false) {\n      return true;\n    }\n\n    // Always munge identifiers that were declared within the method function\n    // scope\n    if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) {\n      return true;\n    }\n\n    // Always munge private keys on object literals defined within a method's\n    // scope.\n    if (path[0].type === Syntax.Property\n        && path[1].type === Syntax.ObjectExpression) {\n      return true;\n    }\n\n    // Always munge function parameters\n    if (path[0].type === Syntax.FunctionExpression\n        || path[0].type === Syntax.FunctionDeclaration\n        || path[0].type === Syntax.ArrowFunctionExpression) {\n      for (var i = 0; i < path[0].params.length; i++) {\n        if (path[0].params[i] === node) {\n          return true;\n        }\n      }\n    }\n  }\n  return false;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitSuperCallExpression(traverse, node, path, state) {\n  var superClassName = state.superClass.name;\n\n  if (node.callee.type === Syntax.Identifier) {\n    if (_isConstructorMethod(state.methodNode)) {\n      utils.append(superClassName + '.call(', state);\n    } else {\n      var protoProp = SUPER_PROTO_IDENT_PREFIX + superClassName;\n      if (state.methodNode.key.type === Syntax.Identifier) {\n        protoProp += '.' + state.methodNode.key.name;\n      } else if (state.methodNode.key.type === Syntax.Literal) {\n        protoProp += '[' + JSON.stringify(state.methodNode.key.value) + ']';\n      }\n      utils.append(protoProp + \".call(\", state);\n    }\n    utils.move(node.callee.range[1], state);\n  } else if (node.callee.type === Syntax.MemberExpression) {\n    utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);\n    utils.move(node.callee.object.range[1], state);\n\n    if (node.callee.computed) {\n      // [\"a\" + \"b\"]\n      utils.catchup(node.callee.property.range[1] + ']'.length, state);\n    } else {\n      // .ab\n      utils.append('.' + node.callee.property.name, state);\n    }\n\n    utils.append('.call(', state);\n    utils.move(node.callee.range[1], state);\n  }\n\n  utils.append('this', state);\n  if (node.arguments.length > 0) {\n    utils.append(',', state);\n    utils.catchupWhiteSpace(node.arguments[0].range[0], state);\n    traverse(node.arguments, path, state);\n  }\n\n  utils.catchupWhiteSpace(node.range[1], state);\n  utils.append(')', state);\n  return false;\n}\nvisitSuperCallExpression.test = function(node, path, state) {\n  if (state.superClass && node.type === Syntax.CallExpression) {\n    var callee = node.callee;\n    if (callee.type === Syntax.Identifier && callee.name === 'super'\n        || callee.type == Syntax.MemberExpression\n           && callee.object.name === 'super') {\n      return true;\n    }\n  }\n  return false;\n};\n\n/**\n * @param {function} traverse\n * @param {object} node\n * @param {array} path\n * @param {object} state\n */\nfunction visitSuperMemberExpression(traverse, node, path, state) {\n  var superClassName = state.superClass.name;\n\n  utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);\n  utils.move(node.object.range[1], state);\n}\nvisitSuperMemberExpression.test = function(node, path, state) {\n  return state.superClass\n         && node.type === Syntax.MemberExpression\n         && node.object.type === Syntax.Identifier\n         && node.object.name === 'super';\n};\n\nexports.resetSymbols = resetSymbols;\n\nexports.visitorList = [\n  visitClassDeclaration,\n  visitClassExpression,\n  visitClassFunctionExpression,\n  visitClassMethod,\n  visitClassMethodParam,\n  visitPrivateIdentifier,\n  visitSuperCallExpression,\n  visitSuperMemberExpression\n];\n\n},{\"../src/utils\":23,\"./reserved-words-helper\":34,\"base62\":10,\"esprima-fb\":9}],27:[function(_dereq_,module,exports){\n/**\n * Copyright 2014 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/*global exports:true*/\n\n/**\n * Implements ES6 destructuring assignment and pattern matchng.\n *\n * function init({port, ip, coords: [x, y]}) {\n *   return (x && y) ? {id, port} : {ip};\n * };\n *\n * function init($__0) {\n *   var\n *    port = $__0.port,\n *    ip = $__0.ip,\n *    $__1 = $__0.coords,\n *    x = $__1[0],\n *    y = $__1[1];\n *   return (x && y) ? {id, port} : {ip};\n * }\n *\n * var x, {ip, port} = init({ip, port});\n *\n * var x, $__0 = init({ip, port}), ip = $__0.ip, port = $__0.port;\n *\n */\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\nvar reservedWordsHelper = _dereq_('./reserved-words-helper');\nvar restParamVisitors = _dereq_('./es6-rest-param-visitors');\nvar restPropertyHelpers = _dereq_('./es7-rest-property-helpers');\n\n// -------------------------------------------------------\n// 1. Structured variable declarations.\n//\n// var [a, b] = [b, a];\n// var {x, y} = {y, x};\n// -------------------------------------------------------\n\nfunction visitStructuredVariable(traverse, node, path, state) {\n  // Allocate new temp for the pattern.\n  utils.append(utils.getTempVar(state.localScope.tempVarIndex) + '=', state);\n  // Skip the pattern and assign the init to the temp.\n  utils.catchupWhiteSpace(node.init.range[0], state);\n  traverse(node.init, path, state);\n  utils.catchup(node.init.range[1], state);\n  // Render the destructured data.\n  utils.append(',' + getDestructuredComponents(node.id, state), state);\n  state.localScope.tempVarIndex++;\n  return false;\n}\n\nvisitStructuredVariable.test = function(node, path, state) {\n  return node.type === Syntax.VariableDeclarator &&\n    isStructuredPattern(node.id);\n};\n\nfunction isStructuredPattern(node) {\n  return node.type === Syntax.ObjectPattern ||\n    node.type === Syntax.ArrayPattern;\n}\n\n// Main function which does actual recursive destructuring\n// of nested complex structures.\nfunction getDestructuredComponents(node, state) {\n  var tmpIndex = state.localScope.tempVarIndex;\n  var components = [];\n  var patternItems = getPatternItems(node);\n\n  for (var idx = 0; idx < patternItems.length; idx++) {\n    var item = patternItems[idx];\n    if (!item) {\n      continue;\n    }\n\n    if (item.type === Syntax.SpreadElement) {\n      // Spread/rest of an array.\n      // TODO(dmitrys): support spread in the middle of a pattern\n      // and also for function param patterns: [x, ...xs, y]\n      components.push(item.argument.name +\n        '=Array.prototype.slice.call(' +\n        utils.getTempVar(tmpIndex) + ',' + idx + ')'\n      );\n      continue;\n    }\n\n    if (item.type === Syntax.SpreadProperty) {\n      var restExpression = restPropertyHelpers.renderRestExpression(\n        utils.getTempVar(tmpIndex),\n        patternItems\n      );\n      components.push(item.argument.name + '=' + restExpression);\n      continue;\n    }\n\n    // Depending on pattern type (Array or Object), we get\n    // corresponding pattern item parts.\n    var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);\n    var value = getPatternItemValue(node, item);\n\n    // TODO(dmitrys): implement default values: {x, y=5}\n    if (value.type === Syntax.Identifier) {\n      // Simple pattern item.\n      components.push(value.name + '=' + accessor);\n    } else {\n      // Complex sub-structure.\n      components.push(\n        utils.getTempVar(++state.localScope.tempVarIndex) + '=' + accessor +\n        ',' + getDestructuredComponents(value, state)\n      );\n    }\n  }\n\n  return components.join(',');\n}\n\nfunction getPatternItems(node) {\n  return node.properties || node.elements;\n}\n\nfunction getPatternItemAccessor(node, patternItem, tmpIndex, idx) {\n  var tmpName = utils.getTempVar(tmpIndex);\n  if (node.type === Syntax.ObjectPattern) {\n    if (reservedWordsHelper.isReservedWord(patternItem.key.name)) {\n      return tmpName + '[\"' + patternItem.key.name + '\"]';\n    } else if (patternItem.key.type === Syntax.Literal) {\n      return tmpName + '[' + JSON.stringify(patternItem.key.value) + ']';\n    } else if (patternItem.key.type === Syntax.Identifier) {\n      return tmpName + '.' + patternItem.key.name;\n    }\n  } else if (node.type === Syntax.ArrayPattern) {\n    return tmpName + '[' + idx + ']';\n  }\n}\n\nfunction getPatternItemValue(node, patternItem) {\n  return node.type === Syntax.ObjectPattern\n    ? patternItem.value\n    : patternItem;\n}\n\n// -------------------------------------------------------\n// 2. Assignment expression.\n//\n// [a, b] = [b, a];\n// ({x, y} = {y, x});\n// -------------------------------------------------------\n\nfunction visitStructuredAssignment(traverse, node, path, state) {\n  var exprNode = node.expression;\n  utils.append('var ' + utils.getTempVar(state.localScope.tempVarIndex) + '=', state);\n\n  utils.catchupWhiteSpace(exprNode.right.range[0], state);\n  traverse(exprNode.right, path, state);\n  utils.catchup(exprNode.right.range[1], state);\n\n  utils.append(\n    ';' + getDestructuredComponents(exprNode.left, state) + ';',\n    state\n  );\n\n  utils.catchupWhiteSpace(node.range[1], state);\n  state.localScope.tempVarIndex++;\n  return false;\n}\n\nvisitStructuredAssignment.test = function(node, path, state) {\n  // We consider the expression statement rather than just assignment\n  // expression to cover case with object patters which should be\n  // wrapped in grouping operator: ({x, y} = {y, x});\n  return node.type === Syntax.ExpressionStatement &&\n    node.expression.type === Syntax.AssignmentExpression &&\n    isStructuredPattern(node.expression.left);\n};\n\n// -------------------------------------------------------\n// 3. Structured parameter.\n//\n// function foo({x, y}) { ... }\n// -------------------------------------------------------\n\nfunction visitStructuredParameter(traverse, node, path, state) {\n  utils.append(utils.getTempVar(getParamIndex(node, path)), state);\n  utils.catchupWhiteSpace(node.range[1], state);\n  return true;\n}\n\nfunction getParamIndex(paramNode, path) {\n  var funcNode = path[0];\n  var tmpIndex = 0;\n  for (var k = 0; k < funcNode.params.length; k++) {\n    var param = funcNode.params[k];\n    if (param === paramNode) {\n      break;\n    }\n    if (isStructuredPattern(param)) {\n      tmpIndex++;\n    }\n  }\n  return tmpIndex;\n}\n\nvisitStructuredParameter.test = function(node, path, state) {\n  return isStructuredPattern(node) && isFunctionNode(path[0]);\n};\n\nfunction isFunctionNode(node) {\n  return (node.type == Syntax.FunctionDeclaration ||\n    node.type == Syntax.FunctionExpression ||\n    node.type == Syntax.MethodDefinition ||\n    node.type == Syntax.ArrowFunctionExpression);\n}\n\n// -------------------------------------------------------\n// 4. Function body for structured parameters.\n//\n// function foo({x, y}) { x; y; }\n// -------------------------------------------------------\n\nfunction visitFunctionBodyForStructuredParameter(traverse, node, path, state) {\n  var funcNode = path[0];\n\n  utils.catchup(funcNode.body.range[0] + 1, state);\n  renderDestructuredComponents(funcNode, state);\n\n  if (funcNode.rest) {\n    utils.append(\n      restParamVisitors.renderRestParamSetup(funcNode, state),\n      state\n    );\n  }\n\n  return true;\n}\n\nfunction renderDestructuredComponents(funcNode, state) {\n  var destructuredComponents = [];\n\n  for (var k = 0; k < funcNode.params.length; k++) {\n    var param = funcNode.params[k];\n    if (isStructuredPattern(param)) {\n      destructuredComponents.push(\n        getDestructuredComponents(param, state)\n      );\n      state.localScope.tempVarIndex++;\n    }\n  }\n\n  if (destructuredComponents.length) {\n    utils.append('var ' + destructuredComponents.join(',') + ';', state);\n  }\n}\n\nvisitFunctionBodyForStructuredParameter.test = function(node, path, state) {\n  return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);\n};\n\nexports.visitorList = [\n  visitStructuredVariable,\n  visitStructuredAssignment,\n  visitStructuredParameter,\n  visitFunctionBodyForStructuredParameter\n];\n\nexports.renderDestructuredComponents = renderDestructuredComponents;\n\n\n},{\"../src/utils\":23,\"./es6-rest-param-visitors\":30,\"./es7-rest-property-helpers\":32,\"./reserved-words-helper\":34,\"esprima-fb\":9}],28:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node:true*/\n\n/**\n * Desugars concise methods of objects to function expressions.\n *\n * var foo = {\n *   method(x, y) { ... }\n * };\n *\n * var foo = {\n *   method: function(x, y) { ... }\n * };\n *\n */\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\nvar reservedWordsHelper = _dereq_('./reserved-words-helper');\n\nfunction visitObjectConciseMethod(traverse, node, path, state) {\n  var isGenerator = node.value.generator;\n  if (isGenerator) {\n    utils.catchupWhiteSpace(node.range[0] + 1, state);\n  }\n  if (node.computed) { // [<expr>]() { ...}\n    utils.catchup(node.key.range[1] + 1, state);\n  } else if (reservedWordsHelper.isReservedWord(node.key.name)) {\n    utils.catchup(node.key.range[0], state);\n    utils.append('\"', state);\n    utils.catchup(node.key.range[1], state);\n    utils.append('\"', state);\n  }\n\n  utils.catchup(node.key.range[1], state);\n  utils.append(\n    ':function' + (isGenerator ? '*' : ''),\n    state\n  );\n  path.unshift(node);\n  traverse(node.value, path, state);\n  path.shift();\n  return false;\n}\n\nvisitObjectConciseMethod.test = function(node, path, state) {\n  return node.type === Syntax.Property &&\n    node.value.type === Syntax.FunctionExpression &&\n    node.method === true;\n};\n\nexports.visitorList = [\n  visitObjectConciseMethod\n];\n\n},{\"../src/utils\":23,\"./reserved-words-helper\":34,\"esprima-fb\":9}],29:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node: true*/\n\n/**\n * Desugars ES6 Object Literal short notations into ES3 full notation.\n *\n * // Easier return values.\n * function foo(x, y) {\n *   return {x, y}; // {x: x, y: y}\n * };\n *\n * // Destructuring.\n * function init({port, ip, coords: {x, y}}) { ... }\n *\n */\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\n/**\n * @public\n */\nfunction visitObjectLiteralShortNotation(traverse, node, path, state) {\n  utils.catchup(node.key.range[1], state);\n  utils.append(':' + node.key.name, state);\n  return false;\n}\n\nvisitObjectLiteralShortNotation.test = function(node, path, state) {\n  return node.type === Syntax.Property &&\n    node.kind === 'init' &&\n    node.shorthand === true &&\n    path[0].type !== Syntax.ObjectPattern;\n};\n\nexports.visitorList = [\n  visitObjectLiteralShortNotation\n];\n\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],30:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node:true*/\n\n/**\n * Desugars ES6 rest parameters into an ES3 arguments array.\n *\n * function printf(template, ...args) {\n *   args.forEach(...);\n * }\n *\n * We could use `Array.prototype.slice.call`, but that usage of arguments causes\n * functions to be deoptimized in V8, so instead we use a for-loop.\n *\n * function printf(template) {\n *   for (var args = [], $__0 = 1, $__1 = arguments.length; $__0 < $__1; $__0++)\n *     args.push(arguments[$__0]);\n *   args.forEach(...);\n * }\n *\n */\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\n\n\nfunction _nodeIsFunctionWithRestParam(node) {\n  return (node.type === Syntax.FunctionDeclaration\n          || node.type === Syntax.FunctionExpression\n          || node.type === Syntax.ArrowFunctionExpression)\n         && node.rest;\n}\n\nfunction visitFunctionParamsWithRestParam(traverse, node, path, state) {\n  if (node.parametricType) {\n    utils.catchup(node.parametricType.range[0], state);\n    path.unshift(node);\n    traverse(node.parametricType, path, state);\n    path.shift();\n  }\n\n  // Render params.\n  if (node.params.length) {\n    path.unshift(node);\n    traverse(node.params, path, state);\n    path.shift();\n  } else {\n    // -3 is for ... of the rest.\n    utils.catchup(node.rest.range[0] - 3, state);\n  }\n  utils.catchupWhiteSpace(node.rest.range[1], state);\n\n  path.unshift(node);\n  traverse(node.body, path, state);\n  path.shift();\n\n  return false;\n}\n\nvisitFunctionParamsWithRestParam.test = function(node, path, state) {\n  return _nodeIsFunctionWithRestParam(node);\n};\n\nfunction renderRestParamSetup(functionNode, state) {\n  var idx = state.localScope.tempVarIndex++;\n  var len = state.localScope.tempVarIndex++;\n\n  return 'for (var ' + functionNode.rest.name + '=[],' +\n    utils.getTempVar(idx) + '=' + functionNode.params.length + ',' +\n    utils.getTempVar(len) + '=arguments.length;' +\n    utils.getTempVar(idx) + '<' +  utils.getTempVar(len) + ';' +\n    utils.getTempVar(idx) + '++) ' +\n    functionNode.rest.name + '.push(arguments[' + utils.getTempVar(idx) + ']);';\n}\n\nfunction visitFunctionBodyWithRestParam(traverse, node, path, state) {\n  utils.catchup(node.range[0] + 1, state);\n  var parentNode = path[0];\n  utils.append(renderRestParamSetup(parentNode, state), state);\n  return true;\n}\n\nvisitFunctionBodyWithRestParam.test = function(node, path, state) {\n  return node.type === Syntax.BlockStatement\n         && _nodeIsFunctionWithRestParam(path[0]);\n};\n\nexports.renderRestParamSetup = renderRestParamSetup;\nexports.visitorList = [\n  visitFunctionParamsWithRestParam,\n  visitFunctionBodyWithRestParam\n];\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],31:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node:true*/\n\n/**\n * @typechecks\n */\n'use strict';\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\n/**\n * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.1.9\n */\nfunction visitTemplateLiteral(traverse, node, path, state) {\n  var templateElements = node.quasis;\n\n  utils.append('(', state);\n  for (var ii = 0; ii < templateElements.length; ii++) {\n    var templateElement = templateElements[ii];\n    if (templateElement.value.raw !== '') {\n      utils.append(getCookedValue(templateElement), state);\n      if (!templateElement.tail) {\n        // + between element and substitution\n        utils.append(' + ', state);\n      }\n      // maintain line numbers\n      utils.move(templateElement.range[0], state);\n      utils.catchupNewlines(templateElement.range[1], state);\n    } else {  // templateElement.value.raw === ''\n      // Concatenat adjacent substitutions, e.g. `${x}${y}`. Empty templates\n      // appear before the first and after the last element - nothing to add in\n      // those cases.\n      if (ii > 0 && !templateElement.tail) {\n        // + between substitution and substitution\n        utils.append(' + ', state);\n      }\n    }\n\n    utils.move(templateElement.range[1], state);\n    if (!templateElement.tail) {\n      var substitution = node.expressions[ii];\n      if (substitution.type === Syntax.Identifier ||\n          substitution.type === Syntax.MemberExpression ||\n          substitution.type === Syntax.CallExpression) {\n        utils.catchup(substitution.range[1], state);\n      } else {\n        utils.append('(', state);\n        traverse(substitution, path, state);\n        utils.catchup(substitution.range[1], state);\n        utils.append(')', state);\n      }\n      // if next templateElement isn't empty...\n      if (templateElements[ii + 1].value.cooked !== '') {\n        utils.append(' + ', state);\n      }\n    }\n  }\n  utils.move(node.range[1], state);\n  utils.append(')', state);\n  return false;\n}\n\nvisitTemplateLiteral.test = function(node, path, state) {\n  return node.type === Syntax.TemplateLiteral;\n};\n\n/**\n * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.6\n */\nfunction visitTaggedTemplateExpression(traverse, node, path, state) {\n  var template = node.quasi;\n  var numQuasis = template.quasis.length;\n\n  // print the tag\n  utils.move(node.tag.range[0], state);\n  traverse(node.tag, path, state);\n  utils.catchup(node.tag.range[1], state);\n\n  // print array of template elements\n  utils.append('(function() { var siteObj = [', state);\n  for (var ii = 0; ii < numQuasis; ii++) {\n    utils.append(getCookedValue(template.quasis[ii]), state);\n    if (ii !== numQuasis - 1) {\n      utils.append(', ', state);\n    }\n  }\n  utils.append(']; siteObj.raw = [', state);\n  for (ii = 0; ii < numQuasis; ii++) {\n    utils.append(getRawValue(template.quasis[ii]), state);\n    if (ii !== numQuasis - 1) {\n      utils.append(', ', state);\n    }\n  }\n  utils.append(\n    ']; Object.freeze(siteObj.raw); Object.freeze(siteObj); return siteObj; }()',\n    state\n  );\n\n  // print substitutions\n  if (numQuasis > 1) {\n    for (ii = 0; ii < template.expressions.length; ii++) {\n      var expression = template.expressions[ii];\n      utils.append(', ', state);\n\n      // maintain line numbers by calling catchupWhiteSpace over the whole\n      // previous TemplateElement\n      utils.move(template.quasis[ii].range[0], state);\n      utils.catchupNewlines(template.quasis[ii].range[1], state);\n\n      utils.move(expression.range[0], state);\n      traverse(expression, path, state);\n      utils.catchup(expression.range[1], state);\n    }\n  }\n\n  // print blank lines to push the closing ) down to account for the final\n  // TemplateElement.\n  utils.catchupNewlines(node.range[1], state);\n\n  utils.append(')', state);\n\n  return false;\n}\n\nvisitTaggedTemplateExpression.test = function(node, path, state) {\n  return node.type === Syntax.TaggedTemplateExpression;\n};\n\nfunction getCookedValue(templateElement) {\n  return JSON.stringify(templateElement.value.cooked);\n}\n\nfunction getRawValue(templateElement) {\n  return JSON.stringify(templateElement.value.raw);\n}\n\nexports.visitorList = [\n  visitTemplateLiteral,\n  visitTaggedTemplateExpression\n];\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],32:[function(_dereq_,module,exports){\n/**\n * Copyright 2013 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint node:true*/\n\n/**\n * Desugars ES7 rest properties into ES5 object iteration.\n */\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\n\n// TODO: This is a pretty massive helper, it should only be defined once, in the\n// transform's runtime environment. We don't currently have a runtime though.\nvar restFunction =\n  '(function(source, exclusion) {' +\n    'var rest = {};' +\n    'var hasOwn = Object.prototype.hasOwnProperty;' +\n    'if (source == null) {' +\n      'throw new TypeError();' +\n    '}' +\n    'for (var key in source) {' +\n      'if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {' +\n        'rest[key] = source[key];' +\n      '}' +\n    '}' +\n    'return rest;' +\n  '})';\n\nfunction getPropertyNames(properties) {\n  var names = [];\n  for (var i = 0; i < properties.length; i++) {\n    var property = properties[i];\n    if (property.type === Syntax.SpreadProperty) {\n      continue;\n    }\n    if (property.type === Syntax.Identifier) {\n      names.push(property.name);\n    } else {\n      names.push(property.key.name);\n    }\n  }\n  return names;\n}\n\nfunction getRestFunctionCall(source, exclusion) {\n  return restFunction + '(' + source + ',' + exclusion + ')';\n}\n\nfunction getSimpleShallowCopy(accessorExpression) {\n  // This could be faster with 'Object.assign({}, ' + accessorExpression + ')'\n  // but to unify code paths and avoid a ES6 dependency we use the same\n  // helper as for the exclusion case.\n  return getRestFunctionCall(accessorExpression, '{}');\n}\n\nfunction renderRestExpression(accessorExpression, excludedProperties) {\n  var excludedNames = getPropertyNames(excludedProperties);\n  if (!excludedNames.length) {\n    return getSimpleShallowCopy(accessorExpression);\n  }\n  return getRestFunctionCall(\n    accessorExpression,\n    '{' + excludedNames.join(':1,') + ':1}'\n  );\n}\n\nexports.renderRestExpression = renderRestExpression;\n\n},{\"esprima-fb\":9}],33:[function(_dereq_,module,exports){\n/**\n * Copyright 2004-present Facebook. All Rights Reserved.\n */\n/*global exports:true*/\n\n/**\n * Implements ES7 object spread property.\n * https://gist.github.com/sebmarkbage/aa849c7973cb4452c547\n *\n * { ...a, x: 1 }\n *\n * Object.assign({}, a, {x: 1 })\n *\n */\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\n\nfunction visitObjectLiteralSpread(traverse, node, path, state) {\n  utils.catchup(node.range[0], state);\n\n  utils.append('Object.assign({', state);\n\n  // Skip the original {\n  utils.move(node.range[0] + 1, state);\n\n  var previousWasSpread = false;\n\n  for (var i = 0; i < node.properties.length; i++) {\n    var property = node.properties[i];\n    if (property.type === Syntax.SpreadProperty) {\n\n      // Close the previous object or initial object\n      if (!previousWasSpread) {\n        utils.append('}', state);\n      }\n\n      if (i === 0) {\n        // Normally there will be a comma when we catch up, but not before\n        // the first property.\n        utils.append(',', state);\n      }\n\n      utils.catchup(property.range[0], state);\n\n      // skip ...\n      utils.move(property.range[0] + 3, state);\n\n      traverse(property.argument, path, state);\n\n      utils.catchup(property.range[1], state);\n\n      previousWasSpread = true;\n\n    } else {\n\n      utils.catchup(property.range[0], state);\n\n      if (previousWasSpread) {\n        utils.append('{', state);\n      }\n\n      traverse(property, path, state);\n\n      utils.catchup(property.range[1], state);\n\n      previousWasSpread = false;\n\n    }\n  }\n\n  // Strip any non-whitespace between the last item and the end.\n  // We only catch up on whitespace so that we ignore any trailing commas which\n  // are stripped out for IE8 support. Unfortunately, this also strips out any\n  // trailing comments.\n  utils.catchupWhiteSpace(node.range[1] - 1, state);\n\n  // Skip the trailing }\n  utils.move(node.range[1], state);\n\n  if (!previousWasSpread) {\n    utils.append('}', state);\n  }\n\n  utils.append(')', state);\n  return false;\n}\n\nvisitObjectLiteralSpread.test = function(node, path, state) {\n  if (node.type !== Syntax.ObjectExpression) {\n    return false;\n  }\n  // Tight loop optimization\n  var hasAtLeastOneSpreadProperty = false;\n  for (var i = 0; i < node.properties.length; i++) {\n    var property = node.properties[i];\n    if (property.type === Syntax.SpreadProperty) {\n      hasAtLeastOneSpreadProperty = true;\n    } else if (property.kind !== 'init') {\n      return false;\n    }\n  }\n  return hasAtLeastOneSpreadProperty;\n};\n\nexports.visitorList = [\n  visitObjectLiteralSpread\n];\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],34:[function(_dereq_,module,exports){\n/**\n * Copyright 2014 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar KEYWORDS = [\n  'break', 'do', 'in', 'typeof', 'case', 'else', 'instanceof', 'var', 'catch',\n  'export', 'new', 'void', 'class', 'extends', 'return', 'while', 'const',\n  'finally', 'super', 'with', 'continue', 'for', 'switch', 'yield', 'debugger',\n  'function', 'this', 'default', 'if', 'throw', 'delete', 'import', 'try'\n];\n\nvar FUTURE_RESERVED_WORDS = [\n  'enum', 'await', 'implements', 'package', 'protected', 'static', 'interface',\n  'private', 'public'\n];\n\nvar LITERALS = [\n  'null',\n  'true',\n  'false'\n];\n\n// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words\nvar RESERVED_WORDS = [].concat(\n  KEYWORDS,\n  FUTURE_RESERVED_WORDS,\n  LITERALS\n);\n\nvar reservedWordsMap = Object.create(null);\nRESERVED_WORDS.forEach(function(k) {\n    reservedWordsMap[k] = true;\n});\n\n/**\n * This list should not grow as new reserved words are introdued. This list is\n * of words that need to be quoted because ES3-ish browsers do not allow their\n * use as identifier names.\n */\nvar ES3_FUTURE_RESERVED_WORDS = [\n  'enum', 'implements', 'package', 'protected', 'static', 'interface',\n  'private', 'public'\n];\n\nvar ES3_RESERVED_WORDS = [].concat(\n  KEYWORDS,\n  ES3_FUTURE_RESERVED_WORDS,\n  LITERALS\n);\n\nvar es3ReservedWordsMap = Object.create(null);\nES3_RESERVED_WORDS.forEach(function(k) {\n    es3ReservedWordsMap[k] = true;\n});\n\nexports.isReservedWord = function(word) {\n  return !!reservedWordsMap[word];\n};\n\nexports.isES3ReservedWord = function(word) {\n  return !!es3ReservedWordsMap[word];\n};\n\n},{}],35:[function(_dereq_,module,exports){\n/**\n * Copyright 2014 Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n/*global exports:true*/\n\nvar Syntax = _dereq_('esprima-fb').Syntax;\nvar utils = _dereq_('../src/utils');\nvar reserverdWordsHelper = _dereq_('./reserved-words-helper');\n\n/**\n * Code adapted from https://github.com/spicyj/es3ify\n * The MIT License (MIT)\n * Copyright (c) 2014 Ben Alpert\n */\n\nfunction visitProperty(traverse, node, path, state) {\n  utils.catchup(node.key.range[0], state);\n  utils.append('\"', state);\n  utils.catchup(node.key.range[1], state);\n  utils.append('\"', state);\n  utils.catchup(node.value.range[0], state);\n  traverse(node.value, path, state);\n  return false;\n}\n\nvisitProperty.test = function(node) {\n  return node.type === Syntax.Property &&\n    node.key.type === Syntax.Identifier &&\n    !node.method &&\n    !node.shorthand &&\n    !node.computed &&\n    reserverdWordsHelper.isES3ReservedWord(node.key.name);\n};\n\nfunction visitMemberExpression(traverse, node, path, state) {\n  traverse(node.object, path, state);\n  utils.catchup(node.property.range[0] - 1, state);\n  utils.append('[', state);\n  utils.catchupWhiteSpace(node.property.range[0], state);\n  utils.append('\"', state);\n  utils.catchup(node.property.range[1], state);\n  utils.append('\"]', state);\n  return false;\n}\n\nvisitMemberExpression.test = function(node) {\n  return node.type === Syntax.MemberExpression &&\n    node.property.type === Syntax.Identifier &&\n    reserverdWordsHelper.isES3ReservedWord(node.property.name);\n};\n\nexports.visitorList = [\n  visitProperty,\n  visitMemberExpression\n];\n\n},{\"../src/utils\":23,\"./reserved-words-helper\":34,\"esprima-fb\":9}],36:[function(_dereq_,module,exports){\nvar esprima = _dereq_('esprima-fb');\nvar utils = _dereq_('../src/utils');\n\nvar Syntax = esprima.Syntax;\n\nfunction _isFunctionNode(node) {\n  return node.type === Syntax.FunctionDeclaration\n         || node.type === Syntax.FunctionExpression\n         || node.type === Syntax.ArrowFunctionExpression;\n}\n\nfunction visitClassProperty(traverse, node, path, state) {\n  utils.catchup(node.range[0], state);\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitClassProperty.test = function(node, path, state) {\n  return node.type === Syntax.ClassProperty;\n};\n\nfunction visitTypeAlias(traverse, node, path, state) {\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitTypeAlias.test = function(node, path, state) {\n  return node.type === Syntax.TypeAlias;\n};\n\nfunction visitTypeCast(traverse, node, path, state) {\n  path.unshift(node);\n  traverse(node.expression, path, state);\n  path.shift();\n\n  utils.catchup(node.typeAnnotation.range[0], state);\n  utils.catchupWhiteOut(node.typeAnnotation.range[1], state);\n  return false;\n}\nvisitTypeCast.test = function(node, path, state) {\n  return node.type === Syntax.TypeCastExpression;\n};\n\nfunction visitInterfaceDeclaration(traverse, node, path, state) {\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitInterfaceDeclaration.test = function(node, path, state) {\n  return node.type === Syntax.InterfaceDeclaration;\n};\n\nfunction visitDeclare(traverse, node, path, state) {\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitDeclare.test = function(node, path, state) {\n  switch (node.type) {\n    case Syntax.DeclareVariable:\n    case Syntax.DeclareFunction:\n    case Syntax.DeclareClass:\n    case Syntax.DeclareModule:\n      return true;\n  }\n  return false;\n};\n\nfunction visitFunctionParametricAnnotation(traverse, node, path, state) {\n  utils.catchup(node.range[0], state);\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitFunctionParametricAnnotation.test = function(node, path, state) {\n  return node.type === Syntax.TypeParameterDeclaration\n         && path[0]\n         && _isFunctionNode(path[0])\n         && node === path[0].typeParameters;\n};\n\nfunction visitFunctionReturnAnnotation(traverse, node, path, state) {\n  utils.catchup(node.range[0], state);\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitFunctionReturnAnnotation.test = function(node, path, state) {\n  return path[0] && _isFunctionNode(path[0]) && node === path[0].returnType;\n};\n\nfunction visitOptionalFunctionParameterAnnotation(traverse, node, path, state) {\n  utils.catchup(node.range[0] + node.name.length, state);\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitOptionalFunctionParameterAnnotation.test = function(node, path, state) {\n  return node.type === Syntax.Identifier\n         && node.optional\n         && path[0]\n         && _isFunctionNode(path[0]);\n};\n\nfunction visitTypeAnnotatedIdentifier(traverse, node, path, state) {\n  utils.catchup(node.typeAnnotation.range[0], state);\n  utils.catchupWhiteOut(node.typeAnnotation.range[1], state);\n  return false;\n}\nvisitTypeAnnotatedIdentifier.test = function(node, path, state) {\n  return node.type === Syntax.Identifier && node.typeAnnotation;\n};\n\nfunction visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, state) {\n  utils.catchup(node.typeAnnotation.range[0], state);\n  utils.catchupWhiteOut(node.typeAnnotation.range[1], state);\n  return false;\n}\nvisitTypeAnnotatedObjectOrArrayPattern.test = function(node, path, state) {\n  var rightType = node.type === Syntax.ObjectPattern\n                || node.type === Syntax.ArrayPattern;\n  return rightType && node.typeAnnotation;\n};\n\n/**\n * Methods cause trouble, since esprima parses them as a key/value pair, where\n * the location of the value starts at the method body. For example\n * { bar(x:number,...y:Array<number>):number {} }\n * is parsed as\n * { bar: function(x: number, ...y:Array<number>): number {} }\n * except that the location of the FunctionExpression value is 40-something,\n * which is the location of the function body. This means that by the time we\n * visit the params, rest param, and return type organically, we've already\n * catchup()'d passed them.\n */\nfunction visitMethod(traverse, node, path, state) {\n  path.unshift(node);\n  traverse(node.key, path, state);\n\n  path.unshift(node.value);\n  traverse(node.value.params, path, state);\n  node.value.rest && traverse(node.value.rest, path, state);\n  node.value.returnType && traverse(node.value.returnType, path, state);\n  traverse(node.value.body, path, state);\n\n  path.shift();\n\n  path.shift();\n  return false;\n}\n\nvisitMethod.test = function(node, path, state) {\n  return (node.type === \"Property\" && (node.method || node.kind === \"set\" || node.kind === \"get\"))\n      || (node.type === \"MethodDefinition\");\n};\n\nfunction visitImportType(traverse, node, path, state) {\n  utils.catchupWhiteOut(node.range[1], state);\n  return false;\n}\nvisitImportType.test = function(node, path, state) {\n  return node.type === 'ImportDeclaration'\n         && node.isType;\n};\n\nexports.visitorList = [\n  visitClassProperty,\n  visitDeclare,\n  visitImportType,\n  visitInterfaceDeclaration,\n  visitFunctionParametricAnnotation,\n  visitFunctionReturnAnnotation,\n  visitMethod,\n  visitOptionalFunctionParameterAnnotation,\n  visitTypeAlias,\n  visitTypeCast,\n  visitTypeAnnotatedIdentifier,\n  visitTypeAnnotatedObjectOrArrayPattern\n];\n\n},{\"../src/utils\":23,\"esprima-fb\":9}],37:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n/*global exports:true*/\n'use strict';\nvar Syntax = _dereq_('jstransform').Syntax;\nvar utils = _dereq_('jstransform/src/utils');\n\nfunction renderJSXLiteral(object, isLast, state, start, end) {\n  var lines = object.value.split(/\\r\\n|\\n|\\r/);\n\n  if (start) {\n    utils.append(start, state);\n  }\n\n  var lastNonEmptyLine = 0;\n\n  lines.forEach(function(line, index) {\n    if (line.match(/[^ \\t]/)) {\n      lastNonEmptyLine = index;\n    }\n  });\n\n  lines.forEach(function(line, index) {\n    var isFirstLine = index === 0;\n    var isLastLine = index === lines.length - 1;\n    var isLastNonEmptyLine = index === lastNonEmptyLine;\n\n    // replace rendered whitespace tabs with spaces\n    var trimmedLine = line.replace(/\\t/g, ' ');\n\n    // trim whitespace touching a newline\n    if (!isFirstLine) {\n      trimmedLine = trimmedLine.replace(/^[ ]+/, '');\n    }\n    if (!isLastLine) {\n      trimmedLine = trimmedLine.replace(/[ ]+$/, '');\n    }\n\n    if (!isFirstLine) {\n      utils.append(line.match(/^[ \\t]*/)[0], state);\n    }\n\n    if (trimmedLine || isLastNonEmptyLine) {\n      utils.append(\n        JSON.stringify(trimmedLine) +\n        (!isLastNonEmptyLine ? ' + \\' \\' +' : ''),\n        state);\n\n      if (isLastNonEmptyLine) {\n        if (end) {\n          utils.append(end, state);\n        }\n        if (!isLast) {\n          utils.append(', ', state);\n        }\n      }\n\n      // only restore tail whitespace if line had literals\n      if (trimmedLine && !isLastLine) {\n        utils.append(line.match(/[ \\t]*$/)[0], state);\n      }\n    }\n\n    if (!isLastLine) {\n      utils.append('\\n', state);\n    }\n  });\n\n  utils.move(object.range[1], state);\n}\n\nfunction renderJSXExpressionContainer(traverse, object, isLast, path, state) {\n  // Plus 1 to skip `{`.\n  utils.move(object.range[0] + 1, state);\n  utils.catchup(object.expression.range[0], state);\n  traverse(object.expression, path, state);\n\n  if (!isLast && object.expression.type !== Syntax.JSXEmptyExpression) {\n    // If we need to append a comma, make sure to do so after the expression.\n    utils.catchup(object.expression.range[1], state, trimLeft);\n    utils.append(', ', state);\n  }\n\n  // Minus 1 to skip `}`.\n  utils.catchup(object.range[1] - 1, state, trimLeft);\n  utils.move(object.range[1], state);\n  return false;\n}\n\nfunction quoteAttrName(attr) {\n  // Quote invalid JS identifiers.\n  if (!/^[a-z_$][a-z\\d_$]*$/i.test(attr)) {\n    return '\"' + attr + '\"';\n  }\n  return attr;\n}\n\nfunction trimLeft(value) {\n  return value.replace(/^[ ]+/, '');\n}\n\nexports.renderJSXExpressionContainer = renderJSXExpressionContainer;\nexports.renderJSXLiteral = renderJSXLiteral;\nexports.quoteAttrName = quoteAttrName;\nexports.trimLeft = trimLeft;\n\n},{\"jstransform\":22,\"jstransform/src/utils\":23}],38:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n/*global exports:true*/\n'use strict';\n\nvar Syntax = _dereq_('jstransform').Syntax;\nvar utils = _dereq_('jstransform/src/utils');\n\nvar renderJSXExpressionContainer =\n  _dereq_('./jsx').renderJSXExpressionContainer;\nvar renderJSXLiteral = _dereq_('./jsx').renderJSXLiteral;\nvar quoteAttrName = _dereq_('./jsx').quoteAttrName;\n\nvar trimLeft = _dereq_('./jsx').trimLeft;\n\n/**\n * Customized desugar processor for React JSX. Currently:\n *\n * <X> </X> => React.createElement(X, null)\n * <X prop=\"1\" /> => React.createElement(X, {prop: '1'}, null)\n * <X prop=\"2\"><Y /></X> => React.createElement(X, {prop:'2'},\n *   React.createElement(Y, null)\n * )\n * <div /> => React.createElement(\"div\", null)\n */\n\n/**\n * Removes all non-whitespace/parenthesis characters\n */\nvar reNonWhiteParen = /([^\\s\\(\\)])/g;\nfunction stripNonWhiteParen(value) {\n  return value.replace(reNonWhiteParen, '');\n}\n\nvar tagConvention = /^[a-z]|\\-/;\nfunction isTagName(name) {\n  return tagConvention.test(name);\n}\n\nfunction visitReactTag(traverse, object, path, state) {\n  var openingElement = object.openingElement;\n  var nameObject = openingElement.name;\n  var attributesObject = openingElement.attributes;\n\n  utils.catchup(openingElement.range[0], state, trimLeft);\n\n  if (nameObject.type === Syntax.JSXNamespacedName && nameObject.namespace) {\n    throw new Error('Namespace tags are not supported. ReactJSX is not XML.');\n  }\n\n  // We assume that the React runtime is already in scope\n  utils.append('React.createElement(', state);\n\n  if (nameObject.type === Syntax.JSXIdentifier && isTagName(nameObject.name)) {\n    utils.append('\"' + nameObject.name + '\"', state);\n    utils.move(nameObject.range[1], state);\n  } else {\n    // Use utils.catchup in this case so we can easily handle\n    // JSXMemberExpressions which look like Foo.Bar.Baz. This also handles\n    // JSXIdentifiers that aren't fallback tags.\n    utils.move(nameObject.range[0], state);\n    utils.catchup(nameObject.range[1], state);\n  }\n\n  utils.append(', ', state);\n\n  var hasAttributes = attributesObject.length;\n\n  var hasAtLeastOneSpreadProperty = attributesObject.some(function(attr) {\n    return attr.type === Syntax.JSXSpreadAttribute;\n  });\n\n  // if we don't have any attributes, pass in null\n  if (hasAtLeastOneSpreadProperty) {\n    utils.append('React.__spread({', state);\n  } else if (hasAttributes) {\n    utils.append('{', state);\n  } else {\n    utils.append('null', state);\n  }\n\n  // keep track of if the previous attribute was a spread attribute\n  var previousWasSpread = false;\n\n  // write attributes\n  attributesObject.forEach(function(attr, index) {\n    var isLast = index === attributesObject.length - 1;\n\n    if (attr.type === Syntax.JSXSpreadAttribute) {\n      // Close the previous object or initial object\n      if (!previousWasSpread) {\n        utils.append('}, ', state);\n      }\n\n      // Move to the expression start, ignoring everything except parenthesis\n      // and whitespace.\n      utils.catchup(attr.range[0], state, stripNonWhiteParen);\n      // Plus 1 to skip `{`.\n      utils.move(attr.range[0] + 1, state);\n      utils.catchup(attr.argument.range[0], state, stripNonWhiteParen);\n\n      traverse(attr.argument, path, state);\n\n      utils.catchup(attr.argument.range[1], state);\n\n      // Move to the end, ignoring parenthesis and the closing `}`\n      utils.catchup(attr.range[1] - 1, state, stripNonWhiteParen);\n\n      if (!isLast) {\n        utils.append(', ', state);\n      }\n\n      utils.move(attr.range[1], state);\n\n      previousWasSpread = true;\n\n      return;\n    }\n\n    // If the next attribute is a spread, we're effective last in this object\n    if (!isLast) {\n      isLast = attributesObject[index + 1].type === Syntax.JSXSpreadAttribute;\n    }\n\n    if (attr.name.namespace) {\n      throw new Error(\n         'Namespace attributes are not supported. ReactJSX is not XML.');\n    }\n    var name = attr.name.name;\n\n    utils.catchup(attr.range[0], state, trimLeft);\n\n    if (previousWasSpread) {\n      utils.append('{', state);\n    }\n\n    utils.append(quoteAttrName(name), state);\n    utils.append(': ', state);\n\n    if (!attr.value) {\n      state.g.buffer += 'true';\n      state.g.position = attr.name.range[1];\n      if (!isLast) {\n        utils.append(', ', state);\n      }\n    } else {\n      utils.move(attr.name.range[1], state);\n      // Use catchupNewlines to skip over the '=' in the attribute\n      utils.catchupNewlines(attr.value.range[0], state);\n      if (attr.value.type === Syntax.Literal) {\n        renderJSXLiteral(attr.value, isLast, state);\n      } else {\n        renderJSXExpressionContainer(traverse, attr.value, isLast, path, state);\n      }\n    }\n\n    utils.catchup(attr.range[1], state, trimLeft);\n\n    previousWasSpread = false;\n\n  });\n\n  if (!openingElement.selfClosing) {\n    utils.catchup(openingElement.range[1] - 1, state, trimLeft);\n    utils.move(openingElement.range[1], state);\n  }\n\n  if (hasAttributes && !previousWasSpread) {\n    utils.append('}', state);\n  }\n\n  if (hasAtLeastOneSpreadProperty) {\n    utils.append(')', state);\n  }\n\n  // filter out whitespace\n  var childrenToRender = object.children.filter(function(child) {\n    return !(child.type === Syntax.Literal\n             && typeof child.value === 'string'\n             && child.value.match(/^[ \\t]*[\\r\\n][ \\t\\r\\n]*$/));\n  });\n  if (childrenToRender.length > 0) {\n    var lastRenderableIndex;\n\n    childrenToRender.forEach(function(child, index) {\n      if (child.type !== Syntax.JSXExpressionContainer ||\n          child.expression.type !== Syntax.JSXEmptyExpression) {\n        lastRenderableIndex = index;\n      }\n    });\n\n    if (lastRenderableIndex !== undefined) {\n      utils.append(', ', state);\n    }\n\n    childrenToRender.forEach(function(child, index) {\n      utils.catchup(child.range[0], state, trimLeft);\n\n      var isLast = index >= lastRenderableIndex;\n\n      if (child.type === Syntax.Literal) {\n        renderJSXLiteral(child, isLast, state);\n      } else if (child.type === Syntax.JSXExpressionContainer) {\n        renderJSXExpressionContainer(traverse, child, isLast, path, state);\n      } else {\n        traverse(child, path, state);\n        if (!isLast) {\n          utils.append(', ', state);\n        }\n      }\n\n      utils.catchup(child.range[1], state, trimLeft);\n    });\n  }\n\n  if (openingElement.selfClosing) {\n    // everything up to />\n    utils.catchup(openingElement.range[1] - 2, state, trimLeft);\n    utils.move(openingElement.range[1], state);\n  } else {\n    // everything up to </ sdflksjfd>\n    utils.catchup(object.closingElement.range[0], state, trimLeft);\n    utils.move(object.closingElement.range[1], state);\n  }\n\n  utils.append(')', state);\n  return false;\n}\n\nvisitReactTag.test = function(object, path, state) {\n  return object.type === Syntax.JSXElement;\n};\n\nexports.visitorList = [\n  visitReactTag\n];\n\n},{\"./jsx\":37,\"jstransform\":22,\"jstransform/src/utils\":23}],39:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n/*global exports:true*/\n'use strict';\n\nvar Syntax = _dereq_('jstransform').Syntax;\nvar utils = _dereq_('jstransform/src/utils');\n\nfunction addDisplayName(displayName, object, state) {\n  if (object &&\n      object.type === Syntax.CallExpression &&\n      object.callee.type === Syntax.MemberExpression &&\n      object.callee.object.type === Syntax.Identifier &&\n      object.callee.object.name === 'React' &&\n      object.callee.property.type === Syntax.Identifier &&\n      object.callee.property.name === 'createClass' &&\n      object.arguments.length === 1 &&\n      object.arguments[0].type === Syntax.ObjectExpression) {\n    // Verify that the displayName property isn't already set\n    var properties = object.arguments[0].properties;\n    var safe = properties.every(function(property) {\n      var value = property.key.type === Syntax.Identifier ?\n        property.key.name :\n        property.key.value;\n      return value !== 'displayName';\n    });\n\n    if (safe) {\n      utils.catchup(object.arguments[0].range[0] + 1, state);\n      utils.append('displayName: \"' + displayName + '\",', state);\n    }\n  }\n}\n\n/**\n * Transforms the following:\n *\n * var MyComponent = React.createClass({\n *    render: ...\n * });\n *\n * into:\n *\n * var MyComponent = React.createClass({\n *    displayName: 'MyComponent',\n *    render: ...\n * });\n *\n * Also catches:\n *\n * MyComponent = React.createClass(...);\n * exports.MyComponent = React.createClass(...);\n * module.exports = {MyComponent: React.createClass(...)};\n */\nfunction visitReactDisplayName(traverse, object, path, state) {\n  var left, right;\n\n  if (object.type === Syntax.AssignmentExpression) {\n    left = object.left;\n    right = object.right;\n  } else if (object.type === Syntax.Property) {\n    left = object.key;\n    right = object.value;\n  } else if (object.type === Syntax.VariableDeclarator) {\n    left = object.id;\n    right = object.init;\n  }\n\n  if (left && left.type === Syntax.MemberExpression) {\n    left = left.property;\n  }\n  if (left && left.type === Syntax.Identifier) {\n    addDisplayName(left.name, right, state);\n  }\n}\n\nvisitReactDisplayName.test = function(object, path, state) {\n  return (\n    object.type === Syntax.AssignmentExpression ||\n    object.type === Syntax.Property ||\n    object.type === Syntax.VariableDeclarator\n  );\n};\n\nexports.visitorList = [\n  visitReactDisplayName\n];\n\n},{\"jstransform\":22,\"jstransform/src/utils\":23}],40:[function(_dereq_,module,exports){\n/*global exports:true*/\n\n'use strict';\n\nvar es6ArrowFunctions =\n  _dereq_('jstransform/visitors/es6-arrow-function-visitors');\nvar es6Classes = _dereq_('jstransform/visitors/es6-class-visitors');\nvar es6Destructuring =\n  _dereq_('jstransform/visitors/es6-destructuring-visitors');\nvar es6ObjectConciseMethod =\n  _dereq_('jstransform/visitors/es6-object-concise-method-visitors');\nvar es6ObjectShortNotation =\n  _dereq_('jstransform/visitors/es6-object-short-notation-visitors');\nvar es6RestParameters = _dereq_('jstransform/visitors/es6-rest-param-visitors');\nvar es6Templates = _dereq_('jstransform/visitors/es6-template-visitors');\nvar es6CallSpread =\n  _dereq_('jstransform/visitors/es6-call-spread-visitors');\nvar es7SpreadProperty =\n  _dereq_('jstransform/visitors/es7-spread-property-visitors');\nvar react = _dereq_('./transforms/react');\nvar reactDisplayName = _dereq_('./transforms/reactDisplayName');\nvar reservedWords = _dereq_('jstransform/visitors/reserved-words-visitors');\n\n/**\n * Map from transformName => orderedListOfVisitors.\n */\nvar transformVisitors = {\n  'es6-arrow-functions': es6ArrowFunctions.visitorList,\n  'es6-classes': es6Classes.visitorList,\n  'es6-destructuring': es6Destructuring.visitorList,\n  'es6-object-concise-method': es6ObjectConciseMethod.visitorList,\n  'es6-object-short-notation': es6ObjectShortNotation.visitorList,\n  'es6-rest-params': es6RestParameters.visitorList,\n  'es6-templates': es6Templates.visitorList,\n  'es6-call-spread': es6CallSpread.visitorList,\n  'es7-spread-property': es7SpreadProperty.visitorList,\n  'react': react.visitorList.concat(reactDisplayName.visitorList),\n  'reserved-words': reservedWords.visitorList\n};\n\nvar transformSets = {\n  'harmony': [\n    'es6-arrow-functions',\n    'es6-object-concise-method',\n    'es6-object-short-notation',\n    'es6-classes',\n    'es6-rest-params',\n    'es6-templates',\n    'es6-destructuring',\n    'es6-call-spread',\n    'es7-spread-property'\n  ],\n  'es3': [\n    'reserved-words'\n  ],\n  'react': [\n    'react'\n  ]\n};\n\n/**\n * Specifies the order in which each transform should run.\n */\nvar transformRunOrder = [\n  'reserved-words',\n  'es6-arrow-functions',\n  'es6-object-concise-method',\n  'es6-object-short-notation',\n  'es6-classes',\n  'es6-rest-params',\n  'es6-templates',\n  'es6-destructuring',\n  'es6-call-spread',\n  'es7-spread-property',\n  'react'\n];\n\n/**\n * Given a list of transform names, return the ordered list of visitors to be\n * passed to the transform() function.\n *\n * @param {array?} excludes\n * @return {array}\n */\nfunction getAllVisitors(excludes) {\n  var ret = [];\n  for (var i = 0, il = transformRunOrder.length; i < il; i++) {\n    if (!excludes || excludes.indexOf(transformRunOrder[i]) === -1) {\n      ret = ret.concat(transformVisitors[transformRunOrder[i]]);\n    }\n  }\n  return ret;\n}\n\n/**\n * Given a list of visitor set names, return the ordered list of visitors to be\n * passed to jstransform.\n *\n * @param {array}\n * @return {array}\n */\nfunction getVisitorsBySet(sets) {\n  var visitorsToInclude = sets.reduce(function(visitors, set) {\n    if (!transformSets.hasOwnProperty(set)) {\n      throw new Error('Unknown visitor set: ' + set);\n    }\n    transformSets[set].forEach(function(visitor) {\n      visitors[visitor] = true;\n    });\n    return visitors;\n  }, {});\n\n  var visitorList = [];\n  for (var i = 0; i < transformRunOrder.length; i++) {\n    if (visitorsToInclude.hasOwnProperty(transformRunOrder[i])) {\n      visitorList = visitorList.concat(transformVisitors[transformRunOrder[i]]);\n    }\n  }\n\n  return visitorList;\n}\n\nexports.getVisitorsBySet = getVisitorsBySet;\nexports.getAllVisitors = getAllVisitors;\nexports.transformVisitors = transformVisitors;\n\n},{\"./transforms/react\":38,\"./transforms/reactDisplayName\":39,\"jstransform/visitors/es6-arrow-function-visitors\":24,\"jstransform/visitors/es6-call-spread-visitors\":25,\"jstransform/visitors/es6-class-visitors\":26,\"jstransform/visitors/es6-destructuring-visitors\":27,\"jstransform/visitors/es6-object-concise-method-visitors\":28,\"jstransform/visitors/es6-object-short-notation-visitors\":29,\"jstransform/visitors/es6-rest-param-visitors\":30,\"jstransform/visitors/es6-template-visitors\":31,\"jstransform/visitors/es7-spread-property-visitors\":33,\"jstransform/visitors/reserved-words-visitors\":35}],41:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n'use strict';\n/*eslint-disable no-undef*/\nvar Buffer = _dereq_('buffer').Buffer;\n\nfunction inlineSourceMap(sourceMap, sourceCode, sourceFilename) {\n  // This can be used with a sourcemap that has already has toJSON called on it.\n  // Check first.\n  var json = sourceMap;\n  if (typeof sourceMap.toJSON === 'function') {\n    json = sourceMap.toJSON();\n  }\n  json.sources = [sourceFilename];\n  json.sourcesContent = [sourceCode];\n  var base64 = Buffer(JSON.stringify(json)).toString('base64');\n  return '//# sourceMappingURL=data:application/json;base64,' + base64;\n}\n\nmodule.exports = inlineSourceMap;\n\n},{\"buffer\":3}]},{},[1])(1)\n});"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/static/vendor/react/react-0.13.3.js",
    "content": "/**\n * React v0.13.3\n */\n(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.React = 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){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule React\n */\n\n/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/\n\n'use strict';\n\nvar EventPluginUtils = _dereq_(19);\nvar ReactChildren = _dereq_(32);\nvar ReactComponent = _dereq_(34);\nvar ReactClass = _dereq_(33);\nvar ReactContext = _dereq_(38);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactElement = _dereq_(57);\nvar ReactElementValidator = _dereq_(58);\nvar ReactDOM = _dereq_(40);\nvar ReactDOMTextComponent = _dereq_(51);\nvar ReactDefaultInjection = _dereq_(54);\nvar ReactInstanceHandles = _dereq_(66);\nvar ReactMount = _dereq_(70);\nvar ReactPerf = _dereq_(75);\nvar ReactPropTypes = _dereq_(78);\nvar ReactReconciler = _dereq_(81);\nvar ReactServerRendering = _dereq_(84);\n\nvar assign = _dereq_(27);\nvar findDOMNode = _dereq_(117);\nvar onlyChild = _dereq_(144);\n\nReactDefaultInjection.inject();\n\nvar createElement = ReactElement.createElement;\nvar createFactory = ReactElement.createFactory;\nvar cloneElement = ReactElement.cloneElement;\n\nif (\"production\" !== \"development\") {\n  createElement = ReactElementValidator.createElement;\n  createFactory = ReactElementValidator.createFactory;\n  cloneElement = ReactElementValidator.cloneElement;\n}\n\nvar render = ReactPerf.measure('React', 'render', ReactMount.render);\n\nvar React = {\n  Children: {\n    map: ReactChildren.map,\n    forEach: ReactChildren.forEach,\n    count: ReactChildren.count,\n    only: onlyChild\n  },\n  Component: ReactComponent,\n  DOM: ReactDOM,\n  PropTypes: ReactPropTypes,\n  initializeTouchEvents: function(shouldUseTouch) {\n    EventPluginUtils.useTouchEvents = shouldUseTouch;\n  },\n  createClass: ReactClass.createClass,\n  createElement: createElement,\n  cloneElement: cloneElement,\n  createFactory: createFactory,\n  createMixin: function(mixin) {\n    // Currently a noop. Will be used to validate and trace mixins.\n    return mixin;\n  },\n  constructAndRenderComponent: ReactMount.constructAndRenderComponent,\n  constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,\n  findDOMNode: findDOMNode,\n  render: render,\n  renderToString: ReactServerRendering.renderToString,\n  renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,\n  unmountComponentAtNode: ReactMount.unmountComponentAtNode,\n  isValidElement: ReactElement.isValidElement,\n  withContext: ReactContext.withContext,\n\n  // Hook for JSX spread, don't use this for anything else.\n  __spread: assign\n};\n\n// Inject the runtime into a devtools global hook regardless of browser.\n// Allows for debugging when the hook is injected on the page.\nif (\n  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {\n  __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({\n    CurrentOwner: ReactCurrentOwner,\n    InstanceHandles: ReactInstanceHandles,\n    Mount: ReactMount,\n    Reconciler: ReactReconciler,\n    TextComponent: ReactDOMTextComponent\n  });\n}\n\nif (\"production\" !== \"development\") {\n  var ExecutionEnvironment = _dereq_(21);\n  if (ExecutionEnvironment.canUseDOM && window.top === window.self) {\n\n    // If we're in Chrome, look for the devtools marker and provide a download\n    // link if not installed.\n    if (navigator.userAgent.indexOf('Chrome') > -1) {\n      if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {\n        console.debug(\n          'Download the React DevTools for a better development experience: ' +\n          'https://fb.me/react-devtools'\n        );\n      }\n    }\n\n    var expectedFeatures = [\n      // shims\n      Array.isArray,\n      Array.prototype.every,\n      Array.prototype.forEach,\n      Array.prototype.indexOf,\n      Array.prototype.map,\n      Date.now,\n      Function.prototype.bind,\n      Object.keys,\n      String.prototype.split,\n      String.prototype.trim,\n\n      // shams\n      Object.create,\n      Object.freeze\n    ];\n\n    for (var i = 0; i < expectedFeatures.length; i++) {\n      if (!expectedFeatures[i]) {\n        console.error(\n          'One or more ES5 shim/shams expected by React are not available: ' +\n          'https://fb.me/react-warning-polyfills'\n        );\n        break;\n      }\n    }\n  }\n}\n\nReact.version = '0.13.3';\n\nmodule.exports = React;\n\n},{\"117\":117,\"144\":144,\"19\":19,\"21\":21,\"27\":27,\"32\":32,\"33\":33,\"34\":34,\"38\":38,\"39\":39,\"40\":40,\"51\":51,\"54\":54,\"57\":57,\"58\":58,\"66\":66,\"70\":70,\"75\":75,\"78\":78,\"81\":81,\"84\":84}],2:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule AutoFocusMixin\n * @typechecks static-only\n */\n\n'use strict';\n\nvar focusNode = _dereq_(119);\n\nvar AutoFocusMixin = {\n  componentDidMount: function() {\n    if (this.props.autoFocus) {\n      focusNode(this.getDOMNode());\n    }\n  }\n};\n\nmodule.exports = AutoFocusMixin;\n\n},{\"119\":119}],3:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015 Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule BeforeInputEventPlugin\n * @typechecks static-only\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPropagators = _dereq_(20);\nvar ExecutionEnvironment = _dereq_(21);\nvar FallbackCompositionState = _dereq_(22);\nvar SyntheticCompositionEvent = _dereq_(93);\nvar SyntheticInputEvent = _dereq_(97);\n\nvar keyOf = _dereq_(141);\n\nvar END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space\nvar START_KEYCODE = 229;\n\nvar canUseCompositionEvent = (\n  ExecutionEnvironment.canUseDOM &&\n  'CompositionEvent' in window\n);\n\nvar documentMode = null;\nif (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {\n  documentMode = document.documentMode;\n}\n\n// Webkit offers a very useful `textInput` event that can be used to\n// directly represent `beforeInput`. The IE `textinput` event is not as\n// useful, so we don't use it.\nvar canUseTextInputEvent = (\n  ExecutionEnvironment.canUseDOM &&\n  'TextEvent' in window &&\n  !documentMode &&\n  !isPresto()\n);\n\n// In IE9+, we have access to composition events, but the data supplied\n// by the native compositionend event may be incorrect. Japanese ideographic\n// spaces, for instance (\\u3000) are not recorded correctly.\nvar useFallbackCompositionData = (\n  ExecutionEnvironment.canUseDOM &&\n  (\n    (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)\n  )\n);\n\n/**\n * Opera <= 12 includes TextEvent in window, but does not fire\n * text input events. Rely on keypress instead.\n */\nfunction isPresto() {\n  var opera = window.opera;\n  return (\n    typeof opera === 'object' &&\n    typeof opera.version === 'function' &&\n    parseInt(opera.version(), 10) <= 12\n  );\n}\n\nvar SPACEBAR_CODE = 32;\nvar SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\n// Events and their corresponding property names.\nvar eventTypes = {\n  beforeInput: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onBeforeInput: null}),\n      captured: keyOf({onBeforeInputCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topCompositionEnd,\n      topLevelTypes.topKeyPress,\n      topLevelTypes.topTextInput,\n      topLevelTypes.topPaste\n    ]\n  },\n  compositionEnd: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onCompositionEnd: null}),\n      captured: keyOf({onCompositionEndCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topBlur,\n      topLevelTypes.topCompositionEnd,\n      topLevelTypes.topKeyDown,\n      topLevelTypes.topKeyPress,\n      topLevelTypes.topKeyUp,\n      topLevelTypes.topMouseDown\n    ]\n  },\n  compositionStart: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onCompositionStart: null}),\n      captured: keyOf({onCompositionStartCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topBlur,\n      topLevelTypes.topCompositionStart,\n      topLevelTypes.topKeyDown,\n      topLevelTypes.topKeyPress,\n      topLevelTypes.topKeyUp,\n      topLevelTypes.topMouseDown\n    ]\n  },\n  compositionUpdate: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onCompositionUpdate: null}),\n      captured: keyOf({onCompositionUpdateCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topBlur,\n      topLevelTypes.topCompositionUpdate,\n      topLevelTypes.topKeyDown,\n      topLevelTypes.topKeyPress,\n      topLevelTypes.topKeyUp,\n      topLevelTypes.topMouseDown\n    ]\n  }\n};\n\n// Track whether we've ever handled a keypress on the space key.\nvar hasSpaceKeypress = false;\n\n/**\n * Return whether a native keypress event is assumed to be a command.\n * This is required because Firefox fires `keypress` events for key commands\n * (cut, copy, select-all, etc.) even though no character is inserted.\n */\nfunction isKeypressCommand(nativeEvent) {\n  return (\n    (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&\n    // ctrlKey && altKey is equivalent to AltGr, and is not a command.\n    !(nativeEvent.ctrlKey && nativeEvent.altKey)\n  );\n}\n\n\n/**\n * Translate native top level events into event types.\n *\n * @param {string} topLevelType\n * @return {object}\n */\nfunction getCompositionEventType(topLevelType) {\n  switch (topLevelType) {\n    case topLevelTypes.topCompositionStart:\n      return eventTypes.compositionStart;\n    case topLevelTypes.topCompositionEnd:\n      return eventTypes.compositionEnd;\n    case topLevelTypes.topCompositionUpdate:\n      return eventTypes.compositionUpdate;\n  }\n}\n\n/**\n * Does our fallback best-guess model think this event signifies that\n * composition has begun?\n *\n * @param {string} topLevelType\n * @param {object} nativeEvent\n * @return {boolean}\n */\nfunction isFallbackCompositionStart(topLevelType, nativeEvent) {\n  return (\n    topLevelType === topLevelTypes.topKeyDown &&\n    nativeEvent.keyCode === START_KEYCODE\n  );\n}\n\n/**\n * Does our fallback mode think that this event is the end of composition?\n *\n * @param {string} topLevelType\n * @param {object} nativeEvent\n * @return {boolean}\n */\nfunction isFallbackCompositionEnd(topLevelType, nativeEvent) {\n  switch (topLevelType) {\n    case topLevelTypes.topKeyUp:\n      // Command keys insert or clear IME input.\n      return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);\n    case topLevelTypes.topKeyDown:\n      // Expect IME keyCode on each keydown. If we get any other\n      // code we must have exited earlier.\n      return (nativeEvent.keyCode !== START_KEYCODE);\n    case topLevelTypes.topKeyPress:\n    case topLevelTypes.topMouseDown:\n    case topLevelTypes.topBlur:\n      // Events are not possible without cancelling IME.\n      return true;\n    default:\n      return false;\n  }\n}\n\n/**\n * Google Input Tools provides composition data via a CustomEvent,\n * with the `data` property populated in the `detail` object. If this\n * is available on the event object, use it. If not, this is a plain\n * composition event and we have nothing special to extract.\n *\n * @param {object} nativeEvent\n * @return {?string}\n */\nfunction getDataFromCustomEvent(nativeEvent) {\n  var detail = nativeEvent.detail;\n  if (typeof detail === 'object' && 'data' in detail) {\n    return detail.data;\n  }\n  return null;\n}\n\n// Track the current IME composition fallback object, if any.\nvar currentComposition = null;\n\n/**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {?object} A SyntheticCompositionEvent.\n */\nfunction extractCompositionEvent(\n  topLevelType,\n  topLevelTarget,\n  topLevelTargetID,\n  nativeEvent\n) {\n  var eventType;\n  var fallbackData;\n\n  if (canUseCompositionEvent) {\n    eventType = getCompositionEventType(topLevelType);\n  } else if (!currentComposition) {\n    if (isFallbackCompositionStart(topLevelType, nativeEvent)) {\n      eventType = eventTypes.compositionStart;\n    }\n  } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {\n    eventType = eventTypes.compositionEnd;\n  }\n\n  if (!eventType) {\n    return null;\n  }\n\n  if (useFallbackCompositionData) {\n    // The current composition is stored statically and must not be\n    // overwritten while composition continues.\n    if (!currentComposition && eventType === eventTypes.compositionStart) {\n      currentComposition = FallbackCompositionState.getPooled(topLevelTarget);\n    } else if (eventType === eventTypes.compositionEnd) {\n      if (currentComposition) {\n        fallbackData = currentComposition.getData();\n      }\n    }\n  }\n\n  var event = SyntheticCompositionEvent.getPooled(\n    eventType,\n    topLevelTargetID,\n    nativeEvent\n  );\n\n  if (fallbackData) {\n    // Inject data generated from fallback path into the synthetic event.\n    // This matches the property of native CompositionEventInterface.\n    event.data = fallbackData;\n  } else {\n    var customData = getDataFromCustomEvent(nativeEvent);\n    if (customData !== null) {\n      event.data = customData;\n    }\n  }\n\n  EventPropagators.accumulateTwoPhaseDispatches(event);\n  return event;\n}\n\n/**\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {object} nativeEvent Native browser event.\n * @return {?string} The string corresponding to this `beforeInput` event.\n */\nfunction getNativeBeforeInputChars(topLevelType, nativeEvent) {\n  switch (topLevelType) {\n    case topLevelTypes.topCompositionEnd:\n      return getDataFromCustomEvent(nativeEvent);\n    case topLevelTypes.topKeyPress:\n      /**\n       * If native `textInput` events are available, our goal is to make\n       * use of them. However, there is a special case: the spacebar key.\n       * In Webkit, preventing default on a spacebar `textInput` event\n       * cancels character insertion, but it *also* causes the browser\n       * to fall back to its default spacebar behavior of scrolling the\n       * page.\n       *\n       * Tracking at:\n       * https://code.google.com/p/chromium/issues/detail?id=355103\n       *\n       * To avoid this issue, use the keypress event as if no `textInput`\n       * event is available.\n       */\n      var which = nativeEvent.which;\n      if (which !== SPACEBAR_CODE) {\n        return null;\n      }\n\n      hasSpaceKeypress = true;\n      return SPACEBAR_CHAR;\n\n    case topLevelTypes.topTextInput:\n      // Record the characters to be added to the DOM.\n      var chars = nativeEvent.data;\n\n      // If it's a spacebar character, assume that we have already handled\n      // it at the keypress level and bail immediately. Android Chrome\n      // doesn't give us keycodes, so we need to blacklist it.\n      if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {\n        return null;\n      }\n\n      return chars;\n\n    default:\n      // For other native event types, do nothing.\n      return null;\n  }\n}\n\n/**\n * For browsers that do not provide the `textInput` event, extract the\n * appropriate string to use for SyntheticInputEvent.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {object} nativeEvent Native browser event.\n * @return {?string} The fallback string for this `beforeInput` event.\n */\nfunction getFallbackBeforeInputChars(topLevelType, nativeEvent) {\n  // If we are currently composing (IME) and using a fallback to do so,\n  // try to extract the composed characters from the fallback object.\n  if (currentComposition) {\n    if (\n      topLevelType === topLevelTypes.topCompositionEnd ||\n      isFallbackCompositionEnd(topLevelType, nativeEvent)\n    ) {\n      var chars = currentComposition.getData();\n      FallbackCompositionState.release(currentComposition);\n      currentComposition = null;\n      return chars;\n    }\n    return null;\n  }\n\n  switch (topLevelType) {\n    case topLevelTypes.topPaste:\n      // If a paste event occurs after a keypress, throw out the input\n      // chars. Paste events should not lead to BeforeInput events.\n      return null;\n    case topLevelTypes.topKeyPress:\n      /**\n       * As of v27, Firefox may fire keypress events even when no character\n       * will be inserted. A few possibilities:\n       *\n       * - `which` is `0`. Arrow keys, Esc key, etc.\n       *\n       * - `which` is the pressed key code, but no char is available.\n       *   Ex: 'AltGr + d` in Polish. There is no modified character for\n       *   this key combination and no character is inserted into the\n       *   document, but FF fires the keypress for char code `100` anyway.\n       *   No `input` event will occur.\n       *\n       * - `which` is the pressed key code, but a command combination is\n       *   being used. Ex: `Cmd+C`. No character is inserted, and no\n       *   `input` event will occur.\n       */\n      if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {\n        return String.fromCharCode(nativeEvent.which);\n      }\n      return null;\n    case topLevelTypes.topCompositionEnd:\n      return useFallbackCompositionData ? null : nativeEvent.data;\n    default:\n      return null;\n  }\n}\n\n/**\n * Extract a SyntheticInputEvent for `beforeInput`, based on either native\n * `textInput` or fallback behavior.\n *\n * @param {string} topLevelType Record from `EventConstants`.\n * @param {DOMEventTarget} topLevelTarget The listening component root node.\n * @param {string} topLevelTargetID ID of `topLevelTarget`.\n * @param {object} nativeEvent Native browser event.\n * @return {?object} A SyntheticInputEvent.\n */\nfunction extractBeforeInputEvent(\n  topLevelType,\n  topLevelTarget,\n  topLevelTargetID,\n  nativeEvent\n) {\n  var chars;\n\n  if (canUseTextInputEvent) {\n    chars = getNativeBeforeInputChars(topLevelType, nativeEvent);\n  } else {\n    chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);\n  }\n\n  // If no characters are being inserted, no BeforeInput event should\n  // be fired.\n  if (!chars) {\n    return null;\n  }\n\n  var event = SyntheticInputEvent.getPooled(\n    eventTypes.beforeInput,\n    topLevelTargetID,\n    nativeEvent\n  );\n\n  event.data = chars;\n  EventPropagators.accumulateTwoPhaseDispatches(event);\n  return event;\n}\n\n/**\n * Create an `onBeforeInput` event to match\n * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.\n *\n * This event plugin is based on the native `textInput` event\n * available in Chrome, Safari, Opera, and IE. This event fires after\n * `onKeyPress` and `onCompositionEnd`, but before `onInput`.\n *\n * `beforeInput` is spec'd but not implemented in any browsers, and\n * the `input` event does not provide any useful information about what has\n * actually been added, contrary to the spec. Thus, `textInput` is the best\n * available event to identify the characters that have actually been inserted\n * into the target node.\n *\n * This plugin is also responsible for emitting `composition` events, thus\n * allowing us to share composition fallback code for both `beforeInput` and\n * `composition` event types.\n */\nvar BeforeInputEventPlugin = {\n\n  eventTypes: eventTypes,\n\n  /**\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID,\n    nativeEvent\n  ) {\n    return [\n      extractCompositionEvent(\n        topLevelType,\n        topLevelTarget,\n        topLevelTargetID,\n        nativeEvent\n      ),\n      extractBeforeInputEvent(\n        topLevelType,\n        topLevelTarget,\n        topLevelTargetID,\n        nativeEvent\n      )\n    ];\n  }\n};\n\nmodule.exports = BeforeInputEventPlugin;\n\n},{\"141\":141,\"15\":15,\"20\":20,\"21\":21,\"22\":22,\"93\":93,\"97\":97}],4:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule CSSProperty\n */\n\n'use strict';\n\n/**\n * CSS properties which accept numbers but are not in units of \"px\".\n */\nvar isUnitlessNumber = {\n  boxFlex: true,\n  boxFlexGroup: true,\n  columnCount: true,\n  flex: true,\n  flexGrow: true,\n  flexPositive: true,\n  flexShrink: true,\n  flexNegative: true,\n  fontWeight: true,\n  lineClamp: true,\n  lineHeight: true,\n  opacity: true,\n  order: true,\n  orphans: true,\n  widows: true,\n  zIndex: true,\n  zoom: true,\n\n  // SVG-related properties\n  fillOpacity: true,\n  strokeDashoffset: true,\n  strokeOpacity: true,\n  strokeWidth: true\n};\n\n/**\n * @param {string} prefix vendor-specific prefix, eg: Webkit\n * @param {string} key style name, eg: transitionDuration\n * @return {string} style name prefixed with `prefix`, properly camelCased, eg:\n * WebkitTransitionDuration\n */\nfunction prefixKey(prefix, key) {\n  return prefix + key.charAt(0).toUpperCase() + key.substring(1);\n}\n\n/**\n * Support style names that may come passed in prefixed by adding permutations\n * of vendor prefixes.\n */\nvar prefixes = ['Webkit', 'ms', 'Moz', 'O'];\n\n// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an\n// infinite loop, because it iterates over the newly added props too.\nObject.keys(isUnitlessNumber).forEach(function(prop) {\n  prefixes.forEach(function(prefix) {\n    isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];\n  });\n});\n\n/**\n * Most style properties can be unset by doing .style[prop] = '' but IE8\n * doesn't like doing that with shorthand properties so for the properties that\n * IE8 breaks on, which are listed here, we instead unset each of the\n * individual properties. See http://bugs.jquery.com/ticket/12385.\n * The 4-value 'clock' properties like margin, padding, border-width seem to\n * behave without any problems. Curiously, list-style works too without any\n * special prodding.\n */\nvar shorthandPropertyExpansions = {\n  background: {\n    backgroundImage: true,\n    backgroundPosition: true,\n    backgroundRepeat: true,\n    backgroundColor: true\n  },\n  border: {\n    borderWidth: true,\n    borderStyle: true,\n    borderColor: true\n  },\n  borderBottom: {\n    borderBottomWidth: true,\n    borderBottomStyle: true,\n    borderBottomColor: true\n  },\n  borderLeft: {\n    borderLeftWidth: true,\n    borderLeftStyle: true,\n    borderLeftColor: true\n  },\n  borderRight: {\n    borderRightWidth: true,\n    borderRightStyle: true,\n    borderRightColor: true\n  },\n  borderTop: {\n    borderTopWidth: true,\n    borderTopStyle: true,\n    borderTopColor: true\n  },\n  font: {\n    fontStyle: true,\n    fontVariant: true,\n    fontWeight: true,\n    fontSize: true,\n    lineHeight: true,\n    fontFamily: true\n  }\n};\n\nvar CSSProperty = {\n  isUnitlessNumber: isUnitlessNumber,\n  shorthandPropertyExpansions: shorthandPropertyExpansions\n};\n\nmodule.exports = CSSProperty;\n\n},{}],5:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule CSSPropertyOperations\n * @typechecks static-only\n */\n\n'use strict';\n\nvar CSSProperty = _dereq_(4);\nvar ExecutionEnvironment = _dereq_(21);\n\nvar camelizeStyleName = _dereq_(108);\nvar dangerousStyleValue = _dereq_(113);\nvar hyphenateStyleName = _dereq_(133);\nvar memoizeStringOnly = _dereq_(143);\nvar warning = _dereq_(154);\n\nvar processStyleName = memoizeStringOnly(function(styleName) {\n  return hyphenateStyleName(styleName);\n});\n\nvar styleFloatAccessor = 'cssFloat';\nif (ExecutionEnvironment.canUseDOM) {\n  // IE8 only supports accessing cssFloat (standard) as styleFloat\n  if (document.documentElement.style.cssFloat === undefined) {\n    styleFloatAccessor = 'styleFloat';\n  }\n}\n\nif (\"production\" !== \"development\") {\n  // 'msTransform' is correct, but the other prefixes should be capitalized\n  var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;\n\n  // style values shouldn't contain a semicolon\n  var badStyleValueWithSemicolonPattern = /;\\s*$/;\n\n  var warnedStyleNames = {};\n  var warnedStyleValues = {};\n\n  var warnHyphenatedStyleName = function(name) {\n    if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {\n      return;\n    }\n\n    warnedStyleNames[name] = true;\n    (\"production\" !== \"development\" ? warning(\n      false,\n      'Unsupported style property %s. Did you mean %s?',\n      name,\n      camelizeStyleName(name)\n    ) : null);\n  };\n\n  var warnBadVendoredStyleName = function(name) {\n    if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {\n      return;\n    }\n\n    warnedStyleNames[name] = true;\n    (\"production\" !== \"development\" ? warning(\n      false,\n      'Unsupported vendor-prefixed style property %s. Did you mean %s?',\n      name,\n      name.charAt(0).toUpperCase() + name.slice(1)\n    ) : null);\n  };\n\n  var warnStyleValueWithSemicolon = function(name, value) {\n    if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {\n      return;\n    }\n\n    warnedStyleValues[value] = true;\n    (\"production\" !== \"development\" ? warning(\n      false,\n      'Style property values shouldn\\'t contain a semicolon. ' +\n      'Try \"%s: %s\" instead.',\n      name,\n      value.replace(badStyleValueWithSemicolonPattern, '')\n    ) : null);\n  };\n\n  /**\n   * @param {string} name\n   * @param {*} value\n   */\n  var warnValidStyle = function(name, value) {\n    if (name.indexOf('-') > -1) {\n      warnHyphenatedStyleName(name);\n    } else if (badVendoredStyleNamePattern.test(name)) {\n      warnBadVendoredStyleName(name);\n    } else if (badStyleValueWithSemicolonPattern.test(value)) {\n      warnStyleValueWithSemicolon(name, value);\n    }\n  };\n}\n\n/**\n * Operations for dealing with CSS properties.\n */\nvar CSSPropertyOperations = {\n\n  /**\n   * Serializes a mapping of style properties for use as inline styles:\n   *\n   *   > createMarkupForStyles({width: '200px', height: 0})\n   *   \"width:200px;height:0;\"\n   *\n   * Undefined values are ignored so that declarative programming is easier.\n   * The result should be HTML-escaped before insertion into the DOM.\n   *\n   * @param {object} styles\n   * @return {?string}\n   */\n  createMarkupForStyles: function(styles) {\n    var serialized = '';\n    for (var styleName in styles) {\n      if (!styles.hasOwnProperty(styleName)) {\n        continue;\n      }\n      var styleValue = styles[styleName];\n      if (\"production\" !== \"development\") {\n        warnValidStyle(styleName, styleValue);\n      }\n      if (styleValue != null) {\n        serialized += processStyleName(styleName) + ':';\n        serialized += dangerousStyleValue(styleName, styleValue) + ';';\n      }\n    }\n    return serialized || null;\n  },\n\n  /**\n   * Sets the value for multiple styles on a node.  If a value is specified as\n   * '' (empty string), the corresponding style property will be unset.\n   *\n   * @param {DOMElement} node\n   * @param {object} styles\n   */\n  setValueForStyles: function(node, styles) {\n    var style = node.style;\n    for (var styleName in styles) {\n      if (!styles.hasOwnProperty(styleName)) {\n        continue;\n      }\n      if (\"production\" !== \"development\") {\n        warnValidStyle(styleName, styles[styleName]);\n      }\n      var styleValue = dangerousStyleValue(styleName, styles[styleName]);\n      if (styleName === 'float') {\n        styleName = styleFloatAccessor;\n      }\n      if (styleValue) {\n        style[styleName] = styleValue;\n      } else {\n        var expansion = CSSProperty.shorthandPropertyExpansions[styleName];\n        if (expansion) {\n          // Shorthand property that IE8 won't like unsetting, so unset each\n          // component to placate it\n          for (var individualStyleName in expansion) {\n            style[individualStyleName] = '';\n          }\n        } else {\n          style[styleName] = '';\n        }\n      }\n    }\n  }\n\n};\n\nmodule.exports = CSSPropertyOperations;\n\n},{\"108\":108,\"113\":113,\"133\":133,\"143\":143,\"154\":154,\"21\":21,\"4\":4}],6:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule CallbackQueue\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\n\n/**\n * A specialized pseudo-event module to help keep track of components waiting to\n * be notified when their DOM representations are available for use.\n *\n * This implements `PooledClass`, so you should never need to instantiate this.\n * Instead, use `CallbackQueue.getPooled()`.\n *\n * @class ReactMountReady\n * @implements PooledClass\n * @internal\n */\nfunction CallbackQueue() {\n  this._callbacks = null;\n  this._contexts = null;\n}\n\nassign(CallbackQueue.prototype, {\n\n  /**\n   * Enqueues a callback to be invoked when `notifyAll` is invoked.\n   *\n   * @param {function} callback Invoked when `notifyAll` is invoked.\n   * @param {?object} context Context to call `callback` with.\n   * @internal\n   */\n  enqueue: function(callback, context) {\n    this._callbacks = this._callbacks || [];\n    this._contexts = this._contexts || [];\n    this._callbacks.push(callback);\n    this._contexts.push(context);\n  },\n\n  /**\n   * Invokes all enqueued callbacks and clears the queue. This is invoked after\n   * the DOM representation of a component has been created or updated.\n   *\n   * @internal\n   */\n  notifyAll: function() {\n    var callbacks = this._callbacks;\n    var contexts = this._contexts;\n    if (callbacks) {\n      (\"production\" !== \"development\" ? invariant(\n        callbacks.length === contexts.length,\n        'Mismatched list of contexts in callback queue'\n      ) : invariant(callbacks.length === contexts.length));\n      this._callbacks = null;\n      this._contexts = null;\n      for (var i = 0, l = callbacks.length; i < l; i++) {\n        callbacks[i].call(contexts[i]);\n      }\n      callbacks.length = 0;\n      contexts.length = 0;\n    }\n  },\n\n  /**\n   * Resets the internal queue.\n   *\n   * @internal\n   */\n  reset: function() {\n    this._callbacks = null;\n    this._contexts = null;\n  },\n\n  /**\n   * `PooledClass` looks for this.\n   */\n  destructor: function() {\n    this.reset();\n  }\n\n});\n\nPooledClass.addPoolingTo(CallbackQueue);\n\nmodule.exports = CallbackQueue;\n\n},{\"135\":135,\"27\":27,\"28\":28}],7:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ChangeEventPlugin\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPluginHub = _dereq_(17);\nvar EventPropagators = _dereq_(20);\nvar ExecutionEnvironment = _dereq_(21);\nvar ReactUpdates = _dereq_(87);\nvar SyntheticEvent = _dereq_(95);\n\nvar isEventSupported = _dereq_(136);\nvar isTextInputElement = _dereq_(138);\nvar keyOf = _dereq_(141);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n  change: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onChange: null}),\n      captured: keyOf({onChangeCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topBlur,\n      topLevelTypes.topChange,\n      topLevelTypes.topClick,\n      topLevelTypes.topFocus,\n      topLevelTypes.topInput,\n      topLevelTypes.topKeyDown,\n      topLevelTypes.topKeyUp,\n      topLevelTypes.topSelectionChange\n    ]\n  }\n};\n\n/**\n * For IE shims\n */\nvar activeElement = null;\nvar activeElementID = null;\nvar activeElementValue = null;\nvar activeElementValueProp = null;\n\n/**\n * SECTION: handle `change` event\n */\nfunction shouldUseChangeEvent(elem) {\n  return (\n    elem.nodeName === 'SELECT' ||\n    (elem.nodeName === 'INPUT' && elem.type === 'file')\n  );\n}\n\nvar doesChangeEventBubble = false;\nif (ExecutionEnvironment.canUseDOM) {\n  // See `handleChange` comment below\n  doesChangeEventBubble = isEventSupported('change') && (\n    (!('documentMode' in document) || document.documentMode > 8)\n  );\n}\n\nfunction manualDispatchChangeEvent(nativeEvent) {\n  var event = SyntheticEvent.getPooled(\n    eventTypes.change,\n    activeElementID,\n    nativeEvent\n  );\n  EventPropagators.accumulateTwoPhaseDispatches(event);\n\n  // If change and propertychange bubbled, we'd just bind to it like all the\n  // other events and have it go through ReactBrowserEventEmitter. Since it\n  // doesn't, we manually listen for the events and so we have to enqueue and\n  // process the abstract event manually.\n  //\n  // Batching is necessary here in order to ensure that all event handlers run\n  // before the next rerender (including event handlers attached to ancestor\n  // elements instead of directly on the input). Without this, controlled\n  // components don't work properly in conjunction with event bubbling because\n  // the component is rerendered and the value reverted before all the event\n  // handlers can run. See https://github.com/facebook/react/issues/708.\n  ReactUpdates.batchedUpdates(runEventInBatch, event);\n}\n\nfunction runEventInBatch(event) {\n  EventPluginHub.enqueueEvents(event);\n  EventPluginHub.processEventQueue();\n}\n\nfunction startWatchingForChangeEventIE8(target, targetID) {\n  activeElement = target;\n  activeElementID = targetID;\n  activeElement.attachEvent('onchange', manualDispatchChangeEvent);\n}\n\nfunction stopWatchingForChangeEventIE8() {\n  if (!activeElement) {\n    return;\n  }\n  activeElement.detachEvent('onchange', manualDispatchChangeEvent);\n  activeElement = null;\n  activeElementID = null;\n}\n\nfunction getTargetIDForChangeEvent(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topChange) {\n    return topLevelTargetID;\n  }\n}\nfunction handleEventsForChangeEventIE8(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topFocus) {\n    // stopWatching() should be a noop here but we call it just in case we\n    // missed a blur event somehow.\n    stopWatchingForChangeEventIE8();\n    startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);\n  } else if (topLevelType === topLevelTypes.topBlur) {\n    stopWatchingForChangeEventIE8();\n  }\n}\n\n\n/**\n * SECTION: handle `input` event\n */\nvar isInputEventSupported = false;\nif (ExecutionEnvironment.canUseDOM) {\n  // IE9 claims to support the input event but fails to trigger it when\n  // deleting text, so we ignore its input events\n  isInputEventSupported = isEventSupported('input') && (\n    (!('documentMode' in document) || document.documentMode > 9)\n  );\n}\n\n/**\n * (For old IE.) Replacement getter/setter for the `value` property that gets\n * set on the active element.\n */\nvar newValueProp =  {\n  get: function() {\n    return activeElementValueProp.get.call(this);\n  },\n  set: function(val) {\n    // Cast to a string so we can do equality checks.\n    activeElementValue = '' + val;\n    activeElementValueProp.set.call(this, val);\n  }\n};\n\n/**\n * (For old IE.) Starts tracking propertychange events on the passed-in element\n * and override the value property so that we can distinguish user events from\n * value changes in JS.\n */\nfunction startWatchingForValueChange(target, targetID) {\n  activeElement = target;\n  activeElementID = targetID;\n  activeElementValue = target.value;\n  activeElementValueProp = Object.getOwnPropertyDescriptor(\n    target.constructor.prototype,\n    'value'\n  );\n\n  Object.defineProperty(activeElement, 'value', newValueProp);\n  activeElement.attachEvent('onpropertychange', handlePropertyChange);\n}\n\n/**\n * (For old IE.) Removes the event listeners from the currently-tracked element,\n * if any exists.\n */\nfunction stopWatchingForValueChange() {\n  if (!activeElement) {\n    return;\n  }\n\n  // delete restores the original property definition\n  delete activeElement.value;\n  activeElement.detachEvent('onpropertychange', handlePropertyChange);\n\n  activeElement = null;\n  activeElementID = null;\n  activeElementValue = null;\n  activeElementValueProp = null;\n}\n\n/**\n * (For old IE.) Handles a propertychange event, sending a `change` event if\n * the value of the active element has changed.\n */\nfunction handlePropertyChange(nativeEvent) {\n  if (nativeEvent.propertyName !== 'value') {\n    return;\n  }\n  var value = nativeEvent.srcElement.value;\n  if (value === activeElementValue) {\n    return;\n  }\n  activeElementValue = value;\n\n  manualDispatchChangeEvent(nativeEvent);\n}\n\n/**\n * If a `change` event should be fired, returns the target's ID.\n */\nfunction getTargetIDForInputEvent(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topInput) {\n    // In modern browsers (i.e., not IE8 or IE9), the input event is exactly\n    // what we want so fall through here and trigger an abstract event\n    return topLevelTargetID;\n  }\n}\n\n// For IE8 and IE9.\nfunction handleEventsForInputEventIE(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topFocus) {\n    // In IE8, we can capture almost all .value changes by adding a\n    // propertychange handler and looking for events with propertyName\n    // equal to 'value'\n    // In IE9, propertychange fires for most input events but is buggy and\n    // doesn't fire when text is deleted, but conveniently, selectionchange\n    // appears to fire in all of the remaining cases so we catch those and\n    // forward the event if the value has changed\n    // In either case, we don't want to call the event handler if the value\n    // is changed from JS so we redefine a setter for `.value` that updates\n    // our activeElementValue variable, allowing us to ignore those changes\n    //\n    // stopWatching() should be a noop here but we call it just in case we\n    // missed a blur event somehow.\n    stopWatchingForValueChange();\n    startWatchingForValueChange(topLevelTarget, topLevelTargetID);\n  } else if (topLevelType === topLevelTypes.topBlur) {\n    stopWatchingForValueChange();\n  }\n}\n\n// For IE8 and IE9.\nfunction getTargetIDForInputEventIE(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topSelectionChange ||\n      topLevelType === topLevelTypes.topKeyUp ||\n      topLevelType === topLevelTypes.topKeyDown) {\n    // On the selectionchange event, the target is just document which isn't\n    // helpful for us so just check activeElement instead.\n    //\n    // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire\n    // propertychange on the first input event after setting `value` from a\n    // script and fires only keydown, keypress, keyup. Catching keyup usually\n    // gets it and catching keydown lets us fire an event for the first\n    // keystroke if user does a key repeat (it'll be a little delayed: right\n    // before the second keystroke). Other input methods (e.g., paste) seem to\n    // fire selectionchange normally.\n    if (activeElement && activeElement.value !== activeElementValue) {\n      activeElementValue = activeElement.value;\n      return activeElementID;\n    }\n  }\n}\n\n\n/**\n * SECTION: handle `click` event\n */\nfunction shouldUseClickEvent(elem) {\n  // Use the `click` event to detect changes to checkbox and radio inputs.\n  // This approach works across all browsers, whereas `change` does not fire\n  // until `blur` in IE8.\n  return (\n    elem.nodeName === 'INPUT' &&\n    (elem.type === 'checkbox' || elem.type === 'radio')\n  );\n}\n\nfunction getTargetIDForClickEvent(\n    topLevelType,\n    topLevelTarget,\n    topLevelTargetID) {\n  if (topLevelType === topLevelTypes.topClick) {\n    return topLevelTargetID;\n  }\n}\n\n/**\n * This plugin creates an `onChange` event that normalizes change events\n * across form elements. This event fires at a time when it's possible to\n * change the element's value without seeing a flicker.\n *\n * Supported elements are:\n * - input (see `isTextInputElement`)\n * - textarea\n * - select\n */\nvar ChangeEventPlugin = {\n\n  eventTypes: eventTypes,\n\n  /**\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n\n    var getTargetIDFunc, handleEventFunc;\n    if (shouldUseChangeEvent(topLevelTarget)) {\n      if (doesChangeEventBubble) {\n        getTargetIDFunc = getTargetIDForChangeEvent;\n      } else {\n        handleEventFunc = handleEventsForChangeEventIE8;\n      }\n    } else if (isTextInputElement(topLevelTarget)) {\n      if (isInputEventSupported) {\n        getTargetIDFunc = getTargetIDForInputEvent;\n      } else {\n        getTargetIDFunc = getTargetIDForInputEventIE;\n        handleEventFunc = handleEventsForInputEventIE;\n      }\n    } else if (shouldUseClickEvent(topLevelTarget)) {\n      getTargetIDFunc = getTargetIDForClickEvent;\n    }\n\n    if (getTargetIDFunc) {\n      var targetID = getTargetIDFunc(\n        topLevelType,\n        topLevelTarget,\n        topLevelTargetID\n      );\n      if (targetID) {\n        var event = SyntheticEvent.getPooled(\n          eventTypes.change,\n          targetID,\n          nativeEvent\n        );\n        EventPropagators.accumulateTwoPhaseDispatches(event);\n        return event;\n      }\n    }\n\n    if (handleEventFunc) {\n      handleEventFunc(\n        topLevelType,\n        topLevelTarget,\n        topLevelTargetID\n      );\n    }\n  }\n\n};\n\nmodule.exports = ChangeEventPlugin;\n\n},{\"136\":136,\"138\":138,\"141\":141,\"15\":15,\"17\":17,\"20\":20,\"21\":21,\"87\":87,\"95\":95}],8:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ClientReactRootIndex\n * @typechecks\n */\n\n'use strict';\n\nvar nextReactRootIndex = 0;\n\nvar ClientReactRootIndex = {\n  createReactRootIndex: function() {\n    return nextReactRootIndex++;\n  }\n};\n\nmodule.exports = ClientReactRootIndex;\n\n},{}],9:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule DOMChildrenOperations\n * @typechecks static-only\n */\n\n'use strict';\n\nvar Danger = _dereq_(12);\nvar ReactMultiChildUpdateTypes = _dereq_(72);\n\nvar setTextContent = _dereq_(149);\nvar invariant = _dereq_(135);\n\n/**\n * Inserts `childNode` as a child of `parentNode` at the `index`.\n *\n * @param {DOMElement} parentNode Parent node in which to insert.\n * @param {DOMElement} childNode Child node to insert.\n * @param {number} index Index at which to insert the child.\n * @internal\n */\nfunction insertChildAt(parentNode, childNode, index) {\n  // By exploiting arrays returning `undefined` for an undefined index, we can\n  // rely exclusively on `insertBefore(node, null)` instead of also using\n  // `appendChild(node)`. However, using `undefined` is not allowed by all\n  // browsers so we must replace it with `null`.\n  parentNode.insertBefore(\n    childNode,\n    parentNode.childNodes[index] || null\n  );\n}\n\n/**\n * Operations for updating with DOM children.\n */\nvar DOMChildrenOperations = {\n\n  dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,\n\n  updateTextContent: setTextContent,\n\n  /**\n   * Updates a component's children by processing a series of updates. The\n   * update configurations are each expected to have a `parentNode` property.\n   *\n   * @param {array<object>} updates List of update configurations.\n   * @param {array<string>} markupList List of markup strings.\n   * @internal\n   */\n  processUpdates: function(updates, markupList) {\n    var update;\n    // Mapping from parent IDs to initial child orderings.\n    var initialChildren = null;\n    // List of children that will be moved or removed.\n    var updatedChildren = null;\n\n    for (var i = 0; i < updates.length; i++) {\n      update = updates[i];\n      if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||\n          update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {\n        var updatedIndex = update.fromIndex;\n        var updatedChild = update.parentNode.childNodes[updatedIndex];\n        var parentID = update.parentID;\n\n        (\"production\" !== \"development\" ? invariant(\n          updatedChild,\n          'processUpdates(): Unable to find child %s of element. This ' +\n          'probably means the DOM was unexpectedly mutated (e.g., by the ' +\n          'browser), usually due to forgetting a <tbody> when using tables, ' +\n          'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +\n          'in an <svg> parent. Try inspecting the child nodes of the element ' +\n          'with React ID `%s`.',\n          updatedIndex,\n          parentID\n        ) : invariant(updatedChild));\n\n        initialChildren = initialChildren || {};\n        initialChildren[parentID] = initialChildren[parentID] || [];\n        initialChildren[parentID][updatedIndex] = updatedChild;\n\n        updatedChildren = updatedChildren || [];\n        updatedChildren.push(updatedChild);\n      }\n    }\n\n    var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);\n\n    // Remove updated children first so that `toIndex` is consistent.\n    if (updatedChildren) {\n      for (var j = 0; j < updatedChildren.length; j++) {\n        updatedChildren[j].parentNode.removeChild(updatedChildren[j]);\n      }\n    }\n\n    for (var k = 0; k < updates.length; k++) {\n      update = updates[k];\n      switch (update.type) {\n        case ReactMultiChildUpdateTypes.INSERT_MARKUP:\n          insertChildAt(\n            update.parentNode,\n            renderedMarkup[update.markupIndex],\n            update.toIndex\n          );\n          break;\n        case ReactMultiChildUpdateTypes.MOVE_EXISTING:\n          insertChildAt(\n            update.parentNode,\n            initialChildren[update.parentID][update.fromIndex],\n            update.toIndex\n          );\n          break;\n        case ReactMultiChildUpdateTypes.TEXT_CONTENT:\n          setTextContent(\n            update.parentNode,\n            update.textContent\n          );\n          break;\n        case ReactMultiChildUpdateTypes.REMOVE_NODE:\n          // Already removed by the for-loop above.\n          break;\n      }\n    }\n  }\n\n};\n\nmodule.exports = DOMChildrenOperations;\n\n},{\"12\":12,\"135\":135,\"149\":149,\"72\":72}],10:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule DOMProperty\n * @typechecks static-only\n */\n\n/*jslint bitwise: true */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\nfunction checkMask(value, bitmask) {\n  return (value & bitmask) === bitmask;\n}\n\nvar DOMPropertyInjection = {\n  /**\n   * Mapping from normalized, camelcased property names to a configuration that\n   * specifies how the associated DOM property should be accessed or rendered.\n   */\n  MUST_USE_ATTRIBUTE: 0x1,\n  MUST_USE_PROPERTY: 0x2,\n  HAS_SIDE_EFFECTS: 0x4,\n  HAS_BOOLEAN_VALUE: 0x8,\n  HAS_NUMERIC_VALUE: 0x10,\n  HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,\n  HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,\n\n  /**\n   * Inject some specialized knowledge about the DOM. This takes a config object\n   * with the following properties:\n   *\n   * isCustomAttribute: function that given an attribute name will return true\n   * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*\n   * attributes where it's impossible to enumerate all of the possible\n   * attribute names,\n   *\n   * Properties: object mapping DOM property name to one of the\n   * DOMPropertyInjection constants or null. If your attribute isn't in here,\n   * it won't get written to the DOM.\n   *\n   * DOMAttributeNames: object mapping React attribute name to the DOM\n   * attribute name. Attribute names not specified use the **lowercase**\n   * normalized name.\n   *\n   * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.\n   * Property names not specified use the normalized name.\n   *\n   * DOMMutationMethods: Properties that require special mutation methods. If\n   * `value` is undefined, the mutation method should unset the property.\n   *\n   * @param {object} domPropertyConfig the config as described above.\n   */\n  injectDOMPropertyConfig: function(domPropertyConfig) {\n    var Properties = domPropertyConfig.Properties || {};\n    var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};\n    var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};\n    var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};\n\n    if (domPropertyConfig.isCustomAttribute) {\n      DOMProperty._isCustomAttributeFunctions.push(\n        domPropertyConfig.isCustomAttribute\n      );\n    }\n\n    for (var propName in Properties) {\n      (\"production\" !== \"development\" ? invariant(\n        !DOMProperty.isStandardName.hasOwnProperty(propName),\n        'injectDOMPropertyConfig(...): You\\'re trying to inject DOM property ' +\n        '\\'%s\\' which has already been injected. You may be accidentally ' +\n        'injecting the same DOM property config twice, or you may be ' +\n        'injecting two configs that have conflicting property names.',\n        propName\n      ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));\n\n      DOMProperty.isStandardName[propName] = true;\n\n      var lowerCased = propName.toLowerCase();\n      DOMProperty.getPossibleStandardName[lowerCased] = propName;\n\n      if (DOMAttributeNames.hasOwnProperty(propName)) {\n        var attributeName = DOMAttributeNames[propName];\n        DOMProperty.getPossibleStandardName[attributeName] = propName;\n        DOMProperty.getAttributeName[propName] = attributeName;\n      } else {\n        DOMProperty.getAttributeName[propName] = lowerCased;\n      }\n\n      DOMProperty.getPropertyName[propName] =\n        DOMPropertyNames.hasOwnProperty(propName) ?\n          DOMPropertyNames[propName] :\n          propName;\n\n      if (DOMMutationMethods.hasOwnProperty(propName)) {\n        DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];\n      } else {\n        DOMProperty.getMutationMethod[propName] = null;\n      }\n\n      var propConfig = Properties[propName];\n      DOMProperty.mustUseAttribute[propName] =\n        checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);\n      DOMProperty.mustUseProperty[propName] =\n        checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);\n      DOMProperty.hasSideEffects[propName] =\n        checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);\n      DOMProperty.hasBooleanValue[propName] =\n        checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);\n      DOMProperty.hasNumericValue[propName] =\n        checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);\n      DOMProperty.hasPositiveNumericValue[propName] =\n        checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);\n      DOMProperty.hasOverloadedBooleanValue[propName] =\n        checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);\n\n      (\"production\" !== \"development\" ? invariant(\n        !DOMProperty.mustUseAttribute[propName] ||\n          !DOMProperty.mustUseProperty[propName],\n        'DOMProperty: Cannot require using both attribute and property: %s',\n        propName\n      ) : invariant(!DOMProperty.mustUseAttribute[propName] ||\n        !DOMProperty.mustUseProperty[propName]));\n      (\"production\" !== \"development\" ? invariant(\n        DOMProperty.mustUseProperty[propName] ||\n          !DOMProperty.hasSideEffects[propName],\n        'DOMProperty: Properties that have side effects must use property: %s',\n        propName\n      ) : invariant(DOMProperty.mustUseProperty[propName] ||\n        !DOMProperty.hasSideEffects[propName]));\n      (\"production\" !== \"development\" ? invariant(\n        !!DOMProperty.hasBooleanValue[propName] +\n          !!DOMProperty.hasNumericValue[propName] +\n          !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,\n        'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +\n        'numeric value, but not a combination: %s',\n        propName\n      ) : invariant(!!DOMProperty.hasBooleanValue[propName] +\n        !!DOMProperty.hasNumericValue[propName] +\n        !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));\n    }\n  }\n};\nvar defaultValueCache = {};\n\n/**\n * DOMProperty exports lookup objects that can be used like functions:\n *\n *   > DOMProperty.isValid['id']\n *   true\n *   > DOMProperty.isValid['foobar']\n *   undefined\n *\n * Although this may be confusing, it performs better in general.\n *\n * @see http://jsperf.com/key-exists\n * @see http://jsperf.com/key-missing\n */\nvar DOMProperty = {\n\n  ID_ATTRIBUTE_NAME: 'data-reactid',\n\n  /**\n   * Checks whether a property name is a standard property.\n   * @type {Object}\n   */\n  isStandardName: {},\n\n  /**\n   * Mapping from lowercase property names to the properly cased version, used\n   * to warn in the case of missing properties.\n   * @type {Object}\n   */\n  getPossibleStandardName: {},\n\n  /**\n   * Mapping from normalized names to attribute names that differ. Attribute\n   * names are used when rendering markup or with `*Attribute()`.\n   * @type {Object}\n   */\n  getAttributeName: {},\n\n  /**\n   * Mapping from normalized names to properties on DOM node instances.\n   * (This includes properties that mutate due to external factors.)\n   * @type {Object}\n   */\n  getPropertyName: {},\n\n  /**\n   * Mapping from normalized names to mutation methods. This will only exist if\n   * mutation cannot be set simply by the property or `setAttribute()`.\n   * @type {Object}\n   */\n  getMutationMethod: {},\n\n  /**\n   * Whether the property must be accessed and mutated as an object property.\n   * @type {Object}\n   */\n  mustUseAttribute: {},\n\n  /**\n   * Whether the property must be accessed and mutated using `*Attribute()`.\n   * (This includes anything that fails `<propName> in <element>`.)\n   * @type {Object}\n   */\n  mustUseProperty: {},\n\n  /**\n   * Whether or not setting a value causes side effects such as triggering\n   * resources to be loaded or text selection changes. We must ensure that\n   * the value is only set if it has changed.\n   * @type {Object}\n   */\n  hasSideEffects: {},\n\n  /**\n   * Whether the property should be removed when set to a falsey value.\n   * @type {Object}\n   */\n  hasBooleanValue: {},\n\n  /**\n   * Whether the property must be numeric or parse as a\n   * numeric and should be removed when set to a falsey value.\n   * @type {Object}\n   */\n  hasNumericValue: {},\n\n  /**\n   * Whether the property must be positive numeric or parse as a positive\n   * numeric and should be removed when set to a falsey value.\n   * @type {Object}\n   */\n  hasPositiveNumericValue: {},\n\n  /**\n   * Whether the property can be used as a flag as well as with a value. Removed\n   * when strictly equal to false; present without a value when strictly equal\n   * to true; present with a value otherwise.\n   * @type {Object}\n   */\n  hasOverloadedBooleanValue: {},\n\n  /**\n   * All of the isCustomAttribute() functions that have been injected.\n   */\n  _isCustomAttributeFunctions: [],\n\n  /**\n   * Checks whether a property name is a custom attribute.\n   * @method\n   */\n  isCustomAttribute: function(attributeName) {\n    for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {\n      var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];\n      if (isCustomAttributeFn(attributeName)) {\n        return true;\n      }\n    }\n    return false;\n  },\n\n  /**\n   * Returns the default property value for a DOM property (i.e., not an\n   * attribute). Most default values are '' or false, but not all. Worse yet,\n   * some (in particular, `type`) vary depending on the type of element.\n   *\n   * TODO: Is it better to grab all the possible properties when creating an\n   * element to avoid having to create the same element twice?\n   */\n  getDefaultValueForProperty: function(nodeName, prop) {\n    var nodeDefaults = defaultValueCache[nodeName];\n    var testElement;\n    if (!nodeDefaults) {\n      defaultValueCache[nodeName] = nodeDefaults = {};\n    }\n    if (!(prop in nodeDefaults)) {\n      testElement = document.createElement(nodeName);\n      nodeDefaults[prop] = testElement[prop];\n    }\n    return nodeDefaults[prop];\n  },\n\n  injection: DOMPropertyInjection\n};\n\nmodule.exports = DOMProperty;\n\n},{\"135\":135}],11:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule DOMPropertyOperations\n * @typechecks static-only\n */\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\n\nvar quoteAttributeValueForBrowser = _dereq_(147);\nvar warning = _dereq_(154);\n\nfunction shouldIgnoreValue(name, value) {\n  return value == null ||\n    (DOMProperty.hasBooleanValue[name] && !value) ||\n    (DOMProperty.hasNumericValue[name] && isNaN(value)) ||\n    (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||\n    (DOMProperty.hasOverloadedBooleanValue[name] && value === false);\n}\n\nif (\"production\" !== \"development\") {\n  var reactProps = {\n    children: true,\n    dangerouslySetInnerHTML: true,\n    key: true,\n    ref: true\n  };\n  var warnedProperties = {};\n\n  var warnUnknownProperty = function(name) {\n    if (reactProps.hasOwnProperty(name) && reactProps[name] ||\n        warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {\n      return;\n    }\n\n    warnedProperties[name] = true;\n    var lowerCasedName = name.toLowerCase();\n\n    // data-* attributes should be lowercase; suggest the lowercase version\n    var standardName = (\n      DOMProperty.isCustomAttribute(lowerCasedName) ?\n        lowerCasedName :\n      DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?\n        DOMProperty.getPossibleStandardName[lowerCasedName] :\n        null\n    );\n\n    // For now, only warn when we have a suggested correction. This prevents\n    // logging too much when using transferPropsTo.\n    (\"production\" !== \"development\" ? warning(\n      standardName == null,\n      'Unknown DOM property %s. Did you mean %s?',\n      name,\n      standardName\n    ) : null);\n\n  };\n}\n\n/**\n * Operations for dealing with DOM properties.\n */\nvar DOMPropertyOperations = {\n\n  /**\n   * Creates markup for the ID property.\n   *\n   * @param {string} id Unescaped ID.\n   * @return {string} Markup string.\n   */\n  createMarkupForID: function(id) {\n    return DOMProperty.ID_ATTRIBUTE_NAME + '=' +\n      quoteAttributeValueForBrowser(id);\n  },\n\n  /**\n   * Creates markup for a property.\n   *\n   * @param {string} name\n   * @param {*} value\n   * @return {?string} Markup string, or null if the property was invalid.\n   */\n  createMarkupForProperty: function(name, value) {\n    if (DOMProperty.isStandardName.hasOwnProperty(name) &&\n        DOMProperty.isStandardName[name]) {\n      if (shouldIgnoreValue(name, value)) {\n        return '';\n      }\n      var attributeName = DOMProperty.getAttributeName[name];\n      if (DOMProperty.hasBooleanValue[name] ||\n          (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {\n        return attributeName;\n      }\n      return attributeName + '=' + quoteAttributeValueForBrowser(value);\n    } else if (DOMProperty.isCustomAttribute(name)) {\n      if (value == null) {\n        return '';\n      }\n      return name + '=' + quoteAttributeValueForBrowser(value);\n    } else if (\"production\" !== \"development\") {\n      warnUnknownProperty(name);\n    }\n    return null;\n  },\n\n  /**\n   * Sets the value for a property on a node.\n   *\n   * @param {DOMElement} node\n   * @param {string} name\n   * @param {*} value\n   */\n  setValueForProperty: function(node, name, value) {\n    if (DOMProperty.isStandardName.hasOwnProperty(name) &&\n        DOMProperty.isStandardName[name]) {\n      var mutationMethod = DOMProperty.getMutationMethod[name];\n      if (mutationMethod) {\n        mutationMethod(node, value);\n      } else if (shouldIgnoreValue(name, value)) {\n        this.deleteValueForProperty(node, name);\n      } else if (DOMProperty.mustUseAttribute[name]) {\n        // `setAttribute` with objects becomes only `[object]` in IE8/9,\n        // ('' + value) makes it output the correct toString()-value.\n        node.setAttribute(DOMProperty.getAttributeName[name], '' + value);\n      } else {\n        var propName = DOMProperty.getPropertyName[name];\n        // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the\n        // property type before comparing; only `value` does and is string.\n        if (!DOMProperty.hasSideEffects[name] ||\n            ('' + node[propName]) !== ('' + value)) {\n          // Contrary to `setAttribute`, object properties are properly\n          // `toString`ed by IE8/9.\n          node[propName] = value;\n        }\n      }\n    } else if (DOMProperty.isCustomAttribute(name)) {\n      if (value == null) {\n        node.removeAttribute(name);\n      } else {\n        node.setAttribute(name, '' + value);\n      }\n    } else if (\"production\" !== \"development\") {\n      warnUnknownProperty(name);\n    }\n  },\n\n  /**\n   * Deletes the value for a property on a node.\n   *\n   * @param {DOMElement} node\n   * @param {string} name\n   */\n  deleteValueForProperty: function(node, name) {\n    if (DOMProperty.isStandardName.hasOwnProperty(name) &&\n        DOMProperty.isStandardName[name]) {\n      var mutationMethod = DOMProperty.getMutationMethod[name];\n      if (mutationMethod) {\n        mutationMethod(node, undefined);\n      } else if (DOMProperty.mustUseAttribute[name]) {\n        node.removeAttribute(DOMProperty.getAttributeName[name]);\n      } else {\n        var propName = DOMProperty.getPropertyName[name];\n        var defaultValue = DOMProperty.getDefaultValueForProperty(\n          node.nodeName,\n          propName\n        );\n        if (!DOMProperty.hasSideEffects[name] ||\n            ('' + node[propName]) !== defaultValue) {\n          node[propName] = defaultValue;\n        }\n      }\n    } else if (DOMProperty.isCustomAttribute(name)) {\n      node.removeAttribute(name);\n    } else if (\"production\" !== \"development\") {\n      warnUnknownProperty(name);\n    }\n  }\n\n};\n\nmodule.exports = DOMPropertyOperations;\n\n},{\"10\":10,\"147\":147,\"154\":154}],12:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule Danger\n * @typechecks static-only\n */\n\n/*jslint evil: true, sub: true */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar createNodesFromMarkup = _dereq_(112);\nvar emptyFunction = _dereq_(114);\nvar getMarkupWrap = _dereq_(127);\nvar invariant = _dereq_(135);\n\nvar OPEN_TAG_NAME_EXP = /^(<[^ \\/>]+)/;\nvar RESULT_INDEX_ATTR = 'data-danger-index';\n\n/**\n * Extracts the `nodeName` from a string of markup.\n *\n * NOTE: Extracting the `nodeName` does not require a regular expression match\n * because we make assumptions about React-generated markup (i.e. there are no\n * spaces surrounding the opening tag and there is at least one attribute).\n *\n * @param {string} markup String of markup.\n * @return {string} Node name of the supplied markup.\n * @see http://jsperf.com/extract-nodename\n */\nfunction getNodeName(markup) {\n  return markup.substring(1, markup.indexOf(' '));\n}\n\nvar Danger = {\n\n  /**\n   * Renders markup into an array of nodes. The markup is expected to render\n   * into a list of root nodes. Also, the length of `resultList` and\n   * `markupList` should be the same.\n   *\n   * @param {array<string>} markupList List of markup strings to render.\n   * @return {array<DOMElement>} List of rendered nodes.\n   * @internal\n   */\n  dangerouslyRenderMarkup: function(markupList) {\n    (\"production\" !== \"development\" ? invariant(\n      ExecutionEnvironment.canUseDOM,\n      'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +\n      'thread. Make sure `window` and `document` are available globally ' +\n      'before requiring React when unit testing or use ' +\n      'React.renderToString for server rendering.'\n    ) : invariant(ExecutionEnvironment.canUseDOM));\n    var nodeName;\n    var markupByNodeName = {};\n    // Group markup by `nodeName` if a wrap is necessary, else by '*'.\n    for (var i = 0; i < markupList.length; i++) {\n      (\"production\" !== \"development\" ? invariant(\n        markupList[i],\n        'dangerouslyRenderMarkup(...): Missing markup.'\n      ) : invariant(markupList[i]));\n      nodeName = getNodeName(markupList[i]);\n      nodeName = getMarkupWrap(nodeName) ? nodeName : '*';\n      markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];\n      markupByNodeName[nodeName][i] = markupList[i];\n    }\n    var resultList = [];\n    var resultListAssignmentCount = 0;\n    for (nodeName in markupByNodeName) {\n      if (!markupByNodeName.hasOwnProperty(nodeName)) {\n        continue;\n      }\n      var markupListByNodeName = markupByNodeName[nodeName];\n\n      // This for-in loop skips the holes of the sparse array. The order of\n      // iteration should follow the order of assignment, which happens to match\n      // numerical index order, but we don't rely on that.\n      var resultIndex;\n      for (resultIndex in markupListByNodeName) {\n        if (markupListByNodeName.hasOwnProperty(resultIndex)) {\n          var markup = markupListByNodeName[resultIndex];\n\n          // Push the requested markup with an additional RESULT_INDEX_ATTR\n          // attribute.  If the markup does not start with a < character, it\n          // will be discarded below (with an appropriate console.error).\n          markupListByNodeName[resultIndex] = markup.replace(\n            OPEN_TAG_NAME_EXP,\n            // This index will be parsed back out below.\n            '$1 ' + RESULT_INDEX_ATTR + '=\"' + resultIndex + '\" '\n          );\n        }\n      }\n\n      // Render each group of markup with similar wrapping `nodeName`.\n      var renderNodes = createNodesFromMarkup(\n        markupListByNodeName.join(''),\n        emptyFunction // Do nothing special with <script> tags.\n      );\n\n      for (var j = 0; j < renderNodes.length; ++j) {\n        var renderNode = renderNodes[j];\n        if (renderNode.hasAttribute &&\n            renderNode.hasAttribute(RESULT_INDEX_ATTR)) {\n\n          resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);\n          renderNode.removeAttribute(RESULT_INDEX_ATTR);\n\n          (\"production\" !== \"development\" ? invariant(\n            !resultList.hasOwnProperty(resultIndex),\n            'Danger: Assigning to an already-occupied result index.'\n          ) : invariant(!resultList.hasOwnProperty(resultIndex)));\n\n          resultList[resultIndex] = renderNode;\n\n          // This should match resultList.length and markupList.length when\n          // we're done.\n          resultListAssignmentCount += 1;\n\n        } else if (\"production\" !== \"development\") {\n          console.error(\n            'Danger: Discarding unexpected node:',\n            renderNode\n          );\n        }\n      }\n    }\n\n    // Although resultList was populated out of order, it should now be a dense\n    // array.\n    (\"production\" !== \"development\" ? invariant(\n      resultListAssignmentCount === resultList.length,\n      'Danger: Did not assign to every index of resultList.'\n    ) : invariant(resultListAssignmentCount === resultList.length));\n\n    (\"production\" !== \"development\" ? invariant(\n      resultList.length === markupList.length,\n      'Danger: Expected markup to render %s nodes, but rendered %s.',\n      markupList.length,\n      resultList.length\n    ) : invariant(resultList.length === markupList.length));\n\n    return resultList;\n  },\n\n  /**\n   * Replaces a node with a string of markup at its current position within its\n   * parent. The markup must render into a single root node.\n   *\n   * @param {DOMElement} oldChild Child node to replace.\n   * @param {string} markup Markup to render in place of the child node.\n   * @internal\n   */\n  dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {\n    (\"production\" !== \"development\" ? invariant(\n      ExecutionEnvironment.canUseDOM,\n      'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +\n      'worker thread. Make sure `window` and `document` are available ' +\n      'globally before requiring React when unit testing or use ' +\n      'React.renderToString for server rendering.'\n    ) : invariant(ExecutionEnvironment.canUseDOM));\n    (\"production\" !== \"development\" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));\n    (\"production\" !== \"development\" ? invariant(\n      oldChild.tagName.toLowerCase() !== 'html',\n      'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +\n      '<html> node. This is because browser quirks make this unreliable ' +\n      'and/or slow. If you want to render to the root you must use ' +\n      'server rendering. See React.renderToString().'\n    ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));\n\n    var newChild = createNodesFromMarkup(markup, emptyFunction)[0];\n    oldChild.parentNode.replaceChild(newChild, oldChild);\n  }\n\n};\n\nmodule.exports = Danger;\n\n},{\"112\":112,\"114\":114,\"127\":127,\"135\":135,\"21\":21}],13:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule DefaultEventPluginOrder\n */\n\n'use strict';\n\nvar keyOf = _dereq_(141);\n\n/**\n * Module that is injectable into `EventPluginHub`, that specifies a\n * deterministic ordering of `EventPlugin`s. A convenient way to reason about\n * plugins, without having to package every one of them. This is better than\n * having plugins be ordered in the same order that they are injected because\n * that ordering would be influenced by the packaging order.\n * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that\n * preventing default on events is convenient in `SimpleEventPlugin` handlers.\n */\nvar DefaultEventPluginOrder = [\n  keyOf({ResponderEventPlugin: null}),\n  keyOf({SimpleEventPlugin: null}),\n  keyOf({TapEventPlugin: null}),\n  keyOf({EnterLeaveEventPlugin: null}),\n  keyOf({ChangeEventPlugin: null}),\n  keyOf({SelectEventPlugin: null}),\n  keyOf({BeforeInputEventPlugin: null}),\n  keyOf({AnalyticsEventPlugin: null}),\n  keyOf({MobileSafariClickEventPlugin: null})\n];\n\nmodule.exports = DefaultEventPluginOrder;\n\n},{\"141\":141}],14:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EnterLeaveEventPlugin\n * @typechecks static-only\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPropagators = _dereq_(20);\nvar SyntheticMouseEvent = _dereq_(99);\n\nvar ReactMount = _dereq_(70);\nvar keyOf = _dereq_(141);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\nvar getFirstReactDOM = ReactMount.getFirstReactDOM;\n\nvar eventTypes = {\n  mouseEnter: {\n    registrationName: keyOf({onMouseEnter: null}),\n    dependencies: [\n      topLevelTypes.topMouseOut,\n      topLevelTypes.topMouseOver\n    ]\n  },\n  mouseLeave: {\n    registrationName: keyOf({onMouseLeave: null}),\n    dependencies: [\n      topLevelTypes.topMouseOut,\n      topLevelTypes.topMouseOver\n    ]\n  }\n};\n\nvar extractedEvents = [null, null];\n\nvar EnterLeaveEventPlugin = {\n\n  eventTypes: eventTypes,\n\n  /**\n   * For almost every interaction we care about, there will be both a top-level\n   * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that\n   * we do not extract duplicate events. However, moving the mouse into the\n   * browser from outside will not fire a `mouseout` event. In this case, we use\n   * the `mouseover` top-level event.\n   *\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n    if (topLevelType === topLevelTypes.topMouseOver &&\n        (nativeEvent.relatedTarget || nativeEvent.fromElement)) {\n      return null;\n    }\n    if (topLevelType !== topLevelTypes.topMouseOut &&\n        topLevelType !== topLevelTypes.topMouseOver) {\n      // Must not be a mouse in or mouse out - ignoring.\n      return null;\n    }\n\n    var win;\n    if (topLevelTarget.window === topLevelTarget) {\n      // `topLevelTarget` is probably a window object.\n      win = topLevelTarget;\n    } else {\n      // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.\n      var doc = topLevelTarget.ownerDocument;\n      if (doc) {\n        win = doc.defaultView || doc.parentWindow;\n      } else {\n        win = window;\n      }\n    }\n\n    var from, to;\n    if (topLevelType === topLevelTypes.topMouseOut) {\n      from = topLevelTarget;\n      to =\n        getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||\n        win;\n    } else {\n      from = win;\n      to = topLevelTarget;\n    }\n\n    if (from === to) {\n      // Nothing pertains to our managed components.\n      return null;\n    }\n\n    var fromID = from ? ReactMount.getID(from) : '';\n    var toID = to ? ReactMount.getID(to) : '';\n\n    var leave = SyntheticMouseEvent.getPooled(\n      eventTypes.mouseLeave,\n      fromID,\n      nativeEvent\n    );\n    leave.type = 'mouseleave';\n    leave.target = from;\n    leave.relatedTarget = to;\n\n    var enter = SyntheticMouseEvent.getPooled(\n      eventTypes.mouseEnter,\n      toID,\n      nativeEvent\n    );\n    enter.type = 'mouseenter';\n    enter.target = to;\n    enter.relatedTarget = from;\n\n    EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);\n\n    extractedEvents[0] = leave;\n    extractedEvents[1] = enter;\n\n    return extractedEvents;\n  }\n\n};\n\nmodule.exports = EnterLeaveEventPlugin;\n\n},{\"141\":141,\"15\":15,\"20\":20,\"70\":70,\"99\":99}],15:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EventConstants\n */\n\n'use strict';\n\nvar keyMirror = _dereq_(140);\n\nvar PropagationPhases = keyMirror({bubbled: null, captured: null});\n\n/**\n * Types of raw signals from the browser caught at the top level.\n */\nvar topLevelTypes = keyMirror({\n  topBlur: null,\n  topChange: null,\n  topClick: null,\n  topCompositionEnd: null,\n  topCompositionStart: null,\n  topCompositionUpdate: null,\n  topContextMenu: null,\n  topCopy: null,\n  topCut: null,\n  topDoubleClick: null,\n  topDrag: null,\n  topDragEnd: null,\n  topDragEnter: null,\n  topDragExit: null,\n  topDragLeave: null,\n  topDragOver: null,\n  topDragStart: null,\n  topDrop: null,\n  topError: null,\n  topFocus: null,\n  topInput: null,\n  topKeyDown: null,\n  topKeyPress: null,\n  topKeyUp: null,\n  topLoad: null,\n  topMouseDown: null,\n  topMouseMove: null,\n  topMouseOut: null,\n  topMouseOver: null,\n  topMouseUp: null,\n  topPaste: null,\n  topReset: null,\n  topScroll: null,\n  topSelectionChange: null,\n  topSubmit: null,\n  topTextInput: null,\n  topTouchCancel: null,\n  topTouchEnd: null,\n  topTouchMove: null,\n  topTouchStart: null,\n  topWheel: null\n});\n\nvar EventConstants = {\n  topLevelTypes: topLevelTypes,\n  PropagationPhases: PropagationPhases\n};\n\nmodule.exports = EventConstants;\n\n},{\"140\":140}],16:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @providesModule EventListener\n * @typechecks\n */\n\nvar emptyFunction = _dereq_(114);\n\n/**\n * Upstream version of event listener. Does not take into account specific\n * nature of platform.\n */\nvar EventListener = {\n  /**\n   * Listen to DOM events during the bubble phase.\n   *\n   * @param {DOMEventTarget} target DOM element to register listener on.\n   * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n   * @param {function} callback Callback function.\n   * @return {object} Object with a `remove` method.\n   */\n  listen: function(target, eventType, callback) {\n    if (target.addEventListener) {\n      target.addEventListener(eventType, callback, false);\n      return {\n        remove: function() {\n          target.removeEventListener(eventType, callback, false);\n        }\n      };\n    } else if (target.attachEvent) {\n      target.attachEvent('on' + eventType, callback);\n      return {\n        remove: function() {\n          target.detachEvent('on' + eventType, callback);\n        }\n      };\n    }\n  },\n\n  /**\n   * Listen to DOM events during the capture phase.\n   *\n   * @param {DOMEventTarget} target DOM element to register listener on.\n   * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n   * @param {function} callback Callback function.\n   * @return {object} Object with a `remove` method.\n   */\n  capture: function(target, eventType, callback) {\n    if (!target.addEventListener) {\n      if (\"production\" !== \"development\") {\n        console.error(\n          'Attempted to listen to events during the capture phase on a ' +\n          'browser that does not support the capture phase. Your application ' +\n          'will not receive some events.'\n        );\n      }\n      return {\n        remove: emptyFunction\n      };\n    } else {\n      target.addEventListener(eventType, callback, true);\n      return {\n        remove: function() {\n          target.removeEventListener(eventType, callback, true);\n        }\n      };\n    }\n  },\n\n  registerDefault: function() {}\n};\n\nmodule.exports = EventListener;\n\n},{\"114\":114}],17:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EventPluginHub\n */\n\n'use strict';\n\nvar EventPluginRegistry = _dereq_(18);\nvar EventPluginUtils = _dereq_(19);\n\nvar accumulateInto = _dereq_(105);\nvar forEachAccumulated = _dereq_(120);\nvar invariant = _dereq_(135);\n\n/**\n * Internal store for event listeners\n */\nvar listenerBank = {};\n\n/**\n * Internal queue of events that have accumulated their dispatches and are\n * waiting to have their dispatches executed.\n */\nvar eventQueue = null;\n\n/**\n * Dispatches an event and releases it back into the pool, unless persistent.\n *\n * @param {?object} event Synthetic event to be dispatched.\n * @private\n */\nvar executeDispatchesAndRelease = function(event) {\n  if (event) {\n    var executeDispatch = EventPluginUtils.executeDispatch;\n    // Plugins can provide custom behavior when dispatching events.\n    var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);\n    if (PluginModule && PluginModule.executeDispatch) {\n      executeDispatch = PluginModule.executeDispatch;\n    }\n    EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);\n\n    if (!event.isPersistent()) {\n      event.constructor.release(event);\n    }\n  }\n};\n\n/**\n * - `InstanceHandle`: [required] Module that performs logical traversals of DOM\n *   hierarchy given ids of the logical DOM elements involved.\n */\nvar InstanceHandle = null;\n\nfunction validateInstanceHandle() {\n  var valid =\n    InstanceHandle &&\n    InstanceHandle.traverseTwoPhase &&\n    InstanceHandle.traverseEnterLeave;\n  (\"production\" !== \"development\" ? invariant(\n    valid,\n    'InstanceHandle not injected before use!'\n  ) : invariant(valid));\n}\n\n/**\n * This is a unified interface for event plugins to be installed and configured.\n *\n * Event plugins can implement the following properties:\n *\n *   `extractEvents` {function(string, DOMEventTarget, string, object): *}\n *     Required. When a top-level event is fired, this method is expected to\n *     extract synthetic events that will in turn be queued and dispatched.\n *\n *   `eventTypes` {object}\n *     Optional, plugins that fire events must publish a mapping of registration\n *     names that are used to register listeners. Values of this mapping must\n *     be objects that contain `registrationName` or `phasedRegistrationNames`.\n *\n *   `executeDispatch` {function(object, function, string)}\n *     Optional, allows plugins to override how an event gets dispatched. By\n *     default, the listener is simply invoked.\n *\n * Each plugin that is injected into `EventsPluginHub` is immediately operable.\n *\n * @public\n */\nvar EventPluginHub = {\n\n  /**\n   * Methods for injecting dependencies.\n   */\n  injection: {\n\n    /**\n     * @param {object} InjectedMount\n     * @public\n     */\n    injectMount: EventPluginUtils.injection.injectMount,\n\n    /**\n     * @param {object} InjectedInstanceHandle\n     * @public\n     */\n    injectInstanceHandle: function(InjectedInstanceHandle) {\n      InstanceHandle = InjectedInstanceHandle;\n      if (\"production\" !== \"development\") {\n        validateInstanceHandle();\n      }\n    },\n\n    getInstanceHandle: function() {\n      if (\"production\" !== \"development\") {\n        validateInstanceHandle();\n      }\n      return InstanceHandle;\n    },\n\n    /**\n     * @param {array} InjectedEventPluginOrder\n     * @public\n     */\n    injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,\n\n    /**\n     * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n     */\n    injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName\n\n  },\n\n  eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,\n\n  registrationNameModules: EventPluginRegistry.registrationNameModules,\n\n  /**\n   * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.\n   *\n   * @param {string} id ID of the DOM element.\n   * @param {string} registrationName Name of listener (e.g. `onClick`).\n   * @param {?function} listener The callback to store.\n   */\n  putListener: function(id, registrationName, listener) {\n    (\"production\" !== \"development\" ? invariant(\n      !listener || typeof listener === 'function',\n      'Expected %s listener to be a function, instead got type %s',\n      registrationName, typeof listener\n    ) : invariant(!listener || typeof listener === 'function'));\n\n    var bankForRegistrationName =\n      listenerBank[registrationName] || (listenerBank[registrationName] = {});\n    bankForRegistrationName[id] = listener;\n  },\n\n  /**\n   * @param {string} id ID of the DOM element.\n   * @param {string} registrationName Name of listener (e.g. `onClick`).\n   * @return {?function} The stored callback.\n   */\n  getListener: function(id, registrationName) {\n    var bankForRegistrationName = listenerBank[registrationName];\n    return bankForRegistrationName && bankForRegistrationName[id];\n  },\n\n  /**\n   * Deletes a listener from the registration bank.\n   *\n   * @param {string} id ID of the DOM element.\n   * @param {string} registrationName Name of listener (e.g. `onClick`).\n   */\n  deleteListener: function(id, registrationName) {\n    var bankForRegistrationName = listenerBank[registrationName];\n    if (bankForRegistrationName) {\n      delete bankForRegistrationName[id];\n    }\n  },\n\n  /**\n   * Deletes all listeners for the DOM element with the supplied ID.\n   *\n   * @param {string} id ID of the DOM element.\n   */\n  deleteAllListeners: function(id) {\n    for (var registrationName in listenerBank) {\n      delete listenerBank[registrationName][id];\n    }\n  },\n\n  /**\n   * Allows registered plugins an opportunity to extract events from top-level\n   * native browser events.\n   *\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @internal\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n    var events;\n    var plugins = EventPluginRegistry.plugins;\n    for (var i = 0, l = plugins.length; i < l; i++) {\n      // Not every plugin in the ordering may be loaded at runtime.\n      var possiblePlugin = plugins[i];\n      if (possiblePlugin) {\n        var extractedEvents = possiblePlugin.extractEvents(\n          topLevelType,\n          topLevelTarget,\n          topLevelTargetID,\n          nativeEvent\n        );\n        if (extractedEvents) {\n          events = accumulateInto(events, extractedEvents);\n        }\n      }\n    }\n    return events;\n  },\n\n  /**\n   * Enqueues a synthetic event that should be dispatched when\n   * `processEventQueue` is invoked.\n   *\n   * @param {*} events An accumulation of synthetic events.\n   * @internal\n   */\n  enqueueEvents: function(events) {\n    if (events) {\n      eventQueue = accumulateInto(eventQueue, events);\n    }\n  },\n\n  /**\n   * Dispatches all synthetic events on the event queue.\n   *\n   * @internal\n   */\n  processEventQueue: function() {\n    // Set `eventQueue` to null before processing it so that we can tell if more\n    // events get enqueued while processing.\n    var processingEventQueue = eventQueue;\n    eventQueue = null;\n    forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);\n    (\"production\" !== \"development\" ? invariant(\n      !eventQueue,\n      'processEventQueue(): Additional events were enqueued while processing ' +\n      'an event queue. Support for this has not yet been implemented.'\n    ) : invariant(!eventQueue));\n  },\n\n  /**\n   * These are needed for tests only. Do not use!\n   */\n  __purge: function() {\n    listenerBank = {};\n  },\n\n  __getListenerBank: function() {\n    return listenerBank;\n  }\n\n};\n\nmodule.exports = EventPluginHub;\n\n},{\"105\":105,\"120\":120,\"135\":135,\"18\":18,\"19\":19}],18:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EventPluginRegistry\n * @typechecks static-only\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n * Injectable ordering of event plugins.\n */\nvar EventPluginOrder = null;\n\n/**\n * Injectable mapping from names to event plugin modules.\n */\nvar namesToPlugins = {};\n\n/**\n * Recomputes the plugin list using the injected plugins and plugin ordering.\n *\n * @private\n */\nfunction recomputePluginOrdering() {\n  if (!EventPluginOrder) {\n    // Wait until an `EventPluginOrder` is injected.\n    return;\n  }\n  for (var pluginName in namesToPlugins) {\n    var PluginModule = namesToPlugins[pluginName];\n    var pluginIndex = EventPluginOrder.indexOf(pluginName);\n    (\"production\" !== \"development\" ? invariant(\n      pluginIndex > -1,\n      'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +\n      'the plugin ordering, `%s`.',\n      pluginName\n    ) : invariant(pluginIndex > -1));\n    if (EventPluginRegistry.plugins[pluginIndex]) {\n      continue;\n    }\n    (\"production\" !== \"development\" ? invariant(\n      PluginModule.extractEvents,\n      'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +\n      'method, but `%s` does not.',\n      pluginName\n    ) : invariant(PluginModule.extractEvents));\n    EventPluginRegistry.plugins[pluginIndex] = PluginModule;\n    var publishedEvents = PluginModule.eventTypes;\n    for (var eventName in publishedEvents) {\n      (\"production\" !== \"development\" ? invariant(\n        publishEventForPlugin(\n          publishedEvents[eventName],\n          PluginModule,\n          eventName\n        ),\n        'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',\n        eventName,\n        pluginName\n      ) : invariant(publishEventForPlugin(\n        publishedEvents[eventName],\n        PluginModule,\n        eventName\n      )));\n    }\n  }\n}\n\n/**\n * Publishes an event so that it can be dispatched by the supplied plugin.\n *\n * @param {object} dispatchConfig Dispatch configuration for the event.\n * @param {object} PluginModule Plugin publishing the event.\n * @return {boolean} True if the event was successfully published.\n * @private\n */\nfunction publishEventForPlugin(dispatchConfig, PluginModule, eventName) {\n  (\"production\" !== \"development\" ? invariant(\n    !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),\n    'EventPluginHub: More than one plugin attempted to publish the same ' +\n    'event name, `%s`.',\n    eventName\n  ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));\n  EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;\n\n  var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;\n  if (phasedRegistrationNames) {\n    for (var phaseName in phasedRegistrationNames) {\n      if (phasedRegistrationNames.hasOwnProperty(phaseName)) {\n        var phasedRegistrationName = phasedRegistrationNames[phaseName];\n        publishRegistrationName(\n          phasedRegistrationName,\n          PluginModule,\n          eventName\n        );\n      }\n    }\n    return true;\n  } else if (dispatchConfig.registrationName) {\n    publishRegistrationName(\n      dispatchConfig.registrationName,\n      PluginModule,\n      eventName\n    );\n    return true;\n  }\n  return false;\n}\n\n/**\n * Publishes a registration name that is used to identify dispatched events and\n * can be used with `EventPluginHub.putListener` to register listeners.\n *\n * @param {string} registrationName Registration name to add.\n * @param {object} PluginModule Plugin publishing the event.\n * @private\n */\nfunction publishRegistrationName(registrationName, PluginModule, eventName) {\n  (\"production\" !== \"development\" ? invariant(\n    !EventPluginRegistry.registrationNameModules[registrationName],\n    'EventPluginHub: More than one plugin attempted to publish the same ' +\n    'registration name, `%s`.',\n    registrationName\n  ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));\n  EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;\n  EventPluginRegistry.registrationNameDependencies[registrationName] =\n    PluginModule.eventTypes[eventName].dependencies;\n}\n\n/**\n * Registers plugins so that they can extract and dispatch events.\n *\n * @see {EventPluginHub}\n */\nvar EventPluginRegistry = {\n\n  /**\n   * Ordered list of injected plugins.\n   */\n  plugins: [],\n\n  /**\n   * Mapping from event name to dispatch config\n   */\n  eventNameDispatchConfigs: {},\n\n  /**\n   * Mapping from registration name to plugin module\n   */\n  registrationNameModules: {},\n\n  /**\n   * Mapping from registration name to event name\n   */\n  registrationNameDependencies: {},\n\n  /**\n   * Injects an ordering of plugins (by plugin name). This allows the ordering\n   * to be decoupled from injection of the actual plugins so that ordering is\n   * always deterministic regardless of packaging, on-the-fly injection, etc.\n   *\n   * @param {array} InjectedEventPluginOrder\n   * @internal\n   * @see {EventPluginHub.injection.injectEventPluginOrder}\n   */\n  injectEventPluginOrder: function(InjectedEventPluginOrder) {\n    (\"production\" !== \"development\" ? invariant(\n      !EventPluginOrder,\n      'EventPluginRegistry: Cannot inject event plugin ordering more than ' +\n      'once. You are likely trying to load more than one copy of React.'\n    ) : invariant(!EventPluginOrder));\n    // Clone the ordering so it cannot be dynamically mutated.\n    EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);\n    recomputePluginOrdering();\n  },\n\n  /**\n   * Injects plugins to be used by `EventPluginHub`. The plugin names must be\n   * in the ordering injected by `injectEventPluginOrder`.\n   *\n   * Plugins can be injected as part of page initialization or on-the-fly.\n   *\n   * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n   * @internal\n   * @see {EventPluginHub.injection.injectEventPluginsByName}\n   */\n  injectEventPluginsByName: function(injectedNamesToPlugins) {\n    var isOrderingDirty = false;\n    for (var pluginName in injectedNamesToPlugins) {\n      if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {\n        continue;\n      }\n      var PluginModule = injectedNamesToPlugins[pluginName];\n      if (!namesToPlugins.hasOwnProperty(pluginName) ||\n          namesToPlugins[pluginName] !== PluginModule) {\n        (\"production\" !== \"development\" ? invariant(\n          !namesToPlugins[pluginName],\n          'EventPluginRegistry: Cannot inject two different event plugins ' +\n          'using the same name, `%s`.',\n          pluginName\n        ) : invariant(!namesToPlugins[pluginName]));\n        namesToPlugins[pluginName] = PluginModule;\n        isOrderingDirty = true;\n      }\n    }\n    if (isOrderingDirty) {\n      recomputePluginOrdering();\n    }\n  },\n\n  /**\n   * Looks up the plugin for the supplied event.\n   *\n   * @param {object} event A synthetic event.\n   * @return {?object} The plugin that created the supplied event.\n   * @internal\n   */\n  getPluginModuleForEvent: function(event) {\n    var dispatchConfig = event.dispatchConfig;\n    if (dispatchConfig.registrationName) {\n      return EventPluginRegistry.registrationNameModules[\n        dispatchConfig.registrationName\n      ] || null;\n    }\n    for (var phase in dispatchConfig.phasedRegistrationNames) {\n      if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {\n        continue;\n      }\n      var PluginModule = EventPluginRegistry.registrationNameModules[\n        dispatchConfig.phasedRegistrationNames[phase]\n      ];\n      if (PluginModule) {\n        return PluginModule;\n      }\n    }\n    return null;\n  },\n\n  /**\n   * Exposed for unit testing.\n   * @private\n   */\n  _resetEventPlugins: function() {\n    EventPluginOrder = null;\n    for (var pluginName in namesToPlugins) {\n      if (namesToPlugins.hasOwnProperty(pluginName)) {\n        delete namesToPlugins[pluginName];\n      }\n    }\n    EventPluginRegistry.plugins.length = 0;\n\n    var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;\n    for (var eventName in eventNameDispatchConfigs) {\n      if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {\n        delete eventNameDispatchConfigs[eventName];\n      }\n    }\n\n    var registrationNameModules = EventPluginRegistry.registrationNameModules;\n    for (var registrationName in registrationNameModules) {\n      if (registrationNameModules.hasOwnProperty(registrationName)) {\n        delete registrationNameModules[registrationName];\n      }\n    }\n  }\n\n};\n\nmodule.exports = EventPluginRegistry;\n\n},{\"135\":135}],19:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EventPluginUtils\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\n\nvar invariant = _dereq_(135);\n\n/**\n * Injected dependencies:\n */\n\n/**\n * - `Mount`: [required] Module that can convert between React dom IDs and\n *   actual node references.\n */\nvar injection = {\n  Mount: null,\n  injectMount: function(InjectedMount) {\n    injection.Mount = InjectedMount;\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? invariant(\n        InjectedMount && InjectedMount.getNode,\n        'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +\n        'is missing getNode.'\n      ) : invariant(InjectedMount && InjectedMount.getNode));\n    }\n  }\n};\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nfunction isEndish(topLevelType) {\n  return topLevelType === topLevelTypes.topMouseUp ||\n         topLevelType === topLevelTypes.topTouchEnd ||\n         topLevelType === topLevelTypes.topTouchCancel;\n}\n\nfunction isMoveish(topLevelType) {\n  return topLevelType === topLevelTypes.topMouseMove ||\n         topLevelType === topLevelTypes.topTouchMove;\n}\nfunction isStartish(topLevelType) {\n  return topLevelType === topLevelTypes.topMouseDown ||\n         topLevelType === topLevelTypes.topTouchStart;\n}\n\n\nvar validateEventDispatches;\nif (\"production\" !== \"development\") {\n  validateEventDispatches = function(event) {\n    var dispatchListeners = event._dispatchListeners;\n    var dispatchIDs = event._dispatchIDs;\n\n    var listenersIsArr = Array.isArray(dispatchListeners);\n    var idsIsArr = Array.isArray(dispatchIDs);\n    var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;\n    var listenersLen = listenersIsArr ?\n      dispatchListeners.length :\n      dispatchListeners ? 1 : 0;\n\n    (\"production\" !== \"development\" ? invariant(\n      idsIsArr === listenersIsArr && IDsLen === listenersLen,\n      'EventPluginUtils: Invalid `event`.'\n    ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));\n  };\n}\n\n/**\n * Invokes `cb(event, listener, id)`. Avoids using call if no scope is\n * provided. The `(listener,id)` pair effectively forms the \"dispatch\" but are\n * kept separate to conserve memory.\n */\nfunction forEachEventDispatch(event, cb) {\n  var dispatchListeners = event._dispatchListeners;\n  var dispatchIDs = event._dispatchIDs;\n  if (\"production\" !== \"development\") {\n    validateEventDispatches(event);\n  }\n  if (Array.isArray(dispatchListeners)) {\n    for (var i = 0; i < dispatchListeners.length; i++) {\n      if (event.isPropagationStopped()) {\n        break;\n      }\n      // Listeners and IDs are two parallel arrays that are always in sync.\n      cb(event, dispatchListeners[i], dispatchIDs[i]);\n    }\n  } else if (dispatchListeners) {\n    cb(event, dispatchListeners, dispatchIDs);\n  }\n}\n\n/**\n * Default implementation of PluginModule.executeDispatch().\n * @param {SyntheticEvent} SyntheticEvent to handle\n * @param {function} Application-level callback\n * @param {string} domID DOM id to pass to the callback.\n */\nfunction executeDispatch(event, listener, domID) {\n  event.currentTarget = injection.Mount.getNode(domID);\n  var returnValue = listener(event, domID);\n  event.currentTarget = null;\n  return returnValue;\n}\n\n/**\n * Standard/simple iteration through an event's collected dispatches.\n */\nfunction executeDispatchesInOrder(event, cb) {\n  forEachEventDispatch(event, cb);\n  event._dispatchListeners = null;\n  event._dispatchIDs = null;\n}\n\n/**\n * Standard/simple iteration through an event's collected dispatches, but stops\n * at the first dispatch execution returning true, and returns that id.\n *\n * @return id of the first dispatch execution who's listener returns true, or\n * null if no listener returned true.\n */\nfunction executeDispatchesInOrderStopAtTrueImpl(event) {\n  var dispatchListeners = event._dispatchListeners;\n  var dispatchIDs = event._dispatchIDs;\n  if (\"production\" !== \"development\") {\n    validateEventDispatches(event);\n  }\n  if (Array.isArray(dispatchListeners)) {\n    for (var i = 0; i < dispatchListeners.length; i++) {\n      if (event.isPropagationStopped()) {\n        break;\n      }\n      // Listeners and IDs are two parallel arrays that are always in sync.\n      if (dispatchListeners[i](event, dispatchIDs[i])) {\n        return dispatchIDs[i];\n      }\n    }\n  } else if (dispatchListeners) {\n    if (dispatchListeners(event, dispatchIDs)) {\n      return dispatchIDs;\n    }\n  }\n  return null;\n}\n\n/**\n * @see executeDispatchesInOrderStopAtTrueImpl\n */\nfunction executeDispatchesInOrderStopAtTrue(event) {\n  var ret = executeDispatchesInOrderStopAtTrueImpl(event);\n  event._dispatchIDs = null;\n  event._dispatchListeners = null;\n  return ret;\n}\n\n/**\n * Execution of a \"direct\" dispatch - there must be at most one dispatch\n * accumulated on the event or it is considered an error. It doesn't really make\n * sense for an event with multiple dispatches (bubbled) to keep track of the\n * return values at each dispatch execution, but it does tend to make sense when\n * dealing with \"direct\" dispatches.\n *\n * @return The return value of executing the single dispatch.\n */\nfunction executeDirectDispatch(event) {\n  if (\"production\" !== \"development\") {\n    validateEventDispatches(event);\n  }\n  var dispatchListener = event._dispatchListeners;\n  var dispatchID = event._dispatchIDs;\n  (\"production\" !== \"development\" ? invariant(\n    !Array.isArray(dispatchListener),\n    'executeDirectDispatch(...): Invalid `event`.'\n  ) : invariant(!Array.isArray(dispatchListener)));\n  var res = dispatchListener ?\n    dispatchListener(event, dispatchID) :\n    null;\n  event._dispatchListeners = null;\n  event._dispatchIDs = null;\n  return res;\n}\n\n/**\n * @param {SyntheticEvent} event\n * @return {bool} True iff number of dispatches accumulated is greater than 0.\n */\nfunction hasDispatches(event) {\n  return !!event._dispatchListeners;\n}\n\n/**\n * General utilities that are useful in creating custom Event Plugins.\n */\nvar EventPluginUtils = {\n  isEndish: isEndish,\n  isMoveish: isMoveish,\n  isStartish: isStartish,\n\n  executeDirectDispatch: executeDirectDispatch,\n  executeDispatch: executeDispatch,\n  executeDispatchesInOrder: executeDispatchesInOrder,\n  executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,\n  hasDispatches: hasDispatches,\n  injection: injection,\n  useTouchEvents: false\n};\n\nmodule.exports = EventPluginUtils;\n\n},{\"135\":135,\"15\":15}],20:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule EventPropagators\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPluginHub = _dereq_(17);\n\nvar accumulateInto = _dereq_(105);\nvar forEachAccumulated = _dereq_(120);\n\nvar PropagationPhases = EventConstants.PropagationPhases;\nvar getListener = EventPluginHub.getListener;\n\n/**\n * Some event types have a notion of different registration names for different\n * \"phases\" of propagation. This finds listeners by a given phase.\n */\nfunction listenerAtPhase(id, event, propagationPhase) {\n  var registrationName =\n    event.dispatchConfig.phasedRegistrationNames[propagationPhase];\n  return getListener(id, registrationName);\n}\n\n/**\n * Tags a `SyntheticEvent` with dispatched listeners. Creating this function\n * here, allows us to not have to bind or create functions for each event.\n * Mutating the event's members allows us to not have to create a wrapping\n * \"dispatch\" object that pairs the event with the listener.\n */\nfunction accumulateDirectionalDispatches(domID, upwards, event) {\n  if (\"production\" !== \"development\") {\n    if (!domID) {\n      throw new Error('Dispatching id must not be null');\n    }\n  }\n  var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;\n  var listener = listenerAtPhase(domID, event, phase);\n  if (listener) {\n    event._dispatchListeners =\n      accumulateInto(event._dispatchListeners, listener);\n    event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);\n  }\n}\n\n/**\n * Collect dispatches (must be entirely collected before dispatching - see unit\n * tests). Lazily allocate the array to conserve memory.  We must loop through\n * each event and perform the traversal for each one. We can not perform a\n * single traversal for the entire collection of events because each event may\n * have a different target.\n */\nfunction accumulateTwoPhaseDispatchesSingle(event) {\n  if (event && event.dispatchConfig.phasedRegistrationNames) {\n    EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(\n      event.dispatchMarker,\n      accumulateDirectionalDispatches,\n      event\n    );\n  }\n}\n\n\n/**\n * Accumulates without regard to direction, does not look for phased\n * registration names. Same as `accumulateDirectDispatchesSingle` but without\n * requiring that the `dispatchMarker` be the same as the dispatched ID.\n */\nfunction accumulateDispatches(id, ignoredDirection, event) {\n  if (event && event.dispatchConfig.registrationName) {\n    var registrationName = event.dispatchConfig.registrationName;\n    var listener = getListener(id, registrationName);\n    if (listener) {\n      event._dispatchListeners =\n        accumulateInto(event._dispatchListeners, listener);\n      event._dispatchIDs = accumulateInto(event._dispatchIDs, id);\n    }\n  }\n}\n\n/**\n * Accumulates dispatches on an `SyntheticEvent`, but only for the\n * `dispatchMarker`.\n * @param {SyntheticEvent} event\n */\nfunction accumulateDirectDispatchesSingle(event) {\n  if (event && event.dispatchConfig.registrationName) {\n    accumulateDispatches(event.dispatchMarker, null, event);\n  }\n}\n\nfunction accumulateTwoPhaseDispatches(events) {\n  forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);\n}\n\nfunction accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {\n  EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(\n    fromID,\n    toID,\n    accumulateDispatches,\n    leave,\n    enter\n  );\n}\n\n\nfunction accumulateDirectDispatches(events) {\n  forEachAccumulated(events, accumulateDirectDispatchesSingle);\n}\n\n\n\n/**\n * A small set of propagation patterns, each of which will accept a small amount\n * of information, and generate a set of \"dispatch ready event objects\" - which\n * are sets of events that have already been annotated with a set of dispatched\n * listener functions/ids. The API is designed this way to discourage these\n * propagation strategies from actually executing the dispatches, since we\n * always want to collect the entire set of dispatches before executing event a\n * single one.\n *\n * @constructor EventPropagators\n */\nvar EventPropagators = {\n  accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,\n  accumulateDirectDispatches: accumulateDirectDispatches,\n  accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches\n};\n\nmodule.exports = EventPropagators;\n\n},{\"105\":105,\"120\":120,\"15\":15,\"17\":17}],21:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ExecutionEnvironment\n */\n\n/*jslint evil: true */\n\n\"use strict\";\n\nvar canUseDOM = !!(\n  (typeof window !== 'undefined' &&\n  window.document && window.document.createElement)\n);\n\n/**\n * Simple, lightweight module assisting with the detection and context of\n * Worker. Helps avoid circular dependencies and allows code to reason about\n * whether or not they are in a Worker, even if they never include the main\n * `ReactWorker` dependency.\n */\nvar ExecutionEnvironment = {\n\n  canUseDOM: canUseDOM,\n\n  canUseWorkers: typeof Worker !== 'undefined',\n\n  canUseEventListeners:\n    canUseDOM && !!(window.addEventListener || window.attachEvent),\n\n  canUseViewport: canUseDOM && !!window.screen,\n\n  isInWorker: !canUseDOM // For now, this is true - might change in the future.\n\n};\n\nmodule.exports = ExecutionEnvironment;\n\n},{}],22:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule FallbackCompositionState\n * @typechecks static-only\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\n\nvar assign = _dereq_(27);\nvar getTextContentAccessor = _dereq_(130);\n\n/**\n * This helper class stores information about text content of a target node,\n * allowing comparison of content before and after a given event.\n *\n * Identify the node where selection currently begins, then observe\n * both its text content and its current position in the DOM. Since the\n * browser may natively replace the target node during composition, we can\n * use its position to find its replacement.\n *\n * @param {DOMEventTarget} root\n */\nfunction FallbackCompositionState(root) {\n  this._root = root;\n  this._startText = this.getText();\n  this._fallbackText = null;\n}\n\nassign(FallbackCompositionState.prototype, {\n  /**\n   * Get current text of input.\n   *\n   * @return {string}\n   */\n  getText: function() {\n    if ('value' in this._root) {\n      return this._root.value;\n    }\n    return this._root[getTextContentAccessor()];\n  },\n\n  /**\n   * Determine the differing substring between the initially stored\n   * text content and the current content.\n   *\n   * @return {string}\n   */\n  getData: function() {\n    if (this._fallbackText) {\n      return this._fallbackText;\n    }\n\n    var start;\n    var startValue = this._startText;\n    var startLength = startValue.length;\n    var end;\n    var endValue = this.getText();\n    var endLength = endValue.length;\n\n    for (start = 0; start < startLength; start++) {\n      if (startValue[start] !== endValue[start]) {\n        break;\n      }\n    }\n\n    var minEnd = startLength - start;\n    for (end = 1; end <= minEnd; end++) {\n      if (startValue[startLength - end] !== endValue[endLength - end]) {\n        break;\n      }\n    }\n\n    var sliceTail = end > 1 ? 1 - end : undefined;\n    this._fallbackText = endValue.slice(start, sliceTail);\n    return this._fallbackText;\n  }\n});\n\nPooledClass.addPoolingTo(FallbackCompositionState);\n\nmodule.exports = FallbackCompositionState;\n\n},{\"130\":130,\"27\":27,\"28\":28}],23:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule HTMLDOMPropertyConfig\n */\n\n/*jslint bitwise: true*/\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\nvar ExecutionEnvironment = _dereq_(21);\n\nvar MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;\nvar MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;\nvar HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;\nvar HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;\nvar HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;\nvar HAS_POSITIVE_NUMERIC_VALUE =\n  DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;\nvar HAS_OVERLOADED_BOOLEAN_VALUE =\n  DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;\n\nvar hasSVG;\nif (ExecutionEnvironment.canUseDOM) {\n  var implementation = document.implementation;\n  hasSVG = (\n    implementation &&\n    implementation.hasFeature &&\n    implementation.hasFeature(\n      'http://www.w3.org/TR/SVG11/feature#BasicStructure',\n      '1.1'\n    )\n  );\n}\n\n\nvar HTMLDOMPropertyConfig = {\n  isCustomAttribute: RegExp.prototype.test.bind(\n    /^(data|aria)-[a-z_][a-z\\d_.\\-]*$/\n  ),\n  Properties: {\n    /**\n     * Standard Properties\n     */\n    accept: null,\n    acceptCharset: null,\n    accessKey: null,\n    action: null,\n    allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n    allowTransparency: MUST_USE_ATTRIBUTE,\n    alt: null,\n    async: HAS_BOOLEAN_VALUE,\n    autoComplete: null,\n    // autoFocus is polyfilled/normalized by AutoFocusMixin\n    // autoFocus: HAS_BOOLEAN_VALUE,\n    autoPlay: HAS_BOOLEAN_VALUE,\n    cellPadding: null,\n    cellSpacing: null,\n    charSet: MUST_USE_ATTRIBUTE,\n    checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    classID: MUST_USE_ATTRIBUTE,\n    // To set className on SVG elements, it's necessary to use .setAttribute;\n    // this works on HTML elements too in all browsers except IE8. Conveniently,\n    // IE8 doesn't support SVG and so we can simply use the attribute in\n    // browsers that support SVG and the property in browsers that don't,\n    // regardless of whether the element is HTML or SVG.\n    className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,\n    cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n    colSpan: null,\n    content: null,\n    contentEditable: null,\n    contextMenu: MUST_USE_ATTRIBUTE,\n    controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    coords: null,\n    crossOrigin: null,\n    data: null, // For `<object />` acts as `src`.\n    dateTime: MUST_USE_ATTRIBUTE,\n    defer: HAS_BOOLEAN_VALUE,\n    dir: null,\n    disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n    download: HAS_OVERLOADED_BOOLEAN_VALUE,\n    draggable: null,\n    encType: null,\n    form: MUST_USE_ATTRIBUTE,\n    formAction: MUST_USE_ATTRIBUTE,\n    formEncType: MUST_USE_ATTRIBUTE,\n    formMethod: MUST_USE_ATTRIBUTE,\n    formNoValidate: HAS_BOOLEAN_VALUE,\n    formTarget: MUST_USE_ATTRIBUTE,\n    frameBorder: MUST_USE_ATTRIBUTE,\n    headers: null,\n    height: MUST_USE_ATTRIBUTE,\n    hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n    high: null,\n    href: null,\n    hrefLang: null,\n    htmlFor: null,\n    httpEquiv: null,\n    icon: null,\n    id: MUST_USE_PROPERTY,\n    label: null,\n    lang: null,\n    list: MUST_USE_ATTRIBUTE,\n    loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    low: null,\n    manifest: MUST_USE_ATTRIBUTE,\n    marginHeight: null,\n    marginWidth: null,\n    max: null,\n    maxLength: MUST_USE_ATTRIBUTE,\n    media: MUST_USE_ATTRIBUTE,\n    mediaGroup: null,\n    method: null,\n    min: null,\n    multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    name: null,\n    noValidate: HAS_BOOLEAN_VALUE,\n    open: HAS_BOOLEAN_VALUE,\n    optimum: null,\n    pattern: null,\n    placeholder: null,\n    poster: null,\n    preload: null,\n    radioGroup: null,\n    readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    rel: null,\n    required: HAS_BOOLEAN_VALUE,\n    role: MUST_USE_ATTRIBUTE,\n    rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n    rowSpan: null,\n    sandbox: null,\n    scope: null,\n    scoped: HAS_BOOLEAN_VALUE,\n    scrolling: null,\n    seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n    selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n    shape: null,\n    size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n    sizes: MUST_USE_ATTRIBUTE,\n    span: HAS_POSITIVE_NUMERIC_VALUE,\n    spellCheck: null,\n    src: null,\n    srcDoc: MUST_USE_PROPERTY,\n    srcSet: MUST_USE_ATTRIBUTE,\n    start: HAS_NUMERIC_VALUE,\n    step: null,\n    style: null,\n    tabIndex: null,\n    target: null,\n    title: null,\n    type: null,\n    useMap: null,\n    value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,\n    width: MUST_USE_ATTRIBUTE,\n    wmode: MUST_USE_ATTRIBUTE,\n\n    /**\n     * Non-standard Properties\n     */\n    // autoCapitalize and autoCorrect are supported in Mobile Safari for\n    // keyboard hints.\n    autoCapitalize: null,\n    autoCorrect: null,\n    // itemProp, itemScope, itemType are for\n    // Microdata support. See http://schema.org/docs/gs.html\n    itemProp: MUST_USE_ATTRIBUTE,\n    itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n    itemType: MUST_USE_ATTRIBUTE,\n    // itemID and itemRef are for Microdata support as well but\n    // only specified in the the WHATWG spec document. See\n    // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api\n    itemID: MUST_USE_ATTRIBUTE,\n    itemRef: MUST_USE_ATTRIBUTE,\n    // property is supported for OpenGraph in meta tags.\n    property: null,\n    // IE-only attribute that controls focus behavior\n    unselectable: MUST_USE_ATTRIBUTE\n  },\n  DOMAttributeNames: {\n    acceptCharset: 'accept-charset',\n    className: 'class',\n    htmlFor: 'for',\n    httpEquiv: 'http-equiv'\n  },\n  DOMPropertyNames: {\n    autoCapitalize: 'autocapitalize',\n    autoComplete: 'autocomplete',\n    autoCorrect: 'autocorrect',\n    autoFocus: 'autofocus',\n    autoPlay: 'autoplay',\n    // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.\n    // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding\n    encType: 'encoding',\n    hrefLang: 'hreflang',\n    radioGroup: 'radiogroup',\n    spellCheck: 'spellcheck',\n    srcDoc: 'srcdoc',\n    srcSet: 'srcset'\n  }\n};\n\nmodule.exports = HTMLDOMPropertyConfig;\n\n},{\"10\":10,\"21\":21}],24:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule LinkedValueUtils\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactPropTypes = _dereq_(78);\n\nvar invariant = _dereq_(135);\n\nvar hasReadOnlyValue = {\n  'button': true,\n  'checkbox': true,\n  'image': true,\n  'hidden': true,\n  'radio': true,\n  'reset': true,\n  'submit': true\n};\n\nfunction _assertSingleLink(input) {\n  (\"production\" !== \"development\" ? invariant(\n    input.props.checkedLink == null || input.props.valueLink == null,\n    'Cannot provide a checkedLink and a valueLink. If you want to use ' +\n    'checkedLink, you probably don\\'t want to use valueLink and vice versa.'\n  ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));\n}\nfunction _assertValueLink(input) {\n  _assertSingleLink(input);\n  (\"production\" !== \"development\" ? invariant(\n    input.props.value == null && input.props.onChange == null,\n    'Cannot provide a valueLink and a value or onChange event. If you want ' +\n    'to use value or onChange, you probably don\\'t want to use valueLink.'\n  ) : invariant(input.props.value == null && input.props.onChange == null));\n}\n\nfunction _assertCheckedLink(input) {\n  _assertSingleLink(input);\n  (\"production\" !== \"development\" ? invariant(\n    input.props.checked == null && input.props.onChange == null,\n    'Cannot provide a checkedLink and a checked property or onChange event. ' +\n    'If you want to use checked or onChange, you probably don\\'t want to ' +\n    'use checkedLink'\n  ) : invariant(input.props.checked == null && input.props.onChange == null));\n}\n\n/**\n * @param {SyntheticEvent} e change event to handle\n */\nfunction _handleLinkedValueChange(e) {\n  /*jshint validthis:true */\n  this.props.valueLink.requestChange(e.target.value);\n}\n\n/**\n  * @param {SyntheticEvent} e change event to handle\n  */\nfunction _handleLinkedCheckChange(e) {\n  /*jshint validthis:true */\n  this.props.checkedLink.requestChange(e.target.checked);\n}\n\n/**\n * Provide a linked `value` attribute for controlled forms. You should not use\n * this outside of the ReactDOM controlled form components.\n */\nvar LinkedValueUtils = {\n  Mixin: {\n    propTypes: {\n      value: function(props, propName, componentName) {\n        if (!props[propName] ||\n            hasReadOnlyValue[props.type] ||\n            props.onChange ||\n            props.readOnly ||\n            props.disabled) {\n          return null;\n        }\n        return new Error(\n          'You provided a `value` prop to a form field without an ' +\n          '`onChange` handler. This will render a read-only field. If ' +\n          'the field should be mutable use `defaultValue`. Otherwise, ' +\n          'set either `onChange` or `readOnly`.'\n        );\n      },\n      checked: function(props, propName, componentName) {\n        if (!props[propName] ||\n            props.onChange ||\n            props.readOnly ||\n            props.disabled) {\n          return null;\n        }\n        return new Error(\n          'You provided a `checked` prop to a form field without an ' +\n          '`onChange` handler. This will render a read-only field. If ' +\n          'the field should be mutable use `defaultChecked`. Otherwise, ' +\n          'set either `onChange` or `readOnly`.'\n        );\n      },\n      onChange: ReactPropTypes.func\n    }\n  },\n\n  /**\n   * @param {ReactComponent} input Form component\n   * @return {*} current value of the input either from value prop or link.\n   */\n  getValue: function(input) {\n    if (input.props.valueLink) {\n      _assertValueLink(input);\n      return input.props.valueLink.value;\n    }\n    return input.props.value;\n  },\n\n  /**\n   * @param {ReactComponent} input Form component\n   * @return {*} current checked status of the input either from checked prop\n   *             or link.\n   */\n  getChecked: function(input) {\n    if (input.props.checkedLink) {\n      _assertCheckedLink(input);\n      return input.props.checkedLink.value;\n    }\n    return input.props.checked;\n  },\n\n  /**\n   * @param {ReactComponent} input Form component\n   * @return {function} change callback either from onChange prop or link.\n   */\n  getOnChange: function(input) {\n    if (input.props.valueLink) {\n      _assertValueLink(input);\n      return _handleLinkedValueChange;\n    } else if (input.props.checkedLink) {\n      _assertCheckedLink(input);\n      return _handleLinkedCheckChange;\n    }\n    return input.props.onChange;\n  }\n};\n\nmodule.exports = LinkedValueUtils;\n\n},{\"135\":135,\"78\":78}],25:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule LocalEventTrapMixin\n */\n\n'use strict';\n\nvar ReactBrowserEventEmitter = _dereq_(30);\n\nvar accumulateInto = _dereq_(105);\nvar forEachAccumulated = _dereq_(120);\nvar invariant = _dereq_(135);\n\nfunction remove(event) {\n  event.remove();\n}\n\nvar LocalEventTrapMixin = {\n  trapBubbledEvent:function(topLevelType, handlerBaseName) {\n    (\"production\" !== \"development\" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));\n    // If a component renders to null or if another component fatals and causes\n    // the state of the tree to be corrupted, `node` here can be null.\n    var node = this.getDOMNode();\n    (\"production\" !== \"development\" ? invariant(\n      node,\n      'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'\n    ) : invariant(node));\n    var listener = ReactBrowserEventEmitter.trapBubbledEvent(\n      topLevelType,\n      handlerBaseName,\n      node\n    );\n    this._localEventListeners =\n      accumulateInto(this._localEventListeners, listener);\n  },\n\n  // trapCapturedEvent would look nearly identical. We don't implement that\n  // method because it isn't currently needed.\n\n  componentWillUnmount:function() {\n    if (this._localEventListeners) {\n      forEachAccumulated(this._localEventListeners, remove);\n    }\n  }\n};\n\nmodule.exports = LocalEventTrapMixin;\n\n},{\"105\":105,\"120\":120,\"135\":135,\"30\":30}],26:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule MobileSafariClickEventPlugin\n * @typechecks static-only\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\n\nvar emptyFunction = _dereq_(114);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\n/**\n * Mobile Safari does not fire properly bubble click events on non-interactive\n * elements, which means delegated click listeners do not fire. The workaround\n * for this bug involves attaching an empty click listener on the target node.\n *\n * This particular plugin works around the bug by attaching an empty click\n * listener on `touchstart` (which does fire on every element).\n */\nvar MobileSafariClickEventPlugin = {\n\n  eventTypes: null,\n\n  /**\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n    if (topLevelType === topLevelTypes.topTouchStart) {\n      var target = nativeEvent.target;\n      if (target && !target.onclick) {\n        target.onclick = emptyFunction;\n      }\n    }\n  }\n\n};\n\nmodule.exports = MobileSafariClickEventPlugin;\n\n},{\"114\":114,\"15\":15}],27:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule Object.assign\n */\n\n// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign\n\n'use strict';\n\nfunction assign(target, sources) {\n  if (target == null) {\n    throw new TypeError('Object.assign target cannot be null or undefined');\n  }\n\n  var to = Object(target);\n  var hasOwnProperty = Object.prototype.hasOwnProperty;\n\n  for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {\n    var nextSource = arguments[nextIndex];\n    if (nextSource == null) {\n      continue;\n    }\n\n    var from = Object(nextSource);\n\n    // We don't currently support accessors nor proxies. Therefore this\n    // copy cannot throw. If we ever supported this then we must handle\n    // exceptions and side-effects. We don't support symbols so they won't\n    // be transferred.\n\n    for (var key in from) {\n      if (hasOwnProperty.call(from, key)) {\n        to[key] = from[key];\n      }\n    }\n  }\n\n  return to;\n}\n\nmodule.exports = assign;\n\n},{}],28:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule PooledClass\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n * Static poolers. Several custom versions for each potential number of\n * arguments. A completely generic pooler is easy to implement, but would\n * require accessing the `arguments` object. In each of these, `this` refers to\n * the Class itself, not an instance. If any others are needed, simply add them\n * here, or in their own files.\n */\nvar oneArgumentPooler = function(copyFieldsFrom) {\n  var Klass = this;\n  if (Klass.instancePool.length) {\n    var instance = Klass.instancePool.pop();\n    Klass.call(instance, copyFieldsFrom);\n    return instance;\n  } else {\n    return new Klass(copyFieldsFrom);\n  }\n};\n\nvar twoArgumentPooler = function(a1, a2) {\n  var Klass = this;\n  if (Klass.instancePool.length) {\n    var instance = Klass.instancePool.pop();\n    Klass.call(instance, a1, a2);\n    return instance;\n  } else {\n    return new Klass(a1, a2);\n  }\n};\n\nvar threeArgumentPooler = function(a1, a2, a3) {\n  var Klass = this;\n  if (Klass.instancePool.length) {\n    var instance = Klass.instancePool.pop();\n    Klass.call(instance, a1, a2, a3);\n    return instance;\n  } else {\n    return new Klass(a1, a2, a3);\n  }\n};\n\nvar fiveArgumentPooler = function(a1, a2, a3, a4, a5) {\n  var Klass = this;\n  if (Klass.instancePool.length) {\n    var instance = Klass.instancePool.pop();\n    Klass.call(instance, a1, a2, a3, a4, a5);\n    return instance;\n  } else {\n    return new Klass(a1, a2, a3, a4, a5);\n  }\n};\n\nvar standardReleaser = function(instance) {\n  var Klass = this;\n  (\"production\" !== \"development\" ? invariant(\n    instance instanceof Klass,\n    'Trying to release an instance into a pool of a different type.'\n  ) : invariant(instance instanceof Klass));\n  if (instance.destructor) {\n    instance.destructor();\n  }\n  if (Klass.instancePool.length < Klass.poolSize) {\n    Klass.instancePool.push(instance);\n  }\n};\n\nvar DEFAULT_POOL_SIZE = 10;\nvar DEFAULT_POOLER = oneArgumentPooler;\n\n/**\n * Augments `CopyConstructor` to be a poolable class, augmenting only the class\n * itself (statically) not adding any prototypical fields. Any CopyConstructor\n * you give this may have a `poolSize` property, and will look for a\n * prototypical `destructor` on instances (optional).\n *\n * @param {Function} CopyConstructor Constructor that can be used to reset.\n * @param {Function} pooler Customizable pooler.\n */\nvar addPoolingTo = function(CopyConstructor, pooler) {\n  var NewKlass = CopyConstructor;\n  NewKlass.instancePool = [];\n  NewKlass.getPooled = pooler || DEFAULT_POOLER;\n  if (!NewKlass.poolSize) {\n    NewKlass.poolSize = DEFAULT_POOL_SIZE;\n  }\n  NewKlass.release = standardReleaser;\n  return NewKlass;\n};\n\nvar PooledClass = {\n  addPoolingTo: addPoolingTo,\n  oneArgumentPooler: oneArgumentPooler,\n  twoArgumentPooler: twoArgumentPooler,\n  threeArgumentPooler: threeArgumentPooler,\n  fiveArgumentPooler: fiveArgumentPooler\n};\n\nmodule.exports = PooledClass;\n\n},{\"135\":135}],29:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactBrowserComponentMixin\n */\n\n'use strict';\n\nvar findDOMNode = _dereq_(117);\n\nvar ReactBrowserComponentMixin = {\n  /**\n   * Returns the DOM node rendered by this component.\n   *\n   * @return {DOMElement} The root node of this component.\n   * @final\n   * @protected\n   */\n  getDOMNode: function() {\n    return findDOMNode(this);\n  }\n};\n\nmodule.exports = ReactBrowserComponentMixin;\n\n},{\"117\":117}],30:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactBrowserEventEmitter\n * @typechecks static-only\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPluginHub = _dereq_(17);\nvar EventPluginRegistry = _dereq_(18);\nvar ReactEventEmitterMixin = _dereq_(61);\nvar ViewportMetrics = _dereq_(104);\n\nvar assign = _dereq_(27);\nvar isEventSupported = _dereq_(136);\n\n/**\n * Summary of `ReactBrowserEventEmitter` event handling:\n *\n *  - Top-level delegation is used to trap most native browser events. This\n *    may only occur in the main thread and is the responsibility of\n *    ReactEventListener, which is injected and can therefore support pluggable\n *    event sources. This is the only work that occurs in the main thread.\n *\n *  - We normalize and de-duplicate events to account for browser quirks. This\n *    may be done in the worker thread.\n *\n *  - Forward these native events (with the associated top-level type used to\n *    trap it) to `EventPluginHub`, which in turn will ask plugins if they want\n *    to extract any synthetic events.\n *\n *  - The `EventPluginHub` will then process each event by annotating them with\n *    \"dispatches\", a sequence of listeners and IDs that care about that event.\n *\n *  - The `EventPluginHub` then dispatches the events.\n *\n * Overview of React and the event system:\n *\n * +------------+    .\n * |    DOM     |    .\n * +------------+    .\n *       |           .\n *       v           .\n * +------------+    .\n * | ReactEvent |    .\n * |  Listener  |    .\n * +------------+    .                         +-----------+\n *       |           .               +--------+|SimpleEvent|\n *       |           .               |         |Plugin     |\n * +-----|------+    .               v         +-----------+\n * |     |      |    .    +--------------+                    +------------+\n * |     +-----------.--->|EventPluginHub|                    |    Event   |\n * |            |    .    |              |     +-----------+  | Propagators|\n * | ReactEvent |    .    |              |     |TapEvent   |  |------------|\n * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|\n * |            |    .    |              |     +-----------+  |  utilities |\n * |     +-----------.--->|              |                    +------------+\n * |     |      |    .    +--------------+\n * +-----|------+    .                ^        +-----------+\n *       |           .                |        |Enter/Leave|\n *       +           .                +-------+|Plugin     |\n * +-------------+   .                         +-----------+\n * | application |   .\n * |-------------|   .\n * |             |   .\n * |             |   .\n * +-------------+   .\n *                   .\n *    React Core     .  General Purpose Event Plugin System\n */\n\nvar alreadyListeningTo = {};\nvar isMonitoringScrollValue = false;\nvar reactTopListenersCounter = 0;\n\n// For events like 'submit' which don't consistently bubble (which we trap at a\n// lower node than `document`), binding at `document` would cause duplicate\n// events so we don't include them here\nvar topEventMapping = {\n  topBlur: 'blur',\n  topChange: 'change',\n  topClick: 'click',\n  topCompositionEnd: 'compositionend',\n  topCompositionStart: 'compositionstart',\n  topCompositionUpdate: 'compositionupdate',\n  topContextMenu: 'contextmenu',\n  topCopy: 'copy',\n  topCut: 'cut',\n  topDoubleClick: 'dblclick',\n  topDrag: 'drag',\n  topDragEnd: 'dragend',\n  topDragEnter: 'dragenter',\n  topDragExit: 'dragexit',\n  topDragLeave: 'dragleave',\n  topDragOver: 'dragover',\n  topDragStart: 'dragstart',\n  topDrop: 'drop',\n  topFocus: 'focus',\n  topInput: 'input',\n  topKeyDown: 'keydown',\n  topKeyPress: 'keypress',\n  topKeyUp: 'keyup',\n  topMouseDown: 'mousedown',\n  topMouseMove: 'mousemove',\n  topMouseOut: 'mouseout',\n  topMouseOver: 'mouseover',\n  topMouseUp: 'mouseup',\n  topPaste: 'paste',\n  topScroll: 'scroll',\n  topSelectionChange: 'selectionchange',\n  topTextInput: 'textInput',\n  topTouchCancel: 'touchcancel',\n  topTouchEnd: 'touchend',\n  topTouchMove: 'touchmove',\n  topTouchStart: 'touchstart',\n  topWheel: 'wheel'\n};\n\n/**\n * To ensure no conflicts with other potential React instances on the page\n */\nvar topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);\n\nfunction getListeningForDocument(mountAt) {\n  // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`\n  // directly.\n  if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {\n    mountAt[topListenersIDKey] = reactTopListenersCounter++;\n    alreadyListeningTo[mountAt[topListenersIDKey]] = {};\n  }\n  return alreadyListeningTo[mountAt[topListenersIDKey]];\n}\n\n/**\n * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For\n * example:\n *\n *   ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);\n *\n * This would allocate a \"registration\" of `('onClick', myFunction)` on 'myID'.\n *\n * @internal\n */\nvar ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {\n\n  /**\n   * Injectable event backend\n   */\n  ReactEventListener: null,\n\n  injection: {\n    /**\n     * @param {object} ReactEventListener\n     */\n    injectReactEventListener: function(ReactEventListener) {\n      ReactEventListener.setHandleTopLevel(\n        ReactBrowserEventEmitter.handleTopLevel\n      );\n      ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;\n    }\n  },\n\n  /**\n   * Sets whether or not any created callbacks should be enabled.\n   *\n   * @param {boolean} enabled True if callbacks should be enabled.\n   */\n  setEnabled: function(enabled) {\n    if (ReactBrowserEventEmitter.ReactEventListener) {\n      ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);\n    }\n  },\n\n  /**\n   * @return {boolean} True if callbacks are enabled.\n   */\n  isEnabled: function() {\n    return !!(\n      (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())\n    );\n  },\n\n  /**\n   * We listen for bubbled touch events on the document object.\n   *\n   * Firefox v8.01 (and possibly others) exhibited strange behavior when\n   * mounting `onmousemove` events at some node that was not the document\n   * element. The symptoms were that if your mouse is not moving over something\n   * contained within that mount point (for example on the background) the\n   * top-level listeners for `onmousemove` won't be called. However, if you\n   * register the `mousemove` on the document object, then it will of course\n   * catch all `mousemove`s. This along with iOS quirks, justifies restricting\n   * top-level listeners to the document object only, at least for these\n   * movement types of events and possibly all events.\n   *\n   * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html\n   *\n   * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but\n   * they bubble to document.\n   *\n   * @param {string} registrationName Name of listener (e.g. `onClick`).\n   * @param {object} contentDocumentHandle Document which owns the container\n   */\n  listenTo: function(registrationName, contentDocumentHandle) {\n    var mountAt = contentDocumentHandle;\n    var isListening = getListeningForDocument(mountAt);\n    var dependencies = EventPluginRegistry.\n      registrationNameDependencies[registrationName];\n\n    var topLevelTypes = EventConstants.topLevelTypes;\n    for (var i = 0, l = dependencies.length; i < l; i++) {\n      var dependency = dependencies[i];\n      if (!(\n            (isListening.hasOwnProperty(dependency) && isListening[dependency])\n          )) {\n        if (dependency === topLevelTypes.topWheel) {\n          if (isEventSupported('wheel')) {\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topWheel,\n              'wheel',\n              mountAt\n            );\n          } else if (isEventSupported('mousewheel')) {\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topWheel,\n              'mousewheel',\n              mountAt\n            );\n          } else {\n            // Firefox needs to capture a different mouse scroll event.\n            // @see http://www.quirksmode.org/dom/events/tests/scroll.html\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topWheel,\n              'DOMMouseScroll',\n              mountAt\n            );\n          }\n        } else if (dependency === topLevelTypes.topScroll) {\n\n          if (isEventSupported('scroll', true)) {\n            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n              topLevelTypes.topScroll,\n              'scroll',\n              mountAt\n            );\n          } else {\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topScroll,\n              'scroll',\n              ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE\n            );\n          }\n        } else if (dependency === topLevelTypes.topFocus ||\n            dependency === topLevelTypes.topBlur) {\n\n          if (isEventSupported('focus', true)) {\n            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n              topLevelTypes.topFocus,\n              'focus',\n              mountAt\n            );\n            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n              topLevelTypes.topBlur,\n              'blur',\n              mountAt\n            );\n          } else if (isEventSupported('focusin')) {\n            // IE has `focusin` and `focusout` events which bubble.\n            // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topFocus,\n              'focusin',\n              mountAt\n            );\n            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n              topLevelTypes.topBlur,\n              'focusout',\n              mountAt\n            );\n          }\n\n          // to make sure blur and focus event listeners are only attached once\n          isListening[topLevelTypes.topBlur] = true;\n          isListening[topLevelTypes.topFocus] = true;\n        } else if (topEventMapping.hasOwnProperty(dependency)) {\n          ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n            dependency,\n            topEventMapping[dependency],\n            mountAt\n          );\n        }\n\n        isListening[dependency] = true;\n      }\n    }\n  },\n\n  trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {\n    return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n      topLevelType,\n      handlerBaseName,\n      handle\n    );\n  },\n\n  trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {\n    return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n      topLevelType,\n      handlerBaseName,\n      handle\n    );\n  },\n\n  /**\n   * Listens to window scroll and resize events. We cache scroll values so that\n   * application code can access them without triggering reflows.\n   *\n   * NOTE: Scroll events do not bubble.\n   *\n   * @see http://www.quirksmode.org/dom/events/scroll.html\n   */\n  ensureScrollValueMonitoring: function() {\n    if (!isMonitoringScrollValue) {\n      var refresh = ViewportMetrics.refreshScrollValues;\n      ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);\n      isMonitoringScrollValue = true;\n    }\n  },\n\n  eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,\n\n  registrationNameModules: EventPluginHub.registrationNameModules,\n\n  putListener: EventPluginHub.putListener,\n\n  getListener: EventPluginHub.getListener,\n\n  deleteListener: EventPluginHub.deleteListener,\n\n  deleteAllListeners: EventPluginHub.deleteAllListeners\n\n});\n\nmodule.exports = ReactBrowserEventEmitter;\n\n},{\"104\":104,\"136\":136,\"15\":15,\"17\":17,\"18\":18,\"27\":27,\"61\":61}],31:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactChildReconciler\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactReconciler = _dereq_(81);\n\nvar flattenChildren = _dereq_(118);\nvar instantiateReactComponent = _dereq_(134);\nvar shouldUpdateReactComponent = _dereq_(151);\n\n/**\n * ReactChildReconciler provides helpers for initializing or updating a set of\n * children. Its output is suitable for passing it onto ReactMultiChild which\n * does diffed reordering and insertion.\n */\nvar ReactChildReconciler = {\n\n  /**\n   * Generates a \"mount image\" for each of the supplied children. In the case\n   * of `ReactDOMComponent`, a mount image is a string of markup.\n   *\n   * @param {?object} nestedChildNodes Nested child maps.\n   * @return {?object} A set of child instances.\n   * @internal\n   */\n  instantiateChildren: function(nestedChildNodes, transaction, context) {\n    var children = flattenChildren(nestedChildNodes);\n    for (var name in children) {\n      if (children.hasOwnProperty(name)) {\n        var child = children[name];\n        // The rendered children must be turned into instances as they're\n        // mounted.\n        var childInstance = instantiateReactComponent(child, null);\n        children[name] = childInstance;\n      }\n    }\n    return children;\n  },\n\n  /**\n   * Updates the rendered children and returns a new set of children.\n   *\n   * @param {?object} prevChildren Previously initialized set of children.\n   * @param {?object} nextNestedChildNodes Nested child maps.\n   * @param {ReactReconcileTransaction} transaction\n   * @param {object} context\n   * @return {?object} A new set of child instances.\n   * @internal\n   */\n  updateChildren: function(\n    prevChildren,\n    nextNestedChildNodes,\n    transaction,\n    context) {\n    // We currently don't have a way to track moves here but if we use iterators\n    // instead of for..in we can zip the iterators and check if an item has\n    // moved.\n    // TODO: If nothing has changed, return the prevChildren object so that we\n    // can quickly bailout if nothing has changed.\n    var nextChildren = flattenChildren(nextNestedChildNodes);\n    if (!nextChildren && !prevChildren) {\n      return null;\n    }\n    var name;\n    for (name in nextChildren) {\n      if (!nextChildren.hasOwnProperty(name)) {\n        continue;\n      }\n      var prevChild = prevChildren && prevChildren[name];\n      var prevElement = prevChild && prevChild._currentElement;\n      var nextElement = nextChildren[name];\n      if (shouldUpdateReactComponent(prevElement, nextElement)) {\n        ReactReconciler.receiveComponent(\n          prevChild, nextElement, transaction, context\n        );\n        nextChildren[name] = prevChild;\n      } else {\n        if (prevChild) {\n          ReactReconciler.unmountComponent(prevChild, name);\n        }\n        // The child must be instantiated before it's mounted.\n        var nextChildInstance = instantiateReactComponent(\n          nextElement,\n          null\n        );\n        nextChildren[name] = nextChildInstance;\n      }\n    }\n    // Unmount children that are no longer present.\n    for (name in prevChildren) {\n      if (prevChildren.hasOwnProperty(name) &&\n          !(nextChildren && nextChildren.hasOwnProperty(name))) {\n        ReactReconciler.unmountComponent(prevChildren[name]);\n      }\n    }\n    return nextChildren;\n  },\n\n  /**\n   * Unmounts all rendered children. This should be used to clean up children\n   * when this component is unmounted.\n   *\n   * @param {?object} renderedChildren Previously initialized set of children.\n   * @internal\n   */\n  unmountChildren: function(renderedChildren) {\n    for (var name in renderedChildren) {\n      var renderedChild = renderedChildren[name];\n      ReactReconciler.unmountComponent(renderedChild);\n    }\n  }\n\n};\n\nmodule.exports = ReactChildReconciler;\n\n},{\"118\":118,\"134\":134,\"151\":151,\"81\":81}],32:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactChildren\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\nvar ReactFragment = _dereq_(63);\n\nvar traverseAllChildren = _dereq_(153);\nvar warning = _dereq_(154);\n\nvar twoArgumentPooler = PooledClass.twoArgumentPooler;\nvar threeArgumentPooler = PooledClass.threeArgumentPooler;\n\n/**\n * PooledClass representing the bookkeeping associated with performing a child\n * traversal. Allows avoiding binding callbacks.\n *\n * @constructor ForEachBookKeeping\n * @param {!function} forEachFunction Function to perform traversal with.\n * @param {?*} forEachContext Context to perform context with.\n */\nfunction ForEachBookKeeping(forEachFunction, forEachContext) {\n  this.forEachFunction = forEachFunction;\n  this.forEachContext = forEachContext;\n}\nPooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);\n\nfunction forEachSingleChild(traverseContext, child, name, i) {\n  var forEachBookKeeping = traverseContext;\n  forEachBookKeeping.forEachFunction.call(\n    forEachBookKeeping.forEachContext, child, i);\n}\n\n/**\n * Iterates through children that are typically specified as `props.children`.\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} forEachFunc.\n * @param {*} forEachContext Context for forEachContext.\n */\nfunction forEachChildren(children, forEachFunc, forEachContext) {\n  if (children == null) {\n    return children;\n  }\n\n  var traverseContext =\n    ForEachBookKeeping.getPooled(forEachFunc, forEachContext);\n  traverseAllChildren(children, forEachSingleChild, traverseContext);\n  ForEachBookKeeping.release(traverseContext);\n}\n\n/**\n * PooledClass representing the bookkeeping associated with performing a child\n * mapping. Allows avoiding binding callbacks.\n *\n * @constructor MapBookKeeping\n * @param {!*} mapResult Object containing the ordered map of results.\n * @param {!function} mapFunction Function to perform mapping with.\n * @param {?*} mapContext Context to perform mapping with.\n */\nfunction MapBookKeeping(mapResult, mapFunction, mapContext) {\n  this.mapResult = mapResult;\n  this.mapFunction = mapFunction;\n  this.mapContext = mapContext;\n}\nPooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);\n\nfunction mapSingleChildIntoContext(traverseContext, child, name, i) {\n  var mapBookKeeping = traverseContext;\n  var mapResult = mapBookKeeping.mapResult;\n\n  var keyUnique = !mapResult.hasOwnProperty(name);\n  if (\"production\" !== \"development\") {\n    (\"production\" !== \"development\" ? warning(\n      keyUnique,\n      'ReactChildren.map(...): Encountered two children with the same key, ' +\n      '`%s`. Child keys must be unique; when two children share a key, only ' +\n      'the first child will be used.',\n      name\n    ) : null);\n  }\n\n  if (keyUnique) {\n    var mappedChild =\n      mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);\n    mapResult[name] = mappedChild;\n  }\n}\n\n/**\n * Maps children that are typically specified as `props.children`.\n *\n * The provided mapFunction(child, key, index) will be called for each\n * leaf child.\n *\n * TODO: This may likely break any calls to `ReactChildren.map` that were\n * previously relying on the fact that we guarded against null children.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} mapFunction.\n * @param {*} mapContext Context for mapFunction.\n * @return {object} Object containing the ordered map of results.\n */\nfunction mapChildren(children, func, context) {\n  if (children == null) {\n    return children;\n  }\n\n  var mapResult = {};\n  var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);\n  traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);\n  MapBookKeeping.release(traverseContext);\n  return ReactFragment.create(mapResult);\n}\n\nfunction forEachSingleChildDummy(traverseContext, child, name, i) {\n  return null;\n}\n\n/**\n * Count the number of children that are typically specified as\n * `props.children`.\n *\n * @param {?*} children Children tree container.\n * @return {number} The number of children.\n */\nfunction countChildren(children, context) {\n  return traverseAllChildren(children, forEachSingleChildDummy, null);\n}\n\nvar ReactChildren = {\n  forEach: forEachChildren,\n  map: mapChildren,\n  count: countChildren\n};\n\nmodule.exports = ReactChildren;\n\n},{\"153\":153,\"154\":154,\"28\":28,\"63\":63}],33:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactClass\n */\n\n'use strict';\n\nvar ReactComponent = _dereq_(34);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactElement = _dereq_(57);\nvar ReactErrorUtils = _dereq_(60);\nvar ReactInstanceMap = _dereq_(67);\nvar ReactLifeCycle = _dereq_(68);\nvar ReactPropTypeLocations = _dereq_(77);\nvar ReactPropTypeLocationNames = _dereq_(76);\nvar ReactUpdateQueue = _dereq_(86);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\nvar keyMirror = _dereq_(140);\nvar keyOf = _dereq_(141);\nvar warning = _dereq_(154);\n\nvar MIXINS_KEY = keyOf({mixins: null});\n\n/**\n * Policies that describe methods in `ReactClassInterface`.\n */\nvar SpecPolicy = keyMirror({\n  /**\n   * These methods may be defined only once by the class specification or mixin.\n   */\n  DEFINE_ONCE: null,\n  /**\n   * These methods may be defined by both the class specification and mixins.\n   * Subsequent definitions will be chained. These methods must return void.\n   */\n  DEFINE_MANY: null,\n  /**\n   * These methods are overriding the base class.\n   */\n  OVERRIDE_BASE: null,\n  /**\n   * These methods are similar to DEFINE_MANY, except we assume they return\n   * objects. We try to merge the keys of the return values of all the mixed in\n   * functions. If there is a key conflict we throw.\n   */\n  DEFINE_MANY_MERGED: null\n});\n\n\nvar injectedMixins = [];\n\n/**\n * Composite components are higher-level components that compose other composite\n * or native components.\n *\n * To create a new type of `ReactClass`, pass a specification of\n * your new class to `React.createClass`. The only requirement of your class\n * specification is that you implement a `render` method.\n *\n *   var MyComponent = React.createClass({\n *     render: function() {\n *       return <div>Hello World</div>;\n *     }\n *   });\n *\n * The class specification supports a specific protocol of methods that have\n * special meaning (e.g. `render`). See `ReactClassInterface` for\n * more the comprehensive protocol. Any other properties and methods in the\n * class specification will available on the prototype.\n *\n * @interface ReactClassInterface\n * @internal\n */\nvar ReactClassInterface = {\n\n  /**\n   * An array of Mixin objects to include when defining your component.\n   *\n   * @type {array}\n   * @optional\n   */\n  mixins: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * An object containing properties and methods that should be defined on\n   * the component's constructor instead of its prototype (static methods).\n   *\n   * @type {object}\n   * @optional\n   */\n  statics: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Definition of prop types for this component.\n   *\n   * @type {object}\n   * @optional\n   */\n  propTypes: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Definition of context types for this component.\n   *\n   * @type {object}\n   * @optional\n   */\n  contextTypes: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Definition of context types this component sets for its children.\n   *\n   * @type {object}\n   * @optional\n   */\n  childContextTypes: SpecPolicy.DEFINE_MANY,\n\n  // ==== Definition methods ====\n\n  /**\n   * Invoked when the component is mounted. Values in the mapping will be set on\n   * `this.props` if that prop is not specified (i.e. using an `in` check).\n   *\n   * This method is invoked before `getInitialState` and therefore cannot rely\n   * on `this.state` or use `this.setState`.\n   *\n   * @return {object}\n   * @optional\n   */\n  getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,\n\n  /**\n   * Invoked once before the component is mounted. The return value will be used\n   * as the initial value of `this.state`.\n   *\n   *   getInitialState: function() {\n   *     return {\n   *       isOn: false,\n   *       fooBaz: new BazFoo()\n   *     }\n   *   }\n   *\n   * @return {object}\n   * @optional\n   */\n  getInitialState: SpecPolicy.DEFINE_MANY_MERGED,\n\n  /**\n   * @return {object}\n   * @optional\n   */\n  getChildContext: SpecPolicy.DEFINE_MANY_MERGED,\n\n  /**\n   * Uses props from `this.props` and state from `this.state` to render the\n   * structure of the component.\n   *\n   * No guarantees are made about when or how often this method is invoked, so\n   * it must not have side effects.\n   *\n   *   render: function() {\n   *     var name = this.props.name;\n   *     return <div>Hello, {name}!</div>;\n   *   }\n   *\n   * @return {ReactComponent}\n   * @nosideeffects\n   * @required\n   */\n  render: SpecPolicy.DEFINE_ONCE,\n\n\n\n  // ==== Delegate methods ====\n\n  /**\n   * Invoked when the component is initially created and about to be mounted.\n   * This may have side effects, but any external subscriptions or data created\n   * by this method must be cleaned up in `componentWillUnmount`.\n   *\n   * @optional\n   */\n  componentWillMount: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Invoked when the component has been mounted and has a DOM representation.\n   * However, there is no guarantee that the DOM node is in the document.\n   *\n   * Use this as an opportunity to operate on the DOM when the component has\n   * been mounted (initialized and rendered) for the first time.\n   *\n   * @param {DOMElement} rootNode DOM element representing the component.\n   * @optional\n   */\n  componentDidMount: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Invoked before the component receives new props.\n   *\n   * Use this as an opportunity to react to a prop transition by updating the\n   * state using `this.setState`. Current props are accessed via `this.props`.\n   *\n   *   componentWillReceiveProps: function(nextProps, nextContext) {\n   *     this.setState({\n   *       likesIncreasing: nextProps.likeCount > this.props.likeCount\n   *     });\n   *   }\n   *\n   * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop\n   * transition may cause a state change, but the opposite is not true. If you\n   * need it, you are probably looking for `componentWillUpdate`.\n   *\n   * @param {object} nextProps\n   * @optional\n   */\n  componentWillReceiveProps: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Invoked while deciding if the component should be updated as a result of\n   * receiving new props, state and/or context.\n   *\n   * Use this as an opportunity to `return false` when you're certain that the\n   * transition to the new props/state/context will not require a component\n   * update.\n   *\n   *   shouldComponentUpdate: function(nextProps, nextState, nextContext) {\n   *     return !equal(nextProps, this.props) ||\n   *       !equal(nextState, this.state) ||\n   *       !equal(nextContext, this.context);\n   *   }\n   *\n   * @param {object} nextProps\n   * @param {?object} nextState\n   * @param {?object} nextContext\n   * @return {boolean} True if the component should update.\n   * @optional\n   */\n  shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,\n\n  /**\n   * Invoked when the component is about to update due to a transition from\n   * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`\n   * and `nextContext`.\n   *\n   * Use this as an opportunity to perform preparation before an update occurs.\n   *\n   * NOTE: You **cannot** use `this.setState()` in this method.\n   *\n   * @param {object} nextProps\n   * @param {?object} nextState\n   * @param {?object} nextContext\n   * @param {ReactReconcileTransaction} transaction\n   * @optional\n   */\n  componentWillUpdate: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Invoked when the component's DOM representation has been updated.\n   *\n   * Use this as an opportunity to operate on the DOM when the component has\n   * been updated.\n   *\n   * @param {object} prevProps\n   * @param {?object} prevState\n   * @param {?object} prevContext\n   * @param {DOMElement} rootNode DOM element representing the component.\n   * @optional\n   */\n  componentDidUpdate: SpecPolicy.DEFINE_MANY,\n\n  /**\n   * Invoked when the component is about to be removed from its parent and have\n   * its DOM representation destroyed.\n   *\n   * Use this as an opportunity to deallocate any external resources.\n   *\n   * NOTE: There is no `componentDidUnmount` since your component will have been\n   * destroyed by that point.\n   *\n   * @optional\n   */\n  componentWillUnmount: SpecPolicy.DEFINE_MANY,\n\n\n\n  // ==== Advanced methods ====\n\n  /**\n   * Updates the component's currently mounted DOM representation.\n   *\n   * By default, this implements React's rendering and reconciliation algorithm.\n   * Sophisticated clients may wish to override this.\n   *\n   * @param {ReactReconcileTransaction} transaction\n   * @internal\n   * @overridable\n   */\n  updateComponent: SpecPolicy.OVERRIDE_BASE\n\n};\n\n/**\n * Mapping from class specification keys to special processing functions.\n *\n * Although these are declared like instance properties in the specification\n * when defining classes using `React.createClass`, they are actually static\n * and are accessible on the constructor instead of the prototype. Despite\n * being static, they must be defined outside of the \"statics\" key under\n * which all other static methods are defined.\n */\nvar RESERVED_SPEC_KEYS = {\n  displayName: function(Constructor, displayName) {\n    Constructor.displayName = displayName;\n  },\n  mixins: function(Constructor, mixins) {\n    if (mixins) {\n      for (var i = 0; i < mixins.length; i++) {\n        mixSpecIntoComponent(Constructor, mixins[i]);\n      }\n    }\n  },\n  childContextTypes: function(Constructor, childContextTypes) {\n    if (\"production\" !== \"development\") {\n      validateTypeDef(\n        Constructor,\n        childContextTypes,\n        ReactPropTypeLocations.childContext\n      );\n    }\n    Constructor.childContextTypes = assign(\n      {},\n      Constructor.childContextTypes,\n      childContextTypes\n    );\n  },\n  contextTypes: function(Constructor, contextTypes) {\n    if (\"production\" !== \"development\") {\n      validateTypeDef(\n        Constructor,\n        contextTypes,\n        ReactPropTypeLocations.context\n      );\n    }\n    Constructor.contextTypes = assign(\n      {},\n      Constructor.contextTypes,\n      contextTypes\n    );\n  },\n  /**\n   * Special case getDefaultProps which should move into statics but requires\n   * automatic merging.\n   */\n  getDefaultProps: function(Constructor, getDefaultProps) {\n    if (Constructor.getDefaultProps) {\n      Constructor.getDefaultProps = createMergedResultFunction(\n        Constructor.getDefaultProps,\n        getDefaultProps\n      );\n    } else {\n      Constructor.getDefaultProps = getDefaultProps;\n    }\n  },\n  propTypes: function(Constructor, propTypes) {\n    if (\"production\" !== \"development\") {\n      validateTypeDef(\n        Constructor,\n        propTypes,\n        ReactPropTypeLocations.prop\n      );\n    }\n    Constructor.propTypes = assign(\n      {},\n      Constructor.propTypes,\n      propTypes\n    );\n  },\n  statics: function(Constructor, statics) {\n    mixStaticSpecIntoComponent(Constructor, statics);\n  }\n};\n\nfunction validateTypeDef(Constructor, typeDef, location) {\n  for (var propName in typeDef) {\n    if (typeDef.hasOwnProperty(propName)) {\n      // use a warning instead of an invariant so components\n      // don't show up in prod but not in __DEV__\n      (\"production\" !== \"development\" ? warning(\n        typeof typeDef[propName] === 'function',\n        '%s: %s type `%s` is invalid; it must be a function, usually from ' +\n        'React.PropTypes.',\n        Constructor.displayName || 'ReactClass',\n        ReactPropTypeLocationNames[location],\n        propName\n      ) : null);\n    }\n  }\n}\n\nfunction validateMethodOverride(proto, name) {\n  var specPolicy = ReactClassInterface.hasOwnProperty(name) ?\n    ReactClassInterface[name] :\n    null;\n\n  // Disallow overriding of base class methods unless explicitly allowed.\n  if (ReactClassMixin.hasOwnProperty(name)) {\n    (\"production\" !== \"development\" ? invariant(\n      specPolicy === SpecPolicy.OVERRIDE_BASE,\n      'ReactClassInterface: You are attempting to override ' +\n      '`%s` from your class specification. Ensure that your method names ' +\n      'do not overlap with React methods.',\n      name\n    ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));\n  }\n\n  // Disallow defining methods more than once unless explicitly allowed.\n  if (proto.hasOwnProperty(name)) {\n    (\"production\" !== \"development\" ? invariant(\n      specPolicy === SpecPolicy.DEFINE_MANY ||\n      specPolicy === SpecPolicy.DEFINE_MANY_MERGED,\n      'ReactClassInterface: You are attempting to define ' +\n      '`%s` on your component more than once. This conflict may be due ' +\n      'to a mixin.',\n      name\n    ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||\n    specPolicy === SpecPolicy.DEFINE_MANY_MERGED));\n  }\n}\n\n/**\n * Mixin helper which handles policy validation and reserved\n * specification keys when building React classses.\n */\nfunction mixSpecIntoComponent(Constructor, spec) {\n  if (!spec) {\n    return;\n  }\n\n  (\"production\" !== \"development\" ? invariant(\n    typeof spec !== 'function',\n    'ReactClass: You\\'re attempting to ' +\n    'use a component class as a mixin. Instead, just use a regular object.'\n  ) : invariant(typeof spec !== 'function'));\n  (\"production\" !== \"development\" ? invariant(\n    !ReactElement.isValidElement(spec),\n    'ReactClass: You\\'re attempting to ' +\n    'use a component as a mixin. Instead, just use a regular object.'\n  ) : invariant(!ReactElement.isValidElement(spec)));\n\n  var proto = Constructor.prototype;\n\n  // By handling mixins before any other properties, we ensure the same\n  // chaining order is applied to methods with DEFINE_MANY policy, whether\n  // mixins are listed before or after these methods in the spec.\n  if (spec.hasOwnProperty(MIXINS_KEY)) {\n    RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);\n  }\n\n  for (var name in spec) {\n    if (!spec.hasOwnProperty(name)) {\n      continue;\n    }\n\n    if (name === MIXINS_KEY) {\n      // We have already handled mixins in a special case above\n      continue;\n    }\n\n    var property = spec[name];\n    validateMethodOverride(proto, name);\n\n    if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {\n      RESERVED_SPEC_KEYS[name](Constructor, property);\n    } else {\n      // Setup methods on prototype:\n      // The following member methods should not be automatically bound:\n      // 1. Expected ReactClass methods (in the \"interface\").\n      // 2. Overridden methods (that were mixed in).\n      var isReactClassMethod =\n        ReactClassInterface.hasOwnProperty(name);\n      var isAlreadyDefined = proto.hasOwnProperty(name);\n      var markedDontBind = property && property.__reactDontBind;\n      var isFunction = typeof property === 'function';\n      var shouldAutoBind =\n        isFunction &&\n        !isReactClassMethod &&\n        !isAlreadyDefined &&\n        !markedDontBind;\n\n      if (shouldAutoBind) {\n        if (!proto.__reactAutoBindMap) {\n          proto.__reactAutoBindMap = {};\n        }\n        proto.__reactAutoBindMap[name] = property;\n        proto[name] = property;\n      } else {\n        if (isAlreadyDefined) {\n          var specPolicy = ReactClassInterface[name];\n\n          // These cases should already be caught by validateMethodOverride\n          (\"production\" !== \"development\" ? invariant(\n            isReactClassMethod && (\n              (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)\n            ),\n            'ReactClass: Unexpected spec policy %s for key %s ' +\n            'when mixing in component specs.',\n            specPolicy,\n            name\n          ) : invariant(isReactClassMethod && (\n            (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)\n          )));\n\n          // For methods which are defined more than once, call the existing\n          // methods before calling the new property, merging if appropriate.\n          if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {\n            proto[name] = createMergedResultFunction(proto[name], property);\n          } else if (specPolicy === SpecPolicy.DEFINE_MANY) {\n            proto[name] = createChainedFunction(proto[name], property);\n          }\n        } else {\n          proto[name] = property;\n          if (\"production\" !== \"development\") {\n            // Add verbose displayName to the function, which helps when looking\n            // at profiling tools.\n            if (typeof property === 'function' && spec.displayName) {\n              proto[name].displayName = spec.displayName + '_' + name;\n            }\n          }\n        }\n      }\n    }\n  }\n}\n\nfunction mixStaticSpecIntoComponent(Constructor, statics) {\n  if (!statics) {\n    return;\n  }\n  for (var name in statics) {\n    var property = statics[name];\n    if (!statics.hasOwnProperty(name)) {\n      continue;\n    }\n\n    var isReserved = name in RESERVED_SPEC_KEYS;\n    (\"production\" !== \"development\" ? invariant(\n      !isReserved,\n      'ReactClass: You are attempting to define a reserved ' +\n      'property, `%s`, that shouldn\\'t be on the \"statics\" key. Define it ' +\n      'as an instance property instead; it will still be accessible on the ' +\n      'constructor.',\n      name\n    ) : invariant(!isReserved));\n\n    var isInherited = name in Constructor;\n    (\"production\" !== \"development\" ? invariant(\n      !isInherited,\n      'ReactClass: You are attempting to define ' +\n      '`%s` on your component more than once. This conflict may be ' +\n      'due to a mixin.',\n      name\n    ) : invariant(!isInherited));\n    Constructor[name] = property;\n  }\n}\n\n/**\n * Merge two objects, but throw if both contain the same key.\n *\n * @param {object} one The first object, which is mutated.\n * @param {object} two The second object\n * @return {object} one after it has been mutated to contain everything in two.\n */\nfunction mergeIntoWithNoDuplicateKeys(one, two) {\n  (\"production\" !== \"development\" ? invariant(\n    one && two && typeof one === 'object' && typeof two === 'object',\n    'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'\n  ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));\n\n  for (var key in two) {\n    if (two.hasOwnProperty(key)) {\n      (\"production\" !== \"development\" ? invariant(\n        one[key] === undefined,\n        'mergeIntoWithNoDuplicateKeys(): ' +\n        'Tried to merge two objects with the same key: `%s`. This conflict ' +\n        'may be due to a mixin; in particular, this may be caused by two ' +\n        'getInitialState() or getDefaultProps() methods returning objects ' +\n        'with clashing keys.',\n        key\n      ) : invariant(one[key] === undefined));\n      one[key] = two[key];\n    }\n  }\n  return one;\n}\n\n/**\n * Creates a function that invokes two functions and merges their return values.\n *\n * @param {function} one Function to invoke first.\n * @param {function} two Function to invoke second.\n * @return {function} Function that invokes the two argument functions.\n * @private\n */\nfunction createMergedResultFunction(one, two) {\n  return function mergedResult() {\n    var a = one.apply(this, arguments);\n    var b = two.apply(this, arguments);\n    if (a == null) {\n      return b;\n    } else if (b == null) {\n      return a;\n    }\n    var c = {};\n    mergeIntoWithNoDuplicateKeys(c, a);\n    mergeIntoWithNoDuplicateKeys(c, b);\n    return c;\n  };\n}\n\n/**\n * Creates a function that invokes two functions and ignores their return vales.\n *\n * @param {function} one Function to invoke first.\n * @param {function} two Function to invoke second.\n * @return {function} Function that invokes the two argument functions.\n * @private\n */\nfunction createChainedFunction(one, two) {\n  return function chainedFunction() {\n    one.apply(this, arguments);\n    two.apply(this, arguments);\n  };\n}\n\n/**\n * Binds a method to the component.\n *\n * @param {object} component Component whose method is going to be bound.\n * @param {function} method Method to be bound.\n * @return {function} The bound method.\n */\nfunction bindAutoBindMethod(component, method) {\n  var boundMethod = method.bind(component);\n  if (\"production\" !== \"development\") {\n    boundMethod.__reactBoundContext = component;\n    boundMethod.__reactBoundMethod = method;\n    boundMethod.__reactBoundArguments = null;\n    var componentName = component.constructor.displayName;\n    var _bind = boundMethod.bind;\n    /* eslint-disable block-scoped-var, no-undef */\n    boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);\n      // User is trying to bind() an autobound method; we effectively will\n      // ignore the value of \"this\" that the user is trying to use, so\n      // let's warn.\n      if (newThis !== component && newThis !== null) {\n        (\"production\" !== \"development\" ? warning(\n          false,\n          'bind(): React component methods may only be bound to the ' +\n          'component instance. See %s',\n          componentName\n        ) : null);\n      } else if (!args.length) {\n        (\"production\" !== \"development\" ? warning(\n          false,\n          'bind(): You are binding a component method to the component. ' +\n          'React does this for you automatically in a high-performance ' +\n          'way, so you can safely remove this call. See %s',\n          componentName\n        ) : null);\n        return boundMethod;\n      }\n      var reboundMethod = _bind.apply(boundMethod, arguments);\n      reboundMethod.__reactBoundContext = component;\n      reboundMethod.__reactBoundMethod = method;\n      reboundMethod.__reactBoundArguments = args;\n      return reboundMethod;\n      /* eslint-enable */\n    };\n  }\n  return boundMethod;\n}\n\n/**\n * Binds all auto-bound methods in a component.\n *\n * @param {object} component Component whose method is going to be bound.\n */\nfunction bindAutoBindMethods(component) {\n  for (var autoBindKey in component.__reactAutoBindMap) {\n    if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {\n      var method = component.__reactAutoBindMap[autoBindKey];\n      component[autoBindKey] = bindAutoBindMethod(\n        component,\n        ReactErrorUtils.guard(\n          method,\n          component.constructor.displayName + '.' + autoBindKey\n        )\n      );\n    }\n  }\n}\n\nvar typeDeprecationDescriptor = {\n  enumerable: false,\n  get: function() {\n    var displayName = this.displayName || this.name || 'Component';\n    (\"production\" !== \"development\" ? warning(\n      false,\n      '%s.type is deprecated. Use %s directly to access the class.',\n      displayName,\n      displayName\n    ) : null);\n    Object.defineProperty(this, 'type', {\n      value: this\n    });\n    return this;\n  }\n};\n\n/**\n * Add more to the ReactClass base class. These are all legacy features and\n * therefore not already part of the modern ReactComponent.\n */\nvar ReactClassMixin = {\n\n  /**\n   * TODO: This will be deprecated because state should always keep a consistent\n   * type signature and the only use case for this, is to avoid that.\n   */\n  replaceState: function(newState, callback) {\n    ReactUpdateQueue.enqueueReplaceState(this, newState);\n    if (callback) {\n      ReactUpdateQueue.enqueueCallback(this, callback);\n    }\n  },\n\n  /**\n   * Checks whether or not this composite component is mounted.\n   * @return {boolean} True if mounted, false otherwise.\n   * @protected\n   * @final\n   */\n  isMounted: function() {\n    if (\"production\" !== \"development\") {\n      var owner = ReactCurrentOwner.current;\n      if (owner !== null) {\n        (\"production\" !== \"development\" ? warning(\n          owner._warnedAboutRefsInRender,\n          '%s is accessing isMounted inside its render() function. ' +\n          'render() should be a pure function of props and state. It should ' +\n          'never access something that requires stale data from the previous ' +\n          'render, such as refs. Move this logic to componentDidMount and ' +\n          'componentDidUpdate instead.',\n          owner.getName() || 'A component'\n        ) : null);\n        owner._warnedAboutRefsInRender = true;\n      }\n    }\n    var internalInstance = ReactInstanceMap.get(this);\n    return (\n      internalInstance &&\n      internalInstance !== ReactLifeCycle.currentlyMountingInstance\n    );\n  },\n\n  /**\n   * Sets a subset of the props.\n   *\n   * @param {object} partialProps Subset of the next props.\n   * @param {?function} callback Called after props are updated.\n   * @final\n   * @public\n   * @deprecated\n   */\n  setProps: function(partialProps, callback) {\n    ReactUpdateQueue.enqueueSetProps(this, partialProps);\n    if (callback) {\n      ReactUpdateQueue.enqueueCallback(this, callback);\n    }\n  },\n\n  /**\n   * Replace all the props.\n   *\n   * @param {object} newProps Subset of the next props.\n   * @param {?function} callback Called after props are updated.\n   * @final\n   * @public\n   * @deprecated\n   */\n  replaceProps: function(newProps, callback) {\n    ReactUpdateQueue.enqueueReplaceProps(this, newProps);\n    if (callback) {\n      ReactUpdateQueue.enqueueCallback(this, callback);\n    }\n  }\n};\n\nvar ReactClassComponent = function() {};\nassign(\n  ReactClassComponent.prototype,\n  ReactComponent.prototype,\n  ReactClassMixin\n);\n\n/**\n * Module for creating composite components.\n *\n * @class ReactClass\n */\nvar ReactClass = {\n\n  /**\n   * Creates a composite component class given a class specification.\n   *\n   * @param {object} spec Class specification (which must define `render`).\n   * @return {function} Component constructor function.\n   * @public\n   */\n  createClass: function(spec) {\n    var Constructor = function(props, context) {\n      // This constructor is overridden by mocks. The argument is used\n      // by mocks to assert on what gets mounted.\n\n      if (\"production\" !== \"development\") {\n        (\"production\" !== \"development\" ? warning(\n          this instanceof Constructor,\n          'Something is calling a React component directly. Use a factory or ' +\n          'JSX instead. See: https://fb.me/react-legacyfactory'\n        ) : null);\n      }\n\n      // Wire up auto-binding\n      if (this.__reactAutoBindMap) {\n        bindAutoBindMethods(this);\n      }\n\n      this.props = props;\n      this.context = context;\n      this.state = null;\n\n      // ReactClasses doesn't have constructors. Instead, they use the\n      // getInitialState and componentWillMount methods for initialization.\n\n      var initialState = this.getInitialState ? this.getInitialState() : null;\n      if (\"production\" !== \"development\") {\n        // We allow auto-mocks to proceed as if they're returning null.\n        if (typeof initialState === 'undefined' &&\n            this.getInitialState._isMockFunction) {\n          // This is probably bad practice. Consider warning here and\n          // deprecating this convenience.\n          initialState = null;\n        }\n      }\n      (\"production\" !== \"development\" ? invariant(\n        typeof initialState === 'object' && !Array.isArray(initialState),\n        '%s.getInitialState(): must return an object or null',\n        Constructor.displayName || 'ReactCompositeComponent'\n      ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));\n\n      this.state = initialState;\n    };\n    Constructor.prototype = new ReactClassComponent();\n    Constructor.prototype.constructor = Constructor;\n\n    injectedMixins.forEach(\n      mixSpecIntoComponent.bind(null, Constructor)\n    );\n\n    mixSpecIntoComponent(Constructor, spec);\n\n    // Initialize the defaultProps property after all mixins have been merged\n    if (Constructor.getDefaultProps) {\n      Constructor.defaultProps = Constructor.getDefaultProps();\n    }\n\n    if (\"production\" !== \"development\") {\n      // This is a tag to indicate that the use of these method names is ok,\n      // since it's used with createClass. If it's not, then it's likely a\n      // mistake so we'll warn you to use the static property, property\n      // initializer or constructor respectively.\n      if (Constructor.getDefaultProps) {\n        Constructor.getDefaultProps.isReactClassApproved = {};\n      }\n      if (Constructor.prototype.getInitialState) {\n        Constructor.prototype.getInitialState.isReactClassApproved = {};\n      }\n    }\n\n    (\"production\" !== \"development\" ? invariant(\n      Constructor.prototype.render,\n      'createClass(...): Class specification must implement a `render` method.'\n    ) : invariant(Constructor.prototype.render));\n\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? warning(\n        !Constructor.prototype.componentShouldUpdate,\n        '%s has a method called ' +\n        'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +\n        'The name is phrased as a question because the function is ' +\n        'expected to return a value.',\n        spec.displayName || 'A component'\n      ) : null);\n    }\n\n    // Reduce time spent doing lookups by setting these on the prototype.\n    for (var methodName in ReactClassInterface) {\n      if (!Constructor.prototype[methodName]) {\n        Constructor.prototype[methodName] = null;\n      }\n    }\n\n    // Legacy hook\n    Constructor.type = Constructor;\n    if (\"production\" !== \"development\") {\n      try {\n        Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);\n      } catch (x) {\n        // IE will fail on defineProperty (es5-shim/sham too)\n      }\n    }\n\n    return Constructor;\n  },\n\n  injection: {\n    injectMixin: function(mixin) {\n      injectedMixins.push(mixin);\n    }\n  }\n\n};\n\nmodule.exports = ReactClass;\n\n},{\"135\":135,\"140\":140,\"141\":141,\"154\":154,\"27\":27,\"34\":34,\"39\":39,\"57\":57,\"60\":60,\"67\":67,\"68\":68,\"76\":76,\"77\":77,\"86\":86}],34:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactComponent\n */\n\n'use strict';\n\nvar ReactUpdateQueue = _dereq_(86);\n\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\n/**\n * Base class helpers for the updating state of a component.\n */\nfunction ReactComponent(props, context) {\n  this.props = props;\n  this.context = context;\n}\n\n/**\n * Sets a subset of the state. Always use this to mutate\n * state. You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * There is no guarantee that calls to `setState` will run synchronously,\n * as they may eventually be batched together.  You can provide an optional\n * callback that will be executed when the call to setState is actually\n * completed.\n *\n * When a function is provided to setState, it will be called at some point in\n * the future (not synchronously). It will be called with the up to date\n * component arguments (state, props, context). These values can be different\n * from this.* because your function may be called after receiveProps but before\n * shouldComponentUpdate, and this new state, props, and context will not yet be\n * assigned to this.\n *\n * @param {object|function} partialState Next partial state or function to\n *        produce next partial state to be merged with current state.\n * @param {?function} callback Called after state is updated.\n * @final\n * @protected\n */\nReactComponent.prototype.setState = function(partialState, callback) {\n  (\"production\" !== \"development\" ? invariant(\n    typeof partialState === 'object' ||\n    typeof partialState === 'function' ||\n    partialState == null,\n    'setState(...): takes an object of state variables to update or a ' +\n    'function which returns an object of state variables.'\n  ) : invariant(typeof partialState === 'object' ||\n  typeof partialState === 'function' ||\n  partialState == null));\n  if (\"production\" !== \"development\") {\n    (\"production\" !== \"development\" ? warning(\n      partialState != null,\n      'setState(...): You passed an undefined or null state object; ' +\n      'instead, use forceUpdate().'\n    ) : null);\n  }\n  ReactUpdateQueue.enqueueSetState(this, partialState);\n  if (callback) {\n    ReactUpdateQueue.enqueueCallback(this, callback);\n  }\n};\n\n/**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldComponentUpdate`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {?function} callback Called after update is complete.\n * @final\n * @protected\n */\nReactComponent.prototype.forceUpdate = function(callback) {\n  ReactUpdateQueue.enqueueForceUpdate(this);\n  if (callback) {\n    ReactUpdateQueue.enqueueCallback(this, callback);\n  }\n};\n\n/**\n * Deprecated APIs. These APIs used to exist on classic React classes but since\n * we would like to deprecate them, we're not going to move them over to this\n * modern base class. Instead, we define a getter that warns if it's accessed.\n */\nif (\"production\" !== \"development\") {\n  var deprecatedAPIs = {\n    getDOMNode: [\n      'getDOMNode',\n      'Use React.findDOMNode(component) instead.'\n    ],\n    isMounted: [\n      'isMounted',\n      'Instead, make sure to clean up subscriptions and pending requests in ' +\n      'componentWillUnmount to prevent memory leaks.'\n    ],\n    replaceProps: [\n      'replaceProps',\n      'Instead call React.render again at the top level.'\n    ],\n    replaceState: [\n      'replaceState',\n      'Refactor your code to use setState instead (see ' +\n      'https://github.com/facebook/react/issues/3236).'\n    ],\n    setProps: [\n      'setProps',\n      'Instead call React.render again at the top level.'\n    ]\n  };\n  var defineDeprecationWarning = function(methodName, info) {\n    try {\n      Object.defineProperty(ReactComponent.prototype, methodName, {\n        get: function() {\n          (\"production\" !== \"development\" ? warning(\n            false,\n            '%s(...) is deprecated in plain JavaScript React classes. %s',\n            info[0],\n            info[1]\n          ) : null);\n          return undefined;\n        }\n      });\n    } catch (x) {\n      // IE will fail on defineProperty (es5-shim/sham too)\n    }\n  };\n  for (var fnName in deprecatedAPIs) {\n    if (deprecatedAPIs.hasOwnProperty(fnName)) {\n      defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);\n    }\n  }\n}\n\nmodule.exports = ReactComponent;\n\n},{\"135\":135,\"154\":154,\"86\":86}],35:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactComponentBrowserEnvironment\n */\n\n/*jslint evil: true */\n\n'use strict';\n\nvar ReactDOMIDOperations = _dereq_(44);\nvar ReactMount = _dereq_(70);\n\n/**\n * Abstracts away all functionality of the reconciler that requires knowledge of\n * the browser context. TODO: These callers should be refactored to avoid the\n * need for this injection.\n */\nvar ReactComponentBrowserEnvironment = {\n\n  processChildrenUpdates:\n    ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,\n\n  replaceNodeWithMarkupByID:\n    ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,\n\n  /**\n   * If a particular environment requires that some resources be cleaned up,\n   * specify this in the injected Mixin. In the DOM, we would likely want to\n   * purge any cached node ID lookups.\n   *\n   * @private\n   */\n  unmountIDFromEnvironment: function(rootNodeID) {\n    ReactMount.purgeID(rootNodeID);\n  }\n\n};\n\nmodule.exports = ReactComponentBrowserEnvironment;\n\n},{\"44\":44,\"70\":70}],36:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactComponentEnvironment\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\nvar injected = false;\n\nvar ReactComponentEnvironment = {\n\n  /**\n   * Optionally injectable environment dependent cleanup hook. (server vs.\n   * browser etc). Example: A browser system caches DOM nodes based on component\n   * ID and must remove that cache entry when this instance is unmounted.\n   */\n  unmountIDFromEnvironment: null,\n\n  /**\n   * Optionally injectable hook for swapping out mount images in the middle of\n   * the tree.\n   */\n  replaceNodeWithMarkupByID: null,\n\n  /**\n   * Optionally injectable hook for processing a queue of child updates. Will\n   * later move into MultiChildComponents.\n   */\n  processChildrenUpdates: null,\n\n  injection: {\n    injectEnvironment: function(environment) {\n      (\"production\" !== \"development\" ? invariant(\n        !injected,\n        'ReactCompositeComponent: injectEnvironment() can only be called once.'\n      ) : invariant(!injected));\n      ReactComponentEnvironment.unmountIDFromEnvironment =\n        environment.unmountIDFromEnvironment;\n      ReactComponentEnvironment.replaceNodeWithMarkupByID =\n        environment.replaceNodeWithMarkupByID;\n      ReactComponentEnvironment.processChildrenUpdates =\n        environment.processChildrenUpdates;\n      injected = true;\n    }\n  }\n\n};\n\nmodule.exports = ReactComponentEnvironment;\n\n},{\"135\":135}],37:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactCompositeComponent\n */\n\n'use strict';\n\nvar ReactComponentEnvironment = _dereq_(36);\nvar ReactContext = _dereq_(38);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactElement = _dereq_(57);\nvar ReactElementValidator = _dereq_(58);\nvar ReactInstanceMap = _dereq_(67);\nvar ReactLifeCycle = _dereq_(68);\nvar ReactNativeComponent = _dereq_(73);\nvar ReactPerf = _dereq_(75);\nvar ReactPropTypeLocations = _dereq_(77);\nvar ReactPropTypeLocationNames = _dereq_(76);\nvar ReactReconciler = _dereq_(81);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\nvar emptyObject = _dereq_(115);\nvar invariant = _dereq_(135);\nvar shouldUpdateReactComponent = _dereq_(151);\nvar warning = _dereq_(154);\n\nfunction getDeclarationErrorAddendum(component) {\n  var owner = component._currentElement._owner || null;\n  if (owner) {\n    var name = owner.getName();\n    if (name) {\n      return ' Check the render method of `' + name + '`.';\n    }\n  }\n  return '';\n}\n\n/**\n * ------------------ The Life-Cycle of a Composite Component ------------------\n *\n * - constructor: Initialization of state. The instance is now retained.\n *   - componentWillMount\n *   - render\n *   - [children's constructors]\n *     - [children's componentWillMount and render]\n *     - [children's componentDidMount]\n *     - componentDidMount\n *\n *       Update Phases:\n *       - componentWillReceiveProps (only called if parent updated)\n *       - shouldComponentUpdate\n *         - componentWillUpdate\n *           - render\n *           - [children's constructors or receive props phases]\n *         - componentDidUpdate\n *\n *     - componentWillUnmount\n *     - [children's componentWillUnmount]\n *   - [children destroyed]\n * - (destroyed): The instance is now blank, released by React and ready for GC.\n *\n * -----------------------------------------------------------------------------\n */\n\n/**\n * An incrementing ID assigned to each component when it is mounted. This is\n * used to enforce the order in which `ReactUpdates` updates dirty components.\n *\n * @private\n */\nvar nextMountID = 1;\n\n/**\n * @lends {ReactCompositeComponent.prototype}\n */\nvar ReactCompositeComponentMixin = {\n\n  /**\n   * Base constructor for all composite component.\n   *\n   * @param {ReactElement} element\n   * @final\n   * @internal\n   */\n  construct: function(element) {\n    this._currentElement = element;\n    this._rootNodeID = null;\n    this._instance = null;\n\n    // See ReactUpdateQueue\n    this._pendingElement = null;\n    this._pendingStateQueue = null;\n    this._pendingReplaceState = false;\n    this._pendingForceUpdate = false;\n\n    this._renderedComponent = null;\n\n    this._context = null;\n    this._mountOrder = 0;\n    this._isTopLevel = false;\n\n    // See ReactUpdates and ReactUpdateQueue.\n    this._pendingCallbacks = null;\n  },\n\n  /**\n   * Initializes the component, renders markup, and registers event listeners.\n   *\n   * @param {string} rootID DOM ID of the root node.\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @return {?string} Rendered markup to be inserted into the DOM.\n   * @final\n   * @internal\n   */\n  mountComponent: function(rootID, transaction, context) {\n    this._context = context;\n    this._mountOrder = nextMountID++;\n    this._rootNodeID = rootID;\n\n    var publicProps = this._processProps(this._currentElement.props);\n    var publicContext = this._processContext(this._currentElement._context);\n\n    var Component = ReactNativeComponent.getComponentClassForElement(\n      this._currentElement\n    );\n\n    // Initialize the public class\n    var inst = new Component(publicProps, publicContext);\n\n    if (\"production\" !== \"development\") {\n      // This will throw later in _renderValidatedComponent, but add an early\n      // warning now to help debugging\n      (\"production\" !== \"development\" ? warning(\n        inst.render != null,\n        '%s(...): No `render` method found on the returned component ' +\n        'instance: you may have forgotten to define `render` in your ' +\n        'component or you may have accidentally tried to render an element ' +\n        'whose type is a function that isn\\'t a React component.',\n        Component.displayName || Component.name || 'Component'\n      ) : null);\n    }\n\n    // These should be set up in the constructor, but as a convenience for\n    // simpler class abstractions, we set them up after the fact.\n    inst.props = publicProps;\n    inst.context = publicContext;\n    inst.refs = emptyObject;\n\n    this._instance = inst;\n\n    // Store a reference from the instance back to the internal representation\n    ReactInstanceMap.set(inst, this);\n\n    if (\"production\" !== \"development\") {\n      this._warnIfContextsDiffer(this._currentElement._context, context);\n    }\n\n    if (\"production\" !== \"development\") {\n      // Since plain JS classes are defined without any special initialization\n      // logic, we can not catch common errors early. Therefore, we have to\n      // catch them here, at initialization time, instead.\n      (\"production\" !== \"development\" ? warning(\n        !inst.getInitialState ||\n        inst.getInitialState.isReactClassApproved,\n        'getInitialState was defined on %s, a plain JavaScript class. ' +\n        'This is only supported for classes created using React.createClass. ' +\n        'Did you mean to define a state property instead?',\n        this.getName() || 'a component'\n      ) : null);\n      (\"production\" !== \"development\" ? warning(\n        !inst.getDefaultProps ||\n        inst.getDefaultProps.isReactClassApproved,\n        'getDefaultProps was defined on %s, a plain JavaScript class. ' +\n        'This is only supported for classes created using React.createClass. ' +\n        'Use a static property to define defaultProps instead.',\n        this.getName() || 'a component'\n      ) : null);\n      (\"production\" !== \"development\" ? warning(\n        !inst.propTypes,\n        'propTypes was defined as an instance property on %s. Use a static ' +\n        'property to define propTypes instead.',\n        this.getName() || 'a component'\n      ) : null);\n      (\"production\" !== \"development\" ? warning(\n        !inst.contextTypes,\n        'contextTypes was defined as an instance property on %s. Use a ' +\n        'static property to define contextTypes instead.',\n        this.getName() || 'a component'\n      ) : null);\n      (\"production\" !== \"development\" ? warning(\n        typeof inst.componentShouldUpdate !== 'function',\n        '%s has a method called ' +\n        'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +\n        'The name is phrased as a question because the function is ' +\n        'expected to return a value.',\n        (this.getName() || 'A component')\n      ) : null);\n    }\n\n    var initialState = inst.state;\n    if (initialState === undefined) {\n      inst.state = initialState = null;\n    }\n    (\"production\" !== \"development\" ? invariant(\n      typeof initialState === 'object' && !Array.isArray(initialState),\n      '%s.state: must be set to an object or null',\n      this.getName() || 'ReactCompositeComponent'\n    ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));\n\n    this._pendingStateQueue = null;\n    this._pendingReplaceState = false;\n    this._pendingForceUpdate = false;\n\n    var childContext;\n    var renderedElement;\n\n    var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;\n    ReactLifeCycle.currentlyMountingInstance = this;\n    try {\n      if (inst.componentWillMount) {\n        inst.componentWillMount();\n        // When mounting, calls to `setState` by `componentWillMount` will set\n        // `this._pendingStateQueue` without triggering a re-render.\n        if (this._pendingStateQueue) {\n          inst.state = this._processPendingState(inst.props, inst.context);\n        }\n      }\n\n      childContext = this._getValidatedChildContext(context);\n      renderedElement = this._renderValidatedComponent(childContext);\n    } finally {\n      ReactLifeCycle.currentlyMountingInstance = previouslyMounting;\n    }\n\n    this._renderedComponent = this._instantiateReactComponent(\n      renderedElement,\n      this._currentElement.type // The wrapping type\n    );\n\n    var markup = ReactReconciler.mountComponent(\n      this._renderedComponent,\n      rootID,\n      transaction,\n      this._mergeChildContext(context, childContext)\n    );\n    if (inst.componentDidMount) {\n      transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);\n    }\n\n    return markup;\n  },\n\n  /**\n   * Releases any resources allocated by `mountComponent`.\n   *\n   * @final\n   * @internal\n   */\n  unmountComponent: function() {\n    var inst = this._instance;\n\n    if (inst.componentWillUnmount) {\n      var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;\n      ReactLifeCycle.currentlyUnmountingInstance = this;\n      try {\n        inst.componentWillUnmount();\n      } finally {\n        ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;\n      }\n    }\n\n    ReactReconciler.unmountComponent(this._renderedComponent);\n    this._renderedComponent = null;\n\n    // Reset pending fields\n    this._pendingStateQueue = null;\n    this._pendingReplaceState = false;\n    this._pendingForceUpdate = false;\n    this._pendingCallbacks = null;\n    this._pendingElement = null;\n\n    // These fields do not really need to be reset since this object is no\n    // longer accessible.\n    this._context = null;\n    this._rootNodeID = null;\n\n    // Delete the reference from the instance to this internal representation\n    // which allow the internals to be properly cleaned up even if the user\n    // leaks a reference to the public instance.\n    ReactInstanceMap.remove(inst);\n\n    // Some existing components rely on inst.props even after they've been\n    // destroyed (in event handlers).\n    // TODO: inst.props = null;\n    // TODO: inst.state = null;\n    // TODO: inst.context = null;\n  },\n\n  /**\n   * Schedule a partial update to the props. Only used for internal testing.\n   *\n   * @param {object} partialProps Subset of the next props.\n   * @param {?function} callback Called after props are updated.\n   * @final\n   * @internal\n   */\n  _setPropsInternal: function(partialProps, callback) {\n    // This is a deoptimized path. We optimize for always having an element.\n    // This creates an extra internal element.\n    var element = this._pendingElement || this._currentElement;\n    this._pendingElement = ReactElement.cloneAndReplaceProps(\n      element,\n      assign({}, element.props, partialProps)\n    );\n    ReactUpdates.enqueueUpdate(this, callback);\n  },\n\n  /**\n   * Filters the context object to only contain keys specified in\n   * `contextTypes`\n   *\n   * @param {object} context\n   * @return {?object}\n   * @private\n   */\n  _maskContext: function(context) {\n    var maskedContext = null;\n    // This really should be getting the component class for the element,\n    // but we know that we're not going to need it for built-ins.\n    if (typeof this._currentElement.type === 'string') {\n      return emptyObject;\n    }\n    var contextTypes = this._currentElement.type.contextTypes;\n    if (!contextTypes) {\n      return emptyObject;\n    }\n    maskedContext = {};\n    for (var contextName in contextTypes) {\n      maskedContext[contextName] = context[contextName];\n    }\n    return maskedContext;\n  },\n\n  /**\n   * Filters the context object to only contain keys specified in\n   * `contextTypes`, and asserts that they are valid.\n   *\n   * @param {object} context\n   * @return {?object}\n   * @private\n   */\n  _processContext: function(context) {\n    var maskedContext = this._maskContext(context);\n    if (\"production\" !== \"development\") {\n      var Component = ReactNativeComponent.getComponentClassForElement(\n        this._currentElement\n      );\n      if (Component.contextTypes) {\n        this._checkPropTypes(\n          Component.contextTypes,\n          maskedContext,\n          ReactPropTypeLocations.context\n        );\n      }\n    }\n    return maskedContext;\n  },\n\n  /**\n   * @param {object} currentContext\n   * @return {object}\n   * @private\n   */\n  _getValidatedChildContext: function(currentContext) {\n    var inst = this._instance;\n    var childContext = inst.getChildContext && inst.getChildContext();\n    if (childContext) {\n      (\"production\" !== \"development\" ? invariant(\n        typeof inst.constructor.childContextTypes === 'object',\n        '%s.getChildContext(): childContextTypes must be defined in order to ' +\n        'use getChildContext().',\n        this.getName() || 'ReactCompositeComponent'\n      ) : invariant(typeof inst.constructor.childContextTypes === 'object'));\n      if (\"production\" !== \"development\") {\n        this._checkPropTypes(\n          inst.constructor.childContextTypes,\n          childContext,\n          ReactPropTypeLocations.childContext\n        );\n      }\n      for (var name in childContext) {\n        (\"production\" !== \"development\" ? invariant(\n          name in inst.constructor.childContextTypes,\n          '%s.getChildContext(): key \"%s\" is not defined in childContextTypes.',\n          this.getName() || 'ReactCompositeComponent',\n          name\n        ) : invariant(name in inst.constructor.childContextTypes));\n      }\n      return childContext;\n    }\n    return null;\n  },\n\n  _mergeChildContext: function(currentContext, childContext) {\n    if (childContext) {\n      return assign({}, currentContext, childContext);\n    }\n    return currentContext;\n  },\n\n  /**\n   * Processes props by setting default values for unspecified props and\n   * asserting that the props are valid. Does not mutate its argument; returns\n   * a new props object with defaults merged in.\n   *\n   * @param {object} newProps\n   * @return {object}\n   * @private\n   */\n  _processProps: function(newProps) {\n    if (\"production\" !== \"development\") {\n      var Component = ReactNativeComponent.getComponentClassForElement(\n        this._currentElement\n      );\n      if (Component.propTypes) {\n        this._checkPropTypes(\n          Component.propTypes,\n          newProps,\n          ReactPropTypeLocations.prop\n        );\n      }\n    }\n    return newProps;\n  },\n\n  /**\n   * Assert that the props are valid\n   *\n   * @param {object} propTypes Map of prop name to a ReactPropType\n   * @param {object} props\n   * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n   * @private\n   */\n  _checkPropTypes: function(propTypes, props, location) {\n    // TODO: Stop validating prop types here and only use the element\n    // validation.\n    var componentName = this.getName();\n    for (var propName in propTypes) {\n      if (propTypes.hasOwnProperty(propName)) {\n        var error;\n        try {\n          // This is intentionally an invariant that gets caught. It's the same\n          // behavior as without this statement except with a better message.\n          (\"production\" !== \"development\" ? invariant(\n            typeof propTypes[propName] === 'function',\n            '%s: %s type `%s` is invalid; it must be a function, usually ' +\n            'from React.PropTypes.',\n            componentName || 'React class',\n            ReactPropTypeLocationNames[location],\n            propName\n          ) : invariant(typeof propTypes[propName] === 'function'));\n          error = propTypes[propName](props, propName, componentName, location);\n        } catch (ex) {\n          error = ex;\n        }\n        if (error instanceof Error) {\n          // We may want to extend this logic for similar errors in\n          // React.render calls, so I'm abstracting it away into\n          // a function to minimize refactoring in the future\n          var addendum = getDeclarationErrorAddendum(this);\n\n          if (location === ReactPropTypeLocations.prop) {\n            // Preface gives us something to blacklist in warning module\n            (\"production\" !== \"development\" ? warning(\n              false,\n              'Failed Composite propType: %s%s',\n              error.message,\n              addendum\n            ) : null);\n          } else {\n            (\"production\" !== \"development\" ? warning(\n              false,\n              'Failed Context Types: %s%s',\n              error.message,\n              addendum\n            ) : null);\n          }\n        }\n      }\n    }\n  },\n\n  receiveComponent: function(nextElement, transaction, nextContext) {\n    var prevElement = this._currentElement;\n    var prevContext = this._context;\n\n    this._pendingElement = null;\n\n    this.updateComponent(\n      transaction,\n      prevElement,\n      nextElement,\n      prevContext,\n      nextContext\n    );\n  },\n\n  /**\n   * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`\n   * is set, update the component.\n   *\n   * @param {ReactReconcileTransaction} transaction\n   * @internal\n   */\n  performUpdateIfNecessary: function(transaction) {\n    if (this._pendingElement != null) {\n      ReactReconciler.receiveComponent(\n        this,\n        this._pendingElement || this._currentElement,\n        transaction,\n        this._context\n      );\n    }\n\n    if (this._pendingStateQueue !== null || this._pendingForceUpdate) {\n      if (\"production\" !== \"development\") {\n        ReactElementValidator.checkAndWarnForMutatedProps(\n          this._currentElement\n        );\n      }\n\n      this.updateComponent(\n        transaction,\n        this._currentElement,\n        this._currentElement,\n        this._context,\n        this._context\n      );\n    }\n  },\n\n  /**\n   * Compare two contexts, warning if they are different\n   * TODO: Remove this check when owner-context is removed\n   */\n   _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {\n    ownerBasedContext = this._maskContext(ownerBasedContext);\n    parentBasedContext = this._maskContext(parentBasedContext);\n    var parentKeys = Object.keys(parentBasedContext).sort();\n    var displayName = this.getName() || 'ReactCompositeComponent';\n    for (var i = 0; i < parentKeys.length; i++) {\n      var key = parentKeys[i];\n      (\"production\" !== \"development\" ? warning(\n        ownerBasedContext[key] === parentBasedContext[key],\n        'owner-based and parent-based contexts differ '  +\n        '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +\n        '(see: http://fb.me/react-context-by-parent)',\n        ownerBasedContext[key],\n        parentBasedContext[key],\n        key,\n        displayName\n      ) : null);\n    }\n  },\n\n  /**\n   * Perform an update to a mounted component. The componentWillReceiveProps and\n   * shouldComponentUpdate methods are called, then (assuming the update isn't\n   * skipped) the remaining update lifecycle methods are called and the DOM\n   * representation is updated.\n   *\n   * By default, this implements React's rendering and reconciliation algorithm.\n   * Sophisticated clients may wish to override this.\n   *\n   * @param {ReactReconcileTransaction} transaction\n   * @param {ReactElement} prevParentElement\n   * @param {ReactElement} nextParentElement\n   * @internal\n   * @overridable\n   */\n  updateComponent: function(\n    transaction,\n    prevParentElement,\n    nextParentElement,\n    prevUnmaskedContext,\n    nextUnmaskedContext\n  ) {\n    var inst = this._instance;\n\n    var nextContext = inst.context;\n    var nextProps = inst.props;\n\n    // Distinguish between a props update versus a simple state update\n    if (prevParentElement !== nextParentElement) {\n      nextContext = this._processContext(nextParentElement._context);\n      nextProps = this._processProps(nextParentElement.props);\n\n      if (\"production\" !== \"development\") {\n        if (nextUnmaskedContext != null) {\n          this._warnIfContextsDiffer(\n            nextParentElement._context,\n            nextUnmaskedContext\n          );\n        }\n      }\n\n      // An update here will schedule an update but immediately set\n      // _pendingStateQueue which will ensure that any state updates gets\n      // immediately reconciled instead of waiting for the next batch.\n\n      if (inst.componentWillReceiveProps) {\n        inst.componentWillReceiveProps(nextProps, nextContext);\n      }\n    }\n\n    var nextState = this._processPendingState(nextProps, nextContext);\n\n    var shouldUpdate =\n      this._pendingForceUpdate ||\n      !inst.shouldComponentUpdate ||\n      inst.shouldComponentUpdate(nextProps, nextState, nextContext);\n\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? warning(\n        typeof shouldUpdate !== 'undefined',\n        '%s.shouldComponentUpdate(): Returned undefined instead of a ' +\n        'boolean value. Make sure to return true or false.',\n        this.getName() || 'ReactCompositeComponent'\n      ) : null);\n    }\n\n    if (shouldUpdate) {\n      this._pendingForceUpdate = false;\n      // Will set `this.props`, `this.state` and `this.context`.\n      this._performComponentUpdate(\n        nextParentElement,\n        nextProps,\n        nextState,\n        nextContext,\n        transaction,\n        nextUnmaskedContext\n      );\n    } else {\n      // If it's determined that a component should not update, we still want\n      // to set props and state but we shortcut the rest of the update.\n      this._currentElement = nextParentElement;\n      this._context = nextUnmaskedContext;\n      inst.props = nextProps;\n      inst.state = nextState;\n      inst.context = nextContext;\n    }\n  },\n\n  _processPendingState: function(props, context) {\n    var inst = this._instance;\n    var queue = this._pendingStateQueue;\n    var replace = this._pendingReplaceState;\n    this._pendingReplaceState = false;\n    this._pendingStateQueue = null;\n\n    if (!queue) {\n      return inst.state;\n    }\n\n    if (replace && queue.length === 1) {\n      return queue[0];\n    }\n\n    var nextState = assign({}, replace ? queue[0] : inst.state);\n    for (var i = replace ? 1 : 0; i < queue.length; i++) {\n      var partial = queue[i];\n      assign(\n        nextState,\n        typeof partial === 'function' ?\n          partial.call(inst, nextState, props, context) :\n          partial\n      );\n    }\n\n    return nextState;\n  },\n\n  /**\n   * Merges new props and state, notifies delegate methods of update and\n   * performs update.\n   *\n   * @param {ReactElement} nextElement Next element\n   * @param {object} nextProps Next public object to set as properties.\n   * @param {?object} nextState Next object to set as state.\n   * @param {?object} nextContext Next public object to set as context.\n   * @param {ReactReconcileTransaction} transaction\n   * @param {?object} unmaskedContext\n   * @private\n   */\n  _performComponentUpdate: function(\n    nextElement,\n    nextProps,\n    nextState,\n    nextContext,\n    transaction,\n    unmaskedContext\n  ) {\n    var inst = this._instance;\n\n    var prevProps = inst.props;\n    var prevState = inst.state;\n    var prevContext = inst.context;\n\n    if (inst.componentWillUpdate) {\n      inst.componentWillUpdate(nextProps, nextState, nextContext);\n    }\n\n    this._currentElement = nextElement;\n    this._context = unmaskedContext;\n    inst.props = nextProps;\n    inst.state = nextState;\n    inst.context = nextContext;\n\n    this._updateRenderedComponent(transaction, unmaskedContext);\n\n    if (inst.componentDidUpdate) {\n      transaction.getReactMountReady().enqueue(\n        inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),\n        inst\n      );\n    }\n  },\n\n  /**\n   * Call the component's `render` method and update the DOM accordingly.\n   *\n   * @param {ReactReconcileTransaction} transaction\n   * @internal\n   */\n  _updateRenderedComponent: function(transaction, context) {\n    var prevComponentInstance = this._renderedComponent;\n    var prevRenderedElement = prevComponentInstance._currentElement;\n    var childContext = this._getValidatedChildContext();\n    var nextRenderedElement = this._renderValidatedComponent(childContext);\n    if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {\n      ReactReconciler.receiveComponent(\n        prevComponentInstance,\n        nextRenderedElement,\n        transaction,\n        this._mergeChildContext(context, childContext)\n      );\n    } else {\n      // These two IDs are actually the same! But nothing should rely on that.\n      var thisID = this._rootNodeID;\n      var prevComponentID = prevComponentInstance._rootNodeID;\n      ReactReconciler.unmountComponent(prevComponentInstance);\n\n      this._renderedComponent = this._instantiateReactComponent(\n        nextRenderedElement,\n        this._currentElement.type\n      );\n      var nextMarkup = ReactReconciler.mountComponent(\n        this._renderedComponent,\n        thisID,\n        transaction,\n        this._mergeChildContext(context, childContext)\n      );\n      this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);\n    }\n  },\n\n  /**\n   * @protected\n   */\n  _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {\n    ReactComponentEnvironment.replaceNodeWithMarkupByID(\n      prevComponentID,\n      nextMarkup\n    );\n  },\n\n  /**\n   * @protected\n   */\n  _renderValidatedComponentWithoutOwnerOrContext: function() {\n    var inst = this._instance;\n    var renderedComponent = inst.render();\n    if (\"production\" !== \"development\") {\n      // We allow auto-mocks to proceed as if they're returning null.\n      if (typeof renderedComponent === 'undefined' &&\n          inst.render._isMockFunction) {\n        // This is probably bad practice. Consider warning here and\n        // deprecating this convenience.\n        renderedComponent = null;\n      }\n    }\n\n    return renderedComponent;\n  },\n\n  /**\n   * @private\n   */\n  _renderValidatedComponent: function(childContext) {\n    var renderedComponent;\n    var previousContext = ReactContext.current;\n    ReactContext.current = this._mergeChildContext(\n      this._currentElement._context,\n      childContext\n    );\n    ReactCurrentOwner.current = this;\n    try {\n      renderedComponent =\n        this._renderValidatedComponentWithoutOwnerOrContext();\n    } finally {\n      ReactContext.current = previousContext;\n      ReactCurrentOwner.current = null;\n    }\n    (\"production\" !== \"development\" ? invariant(\n      // TODO: An `isValidNode` function would probably be more appropriate\n      renderedComponent === null || renderedComponent === false ||\n      ReactElement.isValidElement(renderedComponent),\n      '%s.render(): A valid ReactComponent must be returned. You may have ' +\n        'returned undefined, an array or some other invalid object.',\n      this.getName() || 'ReactCompositeComponent'\n    ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate\n    renderedComponent === null || renderedComponent === false ||\n    ReactElement.isValidElement(renderedComponent)));\n    return renderedComponent;\n  },\n\n  /**\n   * Lazily allocates the refs object and stores `component` as `ref`.\n   *\n   * @param {string} ref Reference name.\n   * @param {component} component Component to store as `ref`.\n   * @final\n   * @private\n   */\n  attachRef: function(ref, component) {\n    var inst = this.getPublicInstance();\n    var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;\n    refs[ref] = component.getPublicInstance();\n  },\n\n  /**\n   * Detaches a reference name.\n   *\n   * @param {string} ref Name to dereference.\n   * @final\n   * @private\n   */\n  detachRef: function(ref) {\n    var refs = this.getPublicInstance().refs;\n    delete refs[ref];\n  },\n\n  /**\n   * Get a text description of the component that can be used to identify it\n   * in error messages.\n   * @return {string} The name or null.\n   * @internal\n   */\n  getName: function() {\n    var type = this._currentElement.type;\n    var constructor = this._instance && this._instance.constructor;\n    return (\n      type.displayName || (constructor && constructor.displayName) ||\n      type.name || (constructor && constructor.name) ||\n      null\n    );\n  },\n\n  /**\n   * Get the publicly accessible representation of this component - i.e. what\n   * is exposed by refs and returned by React.render. Can be null for stateless\n   * components.\n   *\n   * @return {ReactComponent} the public component instance.\n   * @internal\n   */\n  getPublicInstance: function() {\n    return this._instance;\n  },\n\n  // Stub\n  _instantiateReactComponent: null\n\n};\n\nReactPerf.measureMethods(\n  ReactCompositeComponentMixin,\n  'ReactCompositeComponent',\n  {\n    mountComponent: 'mountComponent',\n    updateComponent: 'updateComponent',\n    _renderValidatedComponent: '_renderValidatedComponent'\n  }\n);\n\nvar ReactCompositeComponent = {\n\n  Mixin: ReactCompositeComponentMixin\n\n};\n\nmodule.exports = ReactCompositeComponent;\n\n},{\"115\":115,\"135\":135,\"151\":151,\"154\":154,\"27\":27,\"36\":36,\"38\":38,\"39\":39,\"57\":57,\"58\":58,\"67\":67,\"68\":68,\"73\":73,\"75\":75,\"76\":76,\"77\":77,\"81\":81,\"87\":87}],38:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactContext\n */\n\n'use strict';\n\nvar assign = _dereq_(27);\nvar emptyObject = _dereq_(115);\nvar warning = _dereq_(154);\n\nvar didWarn = false;\n\n/**\n * Keeps track of the current context.\n *\n * The context is automatically passed down the component ownership hierarchy\n * and is accessible via `this.context` on ReactCompositeComponents.\n */\nvar ReactContext = {\n\n  /**\n   * @internal\n   * @type {object}\n   */\n  current: emptyObject,\n\n  /**\n   * Temporarily extends the current context while executing scopedCallback.\n   *\n   * A typical use case might look like\n   *\n   *  render: function() {\n   *    var children = ReactContext.withContext({foo: 'foo'}, () => (\n   *\n   *    ));\n   *    return <div>{children}</div>;\n   *  }\n   *\n   * @param {object} newContext New context to merge into the existing context\n   * @param {function} scopedCallback Callback to run with the new context\n   * @return {ReactComponent|array<ReactComponent>}\n   */\n  withContext: function(newContext, scopedCallback) {\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? warning(\n        didWarn,\n        'withContext is deprecated and will be removed in a future version. ' +\n        'Use a wrapper component with getChildContext instead.'\n      ) : null);\n\n      didWarn = true;\n    }\n\n    var result;\n    var previousContext = ReactContext.current;\n    ReactContext.current = assign({}, previousContext, newContext);\n    try {\n      result = scopedCallback();\n    } finally {\n      ReactContext.current = previousContext;\n    }\n    return result;\n  }\n\n};\n\nmodule.exports = ReactContext;\n\n},{\"115\":115,\"154\":154,\"27\":27}],39:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactCurrentOwner\n */\n\n'use strict';\n\n/**\n * Keeps track of the current owner.\n *\n * The current owner is the component who should own any components that are\n * currently being constructed.\n *\n * The depth indicate how many composite components are above this render level.\n */\nvar ReactCurrentOwner = {\n\n  /**\n   * @internal\n   * @type {ReactComponent}\n   */\n  current: null\n\n};\n\nmodule.exports = ReactCurrentOwner;\n\n},{}],40:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOM\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactElementValidator = _dereq_(58);\n\nvar mapObject = _dereq_(142);\n\n/**\n * Create a factory that creates HTML tag elements.\n *\n * @param {string} tag Tag name (e.g. `div`).\n * @private\n */\nfunction createDOMFactory(tag) {\n  if (\"production\" !== \"development\") {\n    return ReactElementValidator.createFactory(tag);\n  }\n  return ReactElement.createFactory(tag);\n}\n\n/**\n * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.\n * This is also accessible via `React.DOM`.\n *\n * @public\n */\nvar ReactDOM = mapObject({\n  a: 'a',\n  abbr: 'abbr',\n  address: 'address',\n  area: 'area',\n  article: 'article',\n  aside: 'aside',\n  audio: 'audio',\n  b: 'b',\n  base: 'base',\n  bdi: 'bdi',\n  bdo: 'bdo',\n  big: 'big',\n  blockquote: 'blockquote',\n  body: 'body',\n  br: 'br',\n  button: 'button',\n  canvas: 'canvas',\n  caption: 'caption',\n  cite: 'cite',\n  code: 'code',\n  col: 'col',\n  colgroup: 'colgroup',\n  data: 'data',\n  datalist: 'datalist',\n  dd: 'dd',\n  del: 'del',\n  details: 'details',\n  dfn: 'dfn',\n  dialog: 'dialog',\n  div: 'div',\n  dl: 'dl',\n  dt: 'dt',\n  em: 'em',\n  embed: 'embed',\n  fieldset: 'fieldset',\n  figcaption: 'figcaption',\n  figure: 'figure',\n  footer: 'footer',\n  form: 'form',\n  h1: 'h1',\n  h2: 'h2',\n  h3: 'h3',\n  h4: 'h4',\n  h5: 'h5',\n  h6: 'h6',\n  head: 'head',\n  header: 'header',\n  hr: 'hr',\n  html: 'html',\n  i: 'i',\n  iframe: 'iframe',\n  img: 'img',\n  input: 'input',\n  ins: 'ins',\n  kbd: 'kbd',\n  keygen: 'keygen',\n  label: 'label',\n  legend: 'legend',\n  li: 'li',\n  link: 'link',\n  main: 'main',\n  map: 'map',\n  mark: 'mark',\n  menu: 'menu',\n  menuitem: 'menuitem',\n  meta: 'meta',\n  meter: 'meter',\n  nav: 'nav',\n  noscript: 'noscript',\n  object: 'object',\n  ol: 'ol',\n  optgroup: 'optgroup',\n  option: 'option',\n  output: 'output',\n  p: 'p',\n  param: 'param',\n  picture: 'picture',\n  pre: 'pre',\n  progress: 'progress',\n  q: 'q',\n  rp: 'rp',\n  rt: 'rt',\n  ruby: 'ruby',\n  s: 's',\n  samp: 'samp',\n  script: 'script',\n  section: 'section',\n  select: 'select',\n  small: 'small',\n  source: 'source',\n  span: 'span',\n  strong: 'strong',\n  style: 'style',\n  sub: 'sub',\n  summary: 'summary',\n  sup: 'sup',\n  table: 'table',\n  tbody: 'tbody',\n  td: 'td',\n  textarea: 'textarea',\n  tfoot: 'tfoot',\n  th: 'th',\n  thead: 'thead',\n  time: 'time',\n  title: 'title',\n  tr: 'tr',\n  track: 'track',\n  u: 'u',\n  ul: 'ul',\n  'var': 'var',\n  video: 'video',\n  wbr: 'wbr',\n\n  // SVG\n  circle: 'circle',\n  clipPath: 'clipPath',\n  defs: 'defs',\n  ellipse: 'ellipse',\n  g: 'g',\n  line: 'line',\n  linearGradient: 'linearGradient',\n  mask: 'mask',\n  path: 'path',\n  pattern: 'pattern',\n  polygon: 'polygon',\n  polyline: 'polyline',\n  radialGradient: 'radialGradient',\n  rect: 'rect',\n  stop: 'stop',\n  svg: 'svg',\n  text: 'text',\n  tspan: 'tspan'\n\n}, createDOMFactory);\n\nmodule.exports = ReactDOM;\n\n},{\"142\":142,\"57\":57,\"58\":58}],41:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMButton\n */\n\n'use strict';\n\nvar AutoFocusMixin = _dereq_(2);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar keyMirror = _dereq_(140);\n\nvar button = ReactElement.createFactory('button');\n\nvar mouseListenerNames = keyMirror({\n  onClick: true,\n  onDoubleClick: true,\n  onMouseDown: true,\n  onMouseMove: true,\n  onMouseUp: true,\n  onClickCapture: true,\n  onDoubleClickCapture: true,\n  onMouseDownCapture: true,\n  onMouseMoveCapture: true,\n  onMouseUpCapture: true\n});\n\n/**\n * Implements a <button> native component that does not receive mouse events\n * when `disabled` is set.\n */\nvar ReactDOMButton = ReactClass.createClass({\n  displayName: 'ReactDOMButton',\n  tagName: 'BUTTON',\n\n  mixins: [AutoFocusMixin, ReactBrowserComponentMixin],\n\n  render: function() {\n    var props = {};\n\n    // Copy the props; except the mouse listeners if we're disabled\n    for (var key in this.props) {\n      if (this.props.hasOwnProperty(key) &&\n          (!this.props.disabled || !mouseListenerNames[key])) {\n        props[key] = this.props[key];\n      }\n    }\n\n    return button(props, this.props.children);\n  }\n\n});\n\nmodule.exports = ReactDOMButton;\n\n},{\"140\":140,\"2\":2,\"29\":29,\"33\":33,\"57\":57}],42:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMComponent\n * @typechecks static-only\n */\n\n/* global hasOwnProperty:true */\n\n'use strict';\n\nvar CSSPropertyOperations = _dereq_(5);\nvar DOMProperty = _dereq_(10);\nvar DOMPropertyOperations = _dereq_(11);\nvar ReactBrowserEventEmitter = _dereq_(30);\nvar ReactComponentBrowserEnvironment =\n  _dereq_(35);\nvar ReactMount = _dereq_(70);\nvar ReactMultiChild = _dereq_(71);\nvar ReactPerf = _dereq_(75);\n\nvar assign = _dereq_(27);\nvar escapeTextContentForBrowser = _dereq_(116);\nvar invariant = _dereq_(135);\nvar isEventSupported = _dereq_(136);\nvar keyOf = _dereq_(141);\nvar warning = _dereq_(154);\n\nvar deleteListener = ReactBrowserEventEmitter.deleteListener;\nvar listenTo = ReactBrowserEventEmitter.listenTo;\nvar registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;\n\n// For quickly matching children type, to test if can be treated as content.\nvar CONTENT_TYPES = {'string': true, 'number': true};\n\nvar STYLE = keyOf({style: null});\n\nvar ELEMENT_NODE_TYPE = 1;\n\n/**\n * Optionally injectable operations for mutating the DOM\n */\nvar BackendIDOperations = null;\n\n/**\n * @param {?object} props\n */\nfunction assertValidProps(props) {\n  if (!props) {\n    return;\n  }\n  // Note the use of `==` which checks for null or undefined.\n  if (props.dangerouslySetInnerHTML != null) {\n    (\"production\" !== \"development\" ? invariant(\n      props.children == null,\n      'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'\n    ) : invariant(props.children == null));\n    (\"production\" !== \"development\" ? invariant(\n      typeof props.dangerouslySetInnerHTML === 'object' &&\n      '__html' in props.dangerouslySetInnerHTML,\n      '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +\n      'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +\n      'for more information.'\n    ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&\n    '__html' in props.dangerouslySetInnerHTML));\n  }\n  if (\"production\" !== \"development\") {\n    (\"production\" !== \"development\" ? warning(\n      props.innerHTML == null,\n      'Directly setting property `innerHTML` is not permitted. ' +\n      'For more information, lookup documentation on `dangerouslySetInnerHTML`.'\n    ) : null);\n    (\"production\" !== \"development\" ? warning(\n      !props.contentEditable || props.children == null,\n      'A component is `contentEditable` and contains `children` managed by ' +\n      'React. It is now your responsibility to guarantee that none of ' +\n      'those nodes are unexpectedly modified or duplicated. This is ' +\n      'probably not intentional.'\n    ) : null);\n  }\n  (\"production\" !== \"development\" ? invariant(\n    props.style == null || typeof props.style === 'object',\n    'The `style` prop expects a mapping from style properties to values, ' +\n    'not a string. For example, style={{marginRight: spacing + \\'em\\'}} when ' +\n    'using JSX.'\n  ) : invariant(props.style == null || typeof props.style === 'object'));\n}\n\nfunction putListener(id, registrationName, listener, transaction) {\n  if (\"production\" !== \"development\") {\n    // IE8 has no API for event capturing and the `onScroll` event doesn't\n    // bubble.\n    (\"production\" !== \"development\" ? warning(\n      registrationName !== 'onScroll' || isEventSupported('scroll', true),\n      'This browser doesn\\'t support the `onScroll` event'\n    ) : null);\n  }\n  var container = ReactMount.findReactContainerForID(id);\n  if (container) {\n    var doc = container.nodeType === ELEMENT_NODE_TYPE ?\n      container.ownerDocument :\n      container;\n    listenTo(registrationName, doc);\n  }\n  transaction.getPutListenerQueue().enqueuePutListener(\n    id,\n    registrationName,\n    listener\n  );\n}\n\n// For HTML, certain tags should omit their close tag. We keep a whitelist for\n// those special cased tags.\n\nvar omittedCloseTags = {\n  'area': true,\n  'base': true,\n  'br': true,\n  'col': true,\n  'embed': true,\n  'hr': true,\n  'img': true,\n  'input': true,\n  'keygen': true,\n  'link': true,\n  'meta': true,\n  'param': true,\n  'source': true,\n  'track': true,\n  'wbr': true\n  // NOTE: menuitem's close tag should be omitted, but that causes problems.\n};\n\n// We accept any tag to be rendered but since this gets injected into abitrary\n// HTML, we want to make sure that it's a safe tag.\n// http://www.w3.org/TR/REC-xml/#NT-Name\n\nvar VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\\.\\-\\d]*$/; // Simplified subset\nvar validatedTagCache = {};\nvar hasOwnProperty = {}.hasOwnProperty;\n\nfunction validateDangerousTag(tag) {\n  if (!hasOwnProperty.call(validatedTagCache, tag)) {\n    (\"production\" !== \"development\" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));\n    validatedTagCache[tag] = true;\n  }\n}\n\n/**\n * Creates a new React class that is idempotent and capable of containing other\n * React components. It accepts event listeners and DOM properties that are\n * valid according to `DOMProperty`.\n *\n *  - Event listeners: `onClick`, `onMouseDown`, etc.\n *  - DOM properties: `className`, `name`, `title`, etc.\n *\n * The `style` property functions differently from the DOM API. It accepts an\n * object mapping of style properties to values.\n *\n * @constructor ReactDOMComponent\n * @extends ReactMultiChild\n */\nfunction ReactDOMComponent(tag) {\n  validateDangerousTag(tag);\n  this._tag = tag;\n  this._renderedChildren = null;\n  this._previousStyleCopy = null;\n  this._rootNodeID = null;\n}\n\nReactDOMComponent.displayName = 'ReactDOMComponent';\n\nReactDOMComponent.Mixin = {\n\n  construct: function(element) {\n    this._currentElement = element;\n  },\n\n  /**\n   * Generates root tag markup then recurses. This method has side effects and\n   * is not idempotent.\n   *\n   * @internal\n   * @param {string} rootID The root DOM ID for this node.\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @return {string} The computed markup.\n   */\n  mountComponent: function(rootID, transaction, context) {\n    this._rootNodeID = rootID;\n    assertValidProps(this._currentElement.props);\n    var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';\n    return (\n      this._createOpenTagMarkupAndPutListeners(transaction) +\n      this._createContentMarkup(transaction, context) +\n      closeTag\n    );\n  },\n\n  /**\n   * Creates markup for the open tag and all attributes.\n   *\n   * This method has side effects because events get registered.\n   *\n   * Iterating over object properties is faster than iterating over arrays.\n   * @see http://jsperf.com/obj-vs-arr-iteration\n   *\n   * @private\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @return {string} Markup of opening tag.\n   */\n  _createOpenTagMarkupAndPutListeners: function(transaction) {\n    var props = this._currentElement.props;\n    var ret = '<' + this._tag;\n\n    for (var propKey in props) {\n      if (!props.hasOwnProperty(propKey)) {\n        continue;\n      }\n      var propValue = props[propKey];\n      if (propValue == null) {\n        continue;\n      }\n      if (registrationNameModules.hasOwnProperty(propKey)) {\n        putListener(this._rootNodeID, propKey, propValue, transaction);\n      } else {\n        if (propKey === STYLE) {\n          if (propValue) {\n            propValue = this._previousStyleCopy = assign({}, props.style);\n          }\n          propValue = CSSPropertyOperations.createMarkupForStyles(propValue);\n        }\n        var markup =\n          DOMPropertyOperations.createMarkupForProperty(propKey, propValue);\n        if (markup) {\n          ret += ' ' + markup;\n        }\n      }\n    }\n\n    // For static pages, no need to put React ID and checksum. Saves lots of\n    // bytes.\n    if (transaction.renderToStaticMarkup) {\n      return ret + '>';\n    }\n\n    var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);\n    return ret + ' ' + markupForID + '>';\n  },\n\n  /**\n   * Creates markup for the content between the tags.\n   *\n   * @private\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @param {object} context\n   * @return {string} Content markup.\n   */\n  _createContentMarkup: function(transaction, context) {\n    var prefix = '';\n    if (this._tag === 'listing' ||\n        this._tag === 'pre' ||\n        this._tag === 'textarea') {\n      // Add an initial newline because browsers ignore the first newline in\n      // a <listing>, <pre>, or <textarea> as an \"authoring convenience\" -- see\n      // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.\n      prefix = '\\n';\n    }\n\n    var props = this._currentElement.props;\n\n    // Intentional use of != to avoid catching zero/false.\n    var innerHTML = props.dangerouslySetInnerHTML;\n    if (innerHTML != null) {\n      if (innerHTML.__html != null) {\n        return prefix + innerHTML.__html;\n      }\n    } else {\n      var contentToUse =\n        CONTENT_TYPES[typeof props.children] ? props.children : null;\n      var childrenToUse = contentToUse != null ? null : props.children;\n      if (contentToUse != null) {\n        return prefix + escapeTextContentForBrowser(contentToUse);\n      } else if (childrenToUse != null) {\n        var mountImages = this.mountChildren(\n          childrenToUse,\n          transaction,\n          context\n        );\n        return prefix + mountImages.join('');\n      }\n    }\n    return prefix;\n  },\n\n  receiveComponent: function(nextElement, transaction, context) {\n    var prevElement = this._currentElement;\n    this._currentElement = nextElement;\n    this.updateComponent(transaction, prevElement, nextElement, context);\n  },\n\n  /**\n   * Updates a native DOM component after it has already been allocated and\n   * attached to the DOM. Reconciles the root DOM node, then recurses.\n   *\n   * @param {ReactReconcileTransaction} transaction\n   * @param {ReactElement} prevElement\n   * @param {ReactElement} nextElement\n   * @internal\n   * @overridable\n   */\n  updateComponent: function(transaction, prevElement, nextElement, context) {\n    assertValidProps(this._currentElement.props);\n    this._updateDOMProperties(prevElement.props, transaction);\n    this._updateDOMChildren(prevElement.props, transaction, context);\n  },\n\n  /**\n   * Reconciles the properties by detecting differences in property values and\n   * updating the DOM as necessary. This function is probably the single most\n   * critical path for performance optimization.\n   *\n   * TODO: Benchmark whether checking for changed values in memory actually\n   *       improves performance (especially statically positioned elements).\n   * TODO: Benchmark the effects of putting this at the top since 99% of props\n   *       do not change for a given reconciliation.\n   * TODO: Benchmark areas that can be improved with caching.\n   *\n   * @private\n   * @param {object} lastProps\n   * @param {ReactReconcileTransaction} transaction\n   */\n  _updateDOMProperties: function(lastProps, transaction) {\n    var nextProps = this._currentElement.props;\n    var propKey;\n    var styleName;\n    var styleUpdates;\n    for (propKey in lastProps) {\n      if (nextProps.hasOwnProperty(propKey) ||\n         !lastProps.hasOwnProperty(propKey)) {\n        continue;\n      }\n      if (propKey === STYLE) {\n        var lastStyle = this._previousStyleCopy;\n        for (styleName in lastStyle) {\n          if (lastStyle.hasOwnProperty(styleName)) {\n            styleUpdates = styleUpdates || {};\n            styleUpdates[styleName] = '';\n          }\n        }\n        this._previousStyleCopy = null;\n      } else if (registrationNameModules.hasOwnProperty(propKey)) {\n        deleteListener(this._rootNodeID, propKey);\n      } else if (\n          DOMProperty.isStandardName[propKey] ||\n          DOMProperty.isCustomAttribute(propKey)) {\n        BackendIDOperations.deletePropertyByID(\n          this._rootNodeID,\n          propKey\n        );\n      }\n    }\n    for (propKey in nextProps) {\n      var nextProp = nextProps[propKey];\n      var lastProp = propKey === STYLE ?\n        this._previousStyleCopy :\n        lastProps[propKey];\n      if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {\n        continue;\n      }\n      if (propKey === STYLE) {\n        if (nextProp) {\n          nextProp = this._previousStyleCopy = assign({}, nextProp);\n        } else {\n          this._previousStyleCopy = null;\n        }\n        if (lastProp) {\n          // Unset styles on `lastProp` but not on `nextProp`.\n          for (styleName in lastProp) {\n            if (lastProp.hasOwnProperty(styleName) &&\n                (!nextProp || !nextProp.hasOwnProperty(styleName))) {\n              styleUpdates = styleUpdates || {};\n              styleUpdates[styleName] = '';\n            }\n          }\n          // Update styles that changed since `lastProp`.\n          for (styleName in nextProp) {\n            if (nextProp.hasOwnProperty(styleName) &&\n                lastProp[styleName] !== nextProp[styleName]) {\n              styleUpdates = styleUpdates || {};\n              styleUpdates[styleName] = nextProp[styleName];\n            }\n          }\n        } else {\n          // Relies on `updateStylesByID` not mutating `styleUpdates`.\n          styleUpdates = nextProp;\n        }\n      } else if (registrationNameModules.hasOwnProperty(propKey)) {\n        putListener(this._rootNodeID, propKey, nextProp, transaction);\n      } else if (\n          DOMProperty.isStandardName[propKey] ||\n          DOMProperty.isCustomAttribute(propKey)) {\n        BackendIDOperations.updatePropertyByID(\n          this._rootNodeID,\n          propKey,\n          nextProp\n        );\n      }\n    }\n    if (styleUpdates) {\n      BackendIDOperations.updateStylesByID(\n        this._rootNodeID,\n        styleUpdates\n      );\n    }\n  },\n\n  /**\n   * Reconciles the children with the various properties that affect the\n   * children content.\n   *\n   * @param {object} lastProps\n   * @param {ReactReconcileTransaction} transaction\n   */\n  _updateDOMChildren: function(lastProps, transaction, context) {\n    var nextProps = this._currentElement.props;\n\n    var lastContent =\n      CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;\n    var nextContent =\n      CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;\n\n    var lastHtml =\n      lastProps.dangerouslySetInnerHTML &&\n      lastProps.dangerouslySetInnerHTML.__html;\n    var nextHtml =\n      nextProps.dangerouslySetInnerHTML &&\n      nextProps.dangerouslySetInnerHTML.__html;\n\n    // Note the use of `!=` which checks for null or undefined.\n    var lastChildren = lastContent != null ? null : lastProps.children;\n    var nextChildren = nextContent != null ? null : nextProps.children;\n\n    // If we're switching from children to content/html or vice versa, remove\n    // the old content\n    var lastHasContentOrHtml = lastContent != null || lastHtml != null;\n    var nextHasContentOrHtml = nextContent != null || nextHtml != null;\n    if (lastChildren != null && nextChildren == null) {\n      this.updateChildren(null, transaction, context);\n    } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {\n      this.updateTextContent('');\n    }\n\n    if (nextContent != null) {\n      if (lastContent !== nextContent) {\n        this.updateTextContent('' + nextContent);\n      }\n    } else if (nextHtml != null) {\n      if (lastHtml !== nextHtml) {\n        BackendIDOperations.updateInnerHTMLByID(\n          this._rootNodeID,\n          nextHtml\n        );\n      }\n    } else if (nextChildren != null) {\n      this.updateChildren(nextChildren, transaction, context);\n    }\n  },\n\n  /**\n   * Destroys all event registrations for this instance. Does not remove from\n   * the DOM. That must be done by the parent.\n   *\n   * @internal\n   */\n  unmountComponent: function() {\n    this.unmountChildren();\n    ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);\n    ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);\n    this._rootNodeID = null;\n  }\n\n};\n\nReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {\n  mountComponent: 'mountComponent',\n  updateComponent: 'updateComponent'\n});\n\nassign(\n  ReactDOMComponent.prototype,\n  ReactDOMComponent.Mixin,\n  ReactMultiChild.Mixin\n);\n\nReactDOMComponent.injection = {\n  injectIDOperations: function(IDOperations) {\n    ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;\n  }\n};\n\nmodule.exports = ReactDOMComponent;\n\n},{\"10\":10,\"11\":11,\"116\":116,\"135\":135,\"136\":136,\"141\":141,\"154\":154,\"27\":27,\"30\":30,\"35\":35,\"5\":5,\"70\":70,\"71\":71,\"75\":75}],43:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMForm\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar LocalEventTrapMixin = _dereq_(25);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar form = ReactElement.createFactory('form');\n\n/**\n * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need\n * to capture it on the <form> element itself. There are lots of hacks we could\n * do to accomplish this, but the most reliable is to make <form> a\n * composite component and use `componentDidMount` to attach the event handlers.\n */\nvar ReactDOMForm = ReactClass.createClass({\n  displayName: 'ReactDOMForm',\n  tagName: 'FORM',\n\n  mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n  render: function() {\n    // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,\n    // `jshint` fails to parse JSX so in order for linting to work in the open\n    // source repo, we need to just use `ReactDOM.form`.\n    return form(this.props);\n  },\n\n  componentDidMount: function() {\n    this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');\n    this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');\n  }\n});\n\nmodule.exports = ReactDOMForm;\n\n},{\"15\":15,\"25\":25,\"29\":29,\"33\":33,\"57\":57}],44:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMIDOperations\n * @typechecks static-only\n */\n\n/*jslint evil: true */\n\n'use strict';\n\nvar CSSPropertyOperations = _dereq_(5);\nvar DOMChildrenOperations = _dereq_(9);\nvar DOMPropertyOperations = _dereq_(11);\nvar ReactMount = _dereq_(70);\nvar ReactPerf = _dereq_(75);\n\nvar invariant = _dereq_(135);\nvar setInnerHTML = _dereq_(148);\n\n/**\n * Errors for properties that should not be updated with `updatePropertyById()`.\n *\n * @type {object}\n * @private\n */\nvar INVALID_PROPERTY_ERRORS = {\n  dangerouslySetInnerHTML:\n    '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',\n  style: '`style` must be set using `updateStylesByID()`.'\n};\n\n/**\n * Operations used to process updates to DOM nodes. This is made injectable via\n * `ReactDOMComponent.BackendIDOperations`.\n */\nvar ReactDOMIDOperations = {\n\n  /**\n   * Updates a DOM node with new property values. This should only be used to\n   * update DOM properties in `DOMProperty`.\n   *\n   * @param {string} id ID of the node to update.\n   * @param {string} name A valid property name, see `DOMProperty`.\n   * @param {*} value New value of the property.\n   * @internal\n   */\n  updatePropertyByID: function(id, name, value) {\n    var node = ReactMount.getNode(id);\n    (\"production\" !== \"development\" ? invariant(\n      !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n      'updatePropertyByID(...): %s',\n      INVALID_PROPERTY_ERRORS[name]\n    ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));\n\n    // If we're updating to null or undefined, we should remove the property\n    // from the DOM node instead of inadvertantly setting to a string. This\n    // brings us in line with the same behavior we have on initial render.\n    if (value != null) {\n      DOMPropertyOperations.setValueForProperty(node, name, value);\n    } else {\n      DOMPropertyOperations.deleteValueForProperty(node, name);\n    }\n  },\n\n  /**\n   * Updates a DOM node to remove a property. This should only be used to remove\n   * DOM properties in `DOMProperty`.\n   *\n   * @param {string} id ID of the node to update.\n   * @param {string} name A property name to remove, see `DOMProperty`.\n   * @internal\n   */\n  deletePropertyByID: function(id, name, value) {\n    var node = ReactMount.getNode(id);\n    (\"production\" !== \"development\" ? invariant(\n      !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n      'updatePropertyByID(...): %s',\n      INVALID_PROPERTY_ERRORS[name]\n    ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));\n    DOMPropertyOperations.deleteValueForProperty(node, name, value);\n  },\n\n  /**\n   * Updates a DOM node with new style values. If a value is specified as '',\n   * the corresponding style property will be unset.\n   *\n   * @param {string} id ID of the node to update.\n   * @param {object} styles Mapping from styles to values.\n   * @internal\n   */\n  updateStylesByID: function(id, styles) {\n    var node = ReactMount.getNode(id);\n    CSSPropertyOperations.setValueForStyles(node, styles);\n  },\n\n  /**\n   * Updates a DOM node's innerHTML.\n   *\n   * @param {string} id ID of the node to update.\n   * @param {string} html An HTML string.\n   * @internal\n   */\n  updateInnerHTMLByID: function(id, html) {\n    var node = ReactMount.getNode(id);\n    setInnerHTML(node, html);\n  },\n\n  /**\n   * Updates a DOM node's text content set by `props.content`.\n   *\n   * @param {string} id ID of the node to update.\n   * @param {string} content Text content.\n   * @internal\n   */\n  updateTextContentByID: function(id, content) {\n    var node = ReactMount.getNode(id);\n    DOMChildrenOperations.updateTextContent(node, content);\n  },\n\n  /**\n   * Replaces a DOM node that exists in the document with markup.\n   *\n   * @param {string} id ID of child to be replaced.\n   * @param {string} markup Dangerous markup to inject in place of child.\n   * @internal\n   * @see {Danger.dangerouslyReplaceNodeWithMarkup}\n   */\n  dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {\n    var node = ReactMount.getNode(id);\n    DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);\n  },\n\n  /**\n   * Updates a component's children by processing a series of updates.\n   *\n   * @param {array<object>} updates List of update configurations.\n   * @param {array<string>} markup List of markup strings.\n   * @internal\n   */\n  dangerouslyProcessChildrenUpdates: function(updates, markup) {\n    for (var i = 0; i < updates.length; i++) {\n      updates[i].parentNode = ReactMount.getNode(updates[i].parentID);\n    }\n    DOMChildrenOperations.processUpdates(updates, markup);\n  }\n};\n\nReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {\n  updatePropertyByID: 'updatePropertyByID',\n  deletePropertyByID: 'deletePropertyByID',\n  updateStylesByID: 'updateStylesByID',\n  updateInnerHTMLByID: 'updateInnerHTMLByID',\n  updateTextContentByID: 'updateTextContentByID',\n  dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',\n  dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'\n});\n\nmodule.exports = ReactDOMIDOperations;\n\n},{\"11\":11,\"135\":135,\"148\":148,\"5\":5,\"70\":70,\"75\":75,\"9\":9}],45:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMIframe\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar LocalEventTrapMixin = _dereq_(25);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar iframe = ReactElement.createFactory('iframe');\n\n/**\n * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to\n * capture it on the <iframe> element itself. There are lots of hacks we could\n * do to accomplish this, but the most reliable is to make <iframe> a composite\n * component and use `componentDidMount` to attach the event handlers.\n */\nvar ReactDOMIframe = ReactClass.createClass({\n  displayName: 'ReactDOMIframe',\n  tagName: 'IFRAME',\n\n  mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n  render: function() {\n    return iframe(this.props);\n  },\n\n  componentDidMount: function() {\n    this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');\n  }\n});\n\nmodule.exports = ReactDOMIframe;\n\n},{\"15\":15,\"25\":25,\"29\":29,\"33\":33,\"57\":57}],46:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMImg\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar LocalEventTrapMixin = _dereq_(25);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar img = ReactElement.createFactory('img');\n\n/**\n * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to\n * capture it on the <img> element itself. There are lots of hacks we could do\n * to accomplish this, but the most reliable is to make <img> a composite\n * component and use `componentDidMount` to attach the event handlers.\n */\nvar ReactDOMImg = ReactClass.createClass({\n  displayName: 'ReactDOMImg',\n  tagName: 'IMG',\n\n  mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n  render: function() {\n    return img(this.props);\n  },\n\n  componentDidMount: function() {\n    this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');\n    this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');\n  }\n});\n\nmodule.exports = ReactDOMImg;\n\n},{\"15\":15,\"25\":25,\"29\":29,\"33\":33,\"57\":57}],47:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMInput\n */\n\n'use strict';\n\nvar AutoFocusMixin = _dereq_(2);\nvar DOMPropertyOperations = _dereq_(11);\nvar LinkedValueUtils = _dereq_(24);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\nvar ReactMount = _dereq_(70);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\n\nvar input = ReactElement.createFactory('input');\n\nvar instancesByReactID = {};\n\nfunction forceUpdateIfMounted() {\n  /*jshint validthis:true */\n  if (this.isMounted()) {\n    this.forceUpdate();\n  }\n}\n\n/**\n * Implements an <input> native component that allows setting these optional\n * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.\n *\n * If `checked` or `value` are not supplied (or null/undefined), user actions\n * that affect the checked state or value will trigger updates to the element.\n *\n * If they are supplied (and not null/undefined), the rendered element will not\n * trigger updates to the element. Instead, the props must change in order for\n * the rendered element to be updated.\n *\n * The rendered element will be initialized as unchecked (or `defaultChecked`)\n * with an empty value (or `defaultValue`).\n *\n * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html\n */\nvar ReactDOMInput = ReactClass.createClass({\n  displayName: 'ReactDOMInput',\n  tagName: 'INPUT',\n\n  mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],\n\n  getInitialState: function() {\n    var defaultValue = this.props.defaultValue;\n    return {\n      initialChecked: this.props.defaultChecked || false,\n      initialValue: defaultValue != null ? defaultValue : null\n    };\n  },\n\n  render: function() {\n    // Clone `this.props` so we don't mutate the input.\n    var props = assign({}, this.props);\n\n    props.defaultChecked = null;\n    props.defaultValue = null;\n\n    var value = LinkedValueUtils.getValue(this);\n    props.value = value != null ? value : this.state.initialValue;\n\n    var checked = LinkedValueUtils.getChecked(this);\n    props.checked = checked != null ? checked : this.state.initialChecked;\n\n    props.onChange = this._handleChange;\n\n    return input(props, this.props.children);\n  },\n\n  componentDidMount: function() {\n    var id = ReactMount.getID(this.getDOMNode());\n    instancesByReactID[id] = this;\n  },\n\n  componentWillUnmount: function() {\n    var rootNode = this.getDOMNode();\n    var id = ReactMount.getID(rootNode);\n    delete instancesByReactID[id];\n  },\n\n  componentDidUpdate: function(prevProps, prevState, prevContext) {\n    var rootNode = this.getDOMNode();\n    if (this.props.checked != null) {\n      DOMPropertyOperations.setValueForProperty(\n        rootNode,\n        'checked',\n        this.props.checked || false\n      );\n    }\n\n    var value = LinkedValueUtils.getValue(this);\n    if (value != null) {\n      // Cast `value` to a string to ensure the value is set correctly. While\n      // browsers typically do this as necessary, jsdom doesn't.\n      DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);\n    }\n  },\n\n  _handleChange: function(event) {\n    var returnValue;\n    var onChange = LinkedValueUtils.getOnChange(this);\n    if (onChange) {\n      returnValue = onChange.call(this, event);\n    }\n    // Here we use asap to wait until all updates have propagated, which\n    // is important when using controlled components within layers:\n    // https://github.com/facebook/react/issues/1698\n    ReactUpdates.asap(forceUpdateIfMounted, this);\n\n    var name = this.props.name;\n    if (this.props.type === 'radio' && name != null) {\n      var rootNode = this.getDOMNode();\n      var queryRoot = rootNode;\n\n      while (queryRoot.parentNode) {\n        queryRoot = queryRoot.parentNode;\n      }\n\n      // If `rootNode.form` was non-null, then we could try `form.elements`,\n      // but that sometimes behaves strangely in IE8. We could also try using\n      // `form.getElementsByName`, but that will only return direct children\n      // and won't include inputs that use the HTML5 `form=` attribute. Since\n      // the input might not even be in a form, let's just use the global\n      // `querySelectorAll` to ensure we don't miss anything.\n      var group = queryRoot.querySelectorAll(\n        'input[name=' + JSON.stringify('' + name) + '][type=\"radio\"]');\n\n      for (var i = 0, groupLen = group.length; i < groupLen; i++) {\n        var otherNode = group[i];\n        if (otherNode === rootNode ||\n            otherNode.form !== rootNode.form) {\n          continue;\n        }\n        var otherID = ReactMount.getID(otherNode);\n        (\"production\" !== \"development\" ? invariant(\n          otherID,\n          'ReactDOMInput: Mixing React and non-React radio inputs with the ' +\n          'same `name` is not supported.'\n        ) : invariant(otherID));\n        var otherInstance = instancesByReactID[otherID];\n        (\"production\" !== \"development\" ? invariant(\n          otherInstance,\n          'ReactDOMInput: Unknown radio button ID %s.',\n          otherID\n        ) : invariant(otherInstance));\n        // If this is a controlled radio button group, forcing the input that\n        // was previously checked to update will cause it to be come re-checked\n        // as appropriate.\n        ReactUpdates.asap(forceUpdateIfMounted, otherInstance);\n      }\n    }\n\n    return returnValue;\n  }\n\n});\n\nmodule.exports = ReactDOMInput;\n\n},{\"11\":11,\"135\":135,\"2\":2,\"24\":24,\"27\":27,\"29\":29,\"33\":33,\"57\":57,\"70\":70,\"87\":87}],48:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMOption\n */\n\n'use strict';\n\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar warning = _dereq_(154);\n\nvar option = ReactElement.createFactory('option');\n\n/**\n * Implements an <option> native component that warns when `selected` is set.\n */\nvar ReactDOMOption = ReactClass.createClass({\n  displayName: 'ReactDOMOption',\n  tagName: 'OPTION',\n\n  mixins: [ReactBrowserComponentMixin],\n\n  componentWillMount: function() {\n    // TODO (yungsters): Remove support for `selected` in <option>.\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? warning(\n        this.props.selected == null,\n        'Use the `defaultValue` or `value` props on <select> instead of ' +\n        'setting `selected` on <option>.'\n      ) : null);\n    }\n  },\n\n  render: function() {\n    return option(this.props, this.props.children);\n  }\n\n});\n\nmodule.exports = ReactDOMOption;\n\n},{\"154\":154,\"29\":29,\"33\":33,\"57\":57}],49:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMSelect\n */\n\n'use strict';\n\nvar AutoFocusMixin = _dereq_(2);\nvar LinkedValueUtils = _dereq_(24);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\n\nvar select = ReactElement.createFactory('select');\n\nfunction updateOptionsIfPendingUpdateAndMounted() {\n  /*jshint validthis:true */\n  if (this._pendingUpdate) {\n    this._pendingUpdate = false;\n    var value = LinkedValueUtils.getValue(this);\n    if (value != null && this.isMounted()) {\n      updateOptions(this, value);\n    }\n  }\n}\n\n/**\n * Validation function for `value` and `defaultValue`.\n * @private\n */\nfunction selectValueType(props, propName, componentName) {\n  if (props[propName] == null) {\n    return null;\n  }\n  if (props.multiple) {\n    if (!Array.isArray(props[propName])) {\n      return new Error(\n        (\"The `\" + propName + \"` prop supplied to <select> must be an array if \") +\n        (\"`multiple` is true.\")\n      );\n    }\n  } else {\n    if (Array.isArray(props[propName])) {\n      return new Error(\n        (\"The `\" + propName + \"` prop supplied to <select> must be a scalar \") +\n        (\"value if `multiple` is false.\")\n      );\n    }\n  }\n}\n\n/**\n * @param {ReactComponent} component Instance of ReactDOMSelect\n * @param {*} propValue A stringable (with `multiple`, a list of stringables).\n * @private\n */\nfunction updateOptions(component, propValue) {\n  var selectedValue, i, l;\n  var options = component.getDOMNode().options;\n\n  if (component.props.multiple) {\n    selectedValue = {};\n    for (i = 0, l = propValue.length; i < l; i++) {\n      selectedValue['' + propValue[i]] = true;\n    }\n    for (i = 0, l = options.length; i < l; i++) {\n      var selected = selectedValue.hasOwnProperty(options[i].value);\n      if (options[i].selected !== selected) {\n        options[i].selected = selected;\n      }\n    }\n  } else {\n    // Do not set `select.value` as exact behavior isn't consistent across all\n    // browsers for all cases.\n    selectedValue = '' + propValue;\n    for (i = 0, l = options.length; i < l; i++) {\n      if (options[i].value === selectedValue) {\n        options[i].selected = true;\n        return;\n      }\n    }\n    if (options.length) {\n      options[0].selected = true;\n    }\n  }\n}\n\n/**\n * Implements a <select> native component that allows optionally setting the\n * props `value` and `defaultValue`. If `multiple` is false, the prop must be a\n * stringable. If `multiple` is true, the prop must be an array of stringables.\n *\n * If `value` is not supplied (or null/undefined), user actions that change the\n * selected option will trigger updates to the rendered options.\n *\n * If it is supplied (and not null/undefined), the rendered options will not\n * update in response to user actions. Instead, the `value` prop must change in\n * order for the rendered options to update.\n *\n * If `defaultValue` is provided, any options with the supplied values will be\n * selected.\n */\nvar ReactDOMSelect = ReactClass.createClass({\n  displayName: 'ReactDOMSelect',\n  tagName: 'SELECT',\n\n  mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],\n\n  propTypes: {\n    defaultValue: selectValueType,\n    value: selectValueType\n  },\n\n  render: function() {\n    // Clone `this.props` so we don't mutate the input.\n    var props = assign({}, this.props);\n\n    props.onChange = this._handleChange;\n    props.value = null;\n\n    return select(props, this.props.children);\n  },\n\n  componentWillMount: function() {\n    this._pendingUpdate = false;\n  },\n\n  componentDidMount: function() {\n    var value = LinkedValueUtils.getValue(this);\n    if (value != null) {\n      updateOptions(this, value);\n    } else if (this.props.defaultValue != null) {\n      updateOptions(this, this.props.defaultValue);\n    }\n  },\n\n  componentDidUpdate: function(prevProps) {\n    var value = LinkedValueUtils.getValue(this);\n    if (value != null) {\n      this._pendingUpdate = false;\n      updateOptions(this, value);\n    } else if (!prevProps.multiple !== !this.props.multiple) {\n      // For simplicity, reapply `defaultValue` if `multiple` is toggled.\n      if (this.props.defaultValue != null) {\n        updateOptions(this, this.props.defaultValue);\n      } else {\n        // Revert the select back to its default unselected state.\n        updateOptions(this, this.props.multiple ? [] : '');\n      }\n    }\n  },\n\n  _handleChange: function(event) {\n    var returnValue;\n    var onChange = LinkedValueUtils.getOnChange(this);\n    if (onChange) {\n      returnValue = onChange.call(this, event);\n    }\n\n    this._pendingUpdate = true;\n    ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);\n    return returnValue;\n  }\n\n});\n\nmodule.exports = ReactDOMSelect;\n\n},{\"2\":2,\"24\":24,\"27\":27,\"29\":29,\"33\":33,\"57\":57,\"87\":87}],50:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMSelection\n */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar getNodeForCharacterOffset = _dereq_(128);\nvar getTextContentAccessor = _dereq_(130);\n\n/**\n * While `isCollapsed` is available on the Selection object and `collapsed`\n * is available on the Range object, IE11 sometimes gets them wrong.\n * If the anchor/focus nodes and offsets are the same, the range is collapsed.\n */\nfunction isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {\n  return anchorNode === focusNode && anchorOffset === focusOffset;\n}\n\n/**\n * Get the appropriate anchor and focus node/offset pairs for IE.\n *\n * The catch here is that IE's selection API doesn't provide information\n * about whether the selection is forward or backward, so we have to\n * behave as though it's always forward.\n *\n * IE text differs from modern selection in that it behaves as though\n * block elements end with a new line. This means character offsets will\n * differ between the two APIs.\n *\n * @param {DOMElement} node\n * @return {object}\n */\nfunction getIEOffsets(node) {\n  var selection = document.selection;\n  var selectedRange = selection.createRange();\n  var selectedLength = selectedRange.text.length;\n\n  // Duplicate selection so we can move range without breaking user selection.\n  var fromStart = selectedRange.duplicate();\n  fromStart.moveToElementText(node);\n  fromStart.setEndPoint('EndToStart', selectedRange);\n\n  var startOffset = fromStart.text.length;\n  var endOffset = startOffset + selectedLength;\n\n  return {\n    start: startOffset,\n    end: endOffset\n  };\n}\n\n/**\n * @param {DOMElement} node\n * @return {?object}\n */\nfunction getModernOffsets(node) {\n  var selection = window.getSelection && window.getSelection();\n\n  if (!selection || selection.rangeCount === 0) {\n    return null;\n  }\n\n  var anchorNode = selection.anchorNode;\n  var anchorOffset = selection.anchorOffset;\n  var focusNode = selection.focusNode;\n  var focusOffset = selection.focusOffset;\n\n  var currentRange = selection.getRangeAt(0);\n\n  // If the node and offset values are the same, the selection is collapsed.\n  // `Selection.isCollapsed` is available natively, but IE sometimes gets\n  // this value wrong.\n  var isSelectionCollapsed = isCollapsed(\n    selection.anchorNode,\n    selection.anchorOffset,\n    selection.focusNode,\n    selection.focusOffset\n  );\n\n  var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;\n\n  var tempRange = currentRange.cloneRange();\n  tempRange.selectNodeContents(node);\n  tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);\n\n  var isTempRangeCollapsed = isCollapsed(\n    tempRange.startContainer,\n    tempRange.startOffset,\n    tempRange.endContainer,\n    tempRange.endOffset\n  );\n\n  var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;\n  var end = start + rangeLength;\n\n  // Detect whether the selection is backward.\n  var detectionRange = document.createRange();\n  detectionRange.setStart(anchorNode, anchorOffset);\n  detectionRange.setEnd(focusNode, focusOffset);\n  var isBackward = detectionRange.collapsed;\n\n  return {\n    start: isBackward ? end : start,\n    end: isBackward ? start : end\n  };\n}\n\n/**\n * @param {DOMElement|DOMTextNode} node\n * @param {object} offsets\n */\nfunction setIEOffsets(node, offsets) {\n  var range = document.selection.createRange().duplicate();\n  var start, end;\n\n  if (typeof offsets.end === 'undefined') {\n    start = offsets.start;\n    end = start;\n  } else if (offsets.start > offsets.end) {\n    start = offsets.end;\n    end = offsets.start;\n  } else {\n    start = offsets.start;\n    end = offsets.end;\n  }\n\n  range.moveToElementText(node);\n  range.moveStart('character', start);\n  range.setEndPoint('EndToStart', range);\n  range.moveEnd('character', end - start);\n  range.select();\n}\n\n/**\n * In modern non-IE browsers, we can support both forward and backward\n * selections.\n *\n * Note: IE10+ supports the Selection object, but it does not support\n * the `extend` method, which means that even in modern IE, it's not possible\n * to programatically create a backward selection. Thus, for all IE\n * versions, we use the old IE API to create our selections.\n *\n * @param {DOMElement|DOMTextNode} node\n * @param {object} offsets\n */\nfunction setModernOffsets(node, offsets) {\n  if (!window.getSelection) {\n    return;\n  }\n\n  var selection = window.getSelection();\n  var length = node[getTextContentAccessor()].length;\n  var start = Math.min(offsets.start, length);\n  var end = typeof offsets.end === 'undefined' ?\n            start : Math.min(offsets.end, length);\n\n  // IE 11 uses modern selection, but doesn't support the extend method.\n  // Flip backward selections, so we can set with a single range.\n  if (!selection.extend && start > end) {\n    var temp = end;\n    end = start;\n    start = temp;\n  }\n\n  var startMarker = getNodeForCharacterOffset(node, start);\n  var endMarker = getNodeForCharacterOffset(node, end);\n\n  if (startMarker && endMarker) {\n    var range = document.createRange();\n    range.setStart(startMarker.node, startMarker.offset);\n    selection.removeAllRanges();\n\n    if (start > end) {\n      selection.addRange(range);\n      selection.extend(endMarker.node, endMarker.offset);\n    } else {\n      range.setEnd(endMarker.node, endMarker.offset);\n      selection.addRange(range);\n    }\n  }\n}\n\nvar useIEOffsets = (\n  ExecutionEnvironment.canUseDOM &&\n  'selection' in document &&\n  !('getSelection' in window)\n);\n\nvar ReactDOMSelection = {\n  /**\n   * @param {DOMElement} node\n   */\n  getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,\n\n  /**\n   * @param {DOMElement|DOMTextNode} node\n   * @param {object} offsets\n   */\n  setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets\n};\n\nmodule.exports = ReactDOMSelection;\n\n},{\"128\":128,\"130\":130,\"21\":21}],51:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMTextComponent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar DOMPropertyOperations = _dereq_(11);\nvar ReactComponentBrowserEnvironment =\n  _dereq_(35);\nvar ReactDOMComponent = _dereq_(42);\n\nvar assign = _dereq_(27);\nvar escapeTextContentForBrowser = _dereq_(116);\n\n/**\n * Text nodes violate a couple assumptions that React makes about components:\n *\n *  - When mounting text into the DOM, adjacent text nodes are merged.\n *  - Text nodes cannot be assigned a React root ID.\n *\n * This component is used to wrap strings in elements so that they can undergo\n * the same reconciliation that is applied to elements.\n *\n * TODO: Investigate representing React components in the DOM with text nodes.\n *\n * @class ReactDOMTextComponent\n * @extends ReactComponent\n * @internal\n */\nvar ReactDOMTextComponent = function(props) {\n  // This constructor and its argument is currently used by mocks.\n};\n\nassign(ReactDOMTextComponent.prototype, {\n\n  /**\n   * @param {ReactText} text\n   * @internal\n   */\n  construct: function(text) {\n    // TODO: This is really a ReactText (ReactNode), not a ReactElement\n    this._currentElement = text;\n    this._stringText = '' + text;\n\n    // Properties\n    this._rootNodeID = null;\n    this._mountIndex = 0;\n  },\n\n  /**\n   * Creates the markup for this text node. This node is not intended to have\n   * any features besides containing text content.\n   *\n   * @param {string} rootID DOM ID of the root node.\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @return {string} Markup for this text node.\n   * @internal\n   */\n  mountComponent: function(rootID, transaction, context) {\n    this._rootNodeID = rootID;\n    var escapedText = escapeTextContentForBrowser(this._stringText);\n\n    if (transaction.renderToStaticMarkup) {\n      // Normally we'd wrap this in a `span` for the reasons stated above, but\n      // since this is a situation where React won't take over (static pages),\n      // we can simply return the text as it is.\n      return escapedText;\n    }\n\n    return (\n      '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +\n        escapedText +\n      '</span>'\n    );\n  },\n\n  /**\n   * Updates this component by updating the text content.\n   *\n   * @param {ReactText} nextText The next text content\n   * @param {ReactReconcileTransaction} transaction\n   * @internal\n   */\n  receiveComponent: function(nextText, transaction) {\n    if (nextText !== this._currentElement) {\n      this._currentElement = nextText;\n      var nextStringText = '' + nextText;\n      if (nextStringText !== this._stringText) {\n        // TODO: Save this as pending props and use performUpdateIfNecessary\n        // and/or updateComponent to do the actual update for consistency with\n        // other component types?\n        this._stringText = nextStringText;\n        ReactDOMComponent.BackendIDOperations.updateTextContentByID(\n          this._rootNodeID,\n          nextStringText\n        );\n      }\n    }\n  },\n\n  unmountComponent: function() {\n    ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);\n  }\n\n});\n\nmodule.exports = ReactDOMTextComponent;\n\n},{\"11\":11,\"116\":116,\"27\":27,\"35\":35,\"42\":42}],52:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDOMTextarea\n */\n\n'use strict';\n\nvar AutoFocusMixin = _dereq_(2);\nvar DOMPropertyOperations = _dereq_(11);\nvar LinkedValueUtils = _dereq_(24);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\n\nvar warning = _dereq_(154);\n\nvar textarea = ReactElement.createFactory('textarea');\n\nfunction forceUpdateIfMounted() {\n  /*jshint validthis:true */\n  if (this.isMounted()) {\n    this.forceUpdate();\n  }\n}\n\n/**\n * Implements a <textarea> native component that allows setting `value`, and\n * `defaultValue`. This differs from the traditional DOM API because value is\n * usually set as PCDATA children.\n *\n * If `value` is not supplied (or null/undefined), user actions that affect the\n * value will trigger updates to the element.\n *\n * If `value` is supplied (and not null/undefined), the rendered element will\n * not trigger updates to the element. Instead, the `value` prop must change in\n * order for the rendered element to be updated.\n *\n * The rendered element will be initialized with an empty value, the prop\n * `defaultValue` if specified, or the children content (deprecated).\n */\nvar ReactDOMTextarea = ReactClass.createClass({\n  displayName: 'ReactDOMTextarea',\n  tagName: 'TEXTAREA',\n\n  mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],\n\n  getInitialState: function() {\n    var defaultValue = this.props.defaultValue;\n    // TODO (yungsters): Remove support for children content in <textarea>.\n    var children = this.props.children;\n    if (children != null) {\n      if (\"production\" !== \"development\") {\n        (\"production\" !== \"development\" ? warning(\n          false,\n          'Use the `defaultValue` or `value` props instead of setting ' +\n          'children on <textarea>.'\n        ) : null);\n      }\n      (\"production\" !== \"development\" ? invariant(\n        defaultValue == null,\n        'If you supply `defaultValue` on a <textarea>, do not pass children.'\n      ) : invariant(defaultValue == null));\n      if (Array.isArray(children)) {\n        (\"production\" !== \"development\" ? invariant(\n          children.length <= 1,\n          '<textarea> can only have at most one child.'\n        ) : invariant(children.length <= 1));\n        children = children[0];\n      }\n\n      defaultValue = '' + children;\n    }\n    if (defaultValue == null) {\n      defaultValue = '';\n    }\n    var value = LinkedValueUtils.getValue(this);\n    return {\n      // We save the initial value so that `ReactDOMComponent` doesn't update\n      // `textContent` (unnecessary since we update value).\n      // The initial value can be a boolean or object so that's why it's\n      // forced to be a string.\n      initialValue: '' + (value != null ? value : defaultValue)\n    };\n  },\n\n  render: function() {\n    // Clone `this.props` so we don't mutate the input.\n    var props = assign({}, this.props);\n\n    (\"production\" !== \"development\" ? invariant(\n      props.dangerouslySetInnerHTML == null,\n      '`dangerouslySetInnerHTML` does not make sense on <textarea>.'\n    ) : invariant(props.dangerouslySetInnerHTML == null));\n\n    props.defaultValue = null;\n    props.value = null;\n    props.onChange = this._handleChange;\n\n    // Always set children to the same thing. In IE9, the selection range will\n    // get reset if `textContent` is mutated.\n    return textarea(props, this.state.initialValue);\n  },\n\n  componentDidUpdate: function(prevProps, prevState, prevContext) {\n    var value = LinkedValueUtils.getValue(this);\n    if (value != null) {\n      var rootNode = this.getDOMNode();\n      // Cast `value` to a string to ensure the value is set correctly. While\n      // browsers typically do this as necessary, jsdom doesn't.\n      DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);\n    }\n  },\n\n  _handleChange: function(event) {\n    var returnValue;\n    var onChange = LinkedValueUtils.getOnChange(this);\n    if (onChange) {\n      returnValue = onChange.call(this, event);\n    }\n    ReactUpdates.asap(forceUpdateIfMounted, this);\n    return returnValue;\n  }\n\n});\n\nmodule.exports = ReactDOMTextarea;\n\n},{\"11\":11,\"135\":135,\"154\":154,\"2\":2,\"24\":24,\"27\":27,\"29\":29,\"33\":33,\"57\":57,\"87\":87}],53:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDefaultBatchingStrategy\n */\n\n'use strict';\n\nvar ReactUpdates = _dereq_(87);\nvar Transaction = _dereq_(103);\n\nvar assign = _dereq_(27);\nvar emptyFunction = _dereq_(114);\n\nvar RESET_BATCHED_UPDATES = {\n  initialize: emptyFunction,\n  close: function() {\n    ReactDefaultBatchingStrategy.isBatchingUpdates = false;\n  }\n};\n\nvar FLUSH_BATCHED_UPDATES = {\n  initialize: emptyFunction,\n  close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)\n};\n\nvar TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];\n\nfunction ReactDefaultBatchingStrategyTransaction() {\n  this.reinitializeTransaction();\n}\n\nassign(\n  ReactDefaultBatchingStrategyTransaction.prototype,\n  Transaction.Mixin,\n  {\n    getTransactionWrappers: function() {\n      return TRANSACTION_WRAPPERS;\n    }\n  }\n);\n\nvar transaction = new ReactDefaultBatchingStrategyTransaction();\n\nvar ReactDefaultBatchingStrategy = {\n  isBatchingUpdates: false,\n\n  /**\n   * Call the provided function in a context within which calls to `setState`\n   * and friends are batched such that components aren't updated unnecessarily.\n   */\n  batchedUpdates: function(callback, a, b, c, d) {\n    var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;\n\n    ReactDefaultBatchingStrategy.isBatchingUpdates = true;\n\n    // The code is written this way to avoid extra allocations\n    if (alreadyBatchingUpdates) {\n      callback(a, b, c, d);\n    } else {\n      transaction.perform(callback, null, a, b, c, d);\n    }\n  }\n};\n\nmodule.exports = ReactDefaultBatchingStrategy;\n\n},{\"103\":103,\"114\":114,\"27\":27,\"87\":87}],54:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDefaultInjection\n */\n\n'use strict';\n\nvar BeforeInputEventPlugin = _dereq_(3);\nvar ChangeEventPlugin = _dereq_(7);\nvar ClientReactRootIndex = _dereq_(8);\nvar DefaultEventPluginOrder = _dereq_(13);\nvar EnterLeaveEventPlugin = _dereq_(14);\nvar ExecutionEnvironment = _dereq_(21);\nvar HTMLDOMPropertyConfig = _dereq_(23);\nvar MobileSafariClickEventPlugin = _dereq_(26);\nvar ReactBrowserComponentMixin = _dereq_(29);\nvar ReactClass = _dereq_(33);\nvar ReactComponentBrowserEnvironment =\n  _dereq_(35);\nvar ReactDefaultBatchingStrategy = _dereq_(53);\nvar ReactDOMComponent = _dereq_(42);\nvar ReactDOMButton = _dereq_(41);\nvar ReactDOMForm = _dereq_(43);\nvar ReactDOMImg = _dereq_(46);\nvar ReactDOMIDOperations = _dereq_(44);\nvar ReactDOMIframe = _dereq_(45);\nvar ReactDOMInput = _dereq_(47);\nvar ReactDOMOption = _dereq_(48);\nvar ReactDOMSelect = _dereq_(49);\nvar ReactDOMTextarea = _dereq_(52);\nvar ReactDOMTextComponent = _dereq_(51);\nvar ReactElement = _dereq_(57);\nvar ReactEventListener = _dereq_(62);\nvar ReactInjection = _dereq_(64);\nvar ReactInstanceHandles = _dereq_(66);\nvar ReactMount = _dereq_(70);\nvar ReactReconcileTransaction = _dereq_(80);\nvar SelectEventPlugin = _dereq_(89);\nvar ServerReactRootIndex = _dereq_(90);\nvar SimpleEventPlugin = _dereq_(91);\nvar SVGDOMPropertyConfig = _dereq_(88);\n\nvar createFullPageComponent = _dereq_(111);\n\nfunction autoGenerateWrapperClass(type) {\n  return ReactClass.createClass({\n    tagName: type.toUpperCase(),\n    render: function() {\n      return new ReactElement(\n        type,\n        null,\n        null,\n        null,\n        null,\n        this.props\n      );\n    }\n  });\n}\n\nfunction inject() {\n  ReactInjection.EventEmitter.injectReactEventListener(\n    ReactEventListener\n  );\n\n  /**\n   * Inject modules for resolving DOM hierarchy and plugin ordering.\n   */\n  ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);\n  ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);\n  ReactInjection.EventPluginHub.injectMount(ReactMount);\n\n  /**\n   * Some important event plugins included by default (without having to require\n   * them).\n   */\n  ReactInjection.EventPluginHub.injectEventPluginsByName({\n    SimpleEventPlugin: SimpleEventPlugin,\n    EnterLeaveEventPlugin: EnterLeaveEventPlugin,\n    ChangeEventPlugin: ChangeEventPlugin,\n    MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,\n    SelectEventPlugin: SelectEventPlugin,\n    BeforeInputEventPlugin: BeforeInputEventPlugin\n  });\n\n  ReactInjection.NativeComponent.injectGenericComponentClass(\n    ReactDOMComponent\n  );\n\n  ReactInjection.NativeComponent.injectTextComponentClass(\n    ReactDOMTextComponent\n  );\n\n  ReactInjection.NativeComponent.injectAutoWrapper(\n    autoGenerateWrapperClass\n  );\n\n  // This needs to happen before createFullPageComponent() otherwise the mixin\n  // won't be included.\n  ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);\n\n  ReactInjection.NativeComponent.injectComponentClasses({\n    'button': ReactDOMButton,\n    'form': ReactDOMForm,\n    'iframe': ReactDOMIframe,\n    'img': ReactDOMImg,\n    'input': ReactDOMInput,\n    'option': ReactDOMOption,\n    'select': ReactDOMSelect,\n    'textarea': ReactDOMTextarea,\n\n    'html': createFullPageComponent('html'),\n    'head': createFullPageComponent('head'),\n    'body': createFullPageComponent('body')\n  });\n\n  ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);\n  ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);\n\n  ReactInjection.EmptyComponent.injectEmptyComponent('noscript');\n\n  ReactInjection.Updates.injectReconcileTransaction(\n    ReactReconcileTransaction\n  );\n  ReactInjection.Updates.injectBatchingStrategy(\n    ReactDefaultBatchingStrategy\n  );\n\n  ReactInjection.RootIndex.injectCreateReactRootIndex(\n    ExecutionEnvironment.canUseDOM ?\n      ClientReactRootIndex.createReactRootIndex :\n      ServerReactRootIndex.createReactRootIndex\n  );\n\n  ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);\n  ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);\n\n  if (\"production\" !== \"development\") {\n    var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';\n    if ((/[?&]react_perf\\b/).test(url)) {\n      var ReactDefaultPerf = _dereq_(55);\n      ReactDefaultPerf.start();\n    }\n  }\n}\n\nmodule.exports = {\n  inject: inject\n};\n\n},{\"111\":111,\"13\":13,\"14\":14,\"21\":21,\"23\":23,\"26\":26,\"29\":29,\"3\":3,\"33\":33,\"35\":35,\"41\":41,\"42\":42,\"43\":43,\"44\":44,\"45\":45,\"46\":46,\"47\":47,\"48\":48,\"49\":49,\"51\":51,\"52\":52,\"53\":53,\"55\":55,\"57\":57,\"62\":62,\"64\":64,\"66\":66,\"7\":7,\"70\":70,\"8\":8,\"80\":80,\"88\":88,\"89\":89,\"90\":90,\"91\":91}],55:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDefaultPerf\n * @typechecks static-only\n */\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\nvar ReactDefaultPerfAnalysis = _dereq_(56);\nvar ReactMount = _dereq_(70);\nvar ReactPerf = _dereq_(75);\n\nvar performanceNow = _dereq_(146);\n\nfunction roundFloat(val) {\n  return Math.floor(val * 100) / 100;\n}\n\nfunction addValue(obj, key, val) {\n  obj[key] = (obj[key] || 0) + val;\n}\n\nvar ReactDefaultPerf = {\n  _allMeasurements: [], // last item in the list is the current one\n  _mountStack: [0],\n  _injected: false,\n\n  start: function() {\n    if (!ReactDefaultPerf._injected) {\n      ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);\n    }\n\n    ReactDefaultPerf._allMeasurements.length = 0;\n    ReactPerf.enableMeasure = true;\n  },\n\n  stop: function() {\n    ReactPerf.enableMeasure = false;\n  },\n\n  getLastMeasurements: function() {\n    return ReactDefaultPerf._allMeasurements;\n  },\n\n  printExclusive: function(measurements) {\n    measurements = measurements || ReactDefaultPerf._allMeasurements;\n    var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);\n    console.table(summary.map(function(item) {\n      return {\n        'Component class name': item.componentName,\n        'Total inclusive time (ms)': roundFloat(item.inclusive),\n        'Exclusive mount time (ms)': roundFloat(item.exclusive),\n        'Exclusive render time (ms)': roundFloat(item.render),\n        'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),\n        'Render time per instance (ms)': roundFloat(item.render / item.count),\n        'Instances': item.count\n      };\n    }));\n    // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct\n    // number.\n  },\n\n  printInclusive: function(measurements) {\n    measurements = measurements || ReactDefaultPerf._allMeasurements;\n    var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);\n    console.table(summary.map(function(item) {\n      return {\n        'Owner > component': item.componentName,\n        'Inclusive time (ms)': roundFloat(item.time),\n        'Instances': item.count\n      };\n    }));\n    console.log(\n      'Total time:',\n      ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'\n    );\n  },\n\n  getMeasurementsSummaryMap: function(measurements) {\n    var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(\n      measurements,\n      true\n    );\n    return summary.map(function(item) {\n      return {\n        'Owner > component': item.componentName,\n        'Wasted time (ms)': item.time,\n        'Instances': item.count\n      };\n    });\n  },\n\n  printWasted: function(measurements) {\n    measurements = measurements || ReactDefaultPerf._allMeasurements;\n    console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));\n    console.log(\n      'Total time:',\n      ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'\n    );\n  },\n\n  printDOM: function(measurements) {\n    measurements = measurements || ReactDefaultPerf._allMeasurements;\n    var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);\n    console.table(summary.map(function(item) {\n      var result = {};\n      result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;\n      result['type'] = item.type;\n      result['args'] = JSON.stringify(item.args);\n      return result;\n    }));\n    console.log(\n      'Total time:',\n      ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'\n    );\n  },\n\n  _recordWrite: function(id, fnName, totalTime, args) {\n    // TODO: totalTime isn't that useful since it doesn't count paints/reflows\n    var writes =\n      ReactDefaultPerf\n        ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]\n        .writes;\n    writes[id] = writes[id] || [];\n    writes[id].push({\n      type: fnName,\n      time: totalTime,\n      args: args\n    });\n  },\n\n  measure: function(moduleName, fnName, func) {\n    return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);\n      var totalTime;\n      var rv;\n      var start;\n\n      if (fnName === '_renderNewRootComponent' ||\n          fnName === 'flushBatchedUpdates') {\n        // A \"measurement\" is a set of metrics recorded for each flush. We want\n        // to group the metrics for a given flush together so we can look at the\n        // components that rendered and the DOM operations that actually\n        // happened to determine the amount of \"wasted work\" performed.\n        ReactDefaultPerf._allMeasurements.push({\n          exclusive: {},\n          inclusive: {},\n          render: {},\n          counts: {},\n          writes: {},\n          displayNames: {},\n          totalTime: 0\n        });\n        start = performanceNow();\n        rv = func.apply(this, args);\n        ReactDefaultPerf._allMeasurements[\n          ReactDefaultPerf._allMeasurements.length - 1\n        ].totalTime = performanceNow() - start;\n        return rv;\n      } else if (fnName === '_mountImageIntoNode' ||\n          moduleName === 'ReactDOMIDOperations') {\n        start = performanceNow();\n        rv = func.apply(this, args);\n        totalTime = performanceNow() - start;\n\n        if (fnName === '_mountImageIntoNode') {\n          var mountID = ReactMount.getID(args[1]);\n          ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);\n        } else if (fnName === 'dangerouslyProcessChildrenUpdates') {\n          // special format\n          args[0].forEach(function(update) {\n            var writeArgs = {};\n            if (update.fromIndex !== null) {\n              writeArgs.fromIndex = update.fromIndex;\n            }\n            if (update.toIndex !== null) {\n              writeArgs.toIndex = update.toIndex;\n            }\n            if (update.textContent !== null) {\n              writeArgs.textContent = update.textContent;\n            }\n            if (update.markupIndex !== null) {\n              writeArgs.markup = args[1][update.markupIndex];\n            }\n            ReactDefaultPerf._recordWrite(\n              update.parentID,\n              update.type,\n              totalTime,\n              writeArgs\n            );\n          });\n        } else {\n          // basic format\n          ReactDefaultPerf._recordWrite(\n            args[0],\n            fnName,\n            totalTime,\n            Array.prototype.slice.call(args, 1)\n          );\n        }\n        return rv;\n      } else if (moduleName === 'ReactCompositeComponent' && (\n        (// TODO: receiveComponent()?\n        (fnName === 'mountComponent' ||\n        fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {\n\n        if (typeof this._currentElement.type === 'string') {\n          return func.apply(this, args);\n        }\n\n        var rootNodeID = fnName === 'mountComponent' ?\n          args[0] :\n          this._rootNodeID;\n        var isRender = fnName === '_renderValidatedComponent';\n        var isMount = fnName === 'mountComponent';\n\n        var mountStack = ReactDefaultPerf._mountStack;\n        var entry = ReactDefaultPerf._allMeasurements[\n          ReactDefaultPerf._allMeasurements.length - 1\n        ];\n\n        if (isRender) {\n          addValue(entry.counts, rootNodeID, 1);\n        } else if (isMount) {\n          mountStack.push(0);\n        }\n\n        start = performanceNow();\n        rv = func.apply(this, args);\n        totalTime = performanceNow() - start;\n\n        if (isRender) {\n          addValue(entry.render, rootNodeID, totalTime);\n        } else if (isMount) {\n          var subMountTime = mountStack.pop();\n          mountStack[mountStack.length - 1] += totalTime;\n          addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);\n          addValue(entry.inclusive, rootNodeID, totalTime);\n        } else {\n          addValue(entry.inclusive, rootNodeID, totalTime);\n        }\n\n        entry.displayNames[rootNodeID] = {\n          current: this.getName(),\n          owner: this._currentElement._owner ?\n            this._currentElement._owner.getName() :\n            '<root>'\n        };\n\n        return rv;\n      } else {\n        return func.apply(this, args);\n      }\n    };\n  }\n};\n\nmodule.exports = ReactDefaultPerf;\n\n},{\"10\":10,\"146\":146,\"56\":56,\"70\":70,\"75\":75}],56:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactDefaultPerfAnalysis\n */\n\nvar assign = _dereq_(27);\n\n// Don't try to save users less than 1.2ms (a number I made up)\nvar DONT_CARE_THRESHOLD = 1.2;\nvar DOM_OPERATION_TYPES = {\n  '_mountImageIntoNode': 'set innerHTML',\n  INSERT_MARKUP: 'set innerHTML',\n  MOVE_EXISTING: 'move',\n  REMOVE_NODE: 'remove',\n  TEXT_CONTENT: 'set textContent',\n  'updatePropertyByID': 'update attribute',\n  'deletePropertyByID': 'delete attribute',\n  'updateStylesByID': 'update styles',\n  'updateInnerHTMLByID': 'set innerHTML',\n  'dangerouslyReplaceNodeWithMarkupByID': 'replace'\n};\n\nfunction getTotalTime(measurements) {\n  // TODO: return number of DOM ops? could be misleading.\n  // TODO: measure dropped frames after reconcile?\n  // TODO: log total time of each reconcile and the top-level component\n  // class that triggered it.\n  var totalTime = 0;\n  for (var i = 0; i < measurements.length; i++) {\n    var measurement = measurements[i];\n    totalTime += measurement.totalTime;\n  }\n  return totalTime;\n}\n\nfunction getDOMSummary(measurements) {\n  var items = [];\n  for (var i = 0; i < measurements.length; i++) {\n    var measurement = measurements[i];\n    var id;\n\n    for (id in measurement.writes) {\n      measurement.writes[id].forEach(function(write) {\n        items.push({\n          id: id,\n          type: DOM_OPERATION_TYPES[write.type] || write.type,\n          args: write.args\n        });\n      });\n    }\n  }\n  return items;\n}\n\nfunction getExclusiveSummary(measurements) {\n  var candidates = {};\n  var displayName;\n\n  for (var i = 0; i < measurements.length; i++) {\n    var measurement = measurements[i];\n    var allIDs = assign(\n      {},\n      measurement.exclusive,\n      measurement.inclusive\n    );\n\n    for (var id in allIDs) {\n      displayName = measurement.displayNames[id].current;\n\n      candidates[displayName] = candidates[displayName] || {\n        componentName: displayName,\n        inclusive: 0,\n        exclusive: 0,\n        render: 0,\n        count: 0\n      };\n      if (measurement.render[id]) {\n        candidates[displayName].render += measurement.render[id];\n      }\n      if (measurement.exclusive[id]) {\n        candidates[displayName].exclusive += measurement.exclusive[id];\n      }\n      if (measurement.inclusive[id]) {\n        candidates[displayName].inclusive += measurement.inclusive[id];\n      }\n      if (measurement.counts[id]) {\n        candidates[displayName].count += measurement.counts[id];\n      }\n    }\n  }\n\n  // Now make a sorted array with the results.\n  var arr = [];\n  for (displayName in candidates) {\n    if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {\n      arr.push(candidates[displayName]);\n    }\n  }\n\n  arr.sort(function(a, b) {\n    return b.exclusive - a.exclusive;\n  });\n\n  return arr;\n}\n\nfunction getInclusiveSummary(measurements, onlyClean) {\n  var candidates = {};\n  var inclusiveKey;\n\n  for (var i = 0; i < measurements.length; i++) {\n    var measurement = measurements[i];\n    var allIDs = assign(\n      {},\n      measurement.exclusive,\n      measurement.inclusive\n    );\n    var cleanComponents;\n\n    if (onlyClean) {\n      cleanComponents = getUnchangedComponents(measurement);\n    }\n\n    for (var id in allIDs) {\n      if (onlyClean && !cleanComponents[id]) {\n        continue;\n      }\n\n      var displayName = measurement.displayNames[id];\n\n      // Inclusive time is not useful for many components without knowing where\n      // they are instantiated. So we aggregate inclusive time with both the\n      // owner and current displayName as the key.\n      inclusiveKey = displayName.owner + ' > ' + displayName.current;\n\n      candidates[inclusiveKey] = candidates[inclusiveKey] || {\n        componentName: inclusiveKey,\n        time: 0,\n        count: 0\n      };\n\n      if (measurement.inclusive[id]) {\n        candidates[inclusiveKey].time += measurement.inclusive[id];\n      }\n      if (measurement.counts[id]) {\n        candidates[inclusiveKey].count += measurement.counts[id];\n      }\n    }\n  }\n\n  // Now make a sorted array with the results.\n  var arr = [];\n  for (inclusiveKey in candidates) {\n    if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {\n      arr.push(candidates[inclusiveKey]);\n    }\n  }\n\n  arr.sort(function(a, b) {\n    return b.time - a.time;\n  });\n\n  return arr;\n}\n\nfunction getUnchangedComponents(measurement) {\n  // For a given reconcile, look at which components did not actually\n  // render anything to the DOM and return a mapping of their ID to\n  // the amount of time it took to render the entire subtree.\n  var cleanComponents = {};\n  var dirtyLeafIDs = Object.keys(measurement.writes);\n  var allIDs = assign({}, measurement.exclusive, measurement.inclusive);\n\n  for (var id in allIDs) {\n    var isDirty = false;\n    // For each component that rendered, see if a component that triggered\n    // a DOM op is in its subtree.\n    for (var i = 0; i < dirtyLeafIDs.length; i++) {\n      if (dirtyLeafIDs[i].indexOf(id) === 0) {\n        isDirty = true;\n        break;\n      }\n    }\n    if (!isDirty && measurement.counts[id] > 0) {\n      cleanComponents[id] = true;\n    }\n  }\n  return cleanComponents;\n}\n\nvar ReactDefaultPerfAnalysis = {\n  getExclusiveSummary: getExclusiveSummary,\n  getInclusiveSummary: getInclusiveSummary,\n  getDOMSummary: getDOMSummary,\n  getTotalTime: getTotalTime\n};\n\nmodule.exports = ReactDefaultPerfAnalysis;\n\n},{\"27\":27}],57:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactElement\n */\n\n'use strict';\n\nvar ReactContext = _dereq_(38);\nvar ReactCurrentOwner = _dereq_(39);\n\nvar assign = _dereq_(27);\nvar warning = _dereq_(154);\n\nvar RESERVED_PROPS = {\n  key: true,\n  ref: true\n};\n\n/**\n * Warn for mutations.\n *\n * @internal\n * @param {object} object\n * @param {string} key\n */\nfunction defineWarningProperty(object, key) {\n  Object.defineProperty(object, key, {\n\n    configurable: false,\n    enumerable: true,\n\n    get: function() {\n      if (!this._store) {\n        return null;\n      }\n      return this._store[key];\n    },\n\n    set: function(value) {\n      (\"production\" !== \"development\" ? warning(\n        false,\n        'Don\\'t set the %s property of the React element. Instead, ' +\n        'specify the correct value when initially creating the element.',\n        key\n      ) : null);\n      this._store[key] = value;\n    }\n\n  });\n}\n\n/**\n * This is updated to true if the membrane is successfully created.\n */\nvar useMutationMembrane = false;\n\n/**\n * Warn for mutations.\n *\n * @internal\n * @param {object} element\n */\nfunction defineMutationMembrane(prototype) {\n  try {\n    var pseudoFrozenProperties = {\n      props: true\n    };\n    for (var key in pseudoFrozenProperties) {\n      defineWarningProperty(prototype, key);\n    }\n    useMutationMembrane = true;\n  } catch (x) {\n    // IE will fail on defineProperty\n  }\n}\n\n/**\n * Base constructor for all React elements. This is only used to make this\n * work with a dynamic instanceof check. Nothing should live on this prototype.\n *\n * @param {*} type\n * @param {string|object} ref\n * @param {*} key\n * @param {*} props\n * @internal\n */\nvar ReactElement = function(type, key, ref, owner, context, props) {\n  // Built-in properties that belong on the element\n  this.type = type;\n  this.key = key;\n  this.ref = ref;\n\n  // Record the component responsible for creating this element.\n  this._owner = owner;\n\n  // TODO: Deprecate withContext, and then the context becomes accessible\n  // through the owner.\n  this._context = context;\n\n  if (\"production\" !== \"development\") {\n    // The validation flag and props are currently mutative. We put them on\n    // an external backing store so that we can freeze the whole object.\n    // This can be replaced with a WeakMap once they are implemented in\n    // commonly used development environments.\n    this._store = {props: props, originalProps: assign({}, props)};\n\n    // To make comparing ReactElements easier for testing purposes, we make\n    // the validation flag non-enumerable (where possible, which should\n    // include every environment we run tests in), so the test framework\n    // ignores it.\n    try {\n      Object.defineProperty(this._store, 'validated', {\n        configurable: false,\n        enumerable: false,\n        writable: true\n      });\n    } catch (x) {\n    }\n    this._store.validated = false;\n\n    // We're not allowed to set props directly on the object so we early\n    // return and rely on the prototype membrane to forward to the backing\n    // store.\n    if (useMutationMembrane) {\n      Object.freeze(this);\n      return;\n    }\n  }\n\n  this.props = props;\n};\n\n// We intentionally don't expose the function on the constructor property.\n// ReactElement should be indistinguishable from a plain object.\nReactElement.prototype = {\n  _isReactElement: true\n};\n\nif (\"production\" !== \"development\") {\n  defineMutationMembrane(ReactElement.prototype);\n}\n\nReactElement.createElement = function(type, config, children) {\n  var propName;\n\n  // Reserved names are extracted\n  var props = {};\n\n  var key = null;\n  var ref = null;\n\n  if (config != null) {\n    ref = config.ref === undefined ? null : config.ref;\n    key = config.key === undefined ? null : '' + config.key;\n    // Remaining properties are added to a new props object\n    for (propName in config) {\n      if (config.hasOwnProperty(propName) &&\n          !RESERVED_PROPS.hasOwnProperty(propName)) {\n        props[propName] = config[propName];\n      }\n    }\n  }\n\n  // Children can be more than one argument, and those are transferred onto\n  // the newly allocated props object.\n  var childrenLength = arguments.length - 2;\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 + 2];\n    }\n    props.children = childArray;\n  }\n\n  // Resolve default props\n  if (type && type.defaultProps) {\n    var defaultProps = type.defaultProps;\n    for (propName in defaultProps) {\n      if (typeof props[propName] === 'undefined') {\n        props[propName] = defaultProps[propName];\n      }\n    }\n  }\n\n  return new ReactElement(\n    type,\n    key,\n    ref,\n    ReactCurrentOwner.current,\n    ReactContext.current,\n    props\n  );\n};\n\nReactElement.createFactory = function(type) {\n  var factory = ReactElement.createElement.bind(null, type);\n  // Expose the type on the factory and the prototype so that it can be\n  // easily accessed on elements. E.g. <Foo />.type === Foo.type.\n  // This should not be named `constructor` since this may not be the function\n  // that created the element, and it may not even be a constructor.\n  // Legacy hook TODO: Warn if this is accessed\n  factory.type = type;\n  return factory;\n};\n\nReactElement.cloneAndReplaceProps = function(oldElement, newProps) {\n  var newElement = new ReactElement(\n    oldElement.type,\n    oldElement.key,\n    oldElement.ref,\n    oldElement._owner,\n    oldElement._context,\n    newProps\n  );\n\n  if (\"production\" !== \"development\") {\n    // If the key on the original is valid, then the clone is valid\n    newElement._store.validated = oldElement._store.validated;\n  }\n  return newElement;\n};\n\nReactElement.cloneElement = function(element, config, children) {\n  var propName;\n\n  // Original props are copied\n  var props = assign({}, element.props);\n\n  // Reserved names are extracted\n  var key = element.key;\n  var ref = element.ref;\n\n  // Owner will be preserved, unless ref is overridden\n  var owner = element._owner;\n\n  if (config != null) {\n    if (config.ref !== undefined) {\n      // Silently steal the ref from the parent.\n      ref = config.ref;\n      owner = ReactCurrentOwner.current;\n    }\n    if (config.key !== undefined) {\n      key = '' + config.key;\n    }\n    // Remaining properties override existing props\n    for (propName in config) {\n      if (config.hasOwnProperty(propName) &&\n          !RESERVED_PROPS.hasOwnProperty(propName)) {\n        props[propName] = config[propName];\n      }\n    }\n  }\n\n  // Children can be more than one argument, and those are transferred onto\n  // the newly allocated props object.\n  var childrenLength = arguments.length - 2;\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 + 2];\n    }\n    props.children = childArray;\n  }\n\n  return new ReactElement(\n    element.type,\n    key,\n    ref,\n    owner,\n    element._context,\n    props\n  );\n};\n\n/**\n * @param {?object} object\n * @return {boolean} True if `object` is a valid component.\n * @final\n */\nReactElement.isValidElement = function(object) {\n  // ReactTestUtils is often used outside of beforeEach where as React is\n  // within it. This leads to two different instances of React on the same\n  // page. To identify a element from a different React instance we use\n  // a flag instead of an instanceof check.\n  var isElement = !!(object && object._isReactElement);\n  // if (isElement && !(object instanceof ReactElement)) {\n  // This is an indicator that you're using multiple versions of React at the\n  // same time. This will screw with ownership and stuff. Fix it, please.\n  // TODO: We could possibly warn here.\n  // }\n  return isElement;\n};\n\nmodule.exports = ReactElement;\n\n},{\"154\":154,\"27\":27,\"38\":38,\"39\":39}],58:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactElementValidator\n */\n\n/**\n * ReactElementValidator provides a wrapper around a element factory\n * which validates the props passed to the element. This is intended to be\n * used only in DEV and could be replaced by a static type checker for languages\n * that support it.\n */\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactFragment = _dereq_(63);\nvar ReactPropTypeLocations = _dereq_(77);\nvar ReactPropTypeLocationNames = _dereq_(76);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactNativeComponent = _dereq_(73);\n\nvar getIteratorFn = _dereq_(126);\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\nfunction getDeclarationErrorAddendum() {\n  if (ReactCurrentOwner.current) {\n    var name = ReactCurrentOwner.current.getName();\n    if (name) {\n      return ' Check the render method of `' + name + '`.';\n    }\n  }\n  return '';\n}\n\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\nvar ownerHasKeyUseWarning = {};\n\nvar loggedTypeFailures = {};\n\nvar NUMERIC_PROPERTY_REGEX = /^\\d+$/;\n\n/**\n * Gets the instance's name for use in warnings.\n *\n * @internal\n * @return {?string} Display name or undefined\n */\nfunction getName(instance) {\n  var publicInstance = instance && instance.getPublicInstance();\n  if (!publicInstance) {\n    return undefined;\n  }\n  var constructor = publicInstance.constructor;\n  if (!constructor) {\n    return undefined;\n  }\n  return constructor.displayName || constructor.name || undefined;\n}\n\n/**\n * Gets the current owner's displayName for use in warnings.\n *\n * @internal\n * @return {?string} Display name or undefined\n */\nfunction getCurrentOwnerDisplayName() {\n  var current = ReactCurrentOwner.current;\n  return (\n    current && getName(current) || undefined\n  );\n}\n\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\nfunction validateExplicitKey(element, parentType) {\n  if (element._store.validated || element.key != null) {\n    return;\n  }\n  element._store.validated = true;\n\n  warnAndMonitorForKeyUse(\n    'Each child in an array or iterator should have a unique \"key\" prop.',\n    element,\n    parentType\n  );\n}\n\n/**\n * Warn if the key is being defined as an object property but has an incorrect\n * value.\n *\n * @internal\n * @param {string} name Property name of the key.\n * @param {ReactElement} element Component that requires a key.\n * @param {*} parentType element's parent's type.\n */\nfunction validatePropertyKey(name, element, parentType) {\n  if (!NUMERIC_PROPERTY_REGEX.test(name)) {\n    return;\n  }\n  warnAndMonitorForKeyUse(\n    'Child objects should have non-numeric keys so ordering is preserved.',\n    element,\n    parentType\n  );\n}\n\n/**\n * Shared warning and monitoring code for the key warnings.\n *\n * @internal\n * @param {string} message The base warning that gets output.\n * @param {ReactElement} element Component that requires a key.\n * @param {*} parentType element's parent's type.\n */\nfunction warnAndMonitorForKeyUse(message, element, parentType) {\n  var ownerName = getCurrentOwnerDisplayName();\n  var parentName = typeof parentType === 'string' ?\n    parentType : parentType.displayName || parentType.name;\n\n  var useName = ownerName || parentName;\n  var memoizer = ownerHasKeyUseWarning[message] || (\n    (ownerHasKeyUseWarning[message] = {})\n  );\n  if (memoizer.hasOwnProperty(useName)) {\n    return;\n  }\n  memoizer[useName] = true;\n\n  var parentOrOwnerAddendum =\n    ownerName ? (\" Check the render method of \" + ownerName + \".\") :\n    parentName ? (\" Check the React.render call using <\" + parentName + \">.\") :\n    '';\n\n  // Usually the current owner is the offender, but if it accepts children as a\n  // property, it may be the creator of the child that's responsible for\n  // assigning it a key.\n  var childOwnerAddendum = '';\n  if (element &&\n      element._owner &&\n      element._owner !== ReactCurrentOwner.current) {\n    // Name of the component that originally created this child.\n    var childOwnerName = getName(element._owner);\n\n    childOwnerAddendum = (\" It was passed a child from \" + childOwnerName + \".\");\n  }\n\n  (\"production\" !== \"development\" ? warning(\n    false,\n    message + '%s%s See https://fb.me/react-warning-keys for more information.',\n    parentOrOwnerAddendum,\n    childOwnerAddendum\n  ) : null);\n}\n\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\nfunction validateChildKeys(node, parentType) {\n  if (Array.isArray(node)) {\n    for (var i = 0; i < node.length; i++) {\n      var child = node[i];\n      if (ReactElement.isValidElement(child)) {\n        validateExplicitKey(child, parentType);\n      }\n    }\n  } else if (ReactElement.isValidElement(node)) {\n    // This element was passed in a valid location.\n    node._store.validated = true;\n  } else if (node) {\n    var iteratorFn = getIteratorFn(node);\n    // Entry iterators provide implicit keys.\n    if (iteratorFn) {\n      if (iteratorFn !== node.entries) {\n        var iterator = iteratorFn.call(node);\n        var step;\n        while (!(step = iterator.next()).done) {\n          if (ReactElement.isValidElement(step.value)) {\n            validateExplicitKey(step.value, parentType);\n          }\n        }\n      }\n    } else if (typeof node === 'object') {\n      var fragment = ReactFragment.extractIfFragment(node);\n      for (var key in fragment) {\n        if (fragment.hasOwnProperty(key)) {\n          validatePropertyKey(key, fragment[key], parentType);\n        }\n      }\n    }\n  }\n}\n\n/**\n * Assert that the props are valid\n *\n * @param {string} componentName Name of the component for error messages.\n * @param {object} propTypes Map of prop name to a ReactPropType\n * @param {object} props\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @private\n */\nfunction checkPropTypes(componentName, propTypes, props, location) {\n  for (var propName in propTypes) {\n    if (propTypes.hasOwnProperty(propName)) {\n      var error;\n      // Prop type validation may throw. In case they do, we don't want to\n      // fail the render phase where it didn't fail before. So we log it.\n      // After these have been cleaned up, we'll let them throw.\n      try {\n        // This is intentionally an invariant that gets caught. It's the same\n        // behavior as without this statement except with a better message.\n        (\"production\" !== \"development\" ? invariant(\n          typeof propTypes[propName] === 'function',\n          '%s: %s type `%s` is invalid; it must be a function, usually from ' +\n          'React.PropTypes.',\n          componentName || 'React class',\n          ReactPropTypeLocationNames[location],\n          propName\n        ) : invariant(typeof propTypes[propName] === 'function'));\n        error = propTypes[propName](props, propName, componentName, location);\n      } catch (ex) {\n        error = ex;\n      }\n      if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n        // Only monitor this failure once because there tends to be a lot of the\n        // same error.\n        loggedTypeFailures[error.message] = true;\n\n        var addendum = getDeclarationErrorAddendum(this);\n        (\"production\" !== \"development\" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);\n      }\n    }\n  }\n}\n\nvar warnedPropsMutations = {};\n\n/**\n * Warn about mutating props when setting `propName` on `element`.\n *\n * @param {string} propName The string key within props that was set\n * @param {ReactElement} element\n */\nfunction warnForPropsMutation(propName, element) {\n  var type = element.type;\n  var elementName = typeof type === 'string' ? type : type.displayName;\n  var ownerName = element._owner ?\n    element._owner.getPublicInstance().constructor.displayName : null;\n\n  var warningKey = propName + '|' + elementName + '|' + ownerName;\n  if (warnedPropsMutations.hasOwnProperty(warningKey)) {\n    return;\n  }\n  warnedPropsMutations[warningKey] = true;\n\n  var elementInfo = '';\n  if (elementName) {\n    elementInfo = ' <' + elementName + ' />';\n  }\n  var ownerInfo = '';\n  if (ownerName) {\n    ownerInfo = ' The element was created by ' + ownerName + '.';\n  }\n\n  (\"production\" !== \"development\" ? warning(\n    false,\n    'Don\\'t set .props.%s of the React component%s. Instead, specify the ' +\n    'correct value when initially creating the element or use ' +\n    'React.cloneElement to make a new element with updated props.%s',\n    propName,\n    elementInfo,\n    ownerInfo\n  ) : null);\n}\n\n// Inline Object.is polyfill\nfunction is(a, b) {\n  if (a !== a) {\n    // NaN\n    return b !== b;\n  }\n  if (a === 0 && b === 0) {\n    // +-0\n    return 1 / a === 1 / b;\n  }\n  return a === b;\n}\n\n/**\n * Given an element, check if its props have been mutated since element\n * creation (or the last call to this function). In particular, check if any\n * new props have been added, which we can't directly catch by defining warning\n * properties on the props object.\n *\n * @param {ReactElement} element\n */\nfunction checkAndWarnForMutatedProps(element) {\n  if (!element._store) {\n    // Element was created using `new ReactElement` directly or with\n    // `ReactElement.createElement`; skip mutation checking\n    return;\n  }\n\n  var originalProps = element._store.originalProps;\n  var props = element.props;\n\n  for (var propName in props) {\n    if (props.hasOwnProperty(propName)) {\n      if (!originalProps.hasOwnProperty(propName) ||\n          !is(originalProps[propName], props[propName])) {\n        warnForPropsMutation(propName, element);\n\n        // Copy over the new value so that the two props objects match again\n        originalProps[propName] = props[propName];\n      }\n    }\n  }\n}\n\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\nfunction validatePropTypes(element) {\n  if (element.type == null) {\n    // This has already warned. Don't throw.\n    return;\n  }\n  // Extract the component class from the element. Converts string types\n  // to a composite class which may have propTypes.\n  // TODO: Validating a string's propTypes is not decoupled from the\n  // rendering target which is problematic.\n  var componentClass = ReactNativeComponent.getComponentClassForElement(\n    element\n  );\n  var name = componentClass.displayName || componentClass.name;\n  if (componentClass.propTypes) {\n    checkPropTypes(\n      name,\n      componentClass.propTypes,\n      element.props,\n      ReactPropTypeLocations.prop\n    );\n  }\n  if (typeof componentClass.getDefaultProps === 'function') {\n    (\"production\" !== \"development\" ? warning(\n      componentClass.getDefaultProps.isReactClassApproved,\n      'getDefaultProps is only used on classic React.createClass ' +\n      'definitions. Use a static property named `defaultProps` instead.'\n    ) : null);\n  }\n}\n\nvar ReactElementValidator = {\n\n  checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,\n\n  createElement: function(type, props, children) {\n    // We warn in this case but don't throw. We expect the element creation to\n    // succeed and there will likely be errors in render.\n    (\"production\" !== \"development\" ? warning(\n      type != null,\n      'React.createElement: type should not be null or undefined. It should ' +\n        'be a string (for DOM elements) or a ReactClass (for composite ' +\n        'components).'\n    ) : null);\n\n    var element = ReactElement.createElement.apply(this, arguments);\n\n    // The result can be nullish if a mock or a custom function is used.\n    // TODO: Drop this when these are no longer allowed as the type argument.\n    if (element == null) {\n      return element;\n    }\n\n    for (var i = 2; i < arguments.length; i++) {\n      validateChildKeys(arguments[i], type);\n    }\n\n    validatePropTypes(element);\n\n    return element;\n  },\n\n  createFactory: function(type) {\n    var validatedFactory = ReactElementValidator.createElement.bind(\n      null,\n      type\n    );\n    // Legacy hook TODO: Warn if this is accessed\n    validatedFactory.type = type;\n\n    if (\"production\" !== \"development\") {\n      try {\n        Object.defineProperty(\n          validatedFactory,\n          'type',\n          {\n            enumerable: false,\n            get: function() {\n              (\"production\" !== \"development\" ? warning(\n                false,\n                'Factory.type is deprecated. Access the class directly ' +\n                'before passing it to createFactory.'\n              ) : null);\n              Object.defineProperty(this, 'type', {\n                value: type\n              });\n              return type;\n            }\n          }\n        );\n      } catch (x) {\n        // IE will fail on defineProperty (es5-shim/sham too)\n      }\n    }\n\n\n    return validatedFactory;\n  },\n\n  cloneElement: function(element, props, children) {\n    var newElement = ReactElement.cloneElement.apply(this, arguments);\n    for (var i = 2; i < arguments.length; i++) {\n      validateChildKeys(arguments[i], newElement.type);\n    }\n    validatePropTypes(newElement);\n    return newElement;\n  }\n\n};\n\nmodule.exports = ReactElementValidator;\n\n},{\"126\":126,\"135\":135,\"154\":154,\"39\":39,\"57\":57,\"63\":63,\"73\":73,\"76\":76,\"77\":77}],59:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactEmptyComponent\n */\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactInstanceMap = _dereq_(67);\n\nvar invariant = _dereq_(135);\n\nvar component;\n// This registry keeps track of the React IDs of the components that rendered to\n// `null` (in reality a placeholder such as `noscript`)\nvar nullComponentIDsRegistry = {};\n\nvar ReactEmptyComponentInjection = {\n  injectEmptyComponent: function(emptyComponent) {\n    component = ReactElement.createFactory(emptyComponent);\n  }\n};\n\nvar ReactEmptyComponentType = function() {};\nReactEmptyComponentType.prototype.componentDidMount = function() {\n  var internalInstance = ReactInstanceMap.get(this);\n  // TODO: Make sure we run these methods in the correct order, we shouldn't\n  // need this check. We're going to assume if we're here it means we ran\n  // componentWillUnmount already so there is no internal instance (it gets\n  // removed as part of the unmounting process).\n  if (!internalInstance) {\n    return;\n  }\n  registerNullComponentID(internalInstance._rootNodeID);\n};\nReactEmptyComponentType.prototype.componentWillUnmount = function() {\n  var internalInstance = ReactInstanceMap.get(this);\n  // TODO: Get rid of this check. See TODO in componentDidMount.\n  if (!internalInstance) {\n    return;\n  }\n  deregisterNullComponentID(internalInstance._rootNodeID);\n};\nReactEmptyComponentType.prototype.render = function() {\n  (\"production\" !== \"development\" ? invariant(\n    component,\n    'Trying to return null from a render, but no null placeholder component ' +\n    'was injected.'\n  ) : invariant(component));\n  return component();\n};\n\nvar emptyElement = ReactElement.createElement(ReactEmptyComponentType);\n\n/**\n * Mark the component as having rendered to null.\n * @param {string} id Component's `_rootNodeID`.\n */\nfunction registerNullComponentID(id) {\n  nullComponentIDsRegistry[id] = true;\n}\n\n/**\n * Unmark the component as having rendered to null: it renders to something now.\n * @param {string} id Component's `_rootNodeID`.\n */\nfunction deregisterNullComponentID(id) {\n  delete nullComponentIDsRegistry[id];\n}\n\n/**\n * @param {string} id Component's `_rootNodeID`.\n * @return {boolean} True if the component is rendered to null.\n */\nfunction isNullComponentID(id) {\n  return !!nullComponentIDsRegistry[id];\n}\n\nvar ReactEmptyComponent = {\n  emptyElement: emptyElement,\n  injection: ReactEmptyComponentInjection,\n  isNullComponentID: isNullComponentID\n};\n\nmodule.exports = ReactEmptyComponent;\n\n},{\"135\":135,\"57\":57,\"67\":67}],60:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactErrorUtils\n * @typechecks\n */\n\n\"use strict\";\n\nvar ReactErrorUtils = {\n  /**\n   * Creates a guarded version of a function. This is supposed to make debugging\n   * of event handlers easier. To aid debugging with the browser's debugger,\n   * this currently simply returns the original function.\n   *\n   * @param {function} func Function to be executed\n   * @param {string} name The name of the guard\n   * @return {function}\n   */\n  guard: function(func, name) {\n    return func;\n  }\n};\n\nmodule.exports = ReactErrorUtils;\n\n},{}],61:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactEventEmitterMixin\n */\n\n'use strict';\n\nvar EventPluginHub = _dereq_(17);\n\nfunction runEventQueueInBatch(events) {\n  EventPluginHub.enqueueEvents(events);\n  EventPluginHub.processEventQueue();\n}\n\nvar ReactEventEmitterMixin = {\n\n  /**\n   * Streams a fired top-level event to `EventPluginHub` where plugins have the\n   * opportunity to create `ReactEvent`s to be dispatched.\n   *\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {object} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native environment event.\n   */\n  handleTopLevel: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n    var events = EventPluginHub.extractEvents(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent\n    );\n\n    runEventQueueInBatch(events);\n  }\n};\n\nmodule.exports = ReactEventEmitterMixin;\n\n},{\"17\":17}],62:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactEventListener\n * @typechecks static-only\n */\n\n'use strict';\n\nvar EventListener = _dereq_(16);\nvar ExecutionEnvironment = _dereq_(21);\nvar PooledClass = _dereq_(28);\nvar ReactInstanceHandles = _dereq_(66);\nvar ReactMount = _dereq_(70);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\nvar getEventTarget = _dereq_(125);\nvar getUnboundedScrollPosition = _dereq_(131);\n\n/**\n * Finds the parent React component of `node`.\n *\n * @param {*} node\n * @return {?DOMEventTarget} Parent container, or `null` if the specified node\n *                           is not nested.\n */\nfunction findParent(node) {\n  // TODO: It may be a good idea to cache this to prevent unnecessary DOM\n  // traversal, but caching is difficult to do correctly without using a\n  // mutation observer to listen for all DOM changes.\n  var nodeID = ReactMount.getID(node);\n  var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);\n  var container = ReactMount.findReactContainerForID(rootID);\n  var parent = ReactMount.getFirstReactDOM(container);\n  return parent;\n}\n\n// Used to store ancestor hierarchy in top level callback\nfunction TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {\n  this.topLevelType = topLevelType;\n  this.nativeEvent = nativeEvent;\n  this.ancestors = [];\n}\nassign(TopLevelCallbackBookKeeping.prototype, {\n  destructor: function() {\n    this.topLevelType = null;\n    this.nativeEvent = null;\n    this.ancestors.length = 0;\n  }\n});\nPooledClass.addPoolingTo(\n  TopLevelCallbackBookKeeping,\n  PooledClass.twoArgumentPooler\n);\n\nfunction handleTopLevelImpl(bookKeeping) {\n  var topLevelTarget = ReactMount.getFirstReactDOM(\n    getEventTarget(bookKeeping.nativeEvent)\n  ) || window;\n\n  // Loop through the hierarchy, in case there's any nested components.\n  // It's important that we build the array of ancestors before calling any\n  // event handlers, because event handlers can modify the DOM, leading to\n  // inconsistencies with ReactMount's node cache. See #1105.\n  var ancestor = topLevelTarget;\n  while (ancestor) {\n    bookKeeping.ancestors.push(ancestor);\n    ancestor = findParent(ancestor);\n  }\n\n  for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {\n    topLevelTarget = bookKeeping.ancestors[i];\n    var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';\n    ReactEventListener._handleTopLevel(\n      bookKeeping.topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      bookKeeping.nativeEvent\n    );\n  }\n}\n\nfunction scrollValueMonitor(cb) {\n  var scrollPosition = getUnboundedScrollPosition(window);\n  cb(scrollPosition);\n}\n\nvar ReactEventListener = {\n  _enabled: true,\n  _handleTopLevel: null,\n\n  WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,\n\n  setHandleTopLevel: function(handleTopLevel) {\n    ReactEventListener._handleTopLevel = handleTopLevel;\n  },\n\n  setEnabled: function(enabled) {\n    ReactEventListener._enabled = !!enabled;\n  },\n\n  isEnabled: function() {\n    return ReactEventListener._enabled;\n  },\n\n\n  /**\n   * Traps top-level events by using event bubbling.\n   *\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {string} handlerBaseName Event name (e.g. \"click\").\n   * @param {object} handle Element on which to attach listener.\n   * @return {object} An object with a remove function which will forcefully\n   *                  remove the listener.\n   * @internal\n   */\n  trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {\n    var element = handle;\n    if (!element) {\n      return null;\n    }\n    return EventListener.listen(\n      element,\n      handlerBaseName,\n      ReactEventListener.dispatchEvent.bind(null, topLevelType)\n    );\n  },\n\n  /**\n   * Traps a top-level event by using event capturing.\n   *\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {string} handlerBaseName Event name (e.g. \"click\").\n   * @param {object} handle Element on which to attach listener.\n   * @return {object} An object with a remove function which will forcefully\n   *                  remove the listener.\n   * @internal\n   */\n  trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {\n    var element = handle;\n    if (!element) {\n      return null;\n    }\n    return EventListener.capture(\n      element,\n      handlerBaseName,\n      ReactEventListener.dispatchEvent.bind(null, topLevelType)\n    );\n  },\n\n  monitorScrollValue: function(refresh) {\n    var callback = scrollValueMonitor.bind(null, refresh);\n    EventListener.listen(window, 'scroll', callback);\n  },\n\n  dispatchEvent: function(topLevelType, nativeEvent) {\n    if (!ReactEventListener._enabled) {\n      return;\n    }\n\n    var bookKeeping = TopLevelCallbackBookKeeping.getPooled(\n      topLevelType,\n      nativeEvent\n    );\n    try {\n      // Event queue being processed in the same cycle allows\n      // `preventDefault`.\n      ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);\n    } finally {\n      TopLevelCallbackBookKeeping.release(bookKeeping);\n    }\n  }\n};\n\nmodule.exports = ReactEventListener;\n\n},{\"125\":125,\"131\":131,\"16\":16,\"21\":21,\"27\":27,\"28\":28,\"66\":66,\"70\":70,\"87\":87}],63:[function(_dereq_,module,exports){\n/**\n * Copyright 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n* @providesModule ReactFragment\n*/\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\n\nvar warning = _dereq_(154);\n\n/**\n * We used to allow keyed objects to serve as a collection of ReactElements,\n * or nested sets. This allowed us a way to explicitly key a set a fragment of\n * components. This is now being replaced with an opaque data structure.\n * The upgrade path is to call React.addons.createFragment({ key: value }) to\n * create a keyed fragment. The resulting data structure is opaque, for now.\n */\n\nif (\"production\" !== \"development\") {\n  var fragmentKey = '_reactFragment';\n  var didWarnKey = '_reactDidWarn';\n  var canWarnForReactFragment = false;\n\n  try {\n    // Feature test. Don't even try to issue this warning if we can't use\n    // enumerable: false.\n\n    var dummy = function() {\n      return 1;\n    };\n\n    Object.defineProperty(\n      {},\n      fragmentKey,\n      {enumerable: false, value: true}\n    );\n\n    Object.defineProperty(\n      {},\n      'key',\n      {enumerable: true, get: dummy}\n    );\n\n    canWarnForReactFragment = true;\n  } catch (x) { }\n\n  var proxyPropertyAccessWithWarning = function(obj, key) {\n    Object.defineProperty(obj, key, {\n      enumerable: true,\n      get: function() {\n        (\"production\" !== \"development\" ? warning(\n          this[didWarnKey],\n          'A ReactFragment is an opaque type. Accessing any of its ' +\n          'properties is deprecated. Pass it to one of the React.Children ' +\n          'helpers.'\n        ) : null);\n        this[didWarnKey] = true;\n        return this[fragmentKey][key];\n      },\n      set: function(value) {\n        (\"production\" !== \"development\" ? warning(\n          this[didWarnKey],\n          'A ReactFragment is an immutable opaque type. Mutating its ' +\n          'properties is deprecated.'\n        ) : null);\n        this[didWarnKey] = true;\n        this[fragmentKey][key] = value;\n      }\n    });\n  };\n\n  var issuedWarnings = {};\n\n  var didWarnForFragment = function(fragment) {\n    // We use the keys and the type of the value as a heuristic to dedupe the\n    // warning to avoid spamming too much.\n    var fragmentCacheKey = '';\n    for (var key in fragment) {\n      fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';\n    }\n    var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];\n    issuedWarnings[fragmentCacheKey] = true;\n    return alreadyWarnedOnce;\n  };\n}\n\nvar ReactFragment = {\n  // Wrap a keyed object in an opaque proxy that warns you if you access any\n  // of its properties.\n  create: function(object) {\n    if (\"production\" !== \"development\") {\n      if (typeof object !== 'object' || !object || Array.isArray(object)) {\n        (\"production\" !== \"development\" ? warning(\n          false,\n          'React.addons.createFragment only accepts a single object.',\n          object\n        ) : null);\n        return object;\n      }\n      if (ReactElement.isValidElement(object)) {\n        (\"production\" !== \"development\" ? warning(\n          false,\n          'React.addons.createFragment does not accept a ReactElement ' +\n          'without a wrapper object.'\n        ) : null);\n        return object;\n      }\n      if (canWarnForReactFragment) {\n        var proxy = {};\n        Object.defineProperty(proxy, fragmentKey, {\n          enumerable: false,\n          value: object\n        });\n        Object.defineProperty(proxy, didWarnKey, {\n          writable: true,\n          enumerable: false,\n          value: false\n        });\n        for (var key in object) {\n          proxyPropertyAccessWithWarning(proxy, key);\n        }\n        Object.preventExtensions(proxy);\n        return proxy;\n      }\n    }\n    return object;\n  },\n  // Extract the original keyed object from the fragment opaque type. Warn if\n  // a plain object is passed here.\n  extract: function(fragment) {\n    if (\"production\" !== \"development\") {\n      if (canWarnForReactFragment) {\n        if (!fragment[fragmentKey]) {\n          (\"production\" !== \"development\" ? warning(\n            didWarnForFragment(fragment),\n            'Any use of a keyed object should be wrapped in ' +\n            'React.addons.createFragment(object) before being passed as a ' +\n            'child.'\n          ) : null);\n          return fragment;\n        }\n        return fragment[fragmentKey];\n      }\n    }\n    return fragment;\n  },\n  // Check if this is a fragment and if so, extract the keyed object. If it\n  // is a fragment-like object, warn that it should be wrapped. Ignore if we\n  // can't determine what kind of object this is.\n  extractIfFragment: function(fragment) {\n    if (\"production\" !== \"development\") {\n      if (canWarnForReactFragment) {\n        // If it is the opaque type, return the keyed object.\n        if (fragment[fragmentKey]) {\n          return fragment[fragmentKey];\n        }\n        // Otherwise, check each property if it has an element, if it does\n        // it is probably meant as a fragment, so we can warn early. Defer,\n        // the warning to extract.\n        for (var key in fragment) {\n          if (fragment.hasOwnProperty(key) &&\n              ReactElement.isValidElement(fragment[key])) {\n            // This looks like a fragment object, we should provide an\n            // early warning.\n            return ReactFragment.extract(fragment);\n          }\n        }\n      }\n    }\n    return fragment;\n  }\n};\n\nmodule.exports = ReactFragment;\n\n},{\"154\":154,\"57\":57}],64:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactInjection\n */\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\nvar EventPluginHub = _dereq_(17);\nvar ReactComponentEnvironment = _dereq_(36);\nvar ReactClass = _dereq_(33);\nvar ReactEmptyComponent = _dereq_(59);\nvar ReactBrowserEventEmitter = _dereq_(30);\nvar ReactNativeComponent = _dereq_(73);\nvar ReactDOMComponent = _dereq_(42);\nvar ReactPerf = _dereq_(75);\nvar ReactRootIndex = _dereq_(83);\nvar ReactUpdates = _dereq_(87);\n\nvar ReactInjection = {\n  Component: ReactComponentEnvironment.injection,\n  Class: ReactClass.injection,\n  DOMComponent: ReactDOMComponent.injection,\n  DOMProperty: DOMProperty.injection,\n  EmptyComponent: ReactEmptyComponent.injection,\n  EventPluginHub: EventPluginHub.injection,\n  EventEmitter: ReactBrowserEventEmitter.injection,\n  NativeComponent: ReactNativeComponent.injection,\n  Perf: ReactPerf.injection,\n  RootIndex: ReactRootIndex.injection,\n  Updates: ReactUpdates.injection\n};\n\nmodule.exports = ReactInjection;\n\n},{\"10\":10,\"17\":17,\"30\":30,\"33\":33,\"36\":36,\"42\":42,\"59\":59,\"73\":73,\"75\":75,\"83\":83,\"87\":87}],65:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactInputSelection\n */\n\n'use strict';\n\nvar ReactDOMSelection = _dereq_(50);\n\nvar containsNode = _dereq_(109);\nvar focusNode = _dereq_(119);\nvar getActiveElement = _dereq_(121);\n\nfunction isInDocument(node) {\n  return containsNode(document.documentElement, node);\n}\n\n/**\n * @ReactInputSelection: React input selection module. Based on Selection.js,\n * but modified to be suitable for react and has a couple of bug fixes (doesn't\n * assume buttons have range selections allowed).\n * Input selection module for React.\n */\nvar ReactInputSelection = {\n\n  hasSelectionCapabilities: function(elem) {\n    return elem && (\n      ((elem.nodeName === 'INPUT' && elem.type === 'text') ||\n      elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')\n    );\n  },\n\n  getSelectionInformation: function() {\n    var focusedElem = getActiveElement();\n    return {\n      focusedElem: focusedElem,\n      selectionRange:\n          ReactInputSelection.hasSelectionCapabilities(focusedElem) ?\n          ReactInputSelection.getSelection(focusedElem) :\n          null\n    };\n  },\n\n  /**\n   * @restoreSelection: If any selection information was potentially lost,\n   * restore it. This is useful when performing operations that could remove dom\n   * nodes and place them back in, resulting in focus being lost.\n   */\n  restoreSelection: function(priorSelectionInformation) {\n    var curFocusedElem = getActiveElement();\n    var priorFocusedElem = priorSelectionInformation.focusedElem;\n    var priorSelectionRange = priorSelectionInformation.selectionRange;\n    if (curFocusedElem !== priorFocusedElem &&\n        isInDocument(priorFocusedElem)) {\n      if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {\n        ReactInputSelection.setSelection(\n          priorFocusedElem,\n          priorSelectionRange\n        );\n      }\n      focusNode(priorFocusedElem);\n    }\n  },\n\n  /**\n   * @getSelection: Gets the selection bounds of a focused textarea, input or\n   * contentEditable node.\n   * -@input: Look up selection bounds of this input\n   * -@return {start: selectionStart, end: selectionEnd}\n   */\n  getSelection: function(input) {\n    var selection;\n\n    if ('selectionStart' in input) {\n      // Modern browser with input or textarea.\n      selection = {\n        start: input.selectionStart,\n        end: input.selectionEnd\n      };\n    } else if (document.selection && input.nodeName === 'INPUT') {\n      // IE8 input.\n      var range = document.selection.createRange();\n      // There can only be one selection per document in IE, so it must\n      // be in our element.\n      if (range.parentElement() === input) {\n        selection = {\n          start: -range.moveStart('character', -input.value.length),\n          end: -range.moveEnd('character', -input.value.length)\n        };\n      }\n    } else {\n      // Content editable or old IE textarea.\n      selection = ReactDOMSelection.getOffsets(input);\n    }\n\n    return selection || {start: 0, end: 0};\n  },\n\n  /**\n   * @setSelection: Sets the selection bounds of a textarea or input and focuses\n   * the input.\n   * -@input     Set selection bounds of this input or textarea\n   * -@offsets   Object of same form that is returned from get*\n   */\n  setSelection: function(input, offsets) {\n    var start = offsets.start;\n    var end = offsets.end;\n    if (typeof end === 'undefined') {\n      end = start;\n    }\n\n    if ('selectionStart' in input) {\n      input.selectionStart = start;\n      input.selectionEnd = Math.min(end, input.value.length);\n    } else if (document.selection && input.nodeName === 'INPUT') {\n      var range = input.createTextRange();\n      range.collapse(true);\n      range.moveStart('character', start);\n      range.moveEnd('character', end - start);\n      range.select();\n    } else {\n      ReactDOMSelection.setOffsets(input, offsets);\n    }\n  }\n};\n\nmodule.exports = ReactInputSelection;\n\n},{\"109\":109,\"119\":119,\"121\":121,\"50\":50}],66:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactInstanceHandles\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactRootIndex = _dereq_(83);\n\nvar invariant = _dereq_(135);\n\nvar SEPARATOR = '.';\nvar SEPARATOR_LENGTH = SEPARATOR.length;\n\n/**\n * Maximum depth of traversals before we consider the possibility of a bad ID.\n */\nvar MAX_TREE_DEPTH = 100;\n\n/**\n * Creates a DOM ID prefix to use when mounting React components.\n *\n * @param {number} index A unique integer\n * @return {string} React root ID.\n * @internal\n */\nfunction getReactRootIDString(index) {\n  return SEPARATOR + index.toString(36);\n}\n\n/**\n * Checks if a character in the supplied ID is a separator or the end.\n *\n * @param {string} id A React DOM ID.\n * @param {number} index Index of the character to check.\n * @return {boolean} True if the character is a separator or end of the ID.\n * @private\n */\nfunction isBoundary(id, index) {\n  return id.charAt(index) === SEPARATOR || index === id.length;\n}\n\n/**\n * Checks if the supplied string is a valid React DOM ID.\n *\n * @param {string} id A React DOM ID, maybe.\n * @return {boolean} True if the string is a valid React DOM ID.\n * @private\n */\nfunction isValidID(id) {\n  return id === '' || (\n    id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR\n  );\n}\n\n/**\n * Checks if the first ID is an ancestor of or equal to the second ID.\n *\n * @param {string} ancestorID\n * @param {string} descendantID\n * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.\n * @internal\n */\nfunction isAncestorIDOf(ancestorID, descendantID) {\n  return (\n    descendantID.indexOf(ancestorID) === 0 &&\n    isBoundary(descendantID, ancestorID.length)\n  );\n}\n\n/**\n * Gets the parent ID of the supplied React DOM ID, `id`.\n *\n * @param {string} id ID of a component.\n * @return {string} ID of the parent, or an empty string.\n * @private\n */\nfunction getParentID(id) {\n  return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';\n}\n\n/**\n * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the\n * supplied `destinationID`. If they are equal, the ID is returned.\n *\n * @param {string} ancestorID ID of an ancestor node of `destinationID`.\n * @param {string} destinationID ID of the destination node.\n * @return {string} Next ID on the path from `ancestorID` to `destinationID`.\n * @private\n */\nfunction getNextDescendantID(ancestorID, destinationID) {\n  (\"production\" !== \"development\" ? invariant(\n    isValidID(ancestorID) && isValidID(destinationID),\n    'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',\n    ancestorID,\n    destinationID\n  ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));\n  (\"production\" !== \"development\" ? invariant(\n    isAncestorIDOf(ancestorID, destinationID),\n    'getNextDescendantID(...): React has made an invalid assumption about ' +\n    'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',\n    ancestorID,\n    destinationID\n  ) : invariant(isAncestorIDOf(ancestorID, destinationID)));\n  if (ancestorID === destinationID) {\n    return ancestorID;\n  }\n  // Skip over the ancestor and the immediate separator. Traverse until we hit\n  // another separator or we reach the end of `destinationID`.\n  var start = ancestorID.length + SEPARATOR_LENGTH;\n  var i;\n  for (i = start; i < destinationID.length; i++) {\n    if (isBoundary(destinationID, i)) {\n      break;\n    }\n  }\n  return destinationID.substr(0, i);\n}\n\n/**\n * Gets the nearest common ancestor ID of two IDs.\n *\n * Using this ID scheme, the nearest common ancestor ID is the longest common\n * prefix of the two IDs that immediately preceded a \"marker\" in both strings.\n *\n * @param {string} oneID\n * @param {string} twoID\n * @return {string} Nearest common ancestor ID, or the empty string if none.\n * @private\n */\nfunction getFirstCommonAncestorID(oneID, twoID) {\n  var minLength = Math.min(oneID.length, twoID.length);\n  if (minLength === 0) {\n    return '';\n  }\n  var lastCommonMarkerIndex = 0;\n  // Use `<=` to traverse until the \"EOL\" of the shorter string.\n  for (var i = 0; i <= minLength; i++) {\n    if (isBoundary(oneID, i) && isBoundary(twoID, i)) {\n      lastCommonMarkerIndex = i;\n    } else if (oneID.charAt(i) !== twoID.charAt(i)) {\n      break;\n    }\n  }\n  var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);\n  (\"production\" !== \"development\" ? invariant(\n    isValidID(longestCommonID),\n    'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',\n    oneID,\n    twoID,\n    longestCommonID\n  ) : invariant(isValidID(longestCommonID)));\n  return longestCommonID;\n}\n\n/**\n * Traverses the parent path between two IDs (either up or down). The IDs must\n * not be the same, and there must exist a parent path between them. If the\n * callback returns `false`, traversal is stopped.\n *\n * @param {?string} start ID at which to start traversal.\n * @param {?string} stop ID at which to end traversal.\n * @param {function} cb Callback to invoke each ID with.\n * @param {?boolean} skipFirst Whether or not to skip the first node.\n * @param {?boolean} skipLast Whether or not to skip the last node.\n * @private\n */\nfunction traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {\n  start = start || '';\n  stop = stop || '';\n  (\"production\" !== \"development\" ? invariant(\n    start !== stop,\n    'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',\n    start\n  ) : invariant(start !== stop));\n  var traverseUp = isAncestorIDOf(stop, start);\n  (\"production\" !== \"development\" ? invariant(\n    traverseUp || isAncestorIDOf(start, stop),\n    'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +\n    'not have a parent path.',\n    start,\n    stop\n  ) : invariant(traverseUp || isAncestorIDOf(start, stop)));\n  // Traverse from `start` to `stop` one depth at a time.\n  var depth = 0;\n  var traverse = traverseUp ? getParentID : getNextDescendantID;\n  for (var id = start; /* until break */; id = traverse(id, stop)) {\n    var ret;\n    if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {\n      ret = cb(id, traverseUp, arg);\n    }\n    if (ret === false || id === stop) {\n      // Only break //after// visiting `stop`.\n      break;\n    }\n    (\"production\" !== \"development\" ? invariant(\n      depth++ < MAX_TREE_DEPTH,\n      'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +\n      'traversing the React DOM ID tree. This may be due to malformed IDs: %s',\n      start, stop\n    ) : invariant(depth++ < MAX_TREE_DEPTH));\n  }\n}\n\n/**\n * Manages the IDs assigned to DOM representations of React components. This\n * uses a specific scheme in order to traverse the DOM efficiently (e.g. in\n * order to simulate events).\n *\n * @internal\n */\nvar ReactInstanceHandles = {\n\n  /**\n   * Constructs a React root ID\n   * @return {string} A React root ID.\n   */\n  createReactRootID: function() {\n    return getReactRootIDString(ReactRootIndex.createReactRootIndex());\n  },\n\n  /**\n   * Constructs a React ID by joining a root ID with a name.\n   *\n   * @param {string} rootID Root ID of a parent component.\n   * @param {string} name A component's name (as flattened children).\n   * @return {string} A React ID.\n   * @internal\n   */\n  createReactID: function(rootID, name) {\n    return rootID + name;\n  },\n\n  /**\n   * Gets the DOM ID of the React component that is the root of the tree that\n   * contains the React component with the supplied DOM ID.\n   *\n   * @param {string} id DOM ID of a React component.\n   * @return {?string} DOM ID of the React component that is the root.\n   * @internal\n   */\n  getReactRootIDFromNodeID: function(id) {\n    if (id && id.charAt(0) === SEPARATOR && id.length > 1) {\n      var index = id.indexOf(SEPARATOR, 1);\n      return index > -1 ? id.substr(0, index) : id;\n    }\n    return null;\n  },\n\n  /**\n   * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that\n   * should would receive a `mouseEnter` or `mouseLeave` event.\n   *\n   * NOTE: Does not invoke the callback on the nearest common ancestor because\n   * nothing \"entered\" or \"left\" that element.\n   *\n   * @param {string} leaveID ID being left.\n   * @param {string} enterID ID being entered.\n   * @param {function} cb Callback to invoke on each entered/left ID.\n   * @param {*} upArg Argument to invoke the callback with on left IDs.\n   * @param {*} downArg Argument to invoke the callback with on entered IDs.\n   * @internal\n   */\n  traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {\n    var ancestorID = getFirstCommonAncestorID(leaveID, enterID);\n    if (ancestorID !== leaveID) {\n      traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);\n    }\n    if (ancestorID !== enterID) {\n      traverseParentPath(ancestorID, enterID, cb, downArg, true, false);\n    }\n  },\n\n  /**\n   * Simulates the traversal of a two-phase, capture/bubble event dispatch.\n   *\n   * NOTE: This traversal happens on IDs without touching the DOM.\n   *\n   * @param {string} targetID ID of the target node.\n   * @param {function} cb Callback to invoke.\n   * @param {*} arg Argument to invoke the callback with.\n   * @internal\n   */\n  traverseTwoPhase: function(targetID, cb, arg) {\n    if (targetID) {\n      traverseParentPath('', targetID, cb, arg, true, false);\n      traverseParentPath(targetID, '', cb, arg, false, true);\n    }\n  },\n\n  /**\n   * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For\n   * example, passing `.0.$row-0.1` would result in `cb` getting called\n   * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.\n   *\n   * NOTE: This traversal happens on IDs without touching the DOM.\n   *\n   * @param {string} targetID ID of the target node.\n   * @param {function} cb Callback to invoke.\n   * @param {*} arg Argument to invoke the callback with.\n   * @internal\n   */\n  traverseAncestors: function(targetID, cb, arg) {\n    traverseParentPath('', targetID, cb, arg, true, false);\n  },\n\n  /**\n   * Exposed for unit testing.\n   * @private\n   */\n  _getFirstCommonAncestorID: getFirstCommonAncestorID,\n\n  /**\n   * Exposed for unit testing.\n   * @private\n   */\n  _getNextDescendantID: getNextDescendantID,\n\n  isAncestorIDOf: isAncestorIDOf,\n\n  SEPARATOR: SEPARATOR\n\n};\n\nmodule.exports = ReactInstanceHandles;\n\n},{\"135\":135,\"83\":83}],67:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactInstanceMap\n */\n\n'use strict';\n\n/**\n * `ReactInstanceMap` maintains a mapping from a public facing stateful\n * instance (key) and the internal representation (value). This allows public\n * methods to accept the user facing instance as an argument and map them back\n * to internal methods.\n */\n\n// TODO: Replace this with ES6: var ReactInstanceMap = new Map();\nvar ReactInstanceMap = {\n\n  /**\n   * This API should be called `delete` but we'd have to make sure to always\n   * transform these to strings for IE support. When this transform is fully\n   * supported we can rename it.\n   */\n  remove: function(key) {\n    key._reactInternalInstance = undefined;\n  },\n\n  get: function(key) {\n    return key._reactInternalInstance;\n  },\n\n  has: function(key) {\n    return key._reactInternalInstance !== undefined;\n  },\n\n  set: function(key, value) {\n    key._reactInternalInstance = value;\n  }\n\n};\n\nmodule.exports = ReactInstanceMap;\n\n},{}],68:[function(_dereq_,module,exports){\n/**\n * Copyright 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactLifeCycle\n */\n\n'use strict';\n\n/**\n * This module manages the bookkeeping when a component is in the process\n * of being mounted or being unmounted. This is used as a way to enforce\n * invariants (or warnings) when it is not recommended to call\n * setState/forceUpdate.\n *\n * currentlyMountingInstance: During the construction phase, it is not possible\n * to trigger an update since the instance is not fully mounted yet. However, we\n * currently allow this as a convenience for mutating the initial state.\n *\n * currentlyUnmountingInstance: During the unmounting phase, the instance is\n * still mounted and can therefore schedule an update. However, this is not\n * recommended and probably an error since it's about to be unmounted.\n * Therefore we still want to trigger in an error for that case.\n */\n\nvar ReactLifeCycle = {\n  currentlyMountingInstance: null,\n  currentlyUnmountingInstance: null\n};\n\nmodule.exports = ReactLifeCycle;\n\n},{}],69:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactMarkupChecksum\n */\n\n'use strict';\n\nvar adler32 = _dereq_(106);\n\nvar ReactMarkupChecksum = {\n  CHECKSUM_ATTR_NAME: 'data-react-checksum',\n\n  /**\n   * @param {string} markup Markup string\n   * @return {string} Markup string with checksum attribute attached\n   */\n  addChecksumToMarkup: function(markup) {\n    var checksum = adler32(markup);\n    return markup.replace(\n      '>',\n      ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '=\"' + checksum + '\">'\n    );\n  },\n\n  /**\n   * @param {string} markup to use\n   * @param {DOMElement} element root React element\n   * @returns {boolean} whether or not the markup is the same\n   */\n  canReuseMarkup: function(markup, element) {\n    var existingChecksum = element.getAttribute(\n      ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n    );\n    existingChecksum = existingChecksum && parseInt(existingChecksum, 10);\n    var markupChecksum = adler32(markup);\n    return markupChecksum === existingChecksum;\n  }\n};\n\nmodule.exports = ReactMarkupChecksum;\n\n},{\"106\":106}],70:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactMount\n */\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\nvar ReactBrowserEventEmitter = _dereq_(30);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactElement = _dereq_(57);\nvar ReactElementValidator = _dereq_(58);\nvar ReactEmptyComponent = _dereq_(59);\nvar ReactInstanceHandles = _dereq_(66);\nvar ReactInstanceMap = _dereq_(67);\nvar ReactMarkupChecksum = _dereq_(69);\nvar ReactPerf = _dereq_(75);\nvar ReactReconciler = _dereq_(81);\nvar ReactUpdateQueue = _dereq_(86);\nvar ReactUpdates = _dereq_(87);\n\nvar emptyObject = _dereq_(115);\nvar containsNode = _dereq_(109);\nvar getReactRootElementInContainer = _dereq_(129);\nvar instantiateReactComponent = _dereq_(134);\nvar invariant = _dereq_(135);\nvar setInnerHTML = _dereq_(148);\nvar shouldUpdateReactComponent = _dereq_(151);\nvar warning = _dereq_(154);\n\nvar SEPARATOR = ReactInstanceHandles.SEPARATOR;\n\nvar ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;\nvar nodeCache = {};\n\nvar ELEMENT_NODE_TYPE = 1;\nvar DOC_NODE_TYPE = 9;\n\n/** Mapping from reactRootID to React component instance. */\nvar instancesByReactRootID = {};\n\n/** Mapping from reactRootID to `container` nodes. */\nvar containersByReactRootID = {};\n\nif (\"production\" !== \"development\") {\n  /** __DEV__-only mapping from reactRootID to root elements. */\n  var rootElementsByReactRootID = {};\n}\n\n// Used to store breadth-first search state in findComponentRoot.\nvar findComponentRootReusableArray = [];\n\n/**\n * Finds the index of the first character\n * that's not common between the two given strings.\n *\n * @return {number} the index of the character where the strings diverge\n */\nfunction firstDifferenceIndex(string1, string2) {\n  var minLen = Math.min(string1.length, string2.length);\n  for (var i = 0; i < minLen; i++) {\n    if (string1.charAt(i) !== string2.charAt(i)) {\n      return i;\n    }\n  }\n  return string1.length === string2.length ? -1 : minLen;\n}\n\n/**\n * @param {DOMElement} container DOM element that may contain a React component.\n * @return {?string} A \"reactRoot\" ID, if a React component is rendered.\n */\nfunction getReactRootID(container) {\n  var rootElement = getReactRootElementInContainer(container);\n  return rootElement && ReactMount.getID(rootElement);\n}\n\n/**\n * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form\n * element can return its control whose name or ID equals ATTR_NAME. All\n * DOM nodes support `getAttributeNode` but this can also get called on\n * other objects so just return '' if we're given something other than a\n * DOM node (such as window).\n *\n * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.\n * @return {string} ID of the supplied `domNode`.\n */\nfunction getID(node) {\n  var id = internalGetID(node);\n  if (id) {\n    if (nodeCache.hasOwnProperty(id)) {\n      var cached = nodeCache[id];\n      if (cached !== node) {\n        (\"production\" !== \"development\" ? invariant(\n          !isValid(cached, id),\n          'ReactMount: Two valid but unequal nodes with the same `%s`: %s',\n          ATTR_NAME, id\n        ) : invariant(!isValid(cached, id)));\n\n        nodeCache[id] = node;\n      }\n    } else {\n      nodeCache[id] = node;\n    }\n  }\n\n  return id;\n}\n\nfunction internalGetID(node) {\n  // If node is something like a window, document, or text node, none of\n  // which support attributes or a .getAttribute method, gracefully return\n  // the empty string, as if the attribute were missing.\n  return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';\n}\n\n/**\n * Sets the React-specific ID of the given node.\n *\n * @param {DOMElement} node The DOM node whose ID will be set.\n * @param {string} id The value of the ID attribute.\n */\nfunction setID(node, id) {\n  var oldID = internalGetID(node);\n  if (oldID !== id) {\n    delete nodeCache[oldID];\n  }\n  node.setAttribute(ATTR_NAME, id);\n  nodeCache[id] = node;\n}\n\n/**\n * Finds the node with the supplied React-generated DOM ID.\n *\n * @param {string} id A React-generated DOM ID.\n * @return {DOMElement} DOM node with the suppled `id`.\n * @internal\n */\nfunction getNode(id) {\n  if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {\n    nodeCache[id] = ReactMount.findReactNodeByID(id);\n  }\n  return nodeCache[id];\n}\n\n/**\n * Finds the node with the supplied public React instance.\n *\n * @param {*} instance A public React instance.\n * @return {?DOMElement} DOM node with the suppled `id`.\n * @internal\n */\nfunction getNodeFromInstance(instance) {\n  var id = ReactInstanceMap.get(instance)._rootNodeID;\n  if (ReactEmptyComponent.isNullComponentID(id)) {\n    return null;\n  }\n  if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {\n    nodeCache[id] = ReactMount.findReactNodeByID(id);\n  }\n  return nodeCache[id];\n}\n\n/**\n * A node is \"valid\" if it is contained by a currently mounted container.\n *\n * This means that the node does not have to be contained by a document in\n * order to be considered valid.\n *\n * @param {?DOMElement} node The candidate DOM node.\n * @param {string} id The expected ID of the node.\n * @return {boolean} Whether the node is contained by a mounted container.\n */\nfunction isValid(node, id) {\n  if (node) {\n    (\"production\" !== \"development\" ? invariant(\n      internalGetID(node) === id,\n      'ReactMount: Unexpected modification of `%s`',\n      ATTR_NAME\n    ) : invariant(internalGetID(node) === id));\n\n    var container = ReactMount.findReactContainerForID(id);\n    if (container && containsNode(container, node)) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\n/**\n * Causes the cache to forget about one React-specific ID.\n *\n * @param {string} id The ID to forget.\n */\nfunction purgeID(id) {\n  delete nodeCache[id];\n}\n\nvar deepestNodeSoFar = null;\nfunction findDeepestCachedAncestorImpl(ancestorID) {\n  var ancestor = nodeCache[ancestorID];\n  if (ancestor && isValid(ancestor, ancestorID)) {\n    deepestNodeSoFar = ancestor;\n  } else {\n    // This node isn't populated in the cache, so presumably none of its\n    // descendants are. Break out of the loop.\n    return false;\n  }\n}\n\n/**\n * Return the deepest cached node whose ID is a prefix of `targetID`.\n */\nfunction findDeepestCachedAncestor(targetID) {\n  deepestNodeSoFar = null;\n  ReactInstanceHandles.traverseAncestors(\n    targetID,\n    findDeepestCachedAncestorImpl\n  );\n\n  var foundNode = deepestNodeSoFar;\n  deepestNodeSoFar = null;\n  return foundNode;\n}\n\n/**\n * Mounts this component and inserts it into the DOM.\n *\n * @param {ReactComponent} componentInstance The instance to mount.\n * @param {string} rootID DOM ID of the root node.\n * @param {DOMElement} container DOM element to mount into.\n * @param {ReactReconcileTransaction} transaction\n * @param {boolean} shouldReuseMarkup If true, do not insert markup\n */\nfunction mountComponentIntoNode(\n    componentInstance,\n    rootID,\n    container,\n    transaction,\n    shouldReuseMarkup) {\n  var markup = ReactReconciler.mountComponent(\n    componentInstance, rootID, transaction, emptyObject\n  );\n  componentInstance._isTopLevel = true;\n  ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);\n}\n\n/**\n * Batched mount.\n *\n * @param {ReactComponent} componentInstance The instance to mount.\n * @param {string} rootID DOM ID of the root node.\n * @param {DOMElement} container DOM element to mount into.\n * @param {boolean} shouldReuseMarkup If true, do not insert markup\n */\nfunction batchedMountComponentIntoNode(\n    componentInstance,\n    rootID,\n    container,\n    shouldReuseMarkup) {\n  var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();\n  transaction.perform(\n    mountComponentIntoNode,\n    null,\n    componentInstance,\n    rootID,\n    container,\n    transaction,\n    shouldReuseMarkup\n  );\n  ReactUpdates.ReactReconcileTransaction.release(transaction);\n}\n\n/**\n * Mounting is the process of initializing a React component by creating its\n * representative DOM elements and inserting them into a supplied `container`.\n * Any prior content inside `container` is destroyed in the process.\n *\n *   ReactMount.render(\n *     component,\n *     document.getElementById('container')\n *   );\n *\n *   <div id=\"container\">                   <-- Supplied `container`.\n *     <div data-reactid=\".3\">              <-- Rendered reactRoot of React\n *       // ...                                 component.\n *     </div>\n *   </div>\n *\n * Inside of `container`, the first element rendered is the \"reactRoot\".\n */\nvar ReactMount = {\n  /** Exposed for debugging purposes **/\n  _instancesByReactRootID: instancesByReactRootID,\n\n  /**\n   * This is a hook provided to support rendering React components while\n   * ensuring that the apparent scroll position of its `container` does not\n   * change.\n   *\n   * @param {DOMElement} container The `container` being rendered into.\n   * @param {function} renderCallback This must be called once to do the render.\n   */\n  scrollMonitor: function(container, renderCallback) {\n    renderCallback();\n  },\n\n  /**\n   * Take a component that's already mounted into the DOM and replace its props\n   * @param {ReactComponent} prevComponent component instance already in the DOM\n   * @param {ReactElement} nextElement component instance to render\n   * @param {DOMElement} container container to render into\n   * @param {?function} callback function triggered on completion\n   */\n  _updateRootComponent: function(\n      prevComponent,\n      nextElement,\n      container,\n      callback) {\n    if (\"production\" !== \"development\") {\n      ReactElementValidator.checkAndWarnForMutatedProps(nextElement);\n    }\n\n    ReactMount.scrollMonitor(container, function() {\n      ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);\n      if (callback) {\n        ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);\n      }\n    });\n\n    if (\"production\" !== \"development\") {\n      // Record the root element in case it later gets transplanted.\n      rootElementsByReactRootID[getReactRootID(container)] =\n        getReactRootElementInContainer(container);\n    }\n\n    return prevComponent;\n  },\n\n  /**\n   * Register a component into the instance map and starts scroll value\n   * monitoring\n   * @param {ReactComponent} nextComponent component instance to render\n   * @param {DOMElement} container container to render into\n   * @return {string} reactRoot ID prefix\n   */\n  _registerComponent: function(nextComponent, container) {\n    (\"production\" !== \"development\" ? invariant(\n      container && (\n        (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n      ),\n      '_registerComponent(...): Target container is not a DOM element.'\n    ) : invariant(container && (\n      (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n    )));\n\n    ReactBrowserEventEmitter.ensureScrollValueMonitoring();\n\n    var reactRootID = ReactMount.registerContainer(container);\n    instancesByReactRootID[reactRootID] = nextComponent;\n    return reactRootID;\n  },\n\n  /**\n   * Render a new component into the DOM.\n   * @param {ReactElement} nextElement element to render\n   * @param {DOMElement} container container to render into\n   * @param {boolean} shouldReuseMarkup if we should skip the markup insertion\n   * @return {ReactComponent} nextComponent\n   */\n  _renderNewRootComponent: function(\n    nextElement,\n    container,\n    shouldReuseMarkup\n  ) {\n    // Various parts of our code (such as ReactCompositeComponent's\n    // _renderValidatedComponent) assume that calls to render aren't nested;\n    // verify that that's the case.\n    (\"production\" !== \"development\" ? warning(\n      ReactCurrentOwner.current == null,\n      '_renderNewRootComponent(): Render methods should be a pure function ' +\n      'of props and state; triggering nested component updates from ' +\n      'render is not allowed. If necessary, trigger nested updates in ' +\n      'componentDidUpdate.'\n    ) : null);\n\n    var componentInstance = instantiateReactComponent(nextElement, null);\n    var reactRootID = ReactMount._registerComponent(\n      componentInstance,\n      container\n    );\n\n    // The initial render is synchronous but any updates that happen during\n    // rendering, in componentWillMount or componentDidMount, will be batched\n    // according to the current batching strategy.\n\n    ReactUpdates.batchedUpdates(\n      batchedMountComponentIntoNode,\n      componentInstance,\n      reactRootID,\n      container,\n      shouldReuseMarkup\n    );\n\n    if (\"production\" !== \"development\") {\n      // Record the root element in case it later gets transplanted.\n      rootElementsByReactRootID[reactRootID] =\n        getReactRootElementInContainer(container);\n    }\n\n    return componentInstance;\n  },\n\n  /**\n   * Renders a React component into the DOM in the supplied `container`.\n   *\n   * If the React component was previously rendered into `container`, this will\n   * perform an update on it and only mutate the DOM as necessary to reflect the\n   * latest React component.\n   *\n   * @param {ReactElement} nextElement Component element to render.\n   * @param {DOMElement} container DOM element to render into.\n   * @param {?function} callback function triggered on completion\n   * @return {ReactComponent} Component instance rendered in `container`.\n   */\n  render: function(nextElement, container, callback) {\n    (\"production\" !== \"development\" ? invariant(\n      ReactElement.isValidElement(nextElement),\n      'React.render(): Invalid component element.%s',\n      (\n        typeof nextElement === 'string' ?\n          ' Instead of passing an element string, make sure to instantiate ' +\n          'it by passing it to React.createElement.' :\n        typeof nextElement === 'function' ?\n          ' Instead of passing a component class, make sure to instantiate ' +\n          'it by passing it to React.createElement.' :\n        // Check if it quacks like an element\n        nextElement != null && nextElement.props !== undefined ?\n          ' This may be caused by unintentionally loading two independent ' +\n          'copies of React.' :\n          ''\n      )\n    ) : invariant(ReactElement.isValidElement(nextElement)));\n\n    var prevComponent = instancesByReactRootID[getReactRootID(container)];\n\n    if (prevComponent) {\n      var prevElement = prevComponent._currentElement;\n      if (shouldUpdateReactComponent(prevElement, nextElement)) {\n        return ReactMount._updateRootComponent(\n          prevComponent,\n          nextElement,\n          container,\n          callback\n        ).getPublicInstance();\n      } else {\n        ReactMount.unmountComponentAtNode(container);\n      }\n    }\n\n    var reactRootElement = getReactRootElementInContainer(container);\n    var containerHasReactMarkup =\n      reactRootElement && ReactMount.isRenderedByReact(reactRootElement);\n\n    if (\"production\" !== \"development\") {\n      if (!containerHasReactMarkup || reactRootElement.nextSibling) {\n        var rootElementSibling = reactRootElement;\n        while (rootElementSibling) {\n          if (ReactMount.isRenderedByReact(rootElementSibling)) {\n            (\"production\" !== \"development\" ? warning(\n              false,\n              'render(): Target node has markup rendered by React, but there ' +\n              'are unrelated nodes as well. This is most commonly caused by ' +\n              'white-space inserted around server-rendered markup.'\n            ) : null);\n            break;\n          }\n\n          rootElementSibling = rootElementSibling.nextSibling;\n        }\n      }\n    }\n\n    var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;\n\n    var component = ReactMount._renderNewRootComponent(\n      nextElement,\n      container,\n      shouldReuseMarkup\n    ).getPublicInstance();\n    if (callback) {\n      callback.call(component);\n    }\n    return component;\n  },\n\n  /**\n   * Constructs a component instance of `constructor` with `initialProps` and\n   * renders it into the supplied `container`.\n   *\n   * @param {function} constructor React component constructor.\n   * @param {?object} props Initial props of the component instance.\n   * @param {DOMElement} container DOM element to render into.\n   * @return {ReactComponent} Component instance rendered in `container`.\n   */\n  constructAndRenderComponent: function(constructor, props, container) {\n    var element = ReactElement.createElement(constructor, props);\n    return ReactMount.render(element, container);\n  },\n\n  /**\n   * Constructs a component instance of `constructor` with `initialProps` and\n   * renders it into a container node identified by supplied `id`.\n   *\n   * @param {function} componentConstructor React component constructor\n   * @param {?object} props Initial props of the component instance.\n   * @param {string} id ID of the DOM element to render into.\n   * @return {ReactComponent} Component instance rendered in the container node.\n   */\n  constructAndRenderComponentByID: function(constructor, props, id) {\n    var domNode = document.getElementById(id);\n    (\"production\" !== \"development\" ? invariant(\n      domNode,\n      'Tried to get element with id of \"%s\" but it is not present on the page.',\n      id\n    ) : invariant(domNode));\n    return ReactMount.constructAndRenderComponent(constructor, props, domNode);\n  },\n\n  /**\n   * Registers a container node into which React components will be rendered.\n   * This also creates the \"reactRoot\" ID that will be assigned to the element\n   * rendered within.\n   *\n   * @param {DOMElement} container DOM element to register as a container.\n   * @return {string} The \"reactRoot\" ID of elements rendered within.\n   */\n  registerContainer: function(container) {\n    var reactRootID = getReactRootID(container);\n    if (reactRootID) {\n      // If one exists, make sure it is a valid \"reactRoot\" ID.\n      reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);\n    }\n    if (!reactRootID) {\n      // No valid \"reactRoot\" ID found, create one.\n      reactRootID = ReactInstanceHandles.createReactRootID();\n    }\n    containersByReactRootID[reactRootID] = container;\n    return reactRootID;\n  },\n\n  /**\n   * Unmounts and destroys the React component rendered in the `container`.\n   *\n   * @param {DOMElement} container DOM element containing a React component.\n   * @return {boolean} True if a component was found in and unmounted from\n   *                   `container`\n   */\n  unmountComponentAtNode: function(container) {\n    // Various parts of our code (such as ReactCompositeComponent's\n    // _renderValidatedComponent) assume that calls to render aren't nested;\n    // verify that that's the case. (Strictly speaking, unmounting won't cause a\n    // render but we still don't expect to be in a render call here.)\n    (\"production\" !== \"development\" ? warning(\n      ReactCurrentOwner.current == null,\n      'unmountComponentAtNode(): Render methods should be a pure function of ' +\n      'props and state; triggering nested component updates from render is ' +\n      'not allowed. If necessary, trigger nested updates in ' +\n      'componentDidUpdate.'\n    ) : null);\n\n    (\"production\" !== \"development\" ? invariant(\n      container && (\n        (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n      ),\n      'unmountComponentAtNode(...): Target container is not a DOM element.'\n    ) : invariant(container && (\n      (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n    )));\n\n    var reactRootID = getReactRootID(container);\n    var component = instancesByReactRootID[reactRootID];\n    if (!component) {\n      return false;\n    }\n    ReactMount.unmountComponentFromNode(component, container);\n    delete instancesByReactRootID[reactRootID];\n    delete containersByReactRootID[reactRootID];\n    if (\"production\" !== \"development\") {\n      delete rootElementsByReactRootID[reactRootID];\n    }\n    return true;\n  },\n\n  /**\n   * Unmounts a component and removes it from the DOM.\n   *\n   * @param {ReactComponent} instance React component instance.\n   * @param {DOMElement} container DOM element to unmount from.\n   * @final\n   * @internal\n   * @see {ReactMount.unmountComponentAtNode}\n   */\n  unmountComponentFromNode: function(instance, container) {\n    ReactReconciler.unmountComponent(instance);\n\n    if (container.nodeType === DOC_NODE_TYPE) {\n      container = container.documentElement;\n    }\n\n    // http://jsperf.com/emptying-a-node\n    while (container.lastChild) {\n      container.removeChild(container.lastChild);\n    }\n  },\n\n  /**\n   * Finds the container DOM element that contains React component to which the\n   * supplied DOM `id` belongs.\n   *\n   * @param {string} id The ID of an element rendered by a React component.\n   * @return {?DOMElement} DOM element that contains the `id`.\n   */\n  findReactContainerForID: function(id) {\n    var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);\n    var container = containersByReactRootID[reactRootID];\n\n    if (\"production\" !== \"development\") {\n      var rootElement = rootElementsByReactRootID[reactRootID];\n      if (rootElement && rootElement.parentNode !== container) {\n        (\"production\" !== \"development\" ? invariant(\n          // Call internalGetID here because getID calls isValid which calls\n          // findReactContainerForID (this function).\n          internalGetID(rootElement) === reactRootID,\n          'ReactMount: Root element ID differed from reactRootID.'\n        ) : invariant(// Call internalGetID here because getID calls isValid which calls\n        // findReactContainerForID (this function).\n        internalGetID(rootElement) === reactRootID));\n\n        var containerChild = container.firstChild;\n        if (containerChild &&\n            reactRootID === internalGetID(containerChild)) {\n          // If the container has a new child with the same ID as the old\n          // root element, then rootElementsByReactRootID[reactRootID] is\n          // just stale and needs to be updated. The case that deserves a\n          // warning is when the container is empty.\n          rootElementsByReactRootID[reactRootID] = containerChild;\n        } else {\n          (\"production\" !== \"development\" ? warning(\n            false,\n            'ReactMount: Root element has been removed from its original ' +\n            'container. New container:', rootElement.parentNode\n          ) : null);\n        }\n      }\n    }\n\n    return container;\n  },\n\n  /**\n   * Finds an element rendered by React with the supplied ID.\n   *\n   * @param {string} id ID of a DOM node in the React component.\n   * @return {DOMElement} Root DOM node of the React component.\n   */\n  findReactNodeByID: function(id) {\n    var reactRoot = ReactMount.findReactContainerForID(id);\n    return ReactMount.findComponentRoot(reactRoot, id);\n  },\n\n  /**\n   * True if the supplied `node` is rendered by React.\n   *\n   * @param {*} node DOM Element to check.\n   * @return {boolean} True if the DOM Element appears to be rendered by React.\n   * @internal\n   */\n  isRenderedByReact: function(node) {\n    if (node.nodeType !== 1) {\n      // Not a DOMElement, therefore not a React component\n      return false;\n    }\n    var id = ReactMount.getID(node);\n    return id ? id.charAt(0) === SEPARATOR : false;\n  },\n\n  /**\n   * Traverses up the ancestors of the supplied node to find a node that is a\n   * DOM representation of a React component.\n   *\n   * @param {*} node\n   * @return {?DOMEventTarget}\n   * @internal\n   */\n  getFirstReactDOM: function(node) {\n    var current = node;\n    while (current && current.parentNode !== current) {\n      if (ReactMount.isRenderedByReact(current)) {\n        return current;\n      }\n      current = current.parentNode;\n    }\n    return null;\n  },\n\n  /**\n   * Finds a node with the supplied `targetID` inside of the supplied\n   * `ancestorNode`.  Exploits the ID naming scheme to perform the search\n   * quickly.\n   *\n   * @param {DOMEventTarget} ancestorNode Search from this root.\n   * @pararm {string} targetID ID of the DOM representation of the component.\n   * @return {DOMEventTarget} DOM node with the supplied `targetID`.\n   * @internal\n   */\n  findComponentRoot: function(ancestorNode, targetID) {\n    var firstChildren = findComponentRootReusableArray;\n    var childIndex = 0;\n\n    var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;\n\n    firstChildren[0] = deepestAncestor.firstChild;\n    firstChildren.length = 1;\n\n    while (childIndex < firstChildren.length) {\n      var child = firstChildren[childIndex++];\n      var targetChild;\n\n      while (child) {\n        var childID = ReactMount.getID(child);\n        if (childID) {\n          // Even if we find the node we're looking for, we finish looping\n          // through its siblings to ensure they're cached so that we don't have\n          // to revisit this node again. Otherwise, we make n^2 calls to getID\n          // when visiting the many children of a single node in order.\n\n          if (targetID === childID) {\n            targetChild = child;\n          } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {\n            // If we find a child whose ID is an ancestor of the given ID,\n            // then we can be sure that we only want to search the subtree\n            // rooted at this child, so we can throw out the rest of the\n            // search state.\n            firstChildren.length = childIndex = 0;\n            firstChildren.push(child.firstChild);\n          }\n\n        } else {\n          // If this child had no ID, then there's a chance that it was\n          // injected automatically by the browser, as when a `<table>`\n          // element sprouts an extra `<tbody>` child as a side effect of\n          // `.innerHTML` parsing. Optimistically continue down this\n          // branch, but not before examining the other siblings.\n          firstChildren.push(child.firstChild);\n        }\n\n        child = child.nextSibling;\n      }\n\n      if (targetChild) {\n        // Emptying firstChildren/findComponentRootReusableArray is\n        // not necessary for correctness, but it helps the GC reclaim\n        // any nodes that were left at the end of the search.\n        firstChildren.length = 0;\n\n        return targetChild;\n      }\n    }\n\n    firstChildren.length = 0;\n\n    (\"production\" !== \"development\" ? invariant(\n      false,\n      'findComponentRoot(..., %s): Unable to find element. This probably ' +\n      'means the DOM was unexpectedly mutated (e.g., by the browser), ' +\n      'usually due to forgetting a <tbody> when using tables, nesting tags ' +\n      'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +\n      'parent. ' +\n      'Try inspecting the child nodes of the element with React ID `%s`.',\n      targetID,\n      ReactMount.getID(ancestorNode)\n    ) : invariant(false));\n  },\n\n  _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {\n    (\"production\" !== \"development\" ? invariant(\n      container && (\n        (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n      ),\n      'mountComponentIntoNode(...): Target container is not valid.'\n    ) : invariant(container && (\n      (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)\n    )));\n\n    if (shouldReuseMarkup) {\n      var rootElement = getReactRootElementInContainer(container);\n      if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {\n        return;\n      } else {\n        var checksum = rootElement.getAttribute(\n          ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n        );\n        rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);\n\n        var rootMarkup = rootElement.outerHTML;\n        rootElement.setAttribute(\n          ReactMarkupChecksum.CHECKSUM_ATTR_NAME,\n          checksum\n        );\n\n        var diffIndex = firstDifferenceIndex(markup, rootMarkup);\n        var difference = ' (client) ' +\n          markup.substring(diffIndex - 20, diffIndex + 20) +\n          '\\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);\n\n        (\"production\" !== \"development\" ? invariant(\n          container.nodeType !== DOC_NODE_TYPE,\n          'You\\'re trying to render a component to the document using ' +\n          'server rendering but the checksum was invalid. This usually ' +\n          'means you rendered a different component type or props on ' +\n          'the client from the one on the server, or your render() ' +\n          'methods are impure. React cannot handle this case due to ' +\n          'cross-browser quirks by rendering at the document root. You ' +\n          'should look for environment dependent code in your components ' +\n          'and ensure the props are the same client and server side:\\n%s',\n          difference\n        ) : invariant(container.nodeType !== DOC_NODE_TYPE));\n\n        if (\"production\" !== \"development\") {\n          (\"production\" !== \"development\" ? warning(\n            false,\n            'React attempted to reuse markup in a container but the ' +\n            'checksum was invalid. This generally means that you are ' +\n            'using server rendering and the markup generated on the ' +\n            'server was not what the client was expecting. React injected ' +\n            'new markup to compensate which works but you have lost many ' +\n            'of the benefits of server rendering. Instead, figure out ' +\n            'why the markup being generated is different on the client ' +\n            'or server:\\n%s',\n            difference\n          ) : null);\n        }\n      }\n    }\n\n    (\"production\" !== \"development\" ? invariant(\n      container.nodeType !== DOC_NODE_TYPE,\n      'You\\'re trying to render a component to the document but ' +\n        'you didn\\'t use server rendering. We can\\'t do this ' +\n        'without using server rendering due to cross-browser quirks. ' +\n        'See React.renderToString() for server rendering.'\n    ) : invariant(container.nodeType !== DOC_NODE_TYPE));\n\n    setInnerHTML(container, markup);\n  },\n\n  /**\n   * React ID utilities.\n   */\n\n  getReactRootID: getReactRootID,\n\n  getID: getID,\n\n  setID: setID,\n\n  getNode: getNode,\n\n  getNodeFromInstance: getNodeFromInstance,\n\n  purgeID: purgeID\n};\n\nReactPerf.measureMethods(ReactMount, 'ReactMount', {\n  _renderNewRootComponent: '_renderNewRootComponent',\n  _mountImageIntoNode: '_mountImageIntoNode'\n});\n\nmodule.exports = ReactMount;\n\n},{\"10\":10,\"109\":109,\"115\":115,\"129\":129,\"134\":134,\"135\":135,\"148\":148,\"151\":151,\"154\":154,\"30\":30,\"39\":39,\"57\":57,\"58\":58,\"59\":59,\"66\":66,\"67\":67,\"69\":69,\"75\":75,\"81\":81,\"86\":86,\"87\":87}],71:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactMultiChild\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactComponentEnvironment = _dereq_(36);\nvar ReactMultiChildUpdateTypes = _dereq_(72);\n\nvar ReactReconciler = _dereq_(81);\nvar ReactChildReconciler = _dereq_(31);\n\n/**\n * Updating children of a component may trigger recursive updates. The depth is\n * used to batch recursive updates to render markup more efficiently.\n *\n * @type {number}\n * @private\n */\nvar updateDepth = 0;\n\n/**\n * Queue of update configuration objects.\n *\n * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.\n *\n * @type {array<object>}\n * @private\n */\nvar updateQueue = [];\n\n/**\n * Queue of markup to be rendered.\n *\n * @type {array<string>}\n * @private\n */\nvar markupQueue = [];\n\n/**\n * Enqueues markup to be rendered and inserted at a supplied index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {string} markup Markup that renders into an element.\n * @param {number} toIndex Destination index.\n * @private\n */\nfunction enqueueMarkup(parentID, markup, toIndex) {\n  // NOTE: Null values reduce hidden classes.\n  updateQueue.push({\n    parentID: parentID,\n    parentNode: null,\n    type: ReactMultiChildUpdateTypes.INSERT_MARKUP,\n    markupIndex: markupQueue.push(markup) - 1,\n    textContent: null,\n    fromIndex: null,\n    toIndex: toIndex\n  });\n}\n\n/**\n * Enqueues moving an existing element to another index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {number} fromIndex Source index of the existing element.\n * @param {number} toIndex Destination index of the element.\n * @private\n */\nfunction enqueueMove(parentID, fromIndex, toIndex) {\n  // NOTE: Null values reduce hidden classes.\n  updateQueue.push({\n    parentID: parentID,\n    parentNode: null,\n    type: ReactMultiChildUpdateTypes.MOVE_EXISTING,\n    markupIndex: null,\n    textContent: null,\n    fromIndex: fromIndex,\n    toIndex: toIndex\n  });\n}\n\n/**\n * Enqueues removing an element at an index.\n *\n * @param {string} parentID ID of the parent component.\n * @param {number} fromIndex Index of the element to remove.\n * @private\n */\nfunction enqueueRemove(parentID, fromIndex) {\n  // NOTE: Null values reduce hidden classes.\n  updateQueue.push({\n    parentID: parentID,\n    parentNode: null,\n    type: ReactMultiChildUpdateTypes.REMOVE_NODE,\n    markupIndex: null,\n    textContent: null,\n    fromIndex: fromIndex,\n    toIndex: null\n  });\n}\n\n/**\n * Enqueues setting the text content.\n *\n * @param {string} parentID ID of the parent component.\n * @param {string} textContent Text content to set.\n * @private\n */\nfunction enqueueTextContent(parentID, textContent) {\n  // NOTE: Null values reduce hidden classes.\n  updateQueue.push({\n    parentID: parentID,\n    parentNode: null,\n    type: ReactMultiChildUpdateTypes.TEXT_CONTENT,\n    markupIndex: null,\n    textContent: textContent,\n    fromIndex: null,\n    toIndex: null\n  });\n}\n\n/**\n * Processes any enqueued updates.\n *\n * @private\n */\nfunction processQueue() {\n  if (updateQueue.length) {\n    ReactComponentEnvironment.processChildrenUpdates(\n      updateQueue,\n      markupQueue\n    );\n    clearQueue();\n  }\n}\n\n/**\n * Clears any enqueued updates.\n *\n * @private\n */\nfunction clearQueue() {\n  updateQueue.length = 0;\n  markupQueue.length = 0;\n}\n\n/**\n * ReactMultiChild are capable of reconciling multiple children.\n *\n * @class ReactMultiChild\n * @internal\n */\nvar ReactMultiChild = {\n\n  /**\n   * Provides common functionality for components that must reconcile multiple\n   * children. This is used by `ReactDOMComponent` to mount, update, and\n   * unmount child components.\n   *\n   * @lends {ReactMultiChild.prototype}\n   */\n  Mixin: {\n\n    /**\n     * Generates a \"mount image\" for each of the supplied children. In the case\n     * of `ReactDOMComponent`, a mount image is a string of markup.\n     *\n     * @param {?object} nestedChildren Nested child maps.\n     * @return {array} An array of mounted representations.\n     * @internal\n     */\n    mountChildren: function(nestedChildren, transaction, context) {\n      var children = ReactChildReconciler.instantiateChildren(\n        nestedChildren, transaction, context\n      );\n      this._renderedChildren = children;\n      var mountImages = [];\n      var index = 0;\n      for (var name in children) {\n        if (children.hasOwnProperty(name)) {\n          var child = children[name];\n          // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n          var rootID = this._rootNodeID + name;\n          var mountImage = ReactReconciler.mountComponent(\n            child,\n            rootID,\n            transaction,\n            context\n          );\n          child._mountIndex = index;\n          mountImages.push(mountImage);\n          index++;\n        }\n      }\n      return mountImages;\n    },\n\n    /**\n     * Replaces any rendered children with a text content string.\n     *\n     * @param {string} nextContent String of content.\n     * @internal\n     */\n    updateTextContent: function(nextContent) {\n      updateDepth++;\n      var errorThrown = true;\n      try {\n        var prevChildren = this._renderedChildren;\n        // Remove any rendered children.\n        ReactChildReconciler.unmountChildren(prevChildren);\n        // TODO: The setTextContent operation should be enough\n        for (var name in prevChildren) {\n          if (prevChildren.hasOwnProperty(name)) {\n            this._unmountChildByName(prevChildren[name], name);\n          }\n        }\n        // Set new text content.\n        this.setTextContent(nextContent);\n        errorThrown = false;\n      } finally {\n        updateDepth--;\n        if (!updateDepth) {\n          if (errorThrown) {\n            clearQueue();\n          } else {\n            processQueue();\n          }\n        }\n      }\n    },\n\n    /**\n     * Updates the rendered children with new children.\n     *\n     * @param {?object} nextNestedChildren Nested child maps.\n     * @param {ReactReconcileTransaction} transaction\n     * @internal\n     */\n    updateChildren: function(nextNestedChildren, transaction, context) {\n      updateDepth++;\n      var errorThrown = true;\n      try {\n        this._updateChildren(nextNestedChildren, transaction, context);\n        errorThrown = false;\n      } finally {\n        updateDepth--;\n        if (!updateDepth) {\n          if (errorThrown) {\n            clearQueue();\n          } else {\n            processQueue();\n          }\n        }\n\n      }\n    },\n\n    /**\n     * Improve performance by isolating this hot code path from the try/catch\n     * block in `updateChildren`.\n     *\n     * @param {?object} nextNestedChildren Nested child maps.\n     * @param {ReactReconcileTransaction} transaction\n     * @final\n     * @protected\n     */\n    _updateChildren: function(nextNestedChildren, transaction, context) {\n      var prevChildren = this._renderedChildren;\n      var nextChildren = ReactChildReconciler.updateChildren(\n        prevChildren, nextNestedChildren, transaction, context\n      );\n      this._renderedChildren = nextChildren;\n      if (!nextChildren && !prevChildren) {\n        return;\n      }\n      var name;\n      // `nextIndex` will increment for each child in `nextChildren`, but\n      // `lastIndex` will be the last index visited in `prevChildren`.\n      var lastIndex = 0;\n      var nextIndex = 0;\n      for (name in nextChildren) {\n        if (!nextChildren.hasOwnProperty(name)) {\n          continue;\n        }\n        var prevChild = prevChildren && prevChildren[name];\n        var nextChild = nextChildren[name];\n        if (prevChild === nextChild) {\n          this.moveChild(prevChild, nextIndex, lastIndex);\n          lastIndex = Math.max(prevChild._mountIndex, lastIndex);\n          prevChild._mountIndex = nextIndex;\n        } else {\n          if (prevChild) {\n            // Update `lastIndex` before `_mountIndex` gets unset by unmounting.\n            lastIndex = Math.max(prevChild._mountIndex, lastIndex);\n            this._unmountChildByName(prevChild, name);\n          }\n          // The child must be instantiated before it's mounted.\n          this._mountChildByNameAtIndex(\n            nextChild, name, nextIndex, transaction, context\n          );\n        }\n        nextIndex++;\n      }\n      // Remove children that are no longer present.\n      for (name in prevChildren) {\n        if (prevChildren.hasOwnProperty(name) &&\n            !(nextChildren && nextChildren.hasOwnProperty(name))) {\n          this._unmountChildByName(prevChildren[name], name);\n        }\n      }\n    },\n\n    /**\n     * Unmounts all rendered children. This should be used to clean up children\n     * when this component is unmounted.\n     *\n     * @internal\n     */\n    unmountChildren: function() {\n      var renderedChildren = this._renderedChildren;\n      ReactChildReconciler.unmountChildren(renderedChildren);\n      this._renderedChildren = null;\n    },\n\n    /**\n     * Moves a child component to the supplied index.\n     *\n     * @param {ReactComponent} child Component to move.\n     * @param {number} toIndex Destination index of the element.\n     * @param {number} lastIndex Last index visited of the siblings of `child`.\n     * @protected\n     */\n    moveChild: function(child, toIndex, lastIndex) {\n      // If the index of `child` is less than `lastIndex`, then it needs to\n      // be moved. Otherwise, we do not need to move it because a child will be\n      // inserted or moved before `child`.\n      if (child._mountIndex < lastIndex) {\n        enqueueMove(this._rootNodeID, child._mountIndex, toIndex);\n      }\n    },\n\n    /**\n     * Creates a child component.\n     *\n     * @param {ReactComponent} child Component to create.\n     * @param {string} mountImage Markup to insert.\n     * @protected\n     */\n    createChild: function(child, mountImage) {\n      enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);\n    },\n\n    /**\n     * Removes a child component.\n     *\n     * @param {ReactComponent} child Child to remove.\n     * @protected\n     */\n    removeChild: function(child) {\n      enqueueRemove(this._rootNodeID, child._mountIndex);\n    },\n\n    /**\n     * Sets this text content string.\n     *\n     * @param {string} textContent Text content to set.\n     * @protected\n     */\n    setTextContent: function(textContent) {\n      enqueueTextContent(this._rootNodeID, textContent);\n    },\n\n    /**\n     * Mounts a child with the supplied name.\n     *\n     * NOTE: This is part of `updateChildren` and is here for readability.\n     *\n     * @param {ReactComponent} child Component to mount.\n     * @param {string} name Name of the child.\n     * @param {number} index Index at which to insert the child.\n     * @param {ReactReconcileTransaction} transaction\n     * @private\n     */\n    _mountChildByNameAtIndex: function(\n      child,\n      name,\n      index,\n      transaction,\n      context) {\n      // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n      var rootID = this._rootNodeID + name;\n      var mountImage = ReactReconciler.mountComponent(\n        child,\n        rootID,\n        transaction,\n        context\n      );\n      child._mountIndex = index;\n      this.createChild(child, mountImage);\n    },\n\n    /**\n     * Unmounts a rendered child by name.\n     *\n     * NOTE: This is part of `updateChildren` and is here for readability.\n     *\n     * @param {ReactComponent} child Component to unmount.\n     * @param {string} name Name of the child in `this._renderedChildren`.\n     * @private\n     */\n    _unmountChildByName: function(child, name) {\n      this.removeChild(child);\n      child._mountIndex = null;\n    }\n\n  }\n\n};\n\nmodule.exports = ReactMultiChild;\n\n},{\"31\":31,\"36\":36,\"72\":72,\"81\":81}],72:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactMultiChildUpdateTypes\n */\n\n'use strict';\n\nvar keyMirror = _dereq_(140);\n\n/**\n * When a component's children are updated, a series of update configuration\n * objects are created in order to batch and serialize the required changes.\n *\n * Enumerates all the possible types of update configurations.\n *\n * @internal\n */\nvar ReactMultiChildUpdateTypes = keyMirror({\n  INSERT_MARKUP: null,\n  MOVE_EXISTING: null,\n  REMOVE_NODE: null,\n  TEXT_CONTENT: null\n});\n\nmodule.exports = ReactMultiChildUpdateTypes;\n\n},{\"140\":140}],73:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactNativeComponent\n */\n\n'use strict';\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\n\nvar autoGenerateWrapperClass = null;\nvar genericComponentClass = null;\n// This registry keeps track of wrapper classes around native tags\nvar tagToComponentClass = {};\nvar textComponentClass = null;\n\nvar ReactNativeComponentInjection = {\n  // This accepts a class that receives the tag string. This is a catch all\n  // that can render any kind of tag.\n  injectGenericComponentClass: function(componentClass) {\n    genericComponentClass = componentClass;\n  },\n  // This accepts a text component class that takes the text string to be\n  // rendered as props.\n  injectTextComponentClass: function(componentClass) {\n    textComponentClass = componentClass;\n  },\n  // This accepts a keyed object with classes as values. Each key represents a\n  // tag. That particular tag will use this class instead of the generic one.\n  injectComponentClasses: function(componentClasses) {\n    assign(tagToComponentClass, componentClasses);\n  },\n  // Temporary hack since we expect DOM refs to behave like composites,\n  // for this release.\n  injectAutoWrapper: function(wrapperFactory) {\n    autoGenerateWrapperClass = wrapperFactory;\n  }\n};\n\n/**\n * Get a composite component wrapper class for a specific tag.\n *\n * @param {ReactElement} element The tag for which to get the class.\n * @return {function} The React class constructor function.\n */\nfunction getComponentClassForElement(element) {\n  if (typeof element.type === 'function') {\n    return element.type;\n  }\n  var tag = element.type;\n  var componentClass = tagToComponentClass[tag];\n  if (componentClass == null) {\n    tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);\n  }\n  return componentClass;\n}\n\n/**\n * Get a native internal component class for a specific tag.\n *\n * @param {ReactElement} element The element to create.\n * @return {function} The internal class constructor function.\n */\nfunction createInternalComponent(element) {\n  (\"production\" !== \"development\" ? invariant(\n    genericComponentClass,\n    'There is no registered component for the tag %s',\n    element.type\n  ) : invariant(genericComponentClass));\n  return new genericComponentClass(element.type, element.props);\n}\n\n/**\n * @param {ReactText} text\n * @return {ReactComponent}\n */\nfunction createInstanceForText(text) {\n  return new textComponentClass(text);\n}\n\n/**\n * @param {ReactComponent} component\n * @return {boolean}\n */\nfunction isTextComponent(component) {\n  return component instanceof textComponentClass;\n}\n\nvar ReactNativeComponent = {\n  getComponentClassForElement: getComponentClassForElement,\n  createInternalComponent: createInternalComponent,\n  createInstanceForText: createInstanceForText,\n  isTextComponent: isTextComponent,\n  injection: ReactNativeComponentInjection\n};\n\nmodule.exports = ReactNativeComponent;\n\n},{\"135\":135,\"27\":27}],74:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactOwner\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n * ReactOwners are capable of storing references to owned components.\n *\n * All components are capable of //being// referenced by owner components, but\n * only ReactOwner components are capable of //referencing// owned components.\n * The named reference is known as a \"ref\".\n *\n * Refs are available when mounted and updated during reconciliation.\n *\n *   var MyComponent = React.createClass({\n *     render: function() {\n *       return (\n *         <div onClick={this.handleClick}>\n *           <CustomComponent ref=\"custom\" />\n *         </div>\n *       );\n *     },\n *     handleClick: function() {\n *       this.refs.custom.handleClick();\n *     },\n *     componentDidMount: function() {\n *       this.refs.custom.initialize();\n *     }\n *   });\n *\n * Refs should rarely be used. When refs are used, they should only be done to\n * control data that is not handled by React's data flow.\n *\n * @class ReactOwner\n */\nvar ReactOwner = {\n\n  /**\n   * @param {?object} object\n   * @return {boolean} True if `object` is a valid owner.\n   * @final\n   */\n  isValidOwner: function(object) {\n    return !!(\n      (object &&\n      typeof object.attachRef === 'function' && typeof object.detachRef === 'function')\n    );\n  },\n\n  /**\n   * Adds a component by ref to an owner component.\n   *\n   * @param {ReactComponent} component Component to reference.\n   * @param {string} ref Name by which to refer to the component.\n   * @param {ReactOwner} owner Component on which to record the ref.\n   * @final\n   * @internal\n   */\n  addComponentAsRefTo: function(component, ref, owner) {\n    (\"production\" !== \"development\" ? invariant(\n      ReactOwner.isValidOwner(owner),\n      'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +\n      'usually means that you\\'re trying to add a ref to a component that ' +\n      'doesn\\'t have an owner (that is, was not created inside of another ' +\n      'component\\'s `render` method). Try rendering this component inside of ' +\n      'a new top-level component which will hold the ref.'\n    ) : invariant(ReactOwner.isValidOwner(owner)));\n    owner.attachRef(ref, component);\n  },\n\n  /**\n   * Removes a component by ref from an owner component.\n   *\n   * @param {ReactComponent} component Component to dereference.\n   * @param {string} ref Name of the ref to remove.\n   * @param {ReactOwner} owner Component on which the ref is recorded.\n   * @final\n   * @internal\n   */\n  removeComponentAsRefFrom: function(component, ref, owner) {\n    (\"production\" !== \"development\" ? invariant(\n      ReactOwner.isValidOwner(owner),\n      'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +\n      'usually means that you\\'re trying to remove a ref to a component that ' +\n      'doesn\\'t have an owner (that is, was not created inside of another ' +\n      'component\\'s `render` method). Try rendering this component inside of ' +\n      'a new top-level component which will hold the ref.'\n    ) : invariant(ReactOwner.isValidOwner(owner)));\n    // Check that `component` is still the current ref because we do not want to\n    // detach the ref if another component stole it.\n    if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {\n      owner.detachRef(ref);\n    }\n  }\n\n};\n\nmodule.exports = ReactOwner;\n\n},{\"135\":135}],75:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactPerf\n * @typechecks static-only\n */\n\n'use strict';\n\n/**\n * ReactPerf is a general AOP system designed to measure performance. This\n * module only has the hooks: see ReactDefaultPerf for the analysis tool.\n */\nvar ReactPerf = {\n  /**\n   * Boolean to enable/disable measurement. Set to false by default to prevent\n   * accidental logging and perf loss.\n   */\n  enableMeasure: false,\n\n  /**\n   * Holds onto the measure function in use. By default, don't measure\n   * anything, but we'll override this if we inject a measure function.\n   */\n  storedMeasure: _noMeasure,\n\n  /**\n   * @param {object} object\n   * @param {string} objectName\n   * @param {object<string>} methodNames\n   */\n  measureMethods: function(object, objectName, methodNames) {\n    if (\"production\" !== \"development\") {\n      for (var key in methodNames) {\n        if (!methodNames.hasOwnProperty(key)) {\n          continue;\n        }\n        object[key] = ReactPerf.measure(\n          objectName,\n          methodNames[key],\n          object[key]\n        );\n      }\n    }\n  },\n\n  /**\n   * Use this to wrap methods you want to measure. Zero overhead in production.\n   *\n   * @param {string} objName\n   * @param {string} fnName\n   * @param {function} func\n   * @return {function}\n   */\n  measure: function(objName, fnName, func) {\n    if (\"production\" !== \"development\") {\n      var measuredFunc = null;\n      var wrapper = function() {\n        if (ReactPerf.enableMeasure) {\n          if (!measuredFunc) {\n            measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);\n          }\n          return measuredFunc.apply(this, arguments);\n        }\n        return func.apply(this, arguments);\n      };\n      wrapper.displayName = objName + '_' + fnName;\n      return wrapper;\n    }\n    return func;\n  },\n\n  injection: {\n    /**\n     * @param {function} measure\n     */\n    injectMeasure: function(measure) {\n      ReactPerf.storedMeasure = measure;\n    }\n  }\n};\n\n/**\n * Simply passes through the measured function, without measuring it.\n *\n * @param {string} objName\n * @param {string} fnName\n * @param {function} func\n * @return {function}\n */\nfunction _noMeasure(objName, fnName, func) {\n  return func;\n}\n\nmodule.exports = ReactPerf;\n\n},{}],76:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactPropTypeLocationNames\n */\n\n'use strict';\n\nvar ReactPropTypeLocationNames = {};\n\nif (\"production\" !== \"development\") {\n  ReactPropTypeLocationNames = {\n    prop: 'prop',\n    context: 'context',\n    childContext: 'child context'\n  };\n}\n\nmodule.exports = ReactPropTypeLocationNames;\n\n},{}],77:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactPropTypeLocations\n */\n\n'use strict';\n\nvar keyMirror = _dereq_(140);\n\nvar ReactPropTypeLocations = keyMirror({\n  prop: null,\n  context: null,\n  childContext: null\n});\n\nmodule.exports = ReactPropTypeLocations;\n\n},{\"140\":140}],78:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactPropTypes\n */\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactFragment = _dereq_(63);\nvar ReactPropTypeLocationNames = _dereq_(76);\n\nvar emptyFunction = _dereq_(114);\n\n/**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n *   var Props = require('ReactPropTypes');\n *   var MyArticle = React.createClass({\n *     propTypes: {\n *       // An optional string prop named \"description\".\n *       description: Props.string,\n *\n *       // A required enum prop named \"category\".\n *       category: Props.oneOf(['News','Photos']).isRequired,\n *\n *       // A prop named \"dialog\" that requires an instance of Dialog.\n *       dialog: Props.instanceOf(Dialog).isRequired\n *     },\n *     render: function() { ... }\n *   });\n *\n * A more formal specification of how these methods are used:\n *\n *   type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n *   decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n *  var MyLink = React.createClass({\n *    propTypes: {\n *      // An optional string or URI prop named \"href\".\n *      href: function(props, propName, componentName) {\n *        var propValue = props[propName];\n *        if (propValue != null && typeof propValue !== 'string' &&\n *            !(propValue instanceof URI)) {\n *          return new Error(\n *            'Expected a string or an URI for ' + propName + ' in ' +\n *            componentName\n *          );\n *        }\n *      }\n *    },\n *    render: function() {...}\n *  });\n *\n * @internal\n */\n\nvar ANONYMOUS = '<<anonymous>>';\n\nvar elementTypeChecker = createElementTypeChecker();\nvar nodeTypeChecker = createNodeChecker();\n\nvar ReactPropTypes = {\n  array: createPrimitiveTypeChecker('array'),\n  bool: createPrimitiveTypeChecker('boolean'),\n  func: createPrimitiveTypeChecker('function'),\n  number: createPrimitiveTypeChecker('number'),\n  object: createPrimitiveTypeChecker('object'),\n  string: createPrimitiveTypeChecker('string'),\n\n  any: createAnyTypeChecker(),\n  arrayOf: createArrayOfTypeChecker,\n  element: elementTypeChecker,\n  instanceOf: createInstanceTypeChecker,\n  node: nodeTypeChecker,\n  objectOf: createObjectOfTypeChecker,\n  oneOf: createEnumTypeChecker,\n  oneOfType: createUnionTypeChecker,\n  shape: createShapeTypeChecker\n};\n\nfunction createChainableTypeChecker(validate) {\n  function checkType(isRequired, props, propName, componentName, location) {\n    componentName = componentName || ANONYMOUS;\n    if (props[propName] == null) {\n      var locationName = ReactPropTypeLocationNames[location];\n      if (isRequired) {\n        return new Error(\n          (\"Required \" + locationName + \" `\" + propName + \"` was not specified in \") +\n          (\"`\" + componentName + \"`.\")\n        );\n      }\n      return null;\n    } else {\n      return validate(props, propName, componentName, location);\n    }\n  }\n\n  var chainedCheckType = checkType.bind(null, false);\n  chainedCheckType.isRequired = checkType.bind(null, true);\n\n  return chainedCheckType;\n}\n\nfunction createPrimitiveTypeChecker(expectedType) {\n  function validate(props, propName, componentName, location) {\n    var propValue = props[propName];\n    var propType = getPropType(propValue);\n    if (propType !== expectedType) {\n      var locationName = ReactPropTypeLocationNames[location];\n      // `propValue` being instance of, say, date/regexp, pass the 'object'\n      // check, but we can offer a more precise error message here rather than\n      // 'of type `object`'.\n      var preciseType = getPreciseType(propValue);\n\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` of type `\" + preciseType + \"` \") +\n        (\"supplied to `\" + componentName + \"`, expected `\" + expectedType + \"`.\")\n      );\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createAnyTypeChecker() {\n  return createChainableTypeChecker(emptyFunction.thatReturns(null));\n}\n\nfunction createArrayOfTypeChecker(typeChecker) {\n  function validate(props, propName, componentName, location) {\n    var propValue = props[propName];\n    if (!Array.isArray(propValue)) {\n      var locationName = ReactPropTypeLocationNames[location];\n      var propType = getPropType(propValue);\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` of type \") +\n        (\"`\" + propType + \"` supplied to `\" + componentName + \"`, expected an array.\")\n      );\n    }\n    for (var i = 0; i < propValue.length; i++) {\n      var error = typeChecker(propValue, i, componentName, location);\n      if (error instanceof Error) {\n        return error;\n      }\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createElementTypeChecker() {\n  function validate(props, propName, componentName, location) {\n    if (!ReactElement.isValidElement(props[propName])) {\n      var locationName = ReactPropTypeLocationNames[location];\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` supplied to \") +\n        (\"`\" + componentName + \"`, expected a ReactElement.\")\n      );\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createInstanceTypeChecker(expectedClass) {\n  function validate(props, propName, componentName, location) {\n    if (!(props[propName] instanceof expectedClass)) {\n      var locationName = ReactPropTypeLocationNames[location];\n      var expectedClassName = expectedClass.name || ANONYMOUS;\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` supplied to \") +\n        (\"`\" + componentName + \"`, expected instance of `\" + expectedClassName + \"`.\")\n      );\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createEnumTypeChecker(expectedValues) {\n  function validate(props, propName, componentName, location) {\n    var propValue = props[propName];\n    for (var i = 0; i < expectedValues.length; i++) {\n      if (propValue === expectedValues[i]) {\n        return null;\n      }\n    }\n\n    var locationName = ReactPropTypeLocationNames[location];\n    var valuesString = JSON.stringify(expectedValues);\n    return new Error(\n      (\"Invalid \" + locationName + \" `\" + propName + \"` of value `\" + propValue + \"` \") +\n      (\"supplied to `\" + componentName + \"`, expected one of \" + valuesString + \".\")\n    );\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createObjectOfTypeChecker(typeChecker) {\n  function validate(props, propName, componentName, location) {\n    var propValue = props[propName];\n    var propType = getPropType(propValue);\n    if (propType !== 'object') {\n      var locationName = ReactPropTypeLocationNames[location];\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` of type \") +\n        (\"`\" + propType + \"` supplied to `\" + componentName + \"`, expected an object.\")\n      );\n    }\n    for (var key in propValue) {\n      if (propValue.hasOwnProperty(key)) {\n        var error = typeChecker(propValue, key, componentName, location);\n        if (error instanceof Error) {\n          return error;\n        }\n      }\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createUnionTypeChecker(arrayOfTypeCheckers) {\n  function validate(props, propName, componentName, location) {\n    for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n      var checker = arrayOfTypeCheckers[i];\n      if (checker(props, propName, componentName, location) == null) {\n        return null;\n      }\n    }\n\n    var locationName = ReactPropTypeLocationNames[location];\n    return new Error(\n      (\"Invalid \" + locationName + \" `\" + propName + \"` supplied to \") +\n      (\"`\" + componentName + \"`.\")\n    );\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createNodeChecker() {\n  function validate(props, propName, componentName, location) {\n    if (!isNode(props[propName])) {\n      var locationName = ReactPropTypeLocationNames[location];\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` supplied to \") +\n        (\"`\" + componentName + \"`, expected a ReactNode.\")\n      );\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction createShapeTypeChecker(shapeTypes) {\n  function validate(props, propName, componentName, location) {\n    var propValue = props[propName];\n    var propType = getPropType(propValue);\n    if (propType !== 'object') {\n      var locationName = ReactPropTypeLocationNames[location];\n      return new Error(\n        (\"Invalid \" + locationName + \" `\" + propName + \"` of type `\" + propType + \"` \") +\n        (\"supplied to `\" + componentName + \"`, expected `object`.\")\n      );\n    }\n    for (var key in shapeTypes) {\n      var checker = shapeTypes[key];\n      if (!checker) {\n        continue;\n      }\n      var error = checker(propValue, key, componentName, location);\n      if (error) {\n        return error;\n      }\n    }\n    return null;\n  }\n  return createChainableTypeChecker(validate);\n}\n\nfunction isNode(propValue) {\n  switch (typeof propValue) {\n    case 'number':\n    case 'string':\n    case 'undefined':\n      return true;\n    case 'boolean':\n      return !propValue;\n    case 'object':\n      if (Array.isArray(propValue)) {\n        return propValue.every(isNode);\n      }\n      if (propValue === null || ReactElement.isValidElement(propValue)) {\n        return true;\n      }\n      propValue = ReactFragment.extractIfFragment(propValue);\n      for (var k in propValue) {\n        if (!isNode(propValue[k])) {\n          return false;\n        }\n      }\n      return true;\n    default:\n      return false;\n  }\n}\n\n// Equivalent of `typeof` but with special handling for array and regexp.\nfunction getPropType(propValue) {\n  var propType = typeof propValue;\n  if (Array.isArray(propValue)) {\n    return 'array';\n  }\n  if (propValue instanceof RegExp) {\n    // Old webkits (at least until Android 4.0) return 'function' rather than\n    // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n    // passes PropTypes.object.\n    return 'object';\n  }\n  return propType;\n}\n\n// This handles more types than `getPropType`. Only used for error messages.\n// See `createPrimitiveTypeChecker`.\nfunction getPreciseType(propValue) {\n  var propType = getPropType(propValue);\n  if (propType === 'object') {\n    if (propValue instanceof Date) {\n      return 'date';\n    } else if (propValue instanceof RegExp) {\n      return 'regexp';\n    }\n  }\n  return propType;\n}\n\nmodule.exports = ReactPropTypes;\n\n},{\"114\":114,\"57\":57,\"63\":63,\"76\":76}],79:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactPutListenerQueue\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\nvar ReactBrowserEventEmitter = _dereq_(30);\n\nvar assign = _dereq_(27);\n\nfunction ReactPutListenerQueue() {\n  this.listenersToPut = [];\n}\n\nassign(ReactPutListenerQueue.prototype, {\n  enqueuePutListener: function(rootNodeID, propKey, propValue) {\n    this.listenersToPut.push({\n      rootNodeID: rootNodeID,\n      propKey: propKey,\n      propValue: propValue\n    });\n  },\n\n  putListeners: function() {\n    for (var i = 0; i < this.listenersToPut.length; i++) {\n      var listenerToPut = this.listenersToPut[i];\n      ReactBrowserEventEmitter.putListener(\n        listenerToPut.rootNodeID,\n        listenerToPut.propKey,\n        listenerToPut.propValue\n      );\n    }\n  },\n\n  reset: function() {\n    this.listenersToPut.length = 0;\n  },\n\n  destructor: function() {\n    this.reset();\n  }\n});\n\nPooledClass.addPoolingTo(ReactPutListenerQueue);\n\nmodule.exports = ReactPutListenerQueue;\n\n},{\"27\":27,\"28\":28,\"30\":30}],80:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactReconcileTransaction\n * @typechecks static-only\n */\n\n'use strict';\n\nvar CallbackQueue = _dereq_(6);\nvar PooledClass = _dereq_(28);\nvar ReactBrowserEventEmitter = _dereq_(30);\nvar ReactInputSelection = _dereq_(65);\nvar ReactPutListenerQueue = _dereq_(79);\nvar Transaction = _dereq_(103);\n\nvar assign = _dereq_(27);\n\n/**\n * Ensures that, when possible, the selection range (currently selected text\n * input) is not disturbed by performing the transaction.\n */\nvar SELECTION_RESTORATION = {\n  /**\n   * @return {Selection} Selection information.\n   */\n  initialize: ReactInputSelection.getSelectionInformation,\n  /**\n   * @param {Selection} sel Selection information returned from `initialize`.\n   */\n  close: ReactInputSelection.restoreSelection\n};\n\n/**\n * Suppresses events (blur/focus) that could be inadvertently dispatched due to\n * high level DOM manipulations (like temporarily removing a text input from the\n * DOM).\n */\nvar EVENT_SUPPRESSION = {\n  /**\n   * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before\n   * the reconciliation.\n   */\n  initialize: function() {\n    var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();\n    ReactBrowserEventEmitter.setEnabled(false);\n    return currentlyEnabled;\n  },\n\n  /**\n   * @param {boolean} previouslyEnabled Enabled status of\n   *   `ReactBrowserEventEmitter` before the reconciliation occured. `close`\n   *   restores the previous value.\n   */\n  close: function(previouslyEnabled) {\n    ReactBrowserEventEmitter.setEnabled(previouslyEnabled);\n  }\n};\n\n/**\n * Provides a queue for collecting `componentDidMount` and\n * `componentDidUpdate` callbacks during the the transaction.\n */\nvar ON_DOM_READY_QUEUEING = {\n  /**\n   * Initializes the internal `onDOMReady` queue.\n   */\n  initialize: function() {\n    this.reactMountReady.reset();\n  },\n\n  /**\n   * After DOM is flushed, invoke all registered `onDOMReady` callbacks.\n   */\n  close: function() {\n    this.reactMountReady.notifyAll();\n  }\n};\n\nvar PUT_LISTENER_QUEUEING = {\n  initialize: function() {\n    this.putListenerQueue.reset();\n  },\n\n  close: function() {\n    this.putListenerQueue.putListeners();\n  }\n};\n\n/**\n * Executed within the scope of the `Transaction` instance. Consider these as\n * being member methods, but with an implied ordering while being isolated from\n * each other.\n */\nvar TRANSACTION_WRAPPERS = [\n  PUT_LISTENER_QUEUEING,\n  SELECTION_RESTORATION,\n  EVENT_SUPPRESSION,\n  ON_DOM_READY_QUEUEING\n];\n\n/**\n * Currently:\n * - The order that these are listed in the transaction is critical:\n * - Suppresses events.\n * - Restores selection range.\n *\n * Future:\n * - Restore document/overflow scroll positions that were unintentionally\n *   modified via DOM insertions above the top viewport boundary.\n * - Implement/integrate with customized constraint based layout system and keep\n *   track of which dimensions must be remeasured.\n *\n * @class ReactReconcileTransaction\n */\nfunction ReactReconcileTransaction() {\n  this.reinitializeTransaction();\n  // Only server-side rendering really needs this option (see\n  // `ReactServerRendering`), but server-side uses\n  // `ReactServerRenderingTransaction` instead. This option is here so that it's\n  // accessible and defaults to false when `ReactDOMComponent` and\n  // `ReactTextComponent` checks it in `mountComponent`.`\n  this.renderToStaticMarkup = false;\n  this.reactMountReady = CallbackQueue.getPooled(null);\n  this.putListenerQueue = ReactPutListenerQueue.getPooled();\n}\n\nvar Mixin = {\n  /**\n   * @see Transaction\n   * @abstract\n   * @final\n   * @return {array<object>} List of operation wrap proceedures.\n   *   TODO: convert to array<TransactionWrapper>\n   */\n  getTransactionWrappers: function() {\n    return TRANSACTION_WRAPPERS;\n  },\n\n  /**\n   * @return {object} The queue to collect `onDOMReady` callbacks with.\n   */\n  getReactMountReady: function() {\n    return this.reactMountReady;\n  },\n\n  getPutListenerQueue: function() {\n    return this.putListenerQueue;\n  },\n\n  /**\n   * `PooledClass` looks for this, and will invoke this before allowing this\n   * instance to be resused.\n   */\n  destructor: function() {\n    CallbackQueue.release(this.reactMountReady);\n    this.reactMountReady = null;\n\n    ReactPutListenerQueue.release(this.putListenerQueue);\n    this.putListenerQueue = null;\n  }\n};\n\n\nassign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);\n\nPooledClass.addPoolingTo(ReactReconcileTransaction);\n\nmodule.exports = ReactReconcileTransaction;\n\n},{\"103\":103,\"27\":27,\"28\":28,\"30\":30,\"6\":6,\"65\":65,\"79\":79}],81:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactReconciler\n */\n\n'use strict';\n\nvar ReactRef = _dereq_(82);\nvar ReactElementValidator = _dereq_(58);\n\n/**\n * Helper to call ReactRef.attachRefs with this composite component, split out\n * to avoid allocations in the transaction mount-ready queue.\n */\nfunction attachRefs() {\n  ReactRef.attachRefs(this, this._currentElement);\n}\n\nvar ReactReconciler = {\n\n  /**\n   * Initializes the component, renders markup, and registers event listeners.\n   *\n   * @param {ReactComponent} internalInstance\n   * @param {string} rootID DOM ID of the root node.\n   * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n   * @return {?string} Rendered markup to be inserted into the DOM.\n   * @final\n   * @internal\n   */\n  mountComponent: function(internalInstance, rootID, transaction, context) {\n    var markup = internalInstance.mountComponent(rootID, transaction, context);\n    if (\"production\" !== \"development\") {\n      ReactElementValidator.checkAndWarnForMutatedProps(\n        internalInstance._currentElement\n      );\n    }\n    transaction.getReactMountReady().enqueue(attachRefs, internalInstance);\n    return markup;\n  },\n\n  /**\n   * Releases any resources allocated by `mountComponent`.\n   *\n   * @final\n   * @internal\n   */\n  unmountComponent: function(internalInstance) {\n    ReactRef.detachRefs(internalInstance, internalInstance._currentElement);\n    internalInstance.unmountComponent();\n  },\n\n  /**\n   * Update a component using a new element.\n   *\n   * @param {ReactComponent} internalInstance\n   * @param {ReactElement} nextElement\n   * @param {ReactReconcileTransaction} transaction\n   * @param {object} context\n   * @internal\n   */\n  receiveComponent: function(\n    internalInstance, nextElement, transaction, context\n  ) {\n    var prevElement = internalInstance._currentElement;\n\n    if (nextElement === prevElement && nextElement._owner != null) {\n      // Since elements are immutable after the owner is rendered,\n      // we can do a cheap identity compare here to determine if this is a\n      // superfluous reconcile. It's possible for state to be mutable but such\n      // change should trigger an update of the owner which would recreate\n      // the element. We explicitly check for the existence of an owner since\n      // it's possible for an element created outside a composite to be\n      // deeply mutated and reused.\n      return;\n    }\n\n    if (\"production\" !== \"development\") {\n      ReactElementValidator.checkAndWarnForMutatedProps(nextElement);\n    }\n\n    var refsChanged = ReactRef.shouldUpdateRefs(\n      prevElement,\n      nextElement\n    );\n\n    if (refsChanged) {\n      ReactRef.detachRefs(internalInstance, prevElement);\n    }\n\n    internalInstance.receiveComponent(nextElement, transaction, context);\n\n    if (refsChanged) {\n      transaction.getReactMountReady().enqueue(attachRefs, internalInstance);\n    }\n  },\n\n  /**\n   * Flush any dirty changes in a component.\n   *\n   * @param {ReactComponent} internalInstance\n   * @param {ReactReconcileTransaction} transaction\n   * @internal\n   */\n  performUpdateIfNecessary: function(\n    internalInstance,\n    transaction\n  ) {\n    internalInstance.performUpdateIfNecessary(transaction);\n  }\n\n};\n\nmodule.exports = ReactReconciler;\n\n},{\"58\":58,\"82\":82}],82:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactRef\n */\n\n'use strict';\n\nvar ReactOwner = _dereq_(74);\n\nvar ReactRef = {};\n\nfunction attachRef(ref, component, owner) {\n  if (typeof ref === 'function') {\n    ref(component.getPublicInstance());\n  } else {\n    // Legacy ref\n    ReactOwner.addComponentAsRefTo(component, ref, owner);\n  }\n}\n\nfunction detachRef(ref, component, owner) {\n  if (typeof ref === 'function') {\n    ref(null);\n  } else {\n    // Legacy ref\n    ReactOwner.removeComponentAsRefFrom(component, ref, owner);\n  }\n}\n\nReactRef.attachRefs = function(instance, element) {\n  var ref = element.ref;\n  if (ref != null) {\n    attachRef(ref, instance, element._owner);\n  }\n};\n\nReactRef.shouldUpdateRefs = function(prevElement, nextElement) {\n  // If either the owner or a `ref` has changed, make sure the newest owner\n  // has stored a reference to `this`, and the previous owner (if different)\n  // has forgotten the reference to `this`. We use the element instead\n  // of the public this.props because the post processing cannot determine\n  // a ref. The ref conceptually lives on the element.\n\n  // TODO: Should this even be possible? The owner cannot change because\n  // it's forbidden by shouldUpdateReactComponent. The ref can change\n  // if you swap the keys of but not the refs. Reconsider where this check\n  // is made. It probably belongs where the key checking and\n  // instantiateReactComponent is done.\n\n  return (\n    nextElement._owner !== prevElement._owner ||\n    nextElement.ref !== prevElement.ref\n  );\n};\n\nReactRef.detachRefs = function(instance, element) {\n  var ref = element.ref;\n  if (ref != null) {\n    detachRef(ref, instance, element._owner);\n  }\n};\n\nmodule.exports = ReactRef;\n\n},{\"74\":74}],83:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactRootIndex\n * @typechecks\n */\n\n'use strict';\n\nvar ReactRootIndexInjection = {\n  /**\n   * @param {function} _createReactRootIndex\n   */\n  injectCreateReactRootIndex: function(_createReactRootIndex) {\n    ReactRootIndex.createReactRootIndex = _createReactRootIndex;\n  }\n};\n\nvar ReactRootIndex = {\n  createReactRootIndex: null,\n  injection: ReactRootIndexInjection\n};\n\nmodule.exports = ReactRootIndex;\n\n},{}],84:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks static-only\n * @providesModule ReactServerRendering\n */\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactInstanceHandles = _dereq_(66);\nvar ReactMarkupChecksum = _dereq_(69);\nvar ReactServerRenderingTransaction =\n  _dereq_(85);\n\nvar emptyObject = _dereq_(115);\nvar instantiateReactComponent = _dereq_(134);\nvar invariant = _dereq_(135);\n\n/**\n * @param {ReactElement} element\n * @return {string} the HTML markup\n */\nfunction renderToString(element) {\n  (\"production\" !== \"development\" ? invariant(\n    ReactElement.isValidElement(element),\n    'renderToString(): You must pass a valid ReactElement.'\n  ) : invariant(ReactElement.isValidElement(element)));\n\n  var transaction;\n  try {\n    var id = ReactInstanceHandles.createReactRootID();\n    transaction = ReactServerRenderingTransaction.getPooled(false);\n\n    return transaction.perform(function() {\n      var componentInstance = instantiateReactComponent(element, null);\n      var markup =\n        componentInstance.mountComponent(id, transaction, emptyObject);\n      return ReactMarkupChecksum.addChecksumToMarkup(markup);\n    }, null);\n  } finally {\n    ReactServerRenderingTransaction.release(transaction);\n  }\n}\n\n/**\n * @param {ReactElement} element\n * @return {string} the HTML markup, without the extra React ID and checksum\n * (for generating static pages)\n */\nfunction renderToStaticMarkup(element) {\n  (\"production\" !== \"development\" ? invariant(\n    ReactElement.isValidElement(element),\n    'renderToStaticMarkup(): You must pass a valid ReactElement.'\n  ) : invariant(ReactElement.isValidElement(element)));\n\n  var transaction;\n  try {\n    var id = ReactInstanceHandles.createReactRootID();\n    transaction = ReactServerRenderingTransaction.getPooled(true);\n\n    return transaction.perform(function() {\n      var componentInstance = instantiateReactComponent(element, null);\n      return componentInstance.mountComponent(id, transaction, emptyObject);\n    }, null);\n  } finally {\n    ReactServerRenderingTransaction.release(transaction);\n  }\n}\n\nmodule.exports = {\n  renderToString: renderToString,\n  renderToStaticMarkup: renderToStaticMarkup\n};\n\n},{\"115\":115,\"134\":134,\"135\":135,\"57\":57,\"66\":66,\"69\":69,\"85\":85}],85:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactServerRenderingTransaction\n * @typechecks\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\nvar CallbackQueue = _dereq_(6);\nvar ReactPutListenerQueue = _dereq_(79);\nvar Transaction = _dereq_(103);\n\nvar assign = _dereq_(27);\nvar emptyFunction = _dereq_(114);\n\n/**\n * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks\n * during the performing of the transaction.\n */\nvar ON_DOM_READY_QUEUEING = {\n  /**\n   * Initializes the internal `onDOMReady` queue.\n   */\n  initialize: function() {\n    this.reactMountReady.reset();\n  },\n\n  close: emptyFunction\n};\n\nvar PUT_LISTENER_QUEUEING = {\n  initialize: function() {\n    this.putListenerQueue.reset();\n  },\n\n  close: emptyFunction\n};\n\n/**\n * Executed within the scope of the `Transaction` instance. Consider these as\n * being member methods, but with an implied ordering while being isolated from\n * each other.\n */\nvar TRANSACTION_WRAPPERS = [\n  PUT_LISTENER_QUEUEING,\n  ON_DOM_READY_QUEUEING\n];\n\n/**\n * @class ReactServerRenderingTransaction\n * @param {boolean} renderToStaticMarkup\n */\nfunction ReactServerRenderingTransaction(renderToStaticMarkup) {\n  this.reinitializeTransaction();\n  this.renderToStaticMarkup = renderToStaticMarkup;\n  this.reactMountReady = CallbackQueue.getPooled(null);\n  this.putListenerQueue = ReactPutListenerQueue.getPooled();\n}\n\nvar Mixin = {\n  /**\n   * @see Transaction\n   * @abstract\n   * @final\n   * @return {array} Empty list of operation wrap proceedures.\n   */\n  getTransactionWrappers: function() {\n    return TRANSACTION_WRAPPERS;\n  },\n\n  /**\n   * @return {object} The queue to collect `onDOMReady` callbacks with.\n   */\n  getReactMountReady: function() {\n    return this.reactMountReady;\n  },\n\n  getPutListenerQueue: function() {\n    return this.putListenerQueue;\n  },\n\n  /**\n   * `PooledClass` looks for this, and will invoke this before allowing this\n   * instance to be resused.\n   */\n  destructor: function() {\n    CallbackQueue.release(this.reactMountReady);\n    this.reactMountReady = null;\n\n    ReactPutListenerQueue.release(this.putListenerQueue);\n    this.putListenerQueue = null;\n  }\n};\n\n\nassign(\n  ReactServerRenderingTransaction.prototype,\n  Transaction.Mixin,\n  Mixin\n);\n\nPooledClass.addPoolingTo(ReactServerRenderingTransaction);\n\nmodule.exports = ReactServerRenderingTransaction;\n\n},{\"103\":103,\"114\":114,\"27\":27,\"28\":28,\"6\":6,\"79\":79}],86:[function(_dereq_,module,exports){\n/**\n * Copyright 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactUpdateQueue\n */\n\n'use strict';\n\nvar ReactLifeCycle = _dereq_(68);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactElement = _dereq_(57);\nvar ReactInstanceMap = _dereq_(67);\nvar ReactUpdates = _dereq_(87);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\nfunction enqueueUpdate(internalInstance) {\n  if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {\n    // If we're in a componentWillMount handler, don't enqueue a rerender\n    // because ReactUpdates assumes we're in a browser context (which is\n    // wrong for server rendering) and we're about to do a render anyway.\n    // See bug in #1740.\n    ReactUpdates.enqueueUpdate(internalInstance);\n  }\n}\n\nfunction getInternalInstanceReadyForUpdate(publicInstance, callerName) {\n  (\"production\" !== \"development\" ? invariant(\n    ReactCurrentOwner.current == null,\n    '%s(...): Cannot update during an existing state transition ' +\n    '(such as within `render`). Render methods should be a pure function ' +\n    'of props and state.',\n    callerName\n  ) : invariant(ReactCurrentOwner.current == null));\n\n  var internalInstance = ReactInstanceMap.get(publicInstance);\n  if (!internalInstance) {\n    if (\"production\" !== \"development\") {\n      // Only warn when we have a callerName. Otherwise we should be silent.\n      // We're probably calling from enqueueCallback. We don't want to warn\n      // there because we already warned for the corresponding lifecycle method.\n      (\"production\" !== \"development\" ? warning(\n        !callerName,\n        '%s(...): Can only update a mounted or mounting component. ' +\n        'This usually means you called %s() on an unmounted ' +\n        'component. This is a no-op.',\n        callerName,\n        callerName\n      ) : null);\n    }\n    return null;\n  }\n\n  if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {\n    return null;\n  }\n\n  return internalInstance;\n}\n\n/**\n * ReactUpdateQueue allows for state updates to be scheduled into a later\n * reconciliation step.\n */\nvar ReactUpdateQueue = {\n\n  /**\n   * Enqueue a callback that will be executed after all the pending updates\n   * have processed.\n   *\n   * @param {ReactClass} publicInstance The instance to use as `this` context.\n   * @param {?function} callback Called after state is updated.\n   * @internal\n   */\n  enqueueCallback: function(publicInstance, callback) {\n    (\"production\" !== \"development\" ? invariant(\n      typeof callback === 'function',\n      'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +\n      '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +\n      'isn\\'t callable.'\n    ) : invariant(typeof callback === 'function'));\n    var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);\n\n    // Previously we would throw an error if we didn't have an internal\n    // instance. Since we want to make it a no-op instead, we mirror the same\n    // behavior we have in other enqueue* methods.\n    // We also need to ignore callbacks in componentWillMount. See\n    // enqueueUpdates.\n    if (!internalInstance ||\n        internalInstance === ReactLifeCycle.currentlyMountingInstance) {\n      return null;\n    }\n\n    if (internalInstance._pendingCallbacks) {\n      internalInstance._pendingCallbacks.push(callback);\n    } else {\n      internalInstance._pendingCallbacks = [callback];\n    }\n    // TODO: The callback here is ignored when setState is called from\n    // componentWillMount. Either fix it or disallow doing so completely in\n    // favor of getInitialState. Alternatively, we can disallow\n    // componentWillMount during server-side rendering.\n    enqueueUpdate(internalInstance);\n  },\n\n  enqueueCallbackInternal: function(internalInstance, callback) {\n    (\"production\" !== \"development\" ? invariant(\n      typeof callback === 'function',\n      'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +\n      '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +\n      'isn\\'t callable.'\n    ) : invariant(typeof callback === 'function'));\n    if (internalInstance._pendingCallbacks) {\n      internalInstance._pendingCallbacks.push(callback);\n    } else {\n      internalInstance._pendingCallbacks = [callback];\n    }\n    enqueueUpdate(internalInstance);\n  },\n\n  /**\n   * Forces an update. This should only be invoked when it is known with\n   * certainty that we are **not** in a DOM transaction.\n   *\n   * You may want to call this when you know that some deeper aspect of the\n   * component's state has changed but `setState` was not called.\n   *\n   * This will not invoke `shouldUpdateComponent`, but it will invoke\n   * `componentWillUpdate` and `componentDidUpdate`.\n   *\n   * @param {ReactClass} publicInstance The instance that should rerender.\n   * @internal\n   */\n  enqueueForceUpdate: function(publicInstance) {\n    var internalInstance = getInternalInstanceReadyForUpdate(\n      publicInstance,\n      'forceUpdate'\n    );\n\n    if (!internalInstance) {\n      return;\n    }\n\n    internalInstance._pendingForceUpdate = true;\n\n    enqueueUpdate(internalInstance);\n  },\n\n  /**\n   * Replaces all of the state. Always use this or `setState` to mutate state.\n   * You should treat `this.state` as immutable.\n   *\n   * There is no guarantee that `this.state` will be immediately updated, so\n   * accessing `this.state` after calling this method may return the old value.\n   *\n   * @param {ReactClass} publicInstance The instance that should rerender.\n   * @param {object} completeState Next state.\n   * @internal\n   */\n  enqueueReplaceState: function(publicInstance, completeState) {\n    var internalInstance = getInternalInstanceReadyForUpdate(\n      publicInstance,\n      'replaceState'\n    );\n\n    if (!internalInstance) {\n      return;\n    }\n\n    internalInstance._pendingStateQueue = [completeState];\n    internalInstance._pendingReplaceState = true;\n\n    enqueueUpdate(internalInstance);\n  },\n\n  /**\n   * Sets a subset of the state. This only exists because _pendingState is\n   * internal. This provides a merging strategy that is not available to deep\n   * properties which is confusing. TODO: Expose pendingState or don't use it\n   * during the merge.\n   *\n   * @param {ReactClass} publicInstance The instance that should rerender.\n   * @param {object} partialState Next partial state to be merged with state.\n   * @internal\n   */\n  enqueueSetState: function(publicInstance, partialState) {\n    var internalInstance = getInternalInstanceReadyForUpdate(\n      publicInstance,\n      'setState'\n    );\n\n    if (!internalInstance) {\n      return;\n    }\n\n    var queue =\n      internalInstance._pendingStateQueue ||\n      (internalInstance._pendingStateQueue = []);\n    queue.push(partialState);\n\n    enqueueUpdate(internalInstance);\n  },\n\n  /**\n   * Sets a subset of the props.\n   *\n   * @param {ReactClass} publicInstance The instance that should rerender.\n   * @param {object} partialProps Subset of the next props.\n   * @internal\n   */\n  enqueueSetProps: function(publicInstance, partialProps) {\n    var internalInstance = getInternalInstanceReadyForUpdate(\n      publicInstance,\n      'setProps'\n    );\n\n    if (!internalInstance) {\n      return;\n    }\n\n    (\"production\" !== \"development\" ? invariant(\n      internalInstance._isTopLevel,\n      'setProps(...): You called `setProps` on a ' +\n      'component with a parent. This is an anti-pattern since props will ' +\n      'get reactively updated when rendered. Instead, change the owner\\'s ' +\n      '`render` method to pass the correct value as props to the component ' +\n      'where it is created.'\n    ) : invariant(internalInstance._isTopLevel));\n\n    // Merge with the pending element if it exists, otherwise with existing\n    // element props.\n    var element = internalInstance._pendingElement ||\n                  internalInstance._currentElement;\n    var props = assign({}, element.props, partialProps);\n    internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(\n      element,\n      props\n    );\n\n    enqueueUpdate(internalInstance);\n  },\n\n  /**\n   * Replaces all of the props.\n   *\n   * @param {ReactClass} publicInstance The instance that should rerender.\n   * @param {object} props New props.\n   * @internal\n   */\n  enqueueReplaceProps: function(publicInstance, props) {\n    var internalInstance = getInternalInstanceReadyForUpdate(\n      publicInstance,\n      'replaceProps'\n    );\n\n    if (!internalInstance) {\n      return;\n    }\n\n    (\"production\" !== \"development\" ? invariant(\n      internalInstance._isTopLevel,\n      'replaceProps(...): You called `replaceProps` on a ' +\n      'component with a parent. This is an anti-pattern since props will ' +\n      'get reactively updated when rendered. Instead, change the owner\\'s ' +\n      '`render` method to pass the correct value as props to the component ' +\n      'where it is created.'\n    ) : invariant(internalInstance._isTopLevel));\n\n    // Merge with the pending element if it exists, otherwise with existing\n    // element props.\n    var element = internalInstance._pendingElement ||\n                  internalInstance._currentElement;\n    internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(\n      element,\n      props\n    );\n\n    enqueueUpdate(internalInstance);\n  },\n\n  enqueueElementInternal: function(internalInstance, newElement) {\n    internalInstance._pendingElement = newElement;\n    enqueueUpdate(internalInstance);\n  }\n\n};\n\nmodule.exports = ReactUpdateQueue;\n\n},{\"135\":135,\"154\":154,\"27\":27,\"39\":39,\"57\":57,\"67\":67,\"68\":68,\"87\":87}],87:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ReactUpdates\n */\n\n'use strict';\n\nvar CallbackQueue = _dereq_(6);\nvar PooledClass = _dereq_(28);\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactPerf = _dereq_(75);\nvar ReactReconciler = _dereq_(81);\nvar Transaction = _dereq_(103);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\nvar dirtyComponents = [];\nvar asapCallbackQueue = CallbackQueue.getPooled();\nvar asapEnqueued = false;\n\nvar batchingStrategy = null;\n\nfunction ensureInjected() {\n  (\"production\" !== \"development\" ? invariant(\n    ReactUpdates.ReactReconcileTransaction && batchingStrategy,\n    'ReactUpdates: must inject a reconcile transaction class and batching ' +\n    'strategy'\n  ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));\n}\n\nvar NESTED_UPDATES = {\n  initialize: function() {\n    this.dirtyComponentsLength = dirtyComponents.length;\n  },\n  close: function() {\n    if (this.dirtyComponentsLength !== dirtyComponents.length) {\n      // Additional updates were enqueued by componentDidUpdate handlers or\n      // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run\n      // these new updates so that if A's componentDidUpdate calls setState on\n      // B, B will update before the callback A's updater provided when calling\n      // setState.\n      dirtyComponents.splice(0, this.dirtyComponentsLength);\n      flushBatchedUpdates();\n    } else {\n      dirtyComponents.length = 0;\n    }\n  }\n};\n\nvar UPDATE_QUEUEING = {\n  initialize: function() {\n    this.callbackQueue.reset();\n  },\n  close: function() {\n    this.callbackQueue.notifyAll();\n  }\n};\n\nvar TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];\n\nfunction ReactUpdatesFlushTransaction() {\n  this.reinitializeTransaction();\n  this.dirtyComponentsLength = null;\n  this.callbackQueue = CallbackQueue.getPooled();\n  this.reconcileTransaction =\n    ReactUpdates.ReactReconcileTransaction.getPooled();\n}\n\nassign(\n  ReactUpdatesFlushTransaction.prototype,\n  Transaction.Mixin, {\n  getTransactionWrappers: function() {\n    return TRANSACTION_WRAPPERS;\n  },\n\n  destructor: function() {\n    this.dirtyComponentsLength = null;\n    CallbackQueue.release(this.callbackQueue);\n    this.callbackQueue = null;\n    ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);\n    this.reconcileTransaction = null;\n  },\n\n  perform: function(method, scope, a) {\n    // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`\n    // with this transaction's wrappers around it.\n    return Transaction.Mixin.perform.call(\n      this,\n      this.reconcileTransaction.perform,\n      this.reconcileTransaction,\n      method,\n      scope,\n      a\n    );\n  }\n});\n\nPooledClass.addPoolingTo(ReactUpdatesFlushTransaction);\n\nfunction batchedUpdates(callback, a, b, c, d) {\n  ensureInjected();\n  batchingStrategy.batchedUpdates(callback, a, b, c, d);\n}\n\n/**\n * Array comparator for ReactComponents by mount ordering.\n *\n * @param {ReactComponent} c1 first component you're comparing\n * @param {ReactComponent} c2 second component you're comparing\n * @return {number} Return value usable by Array.prototype.sort().\n */\nfunction mountOrderComparator(c1, c2) {\n  return c1._mountOrder - c2._mountOrder;\n}\n\nfunction runBatchedUpdates(transaction) {\n  var len = transaction.dirtyComponentsLength;\n  (\"production\" !== \"development\" ? invariant(\n    len === dirtyComponents.length,\n    'Expected flush transaction\\'s stored dirty-components length (%s) to ' +\n    'match dirty-components array length (%s).',\n    len,\n    dirtyComponents.length\n  ) : invariant(len === dirtyComponents.length));\n\n  // Since reconciling a component higher in the owner hierarchy usually (not\n  // always -- see shouldComponentUpdate()) will reconcile children, reconcile\n  // them before their children by sorting the array.\n  dirtyComponents.sort(mountOrderComparator);\n\n  for (var i = 0; i < len; i++) {\n    // If a component is unmounted before pending changes apply, it will still\n    // be here, but we assume that it has cleared its _pendingCallbacks and\n    // that performUpdateIfNecessary is a noop.\n    var component = dirtyComponents[i];\n\n    // If performUpdateIfNecessary happens to enqueue any new updates, we\n    // shouldn't execute the callbacks until the next render happens, so\n    // stash the callbacks first\n    var callbacks = component._pendingCallbacks;\n    component._pendingCallbacks = null;\n\n    ReactReconciler.performUpdateIfNecessary(\n      component,\n      transaction.reconcileTransaction\n    );\n\n    if (callbacks) {\n      for (var j = 0; j < callbacks.length; j++) {\n        transaction.callbackQueue.enqueue(\n          callbacks[j],\n          component.getPublicInstance()\n        );\n      }\n    }\n  }\n}\n\nvar flushBatchedUpdates = function() {\n  // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents\n  // array and perform any updates enqueued by mount-ready handlers (i.e.,\n  // componentDidUpdate) but we need to check here too in order to catch\n  // updates enqueued by setState callbacks and asap calls.\n  while (dirtyComponents.length || asapEnqueued) {\n    if (dirtyComponents.length) {\n      var transaction = ReactUpdatesFlushTransaction.getPooled();\n      transaction.perform(runBatchedUpdates, null, transaction);\n      ReactUpdatesFlushTransaction.release(transaction);\n    }\n\n    if (asapEnqueued) {\n      asapEnqueued = false;\n      var queue = asapCallbackQueue;\n      asapCallbackQueue = CallbackQueue.getPooled();\n      queue.notifyAll();\n      CallbackQueue.release(queue);\n    }\n  }\n};\nflushBatchedUpdates = ReactPerf.measure(\n  'ReactUpdates',\n  'flushBatchedUpdates',\n  flushBatchedUpdates\n);\n\n/**\n * Mark a component as needing a rerender, adding an optional callback to a\n * list of functions which will be executed once the rerender occurs.\n */\nfunction enqueueUpdate(component) {\n  ensureInjected();\n\n  // Various parts of our code (such as ReactCompositeComponent's\n  // _renderValidatedComponent) assume that calls to render aren't nested;\n  // verify that that's the case. (This is called by each top-level update\n  // function, like setProps, setState, forceUpdate, etc.; creation and\n  // destruction of top-level components is guarded in ReactMount.)\n  (\"production\" !== \"development\" ? warning(\n    ReactCurrentOwner.current == null,\n    'enqueueUpdate(): Render methods should be a pure function of props ' +\n    'and state; triggering nested component updates from render is not ' +\n    'allowed. If necessary, trigger nested updates in ' +\n    'componentDidUpdate.'\n  ) : null);\n\n  if (!batchingStrategy.isBatchingUpdates) {\n    batchingStrategy.batchedUpdates(enqueueUpdate, component);\n    return;\n  }\n\n  dirtyComponents.push(component);\n}\n\n/**\n * Enqueue a callback to be run at the end of the current batching cycle. Throws\n * if no updates are currently being performed.\n */\nfunction asap(callback, context) {\n  (\"production\" !== \"development\" ? invariant(\n    batchingStrategy.isBatchingUpdates,\n    'ReactUpdates.asap: Can\\'t enqueue an asap callback in a context where' +\n    'updates are not being batched.'\n  ) : invariant(batchingStrategy.isBatchingUpdates));\n  asapCallbackQueue.enqueue(callback, context);\n  asapEnqueued = true;\n}\n\nvar ReactUpdatesInjection = {\n  injectReconcileTransaction: function(ReconcileTransaction) {\n    (\"production\" !== \"development\" ? invariant(\n      ReconcileTransaction,\n      'ReactUpdates: must provide a reconcile transaction class'\n    ) : invariant(ReconcileTransaction));\n    ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;\n  },\n\n  injectBatchingStrategy: function(_batchingStrategy) {\n    (\"production\" !== \"development\" ? invariant(\n      _batchingStrategy,\n      'ReactUpdates: must provide a batching strategy'\n    ) : invariant(_batchingStrategy));\n    (\"production\" !== \"development\" ? invariant(\n      typeof _batchingStrategy.batchedUpdates === 'function',\n      'ReactUpdates: must provide a batchedUpdates() function'\n    ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));\n    (\"production\" !== \"development\" ? invariant(\n      typeof _batchingStrategy.isBatchingUpdates === 'boolean',\n      'ReactUpdates: must provide an isBatchingUpdates boolean attribute'\n    ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));\n    batchingStrategy = _batchingStrategy;\n  }\n};\n\nvar ReactUpdates = {\n  /**\n   * React references `ReactReconcileTransaction` using this property in order\n   * to allow dependency injection.\n   *\n   * @internal\n   */\n  ReactReconcileTransaction: null,\n\n  batchedUpdates: batchedUpdates,\n  enqueueUpdate: enqueueUpdate,\n  flushBatchedUpdates: flushBatchedUpdates,\n  injection: ReactUpdatesInjection,\n  asap: asap\n};\n\nmodule.exports = ReactUpdates;\n\n},{\"103\":103,\"135\":135,\"154\":154,\"27\":27,\"28\":28,\"39\":39,\"6\":6,\"75\":75,\"81\":81}],88:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SVGDOMPropertyConfig\n */\n\n/*jslint bitwise: true*/\n\n'use strict';\n\nvar DOMProperty = _dereq_(10);\n\nvar MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;\n\nvar SVGDOMPropertyConfig = {\n  Properties: {\n    clipPath: MUST_USE_ATTRIBUTE,\n    cx: MUST_USE_ATTRIBUTE,\n    cy: MUST_USE_ATTRIBUTE,\n    d: MUST_USE_ATTRIBUTE,\n    dx: MUST_USE_ATTRIBUTE,\n    dy: MUST_USE_ATTRIBUTE,\n    fill: MUST_USE_ATTRIBUTE,\n    fillOpacity: MUST_USE_ATTRIBUTE,\n    fontFamily: MUST_USE_ATTRIBUTE,\n    fontSize: MUST_USE_ATTRIBUTE,\n    fx: MUST_USE_ATTRIBUTE,\n    fy: MUST_USE_ATTRIBUTE,\n    gradientTransform: MUST_USE_ATTRIBUTE,\n    gradientUnits: MUST_USE_ATTRIBUTE,\n    markerEnd: MUST_USE_ATTRIBUTE,\n    markerMid: MUST_USE_ATTRIBUTE,\n    markerStart: MUST_USE_ATTRIBUTE,\n    offset: MUST_USE_ATTRIBUTE,\n    opacity: MUST_USE_ATTRIBUTE,\n    patternContentUnits: MUST_USE_ATTRIBUTE,\n    patternUnits: MUST_USE_ATTRIBUTE,\n    points: MUST_USE_ATTRIBUTE,\n    preserveAspectRatio: MUST_USE_ATTRIBUTE,\n    r: MUST_USE_ATTRIBUTE,\n    rx: MUST_USE_ATTRIBUTE,\n    ry: MUST_USE_ATTRIBUTE,\n    spreadMethod: MUST_USE_ATTRIBUTE,\n    stopColor: MUST_USE_ATTRIBUTE,\n    stopOpacity: MUST_USE_ATTRIBUTE,\n    stroke: MUST_USE_ATTRIBUTE,\n    strokeDasharray: MUST_USE_ATTRIBUTE,\n    strokeLinecap: MUST_USE_ATTRIBUTE,\n    strokeOpacity: MUST_USE_ATTRIBUTE,\n    strokeWidth: MUST_USE_ATTRIBUTE,\n    textAnchor: MUST_USE_ATTRIBUTE,\n    transform: MUST_USE_ATTRIBUTE,\n    version: MUST_USE_ATTRIBUTE,\n    viewBox: MUST_USE_ATTRIBUTE,\n    x1: MUST_USE_ATTRIBUTE,\n    x2: MUST_USE_ATTRIBUTE,\n    x: MUST_USE_ATTRIBUTE,\n    y1: MUST_USE_ATTRIBUTE,\n    y2: MUST_USE_ATTRIBUTE,\n    y: MUST_USE_ATTRIBUTE\n  },\n  DOMAttributeNames: {\n    clipPath: 'clip-path',\n    fillOpacity: 'fill-opacity',\n    fontFamily: 'font-family',\n    fontSize: 'font-size',\n    gradientTransform: 'gradientTransform',\n    gradientUnits: 'gradientUnits',\n    markerEnd: 'marker-end',\n    markerMid: 'marker-mid',\n    markerStart: 'marker-start',\n    patternContentUnits: 'patternContentUnits',\n    patternUnits: 'patternUnits',\n    preserveAspectRatio: 'preserveAspectRatio',\n    spreadMethod: 'spreadMethod',\n    stopColor: 'stop-color',\n    stopOpacity: 'stop-opacity',\n    strokeDasharray: 'stroke-dasharray',\n    strokeLinecap: 'stroke-linecap',\n    strokeOpacity: 'stroke-opacity',\n    strokeWidth: 'stroke-width',\n    textAnchor: 'text-anchor',\n    viewBox: 'viewBox'\n  }\n};\n\nmodule.exports = SVGDOMPropertyConfig;\n\n},{\"10\":10}],89:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SelectEventPlugin\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPropagators = _dereq_(20);\nvar ReactInputSelection = _dereq_(65);\nvar SyntheticEvent = _dereq_(95);\n\nvar getActiveElement = _dereq_(121);\nvar isTextInputElement = _dereq_(138);\nvar keyOf = _dereq_(141);\nvar shallowEqual = _dereq_(150);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n  select: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onSelect: null}),\n      captured: keyOf({onSelectCapture: null})\n    },\n    dependencies: [\n      topLevelTypes.topBlur,\n      topLevelTypes.topContextMenu,\n      topLevelTypes.topFocus,\n      topLevelTypes.topKeyDown,\n      topLevelTypes.topMouseDown,\n      topLevelTypes.topMouseUp,\n      topLevelTypes.topSelectionChange\n    ]\n  }\n};\n\nvar activeElement = null;\nvar activeElementID = null;\nvar lastSelection = null;\nvar mouseDown = false;\n\n/**\n * Get an object which is a unique representation of the current selection.\n *\n * The return value will not be consistent across nodes or browsers, but\n * two identical selections on the same node will return identical objects.\n *\n * @param {DOMElement} node\n * @param {object}\n */\nfunction getSelection(node) {\n  if ('selectionStart' in node &&\n      ReactInputSelection.hasSelectionCapabilities(node)) {\n    return {\n      start: node.selectionStart,\n      end: node.selectionEnd\n    };\n  } else if (window.getSelection) {\n    var selection = window.getSelection();\n    return {\n      anchorNode: selection.anchorNode,\n      anchorOffset: selection.anchorOffset,\n      focusNode: selection.focusNode,\n      focusOffset: selection.focusOffset\n    };\n  } else if (document.selection) {\n    var range = document.selection.createRange();\n    return {\n      parentElement: range.parentElement(),\n      text: range.text,\n      top: range.boundingTop,\n      left: range.boundingLeft\n    };\n  }\n}\n\n/**\n * Poll selection to see whether it's changed.\n *\n * @param {object} nativeEvent\n * @return {?SyntheticEvent}\n */\nfunction constructSelectEvent(nativeEvent) {\n  // Ensure we have the right element, and that the user is not dragging a\n  // selection (this matches native `select` event behavior). In HTML5, select\n  // fires only on input and textarea thus if there's no focused element we\n  // won't dispatch.\n  if (mouseDown ||\n      activeElement == null ||\n      activeElement !== getActiveElement()) {\n    return null;\n  }\n\n  // Only fire when selection has actually changed.\n  var currentSelection = getSelection(activeElement);\n  if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {\n    lastSelection = currentSelection;\n\n    var syntheticEvent = SyntheticEvent.getPooled(\n      eventTypes.select,\n      activeElementID,\n      nativeEvent\n    );\n\n    syntheticEvent.type = 'select';\n    syntheticEvent.target = activeElement;\n\n    EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);\n\n    return syntheticEvent;\n  }\n}\n\n/**\n * This plugin creates an `onSelect` event that normalizes select events\n * across form elements.\n *\n * Supported elements are:\n * - input (see `isTextInputElement`)\n * - textarea\n * - contentEditable\n *\n * This differs from native browser implementations in the following ways:\n * - Fires on contentEditable fields as well as inputs.\n * - Fires for collapsed selection.\n * - Fires after user input.\n */\nvar SelectEventPlugin = {\n\n  eventTypes: eventTypes,\n\n  /**\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n\n    switch (topLevelType) {\n      // Track the input node that has focus.\n      case topLevelTypes.topFocus:\n        if (isTextInputElement(topLevelTarget) ||\n            topLevelTarget.contentEditable === 'true') {\n          activeElement = topLevelTarget;\n          activeElementID = topLevelTargetID;\n          lastSelection = null;\n        }\n        break;\n      case topLevelTypes.topBlur:\n        activeElement = null;\n        activeElementID = null;\n        lastSelection = null;\n        break;\n\n      // Don't fire the event while the user is dragging. This matches the\n      // semantics of the native select event.\n      case topLevelTypes.topMouseDown:\n        mouseDown = true;\n        break;\n      case topLevelTypes.topContextMenu:\n      case topLevelTypes.topMouseUp:\n        mouseDown = false;\n        return constructSelectEvent(nativeEvent);\n\n      // Chrome and IE fire non-standard event when selection is changed (and\n      // sometimes when it hasn't).\n      // Firefox doesn't support selectionchange, so check selection status\n      // after each key entry. The selection changes after keydown and before\n      // keyup, but we check on keydown as well in the case of holding down a\n      // key, when multiple keydown events are fired but only one keyup is.\n      case topLevelTypes.topSelectionChange:\n      case topLevelTypes.topKeyDown:\n      case topLevelTypes.topKeyUp:\n        return constructSelectEvent(nativeEvent);\n    }\n  }\n};\n\nmodule.exports = SelectEventPlugin;\n\n},{\"121\":121,\"138\":138,\"141\":141,\"15\":15,\"150\":150,\"20\":20,\"65\":65,\"95\":95}],90:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ServerReactRootIndex\n * @typechecks\n */\n\n'use strict';\n\n/**\n * Size of the reactRoot ID space. We generate random numbers for React root\n * IDs and if there's a collision the events and DOM update system will\n * get confused. In the future we need a way to generate GUIDs but for\n * now this will work on a smaller scale.\n */\nvar GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);\n\nvar ServerReactRootIndex = {\n  createReactRootIndex: function() {\n    return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);\n  }\n};\n\nmodule.exports = ServerReactRootIndex;\n\n},{}],91:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SimpleEventPlugin\n */\n\n'use strict';\n\nvar EventConstants = _dereq_(15);\nvar EventPluginUtils = _dereq_(19);\nvar EventPropagators = _dereq_(20);\nvar SyntheticClipboardEvent = _dereq_(92);\nvar SyntheticEvent = _dereq_(95);\nvar SyntheticFocusEvent = _dereq_(96);\nvar SyntheticKeyboardEvent = _dereq_(98);\nvar SyntheticMouseEvent = _dereq_(99);\nvar SyntheticDragEvent = _dereq_(94);\nvar SyntheticTouchEvent = _dereq_(100);\nvar SyntheticUIEvent = _dereq_(101);\nvar SyntheticWheelEvent = _dereq_(102);\n\nvar getEventCharCode = _dereq_(122);\n\nvar invariant = _dereq_(135);\nvar keyOf = _dereq_(141);\nvar warning = _dereq_(154);\n\nvar topLevelTypes = EventConstants.topLevelTypes;\n\nvar eventTypes = {\n  blur: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onBlur: true}),\n      captured: keyOf({onBlurCapture: true})\n    }\n  },\n  click: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onClick: true}),\n      captured: keyOf({onClickCapture: true})\n    }\n  },\n  contextMenu: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onContextMenu: true}),\n      captured: keyOf({onContextMenuCapture: true})\n    }\n  },\n  copy: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onCopy: true}),\n      captured: keyOf({onCopyCapture: true})\n    }\n  },\n  cut: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onCut: true}),\n      captured: keyOf({onCutCapture: true})\n    }\n  },\n  doubleClick: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDoubleClick: true}),\n      captured: keyOf({onDoubleClickCapture: true})\n    }\n  },\n  drag: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDrag: true}),\n      captured: keyOf({onDragCapture: true})\n    }\n  },\n  dragEnd: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragEnd: true}),\n      captured: keyOf({onDragEndCapture: true})\n    }\n  },\n  dragEnter: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragEnter: true}),\n      captured: keyOf({onDragEnterCapture: true})\n    }\n  },\n  dragExit: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragExit: true}),\n      captured: keyOf({onDragExitCapture: true})\n    }\n  },\n  dragLeave: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragLeave: true}),\n      captured: keyOf({onDragLeaveCapture: true})\n    }\n  },\n  dragOver: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragOver: true}),\n      captured: keyOf({onDragOverCapture: true})\n    }\n  },\n  dragStart: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDragStart: true}),\n      captured: keyOf({onDragStartCapture: true})\n    }\n  },\n  drop: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onDrop: true}),\n      captured: keyOf({onDropCapture: true})\n    }\n  },\n  focus: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onFocus: true}),\n      captured: keyOf({onFocusCapture: true})\n    }\n  },\n  input: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onInput: true}),\n      captured: keyOf({onInputCapture: true})\n    }\n  },\n  keyDown: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onKeyDown: true}),\n      captured: keyOf({onKeyDownCapture: true})\n    }\n  },\n  keyPress: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onKeyPress: true}),\n      captured: keyOf({onKeyPressCapture: true})\n    }\n  },\n  keyUp: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onKeyUp: true}),\n      captured: keyOf({onKeyUpCapture: true})\n    }\n  },\n  load: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onLoad: true}),\n      captured: keyOf({onLoadCapture: true})\n    }\n  },\n  error: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onError: true}),\n      captured: keyOf({onErrorCapture: true})\n    }\n  },\n  // Note: We do not allow listening to mouseOver events. Instead, use the\n  // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.\n  mouseDown: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onMouseDown: true}),\n      captured: keyOf({onMouseDownCapture: true})\n    }\n  },\n  mouseMove: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onMouseMove: true}),\n      captured: keyOf({onMouseMoveCapture: true})\n    }\n  },\n  mouseOut: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onMouseOut: true}),\n      captured: keyOf({onMouseOutCapture: true})\n    }\n  },\n  mouseOver: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onMouseOver: true}),\n      captured: keyOf({onMouseOverCapture: true})\n    }\n  },\n  mouseUp: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onMouseUp: true}),\n      captured: keyOf({onMouseUpCapture: true})\n    }\n  },\n  paste: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onPaste: true}),\n      captured: keyOf({onPasteCapture: true})\n    }\n  },\n  reset: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onReset: true}),\n      captured: keyOf({onResetCapture: true})\n    }\n  },\n  scroll: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onScroll: true}),\n      captured: keyOf({onScrollCapture: true})\n    }\n  },\n  submit: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onSubmit: true}),\n      captured: keyOf({onSubmitCapture: true})\n    }\n  },\n  touchCancel: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onTouchCancel: true}),\n      captured: keyOf({onTouchCancelCapture: true})\n    }\n  },\n  touchEnd: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onTouchEnd: true}),\n      captured: keyOf({onTouchEndCapture: true})\n    }\n  },\n  touchMove: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onTouchMove: true}),\n      captured: keyOf({onTouchMoveCapture: true})\n    }\n  },\n  touchStart: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onTouchStart: true}),\n      captured: keyOf({onTouchStartCapture: true})\n    }\n  },\n  wheel: {\n    phasedRegistrationNames: {\n      bubbled: keyOf({onWheel: true}),\n      captured: keyOf({onWheelCapture: true})\n    }\n  }\n};\n\nvar topLevelEventsToDispatchConfig = {\n  topBlur:        eventTypes.blur,\n  topClick:       eventTypes.click,\n  topContextMenu: eventTypes.contextMenu,\n  topCopy:        eventTypes.copy,\n  topCut:         eventTypes.cut,\n  topDoubleClick: eventTypes.doubleClick,\n  topDrag:        eventTypes.drag,\n  topDragEnd:     eventTypes.dragEnd,\n  topDragEnter:   eventTypes.dragEnter,\n  topDragExit:    eventTypes.dragExit,\n  topDragLeave:   eventTypes.dragLeave,\n  topDragOver:    eventTypes.dragOver,\n  topDragStart:   eventTypes.dragStart,\n  topDrop:        eventTypes.drop,\n  topError:       eventTypes.error,\n  topFocus:       eventTypes.focus,\n  topInput:       eventTypes.input,\n  topKeyDown:     eventTypes.keyDown,\n  topKeyPress:    eventTypes.keyPress,\n  topKeyUp:       eventTypes.keyUp,\n  topLoad:        eventTypes.load,\n  topMouseDown:   eventTypes.mouseDown,\n  topMouseMove:   eventTypes.mouseMove,\n  topMouseOut:    eventTypes.mouseOut,\n  topMouseOver:   eventTypes.mouseOver,\n  topMouseUp:     eventTypes.mouseUp,\n  topPaste:       eventTypes.paste,\n  topReset:       eventTypes.reset,\n  topScroll:      eventTypes.scroll,\n  topSubmit:      eventTypes.submit,\n  topTouchCancel: eventTypes.touchCancel,\n  topTouchEnd:    eventTypes.touchEnd,\n  topTouchMove:   eventTypes.touchMove,\n  topTouchStart:  eventTypes.touchStart,\n  topWheel:       eventTypes.wheel\n};\n\nfor (var type in topLevelEventsToDispatchConfig) {\n  topLevelEventsToDispatchConfig[type].dependencies = [type];\n}\n\nvar SimpleEventPlugin = {\n\n  eventTypes: eventTypes,\n\n  /**\n   * Same as the default implementation, except cancels the event when return\n   * value is false. This behavior will be disabled in a future release.\n   *\n   * @param {object} Event to be dispatched.\n   * @param {function} Application-level callback.\n   * @param {string} domID DOM ID to pass to the callback.\n   */\n  executeDispatch: function(event, listener, domID) {\n    var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);\n\n    (\"production\" !== \"development\" ? warning(\n      typeof returnValue !== 'boolean',\n      'Returning `false` from an event handler is deprecated and will be ' +\n      'ignored in a future release. Instead, manually call ' +\n      'e.stopPropagation() or e.preventDefault(), as appropriate.'\n    ) : null);\n\n    if (returnValue === false) {\n      event.stopPropagation();\n      event.preventDefault();\n    }\n  },\n\n  /**\n   * @param {string} topLevelType Record from `EventConstants`.\n   * @param {DOMEventTarget} topLevelTarget The listening component root node.\n   * @param {string} topLevelTargetID ID of `topLevelTarget`.\n   * @param {object} nativeEvent Native browser event.\n   * @return {*} An accumulation of synthetic events.\n   * @see {EventPluginHub.extractEvents}\n   */\n  extractEvents: function(\n      topLevelType,\n      topLevelTarget,\n      topLevelTargetID,\n      nativeEvent) {\n    var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];\n    if (!dispatchConfig) {\n      return null;\n    }\n    var EventConstructor;\n    switch (topLevelType) {\n      case topLevelTypes.topInput:\n      case topLevelTypes.topLoad:\n      case topLevelTypes.topError:\n      case topLevelTypes.topReset:\n      case topLevelTypes.topSubmit:\n        // HTML Events\n        // @see http://www.w3.org/TR/html5/index.html#events-0\n        EventConstructor = SyntheticEvent;\n        break;\n      case topLevelTypes.topKeyPress:\n        // FireFox creates a keypress event for function keys too. This removes\n        // the unwanted keypress events. Enter is however both printable and\n        // non-printable. One would expect Tab to be as well (but it isn't).\n        if (getEventCharCode(nativeEvent) === 0) {\n          return null;\n        }\n        /* falls through */\n      case topLevelTypes.topKeyDown:\n      case topLevelTypes.topKeyUp:\n        EventConstructor = SyntheticKeyboardEvent;\n        break;\n      case topLevelTypes.topBlur:\n      case topLevelTypes.topFocus:\n        EventConstructor = SyntheticFocusEvent;\n        break;\n      case topLevelTypes.topClick:\n        // Firefox creates a click event on right mouse clicks. This removes the\n        // unwanted click events.\n        if (nativeEvent.button === 2) {\n          return null;\n        }\n        /* falls through */\n      case topLevelTypes.topContextMenu:\n      case topLevelTypes.topDoubleClick:\n      case topLevelTypes.topMouseDown:\n      case topLevelTypes.topMouseMove:\n      case topLevelTypes.topMouseOut:\n      case topLevelTypes.topMouseOver:\n      case topLevelTypes.topMouseUp:\n        EventConstructor = SyntheticMouseEvent;\n        break;\n      case topLevelTypes.topDrag:\n      case topLevelTypes.topDragEnd:\n      case topLevelTypes.topDragEnter:\n      case topLevelTypes.topDragExit:\n      case topLevelTypes.topDragLeave:\n      case topLevelTypes.topDragOver:\n      case topLevelTypes.topDragStart:\n      case topLevelTypes.topDrop:\n        EventConstructor = SyntheticDragEvent;\n        break;\n      case topLevelTypes.topTouchCancel:\n      case topLevelTypes.topTouchEnd:\n      case topLevelTypes.topTouchMove:\n      case topLevelTypes.topTouchStart:\n        EventConstructor = SyntheticTouchEvent;\n        break;\n      case topLevelTypes.topScroll:\n        EventConstructor = SyntheticUIEvent;\n        break;\n      case topLevelTypes.topWheel:\n        EventConstructor = SyntheticWheelEvent;\n        break;\n      case topLevelTypes.topCopy:\n      case topLevelTypes.topCut:\n      case topLevelTypes.topPaste:\n        EventConstructor = SyntheticClipboardEvent;\n        break;\n    }\n    (\"production\" !== \"development\" ? invariant(\n      EventConstructor,\n      'SimpleEventPlugin: Unhandled event type, `%s`.',\n      topLevelType\n    ) : invariant(EventConstructor));\n    var event = EventConstructor.getPooled(\n      dispatchConfig,\n      topLevelTargetID,\n      nativeEvent\n    );\n    EventPropagators.accumulateTwoPhaseDispatches(event);\n    return event;\n  }\n\n};\n\nmodule.exports = SimpleEventPlugin;\n\n},{\"100\":100,\"101\":101,\"102\":102,\"122\":122,\"135\":135,\"141\":141,\"15\":15,\"154\":154,\"19\":19,\"20\":20,\"92\":92,\"94\":94,\"95\":95,\"96\":96,\"98\":98,\"99\":99}],92:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticClipboardEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticEvent = _dereq_(95);\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/clipboard-apis/\n */\nvar ClipboardEventInterface = {\n  clipboardData: function(event) {\n    return (\n      'clipboardData' in event ?\n        event.clipboardData :\n        window.clipboardData\n    );\n  }\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);\n\nmodule.exports = SyntheticClipboardEvent;\n\n},{\"95\":95}],93:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticCompositionEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticEvent = _dereq_(95);\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents\n */\nvar CompositionEventInterface = {\n  data: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticCompositionEvent(\n  dispatchConfig,\n  dispatchMarker,\n  nativeEvent) {\n  SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(\n  SyntheticCompositionEvent,\n  CompositionEventInterface\n);\n\nmodule.exports = SyntheticCompositionEvent;\n\n},{\"95\":95}],94:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticDragEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticMouseEvent = _dereq_(99);\n\n/**\n * @interface DragEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar DragEventInterface = {\n  dataTransfer: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);\n\nmodule.exports = SyntheticDragEvent;\n\n},{\"99\":99}],95:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar PooledClass = _dereq_(28);\n\nvar assign = _dereq_(27);\nvar emptyFunction = _dereq_(114);\nvar getEventTarget = _dereq_(125);\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar EventInterface = {\n  type: null,\n  target: getEventTarget,\n  // currentTarget is set when dispatching; no use in copying it here\n  currentTarget: emptyFunction.thatReturnsNull,\n  eventPhase: null,\n  bubbles: null,\n  cancelable: null,\n  timeStamp: function(event) {\n    return event.timeStamp || Date.now();\n  },\n  defaultPrevented: null,\n  isTrusted: null\n};\n\n/**\n * Synthetic events are dispatched by event plugins, typically in response to a\n * top-level event delegation handler.\n *\n * These systems should generally use pooling to reduce the frequency of garbage\n * collection. The system should check `isPersistent` to determine whether the\n * event should be released into the pool after being dispatched. Users that\n * need a persisted event should invoke `persist`.\n *\n * Synthetic events (and subclasses) implement the DOM Level 3 Events API by\n * normalizing browser quirks. Subclasses do not necessarily have to implement a\n * DOM interface; custom application-specific events can also subclass this.\n *\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n */\nfunction SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  this.dispatchConfig = dispatchConfig;\n  this.dispatchMarker = dispatchMarker;\n  this.nativeEvent = nativeEvent;\n\n  var Interface = this.constructor.Interface;\n  for (var propName in Interface) {\n    if (!Interface.hasOwnProperty(propName)) {\n      continue;\n    }\n    var normalize = Interface[propName];\n    if (normalize) {\n      this[propName] = normalize(nativeEvent);\n    } else {\n      this[propName] = nativeEvent[propName];\n    }\n  }\n\n  var defaultPrevented = nativeEvent.defaultPrevented != null ?\n    nativeEvent.defaultPrevented :\n    nativeEvent.returnValue === false;\n  if (defaultPrevented) {\n    this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n  } else {\n    this.isDefaultPrevented = emptyFunction.thatReturnsFalse;\n  }\n  this.isPropagationStopped = emptyFunction.thatReturnsFalse;\n}\n\nassign(SyntheticEvent.prototype, {\n\n  preventDefault: function() {\n    this.defaultPrevented = true;\n    var event = this.nativeEvent;\n    if (event.preventDefault) {\n      event.preventDefault();\n    } else {\n      event.returnValue = false;\n    }\n    this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n  },\n\n  stopPropagation: function() {\n    var event = this.nativeEvent;\n    if (event.stopPropagation) {\n      event.stopPropagation();\n    } else {\n      event.cancelBubble = true;\n    }\n    this.isPropagationStopped = emptyFunction.thatReturnsTrue;\n  },\n\n  /**\n   * We release all dispatched `SyntheticEvent`s after each event loop, adding\n   * them back into the pool. This allows a way to hold onto a reference that\n   * won't be added back into the pool.\n   */\n  persist: function() {\n    this.isPersistent = emptyFunction.thatReturnsTrue;\n  },\n\n  /**\n   * Checks if this event should be released back into the pool.\n   *\n   * @return {boolean} True if this should not be released, false otherwise.\n   */\n  isPersistent: emptyFunction.thatReturnsFalse,\n\n  /**\n   * `PooledClass` looks for `destructor` on each instance it releases.\n   */\n  destructor: function() {\n    var Interface = this.constructor.Interface;\n    for (var propName in Interface) {\n      this[propName] = null;\n    }\n    this.dispatchConfig = null;\n    this.dispatchMarker = null;\n    this.nativeEvent = null;\n  }\n\n});\n\nSyntheticEvent.Interface = EventInterface;\n\n/**\n * Helper to reduce boilerplate when creating subclasses.\n *\n * @param {function} Class\n * @param {?object} Interface\n */\nSyntheticEvent.augmentClass = function(Class, Interface) {\n  var Super = this;\n\n  var prototype = Object.create(Super.prototype);\n  assign(prototype, Class.prototype);\n  Class.prototype = prototype;\n  Class.prototype.constructor = Class;\n\n  Class.Interface = assign({}, Super.Interface, Interface);\n  Class.augmentClass = Super.augmentClass;\n\n  PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);\n};\n\nPooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);\n\nmodule.exports = SyntheticEvent;\n\n},{\"114\":114,\"125\":125,\"27\":27,\"28\":28}],96:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticFocusEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticUIEvent = _dereq_(101);\n\n/**\n * @interface FocusEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar FocusEventInterface = {\n  relatedTarget: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);\n\nmodule.exports = SyntheticFocusEvent;\n\n},{\"101\":101}],97:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticInputEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticEvent = _dereq_(95);\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105\n *      /#events-inputevents\n */\nvar InputEventInterface = {\n  data: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticInputEvent(\n  dispatchConfig,\n  dispatchMarker,\n  nativeEvent) {\n  SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(\n  SyntheticInputEvent,\n  InputEventInterface\n);\n\nmodule.exports = SyntheticInputEvent;\n\n},{\"95\":95}],98:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticKeyboardEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticUIEvent = _dereq_(101);\n\nvar getEventCharCode = _dereq_(122);\nvar getEventKey = _dereq_(123);\nvar getEventModifierState = _dereq_(124);\n\n/**\n * @interface KeyboardEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar KeyboardEventInterface = {\n  key: getEventKey,\n  location: null,\n  ctrlKey: null,\n  shiftKey: null,\n  altKey: null,\n  metaKey: null,\n  repeat: null,\n  locale: null,\n  getModifierState: getEventModifierState,\n  // Legacy Interface\n  charCode: function(event) {\n    // `charCode` is the result of a KeyPress event and represents the value of\n    // the actual printable character.\n\n    // KeyPress is deprecated, but its replacement is not yet final and not\n    // implemented in any major browser. Only KeyPress has charCode.\n    if (event.type === 'keypress') {\n      return getEventCharCode(event);\n    }\n    return 0;\n  },\n  keyCode: function(event) {\n    // `keyCode` is the result of a KeyDown/Up event and represents the value of\n    // physical keyboard key.\n\n    // The actual meaning of the value depends on the users' keyboard layout\n    // which cannot be detected. Assuming that it is a US keyboard layout\n    // provides a surprisingly accurate mapping for US and European users.\n    // Due to this, it is left to the user to implement at this time.\n    if (event.type === 'keydown' || event.type === 'keyup') {\n      return event.keyCode;\n    }\n    return 0;\n  },\n  which: function(event) {\n    // `which` is an alias for either `keyCode` or `charCode` depending on the\n    // type of the event.\n    if (event.type === 'keypress') {\n      return getEventCharCode(event);\n    }\n    if (event.type === 'keydown' || event.type === 'keyup') {\n      return event.keyCode;\n    }\n    return 0;\n  }\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);\n\nmodule.exports = SyntheticKeyboardEvent;\n\n},{\"101\":101,\"122\":122,\"123\":123,\"124\":124}],99:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticMouseEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticUIEvent = _dereq_(101);\nvar ViewportMetrics = _dereq_(104);\n\nvar getEventModifierState = _dereq_(124);\n\n/**\n * @interface MouseEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar MouseEventInterface = {\n  screenX: null,\n  screenY: null,\n  clientX: null,\n  clientY: null,\n  ctrlKey: null,\n  shiftKey: null,\n  altKey: null,\n  metaKey: null,\n  getModifierState: getEventModifierState,\n  button: function(event) {\n    // Webkit, Firefox, IE9+\n    // which:  1 2 3\n    // button: 0 1 2 (standard)\n    var button = event.button;\n    if ('which' in event) {\n      return button;\n    }\n    // IE<9\n    // which:  undefined\n    // button: 0 0 0\n    // button: 1 4 2 (onmouseup)\n    return button === 2 ? 2 : button === 4 ? 1 : 0;\n  },\n  buttons: null,\n  relatedTarget: function(event) {\n    return event.relatedTarget || (\n      ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))\n    );\n  },\n  // \"Proprietary\" Interface.\n  pageX: function(event) {\n    return 'pageX' in event ?\n      event.pageX :\n      event.clientX + ViewportMetrics.currentScrollLeft;\n  },\n  pageY: function(event) {\n    return 'pageY' in event ?\n      event.pageY :\n      event.clientY + ViewportMetrics.currentScrollTop;\n  }\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);\n\nmodule.exports = SyntheticMouseEvent;\n\n},{\"101\":101,\"104\":104,\"124\":124}],100:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticTouchEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticUIEvent = _dereq_(101);\n\nvar getEventModifierState = _dereq_(124);\n\n/**\n * @interface TouchEvent\n * @see http://www.w3.org/TR/touch-events/\n */\nvar TouchEventInterface = {\n  touches: null,\n  targetTouches: null,\n  changedTouches: null,\n  altKey: null,\n  metaKey: null,\n  ctrlKey: null,\n  shiftKey: null,\n  getModifierState: getEventModifierState\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticUIEvent}\n */\nfunction SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);\n\nmodule.exports = SyntheticTouchEvent;\n\n},{\"101\":101,\"124\":124}],101:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticUIEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticEvent = _dereq_(95);\n\nvar getEventTarget = _dereq_(125);\n\n/**\n * @interface UIEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar UIEventInterface = {\n  view: function(event) {\n    if (event.view) {\n      return event.view;\n    }\n\n    var target = getEventTarget(event);\n    if (target != null && target.window === target) {\n      // target is a window object\n      return target;\n    }\n\n    var doc = target.ownerDocument;\n    // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.\n    if (doc) {\n      return doc.defaultView || doc.parentWindow;\n    } else {\n      return window;\n    }\n  },\n  detail: function(event) {\n    return event.detail || 0;\n  }\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticEvent}\n */\nfunction SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);\n\nmodule.exports = SyntheticUIEvent;\n\n},{\"125\":125,\"95\":95}],102:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule SyntheticWheelEvent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar SyntheticMouseEvent = _dereq_(99);\n\n/**\n * @interface WheelEvent\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar WheelEventInterface = {\n  deltaX: function(event) {\n    return (\n      'deltaX' in event ? event.deltaX :\n      // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).\n      'wheelDeltaX' in event ? -event.wheelDeltaX : 0\n    );\n  },\n  deltaY: function(event) {\n    return (\n      'deltaY' in event ? event.deltaY :\n      // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).\n      'wheelDeltaY' in event ? -event.wheelDeltaY :\n      // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).\n      'wheelDelta' in event ? -event.wheelDelta : 0\n    );\n  },\n  deltaZ: null,\n\n  // Browsers without \"deltaMode\" is reporting in raw wheel delta where one\n  // notch on the scroll is always +/- 120, roughly equivalent to pixels.\n  // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or\n  // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.\n  deltaMode: null\n};\n\n/**\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {string} dispatchMarker Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @extends {SyntheticMouseEvent}\n */\nfunction SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n  SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);\n}\n\nSyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);\n\nmodule.exports = SyntheticWheelEvent;\n\n},{\"99\":99}],103:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule Transaction\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n * `Transaction` creates a black box that is able to wrap any method such that\n * certain invariants are maintained before and after the method is invoked\n * (Even if an exception is thrown while invoking the wrapped method). Whoever\n * instantiates a transaction can provide enforcers of the invariants at\n * creation time. The `Transaction` class itself will supply one additional\n * automatic invariant for you - the invariant that any transaction instance\n * should not be run while it is already being run. You would typically create a\n * single instance of a `Transaction` for reuse multiple times, that potentially\n * is used to wrap several different methods. Wrappers are extremely simple -\n * they only require implementing two methods.\n *\n * <pre>\n *                       wrappers (injected at creation time)\n *                                      +        +\n *                                      |        |\n *                    +-----------------|--------|--------------+\n *                    |                 v        |              |\n *                    |      +---------------+   |              |\n *                    |   +--|    wrapper1   |---|----+         |\n *                    |   |  +---------------+   v    |         |\n *                    |   |          +-------------+  |         |\n *                    |   |     +----|   wrapper2  |--------+   |\n *                    |   |     |    +-------------+  |     |   |\n *                    |   |     |                     |     |   |\n *                    |   v     v                     v     v   | wrapper\n *                    | +---+ +---+   +---------+   +---+ +---+ | invariants\n * perform(anyMethod) | |   | |   |   |         |   |   | |   | | maintained\n * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | +---+ +---+   +---------+   +---+ +---+ |\n *                    |  initialize                    close    |\n *                    +-----------------------------------------+\n * </pre>\n *\n * Use cases:\n * - Preserving the input selection ranges before/after reconciliation.\n *   Restoring selection even in the event of an unexpected error.\n * - Deactivating events while rearranging the DOM, preventing blurs/focuses,\n *   while guaranteeing that afterwards, the event system is reactivated.\n * - Flushing a queue of collected DOM mutations to the main UI thread after a\n *   reconciliation takes place in a worker thread.\n * - Invoking any collected `componentDidUpdate` callbacks after rendering new\n *   content.\n * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue\n *   to preserve the `scrollTop` (an automatic scroll aware DOM).\n * - (Future use case): Layout calculations before and after DOM updates.\n *\n * Transactional plugin API:\n * - A module that has an `initialize` method that returns any precomputation.\n * - and a `close` method that accepts the precomputation. `close` is invoked\n *   when the wrapped process is completed, or has failed.\n *\n * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules\n * that implement `initialize` and `close`.\n * @return {Transaction} Single transaction for reuse in thread.\n *\n * @class Transaction\n */\nvar Mixin = {\n  /**\n   * Sets up this instance so that it is prepared for collecting metrics. Does\n   * so such that this setup method may be used on an instance that is already\n   * initialized, in a way that does not consume additional memory upon reuse.\n   * That can be useful if you decide to make your subclass of this mixin a\n   * \"PooledClass\".\n   */\n  reinitializeTransaction: function() {\n    this.transactionWrappers = this.getTransactionWrappers();\n    if (!this.wrapperInitData) {\n      this.wrapperInitData = [];\n    } else {\n      this.wrapperInitData.length = 0;\n    }\n    this._isInTransaction = false;\n  },\n\n  _isInTransaction: false,\n\n  /**\n   * @abstract\n   * @return {Array<TransactionWrapper>} Array of transaction wrappers.\n   */\n  getTransactionWrappers: null,\n\n  isInTransaction: function() {\n    return !!this._isInTransaction;\n  },\n\n  /**\n   * Executes the function within a safety window. Use this for the top level\n   * methods that result in large amounts of computation/mutations that would\n   * need to be safety checked.\n   *\n   * @param {function} method Member of scope to call.\n   * @param {Object} scope Scope to invoke from.\n   * @param {Object?=} args... Arguments to pass to the method (optional).\n   *                           Helps prevent need to bind in many cases.\n   * @return Return value from `method`.\n   */\n  perform: function(method, scope, a, b, c, d, e, f) {\n    (\"production\" !== \"development\" ? invariant(\n      !this.isInTransaction(),\n      'Transaction.perform(...): Cannot initialize a transaction when there ' +\n      'is already an outstanding transaction.'\n    ) : invariant(!this.isInTransaction()));\n    var errorThrown;\n    var ret;\n    try {\n      this._isInTransaction = true;\n      // Catching errors makes debugging more difficult, so we start with\n      // errorThrown set to true before setting it to false after calling\n      // close -- if it's still set to true in the finally block, it means\n      // one of these calls threw.\n      errorThrown = true;\n      this.initializeAll(0);\n      ret = method.call(scope, a, b, c, d, e, f);\n      errorThrown = false;\n    } finally {\n      try {\n        if (errorThrown) {\n          // If `method` throws, prefer to show that stack trace over any thrown\n          // by invoking `closeAll`.\n          try {\n            this.closeAll(0);\n          } catch (err) {\n          }\n        } else {\n          // Since `method` didn't throw, we don't want to silence the exception\n          // here.\n          this.closeAll(0);\n        }\n      } finally {\n        this._isInTransaction = false;\n      }\n    }\n    return ret;\n  },\n\n  initializeAll: function(startIndex) {\n    var transactionWrappers = this.transactionWrappers;\n    for (var i = startIndex; i < transactionWrappers.length; i++) {\n      var wrapper = transactionWrappers[i];\n      try {\n        // Catching errors makes debugging more difficult, so we start with the\n        // OBSERVED_ERROR state before overwriting it with the real return value\n        // of initialize -- if it's still set to OBSERVED_ERROR in the finally\n        // block, it means wrapper.initialize threw.\n        this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;\n        this.wrapperInitData[i] = wrapper.initialize ?\n          wrapper.initialize.call(this) :\n          null;\n      } finally {\n        if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {\n          // The initializer for wrapper i threw an error; initialize the\n          // remaining wrappers but silence any exceptions from them to ensure\n          // that the first error is the one to bubble up.\n          try {\n            this.initializeAll(i + 1);\n          } catch (err) {\n          }\n        }\n      }\n    }\n  },\n\n  /**\n   * Invokes each of `this.transactionWrappers.close[i]` functions, passing into\n   * them the respective return values of `this.transactionWrappers.init[i]`\n   * (`close`rs that correspond to initializers that failed will not be\n   * invoked).\n   */\n  closeAll: function(startIndex) {\n    (\"production\" !== \"development\" ? invariant(\n      this.isInTransaction(),\n      'Transaction.closeAll(): Cannot close transaction when none are open.'\n    ) : invariant(this.isInTransaction()));\n    var transactionWrappers = this.transactionWrappers;\n    for (var i = startIndex; i < transactionWrappers.length; i++) {\n      var wrapper = transactionWrappers[i];\n      var initData = this.wrapperInitData[i];\n      var errorThrown;\n      try {\n        // Catching errors makes debugging more difficult, so we start with\n        // errorThrown set to true before setting it to false after calling\n        // close -- if it's still set to true in the finally block, it means\n        // wrapper.close threw.\n        errorThrown = true;\n        if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {\n          wrapper.close.call(this, initData);\n        }\n        errorThrown = false;\n      } finally {\n        if (errorThrown) {\n          // The closer for wrapper i threw an error; close the remaining\n          // wrappers but silence any exceptions from them to ensure that the\n          // first error is the one to bubble up.\n          try {\n            this.closeAll(i + 1);\n          } catch (e) {\n          }\n        }\n      }\n    }\n    this.wrapperInitData.length = 0;\n  }\n};\n\nvar Transaction = {\n\n  Mixin: Mixin,\n\n  /**\n   * Token to look for to determine if an error occured.\n   */\n  OBSERVED_ERROR: {}\n\n};\n\nmodule.exports = Transaction;\n\n},{\"135\":135}],104:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule ViewportMetrics\n */\n\n'use strict';\n\nvar ViewportMetrics = {\n\n  currentScrollLeft: 0,\n\n  currentScrollTop: 0,\n\n  refreshScrollValues: function(scrollPosition) {\n    ViewportMetrics.currentScrollLeft = scrollPosition.x;\n    ViewportMetrics.currentScrollTop = scrollPosition.y;\n  }\n\n};\n\nmodule.exports = ViewportMetrics;\n\n},{}],105:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule accumulateInto\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n *\n * Accumulates items that must not be null or undefined into the first one. This\n * is used to conserve memory by avoiding array allocations, and thus sacrifices\n * API cleanness. Since `current` can be null before being passed in and not\n * null after this function, make sure to assign it back to `current`:\n *\n * `a = accumulateInto(a, b);`\n *\n * This API should be sparingly used. Try `accumulate` for something cleaner.\n *\n * @return {*|array<*>} An accumulation of items.\n */\n\nfunction accumulateInto(current, next) {\n  (\"production\" !== \"development\" ? invariant(\n    next != null,\n    'accumulateInto(...): Accumulated items must not be null or undefined.'\n  ) : invariant(next != null));\n  if (current == null) {\n    return next;\n  }\n\n  // Both are not empty. Warning: Never call x.concat(y) when you are not\n  // certain that x is an Array (x could be a string with concat method).\n  var currentIsArray = Array.isArray(current);\n  var nextIsArray = Array.isArray(next);\n\n  if (currentIsArray && nextIsArray) {\n    current.push.apply(current, next);\n    return current;\n  }\n\n  if (currentIsArray) {\n    current.push(next);\n    return current;\n  }\n\n  if (nextIsArray) {\n    // A bit too dangerous to mutate `next`.\n    return [current].concat(next);\n  }\n\n  return [current, next];\n}\n\nmodule.exports = accumulateInto;\n\n},{\"135\":135}],106:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule adler32\n */\n\n/* jslint bitwise:true */\n\n'use strict';\n\nvar MOD = 65521;\n\n// This is a clean-room implementation of adler32 designed for detecting\n// if markup is not what we expect it to be. It does not need to be\n// cryptographically strong, only reasonably good at detecting if markup\n// generated on the server is different than that on the client.\nfunction adler32(data) {\n  var a = 1;\n  var b = 0;\n  for (var i = 0; i < data.length; i++) {\n    a = (a + data.charCodeAt(i)) % MOD;\n    b = (b + a) % MOD;\n  }\n  return a | (b << 16);\n}\n\nmodule.exports = adler32;\n\n},{}],107:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule camelize\n * @typechecks\n */\n\nvar _hyphenPattern = /-(.)/g;\n\n/**\n * Camelcases a hyphenated string, for example:\n *\n *   > camelize('background-color')\n *   < \"backgroundColor\"\n *\n * @param {string} string\n * @return {string}\n */\nfunction camelize(string) {\n  return string.replace(_hyphenPattern, function(_, character) {\n    return character.toUpperCase();\n  });\n}\n\nmodule.exports = camelize;\n\n},{}],108:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule camelizeStyleName\n * @typechecks\n */\n\n\"use strict\";\n\nvar camelize = _dereq_(107);\n\nvar msPattern = /^-ms-/;\n\n/**\n * Camelcases a hyphenated CSS property name, for example:\n *\n *   > camelizeStyleName('background-color')\n *   < \"backgroundColor\"\n *   > camelizeStyleName('-moz-transition')\n *   < \"MozTransition\"\n *   > camelizeStyleName('-ms-transition')\n *   < \"msTransition\"\n *\n * As Andi Smith suggests\n * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix\n * is converted to lowercase `ms`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction camelizeStyleName(string) {\n  return camelize(string.replace(msPattern, 'ms-'));\n}\n\nmodule.exports = camelizeStyleName;\n\n},{\"107\":107}],109:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule containsNode\n * @typechecks\n */\n\nvar isTextNode = _dereq_(139);\n\n/*jslint bitwise:true */\n\n/**\n * Checks if a given DOM node contains or is another DOM node.\n *\n * @param {?DOMNode} outerNode Outer DOM node.\n * @param {?DOMNode} innerNode Inner DOM node.\n * @return {boolean} True if `outerNode` contains or is `innerNode`.\n */\nfunction containsNode(outerNode, innerNode) {\n  if (!outerNode || !innerNode) {\n    return false;\n  } else if (outerNode === innerNode) {\n    return true;\n  } else if (isTextNode(outerNode)) {\n    return false;\n  } else if (isTextNode(innerNode)) {\n    return containsNode(outerNode, innerNode.parentNode);\n  } else if (outerNode.contains) {\n    return outerNode.contains(innerNode);\n  } else if (outerNode.compareDocumentPosition) {\n    return !!(outerNode.compareDocumentPosition(innerNode) & 16);\n  } else {\n    return false;\n  }\n}\n\nmodule.exports = containsNode;\n\n},{\"139\":139}],110:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule createArrayFromMixed\n * @typechecks\n */\n\nvar toArray = _dereq_(152);\n\n/**\n * Perform a heuristic test to determine if an object is \"array-like\".\n *\n *   A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n *   Joshu replied: \"Mu.\"\n *\n * This function determines if its argument has \"array nature\": it returns\n * true if the argument is an actual array, an `arguments' object, or an\n * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n *\n * It will return false for other array-like objects like Filelist.\n *\n * @param {*} obj\n * @return {boolean}\n */\nfunction hasArrayNature(obj) {\n  return (\n    // not null/false\n    !!obj &&\n    // arrays are objects, NodeLists are functions in Safari\n    (typeof obj == 'object' || typeof obj == 'function') &&\n    // quacks like an array\n    ('length' in obj) &&\n    // not window\n    !('setInterval' in obj) &&\n    // no DOM node should be considered an array-like\n    // a 'select' element has 'length' and 'item' properties on IE8\n    (typeof obj.nodeType != 'number') &&\n    (\n      // a real array\n      (// HTMLCollection/NodeList\n      (Array.isArray(obj) ||\n      // arguments\n      ('callee' in obj) || 'item' in obj))\n    )\n  );\n}\n\n/**\n * Ensure that the argument is an array by wrapping it in an array if it is not.\n * Creates a copy of the argument if it is already an array.\n *\n * This is mostly useful idiomatically:\n *\n *   var createArrayFromMixed = require('createArrayFromMixed');\n *\n *   function takesOneOrMoreThings(things) {\n *     things = createArrayFromMixed(things);\n *     ...\n *   }\n *\n * This allows you to treat `things' as an array, but accept scalars in the API.\n *\n * If you need to convert an array-like object, like `arguments`, into an array\n * use toArray instead.\n *\n * @param {*} obj\n * @return {array}\n */\nfunction createArrayFromMixed(obj) {\n  if (!hasArrayNature(obj)) {\n    return [obj];\n  } else if (Array.isArray(obj)) {\n    return obj.slice();\n  } else {\n    return toArray(obj);\n  }\n}\n\nmodule.exports = createArrayFromMixed;\n\n},{\"152\":152}],111:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule createFullPageComponent\n * @typechecks\n */\n\n'use strict';\n\n// Defeat circular references by requiring this directly.\nvar ReactClass = _dereq_(33);\nvar ReactElement = _dereq_(57);\n\nvar invariant = _dereq_(135);\n\n/**\n * Create a component that will throw an exception when unmounted.\n *\n * Components like <html> <head> and <body> can't be removed or added\n * easily in a cross-browser way, however it's valuable to be able to\n * take advantage of React's reconciliation for styling and <title>\n * management. So we just document it and throw in dangerous cases.\n *\n * @param {string} tag The tag to wrap\n * @return {function} convenience constructor of new component\n */\nfunction createFullPageComponent(tag) {\n  var elementFactory = ReactElement.createFactory(tag);\n\n  var FullPageComponent = ReactClass.createClass({\n    tagName: tag.toUpperCase(),\n    displayName: 'ReactFullPageComponent' + tag,\n\n    componentWillUnmount: function() {\n      (\"production\" !== \"development\" ? invariant(\n        false,\n        '%s tried to unmount. Because of cross-browser quirks it is ' +\n        'impossible to unmount some top-level components (eg <html>, <head>, ' +\n        'and <body>) reliably and efficiently. To fix this, have a single ' +\n        'top-level component that never unmounts render these elements.',\n        this.constructor.displayName\n      ) : invariant(false));\n    },\n\n    render: function() {\n      return elementFactory(this.props);\n    }\n  });\n\n  return FullPageComponent;\n}\n\nmodule.exports = createFullPageComponent;\n\n},{\"135\":135,\"33\":33,\"57\":57}],112:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule createNodesFromMarkup\n * @typechecks\n */\n\n/*jslint evil: true, sub: true */\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar createArrayFromMixed = _dereq_(110);\nvar getMarkupWrap = _dereq_(127);\nvar invariant = _dereq_(135);\n\n/**\n * Dummy container used to render all markup.\n */\nvar dummyNode =\n  ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Pattern used by `getNodeName`.\n */\nvar nodeNamePattern = /^\\s*<(\\w+)/;\n\n/**\n * Extracts the `nodeName` of the first element in a string of markup.\n *\n * @param {string} markup String of markup.\n * @return {?string} Node name of the supplied markup.\n */\nfunction getNodeName(markup) {\n  var nodeNameMatch = markup.match(nodeNamePattern);\n  return nodeNameMatch && nodeNameMatch[1].toLowerCase();\n}\n\n/**\n * Creates an array containing the nodes rendered from the supplied markup. The\n * optionally supplied `handleScript` function will be invoked once for each\n * <script> element that is rendered. If no `handleScript` function is supplied,\n * an exception is thrown if any <script> elements are rendered.\n *\n * @param {string} markup A string of valid HTML markup.\n * @param {?function} handleScript Invoked once for each rendered <script>.\n * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.\n */\nfunction createNodesFromMarkup(markup, handleScript) {\n  var node = dummyNode;\n  (\"production\" !== \"development\" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));\n  var nodeName = getNodeName(markup);\n\n  var wrap = nodeName && getMarkupWrap(nodeName);\n  if (wrap) {\n    node.innerHTML = wrap[1] + markup + wrap[2];\n\n    var wrapDepth = wrap[0];\n    while (wrapDepth--) {\n      node = node.lastChild;\n    }\n  } else {\n    node.innerHTML = markup;\n  }\n\n  var scripts = node.getElementsByTagName('script');\n  if (scripts.length) {\n    (\"production\" !== \"development\" ? invariant(\n      handleScript,\n      'createNodesFromMarkup(...): Unexpected <script> element rendered.'\n    ) : invariant(handleScript));\n    createArrayFromMixed(scripts).forEach(handleScript);\n  }\n\n  var nodes = createArrayFromMixed(node.childNodes);\n  while (node.lastChild) {\n    node.removeChild(node.lastChild);\n  }\n  return nodes;\n}\n\nmodule.exports = createNodesFromMarkup;\n\n},{\"110\":110,\"127\":127,\"135\":135,\"21\":21}],113:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule dangerousStyleValue\n * @typechecks static-only\n */\n\n'use strict';\n\nvar CSSProperty = _dereq_(4);\n\nvar isUnitlessNumber = CSSProperty.isUnitlessNumber;\n\n/**\n * Convert a value into the proper css writable value. The style name `name`\n * should be logical (no hyphens), as specified\n * in `CSSProperty.isUnitlessNumber`.\n *\n * @param {string} name CSS property name such as `topMargin`.\n * @param {*} value CSS property value such as `10px`.\n * @return {string} Normalized style value with dimensions applied.\n */\nfunction dangerousStyleValue(name, value) {\n  // Note that we've removed escapeTextForBrowser() calls here since the\n  // whole string will be escaped when the attribute is injected into\n  // the markup. If you provide unsafe user data here they can inject\n  // arbitrary CSS which may be problematic (I couldn't repro this):\n  // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet\n  // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/\n  // This is not an XSS hole but instead a potential CSS injection issue\n  // which has lead to a greater discussion about how we're going to\n  // trust URLs moving forward. See #2115901\n\n  var isEmpty = value == null || typeof value === 'boolean' || value === '';\n  if (isEmpty) {\n    return '';\n  }\n\n  var isNonNumeric = isNaN(value);\n  if (isNonNumeric || value === 0 ||\n      isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {\n    return '' + value; // cast to string\n  }\n\n  if (typeof value === 'string') {\n    value = value.trim();\n  }\n  return value + 'px';\n}\n\nmodule.exports = dangerousStyleValue;\n\n},{\"4\":4}],114:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule emptyFunction\n */\n\nfunction makeEmptyFunction(arg) {\n  return function() {\n    return arg;\n  };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nfunction emptyFunction() {}\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function() { return this; };\nemptyFunction.thatReturnsArgument = function(arg) { return arg; };\n\nmodule.exports = emptyFunction;\n\n},{}],115:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule emptyObject\n */\n\n\"use strict\";\n\nvar emptyObject = {};\n\nif (\"production\" !== \"development\") {\n  Object.freeze(emptyObject);\n}\n\nmodule.exports = emptyObject;\n\n},{}],116:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule escapeTextContentForBrowser\n */\n\n'use strict';\n\nvar ESCAPE_LOOKUP = {\n  '&': '&amp;',\n  '>': '&gt;',\n  '<': '&lt;',\n  '\"': '&quot;',\n  '\\'': '&#x27;'\n};\n\nvar ESCAPE_REGEX = /[&><\"']/g;\n\nfunction escaper(match) {\n  return ESCAPE_LOOKUP[match];\n}\n\n/**\n * Escapes text to prevent scripting attacks.\n *\n * @param {*} text Text value to escape.\n * @return {string} An escaped string.\n */\nfunction escapeTextContentForBrowser(text) {\n  return ('' + text).replace(ESCAPE_REGEX, escaper);\n}\n\nmodule.exports = escapeTextContentForBrowser;\n\n},{}],117:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule findDOMNode\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactCurrentOwner = _dereq_(39);\nvar ReactInstanceMap = _dereq_(67);\nvar ReactMount = _dereq_(70);\n\nvar invariant = _dereq_(135);\nvar isNode = _dereq_(137);\nvar warning = _dereq_(154);\n\n/**\n * Returns the DOM node rendered by this element.\n *\n * @param {ReactComponent|DOMElement} componentOrElement\n * @return {DOMElement} The root node of this element.\n */\nfunction findDOMNode(componentOrElement) {\n  if (\"production\" !== \"development\") {\n    var owner = ReactCurrentOwner.current;\n    if (owner !== null) {\n      (\"production\" !== \"development\" ? warning(\n        owner._warnedAboutRefsInRender,\n        '%s is accessing getDOMNode or findDOMNode inside its render(). ' +\n        'render() should be a pure function of props and state. It should ' +\n        'never access something that requires stale data from the previous ' +\n        'render, such as refs. Move this logic to componentDidMount and ' +\n        'componentDidUpdate instead.',\n        owner.getName() || 'A component'\n      ) : null);\n      owner._warnedAboutRefsInRender = true;\n    }\n  }\n  if (componentOrElement == null) {\n    return null;\n  }\n  if (isNode(componentOrElement)) {\n    return componentOrElement;\n  }\n  if (ReactInstanceMap.has(componentOrElement)) {\n    return ReactMount.getNodeFromInstance(componentOrElement);\n  }\n  (\"production\" !== \"development\" ? invariant(\n    componentOrElement.render == null ||\n    typeof componentOrElement.render !== 'function',\n    'Component (with keys: %s) contains `render` method ' +\n    'but is not mounted in the DOM',\n    Object.keys(componentOrElement)\n  ) : invariant(componentOrElement.render == null ||\n  typeof componentOrElement.render !== 'function'));\n  (\"production\" !== \"development\" ? invariant(\n    false,\n    'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',\n    Object.keys(componentOrElement)\n  ) : invariant(false));\n}\n\nmodule.exports = findDOMNode;\n\n},{\"135\":135,\"137\":137,\"154\":154,\"39\":39,\"67\":67,\"70\":70}],118:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule flattenChildren\n */\n\n'use strict';\n\nvar traverseAllChildren = _dereq_(153);\nvar warning = _dereq_(154);\n\n/**\n * @param {function} traverseContext Context passed through traversal.\n * @param {?ReactComponent} child React child component.\n * @param {!string} name String name of key path to child.\n */\nfunction flattenSingleChildIntoContext(traverseContext, child, name) {\n  // We found a component instance.\n  var result = traverseContext;\n  var keyUnique = !result.hasOwnProperty(name);\n  if (\"production\" !== \"development\") {\n    (\"production\" !== \"development\" ? warning(\n      keyUnique,\n      'flattenChildren(...): Encountered two children with the same key, ' +\n      '`%s`. Child keys must be unique; when two children share a key, only ' +\n      'the first child will be used.',\n      name\n    ) : null);\n  }\n  if (keyUnique && child != null) {\n    result[name] = child;\n  }\n}\n\n/**\n * Flattens children that are typically specified as `props.children`. Any null\n * children will not be included in the resulting object.\n * @return {!object} flattened children keyed by name.\n */\nfunction flattenChildren(children) {\n  if (children == null) {\n    return children;\n  }\n  var result = {};\n  traverseAllChildren(children, flattenSingleChildIntoContext, result);\n  return result;\n}\n\nmodule.exports = flattenChildren;\n\n},{\"153\":153,\"154\":154}],119:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule focusNode\n */\n\n\"use strict\";\n\n/**\n * @param {DOMElement} node input/textarea to focus\n */\nfunction focusNode(node) {\n  // IE8 can throw \"Can't move focus to the control because it is invisible,\n  // not enabled, or of a type that does not accept the focus.\" for all kinds of\n  // reasons that are too expensive and fragile to test.\n  try {\n    node.focus();\n  } catch(e) {\n  }\n}\n\nmodule.exports = focusNode;\n\n},{}],120:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule forEachAccumulated\n */\n\n'use strict';\n\n/**\n * @param {array} an \"accumulation\" of items which is either an Array or\n * a single item. Useful when paired with the `accumulate` module. This is a\n * simple utility that allows us to reason about a collection of items, but\n * handling the case when there is exactly one item (and we do not need to\n * allocate an array).\n */\nvar forEachAccumulated = function(arr, cb, scope) {\n  if (Array.isArray(arr)) {\n    arr.forEach(cb, scope);\n  } else if (arr) {\n    cb.call(scope, arr);\n  }\n};\n\nmodule.exports = forEachAccumulated;\n\n},{}],121:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getActiveElement\n * @typechecks\n */\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document body is not yet defined.\n */\nfunction getActiveElement() /*?DOMElement*/ {\n  try {\n    return document.activeElement || document.body;\n  } catch (e) {\n    return document.body;\n  }\n}\n\nmodule.exports = getActiveElement;\n\n},{}],122:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getEventCharCode\n * @typechecks static-only\n */\n\n'use strict';\n\n/**\n * `charCode` represents the actual \"character code\" and is safe to use with\n * `String.fromCharCode`. As such, only keys that correspond to printable\n * characters produce a valid `charCode`, the only exception to this is Enter.\n * The Tab-key is considered non-printable and does not have a `charCode`,\n * presumably because it does not produce a tab-character in browsers.\n *\n * @param {object} nativeEvent Native browser event.\n * @return {string} Normalized `charCode` property.\n */\nfunction getEventCharCode(nativeEvent) {\n  var charCode;\n  var keyCode = nativeEvent.keyCode;\n\n  if ('charCode' in nativeEvent) {\n    charCode = nativeEvent.charCode;\n\n    // FF does not set `charCode` for the Enter-key, check against `keyCode`.\n    if (charCode === 0 && keyCode === 13) {\n      charCode = 13;\n    }\n  } else {\n    // IE8 does not implement `charCode`, but `keyCode` has the correct value.\n    charCode = keyCode;\n  }\n\n  // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.\n  // Must not discard the (non-)printable Enter-key.\n  if (charCode >= 32 || charCode === 13) {\n    return charCode;\n  }\n\n  return 0;\n}\n\nmodule.exports = getEventCharCode;\n\n},{}],123:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getEventKey\n * @typechecks static-only\n */\n\n'use strict';\n\nvar getEventCharCode = _dereq_(122);\n\n/**\n * Normalization of deprecated HTML5 `key` values\n * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names\n */\nvar normalizeKey = {\n  'Esc': 'Escape',\n  'Spacebar': ' ',\n  'Left': 'ArrowLeft',\n  'Up': 'ArrowUp',\n  'Right': 'ArrowRight',\n  'Down': 'ArrowDown',\n  'Del': 'Delete',\n  'Win': 'OS',\n  'Menu': 'ContextMenu',\n  'Apps': 'ContextMenu',\n  'Scroll': 'ScrollLock',\n  'MozPrintableKey': 'Unidentified'\n};\n\n/**\n * Translation from legacy `keyCode` to HTML5 `key`\n * Only special keys supported, all others depend on keyboard layout or browser\n * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names\n */\nvar translateToKey = {\n  8: 'Backspace',\n  9: 'Tab',\n  12: 'Clear',\n  13: 'Enter',\n  16: 'Shift',\n  17: 'Control',\n  18: 'Alt',\n  19: 'Pause',\n  20: 'CapsLock',\n  27: 'Escape',\n  32: ' ',\n  33: 'PageUp',\n  34: 'PageDown',\n  35: 'End',\n  36: 'Home',\n  37: 'ArrowLeft',\n  38: 'ArrowUp',\n  39: 'ArrowRight',\n  40: 'ArrowDown',\n  45: 'Insert',\n  46: 'Delete',\n  112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',\n  118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',\n  144: 'NumLock',\n  145: 'ScrollLock',\n  224: 'Meta'\n};\n\n/**\n * @param {object} nativeEvent Native browser event.\n * @return {string} Normalized `key` property.\n */\nfunction getEventKey(nativeEvent) {\n  if (nativeEvent.key) {\n    // Normalize inconsistent values reported by browsers due to\n    // implementations of a working draft specification.\n\n    // FireFox implements `key` but returns `MozPrintableKey` for all\n    // printable characters (normalized to `Unidentified`), ignore it.\n    var key = normalizeKey[nativeEvent.key] || nativeEvent.key;\n    if (key !== 'Unidentified') {\n      return key;\n    }\n  }\n\n  // Browser does not implement `key`, polyfill as much of it as we can.\n  if (nativeEvent.type === 'keypress') {\n    var charCode = getEventCharCode(nativeEvent);\n\n    // The enter-key is technically both printable and non-printable and can\n    // thus be captured by `keypress`, no other non-printable key should.\n    return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);\n  }\n  if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {\n    // While user keyboard layout determines the actual meaning of each\n    // `keyCode` value, almost all function keys have a universal value.\n    return translateToKey[nativeEvent.keyCode] || 'Unidentified';\n  }\n  return '';\n}\n\nmodule.exports = getEventKey;\n\n},{\"122\":122}],124:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getEventModifierState\n * @typechecks static-only\n */\n\n'use strict';\n\n/**\n * Translation from modifier key to the associated property in the event.\n * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers\n */\n\nvar modifierKeyToProp = {\n  'Alt': 'altKey',\n  'Control': 'ctrlKey',\n  'Meta': 'metaKey',\n  'Shift': 'shiftKey'\n};\n\n// IE8 does not implement getModifierState so we simply map it to the only\n// modifier keys exposed by the event itself, does not support Lock-keys.\n// Currently, all major browsers except Chrome seems to support Lock-keys.\nfunction modifierStateGetter(keyArg) {\n  /*jshint validthis:true */\n  var syntheticEvent = this;\n  var nativeEvent = syntheticEvent.nativeEvent;\n  if (nativeEvent.getModifierState) {\n    return nativeEvent.getModifierState(keyArg);\n  }\n  var keyProp = modifierKeyToProp[keyArg];\n  return keyProp ? !!nativeEvent[keyProp] : false;\n}\n\nfunction getEventModifierState(nativeEvent) {\n  return modifierStateGetter;\n}\n\nmodule.exports = getEventModifierState;\n\n},{}],125:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getEventTarget\n * @typechecks static-only\n */\n\n'use strict';\n\n/**\n * Gets the target node from a native browser event by accounting for\n * inconsistencies in browser DOM APIs.\n *\n * @param {object} nativeEvent Native browser event.\n * @return {DOMEventTarget} Target node.\n */\nfunction getEventTarget(nativeEvent) {\n  var target = nativeEvent.target || nativeEvent.srcElement || window;\n  // Safari may fire events on text nodes (Node.TEXT_NODE is 3).\n  // @see http://www.quirksmode.org/js/events_properties.html\n  return target.nodeType === 3 ? target.parentNode : target;\n}\n\nmodule.exports = getEventTarget;\n\n},{}],126:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getIteratorFn\n * @typechecks static-only\n */\n\n'use strict';\n\n/* global Symbol */\nvar ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n/**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n *     var iteratorFn = getIteratorFn(myIterable);\n *     if (iteratorFn) {\n *       var iterator = iteratorFn.call(myIterable);\n *       ...\n *     }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\nfunction getIteratorFn(maybeIterable) {\n  var iteratorFn = maybeIterable && (\n    (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])\n  );\n  if (typeof iteratorFn === 'function') {\n    return iteratorFn;\n  }\n}\n\nmodule.exports = getIteratorFn;\n\n},{}],127:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getMarkupWrap\n */\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar invariant = _dereq_(135);\n\n/**\n * Dummy container used to detect which wraps are necessary.\n */\nvar dummyNode =\n  ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Some browsers cannot use `innerHTML` to render certain elements standalone,\n * so we wrap them, render the wrapped nodes, then extract the desired node.\n *\n * In IE8, certain elements cannot render alone, so wrap all elements ('*').\n */\nvar shouldWrap = {\n  // Force wrapping for SVG elements because if they get created inside a <div>,\n  // they will be initialized in the wrong namespace (and will not display).\n  'circle': true,\n  'clipPath': true,\n  'defs': true,\n  'ellipse': true,\n  'g': true,\n  'line': true,\n  'linearGradient': true,\n  'path': true,\n  'polygon': true,\n  'polyline': true,\n  'radialGradient': true,\n  'rect': true,\n  'stop': true,\n  'text': true\n};\n\nvar selectWrap = [1, '<select multiple=\"true\">', '</select>'];\nvar tableWrap = [1, '<table>', '</table>'];\nvar trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];\n\nvar svgWrap = [1, '<svg>', '</svg>'];\n\nvar markupWrap = {\n  '*': [1, '?<div>', '</div>'],\n\n  'area': [1, '<map>', '</map>'],\n  'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],\n  'legend': [1, '<fieldset>', '</fieldset>'],\n  'param': [1, '<object>', '</object>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n\n  'optgroup': selectWrap,\n  'option': selectWrap,\n\n  'caption': tableWrap,\n  'colgroup': tableWrap,\n  'tbody': tableWrap,\n  'tfoot': tableWrap,\n  'thead': tableWrap,\n\n  'td': trWrap,\n  'th': trWrap,\n\n  'circle': svgWrap,\n  'clipPath': svgWrap,\n  'defs': svgWrap,\n  'ellipse': svgWrap,\n  'g': svgWrap,\n  'line': svgWrap,\n  'linearGradient': svgWrap,\n  'path': svgWrap,\n  'polygon': svgWrap,\n  'polyline': svgWrap,\n  'radialGradient': svgWrap,\n  'rect': svgWrap,\n  'stop': svgWrap,\n  'text': svgWrap\n};\n\n/**\n * Gets the markup wrap configuration for the supplied `nodeName`.\n *\n * NOTE: This lazily detects which wraps are necessary for the current browser.\n *\n * @param {string} nodeName Lowercase `nodeName`.\n * @return {?array} Markup wrap configuration, if applicable.\n */\nfunction getMarkupWrap(nodeName) {\n  (\"production\" !== \"development\" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));\n  if (!markupWrap.hasOwnProperty(nodeName)) {\n    nodeName = '*';\n  }\n  if (!shouldWrap.hasOwnProperty(nodeName)) {\n    if (nodeName === '*') {\n      dummyNode.innerHTML = '<link />';\n    } else {\n      dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';\n    }\n    shouldWrap[nodeName] = !dummyNode.firstChild;\n  }\n  return shouldWrap[nodeName] ? markupWrap[nodeName] : null;\n}\n\n\nmodule.exports = getMarkupWrap;\n\n},{\"135\":135,\"21\":21}],128:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getNodeForCharacterOffset\n */\n\n'use strict';\n\n/**\n * Given any node return the first leaf node without children.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {DOMElement|DOMTextNode}\n */\nfunction getLeafNode(node) {\n  while (node && node.firstChild) {\n    node = node.firstChild;\n  }\n  return node;\n}\n\n/**\n * Get the next sibling within a container. This will walk up the\n * DOM if a node's siblings have been exhausted.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {?DOMElement|DOMTextNode}\n */\nfunction getSiblingNode(node) {\n  while (node) {\n    if (node.nextSibling) {\n      return node.nextSibling;\n    }\n    node = node.parentNode;\n  }\n}\n\n/**\n * Get object describing the nodes which contain characters at offset.\n *\n * @param {DOMElement|DOMTextNode} root\n * @param {number} offset\n * @return {?object}\n */\nfunction getNodeForCharacterOffset(root, offset) {\n  var node = getLeafNode(root);\n  var nodeStart = 0;\n  var nodeEnd = 0;\n\n  while (node) {\n    if (node.nodeType === 3) {\n      nodeEnd = nodeStart + node.textContent.length;\n\n      if (nodeStart <= offset && nodeEnd >= offset) {\n        return {\n          node: node,\n          offset: offset - nodeStart\n        };\n      }\n\n      nodeStart = nodeEnd;\n    }\n\n    node = getLeafNode(getSiblingNode(node));\n  }\n}\n\nmodule.exports = getNodeForCharacterOffset;\n\n},{}],129:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getReactRootElementInContainer\n */\n\n'use strict';\n\nvar DOC_NODE_TYPE = 9;\n\n/**\n * @param {DOMElement|DOMDocument} container DOM element that may contain\n *                                           a React component\n * @return {?*} DOM element that may have the reactRoot ID, or null.\n */\nfunction getReactRootElementInContainer(container) {\n  if (!container) {\n    return null;\n  }\n\n  if (container.nodeType === DOC_NODE_TYPE) {\n    return container.documentElement;\n  } else {\n    return container.firstChild;\n  }\n}\n\nmodule.exports = getReactRootElementInContainer;\n\n},{}],130:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getTextContentAccessor\n */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar contentKey = null;\n\n/**\n * Gets the key used to access text content on a DOM node.\n *\n * @return {?string} Key used to access text content.\n * @internal\n */\nfunction getTextContentAccessor() {\n  if (!contentKey && ExecutionEnvironment.canUseDOM) {\n    // Prefer textContent to innerText because many browsers support both but\n    // SVG <text> elements don't support innerText even when <div> does.\n    contentKey = 'textContent' in document.documentElement ?\n      'textContent' :\n      'innerText';\n  }\n  return contentKey;\n}\n\nmodule.exports = getTextContentAccessor;\n\n},{\"21\":21}],131:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule getUnboundedScrollPosition\n * @typechecks\n */\n\n\"use strict\";\n\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are unbounded, unlike `getScrollPosition`. This means they\n * may be negative or exceed the element boundaries (which is possible using\n * inertial scrolling).\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\nfunction getUnboundedScrollPosition(scrollable) {\n  if (scrollable === window) {\n    return {\n      x: window.pageXOffset || document.documentElement.scrollLeft,\n      y: window.pageYOffset || document.documentElement.scrollTop\n    };\n  }\n  return {\n    x: scrollable.scrollLeft,\n    y: scrollable.scrollTop\n  };\n}\n\nmodule.exports = getUnboundedScrollPosition;\n\n},{}],132:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule hyphenate\n * @typechecks\n */\n\nvar _uppercasePattern = /([A-Z])/g;\n\n/**\n * Hyphenates a camelcased string, for example:\n *\n *   > hyphenate('backgroundColor')\n *   < \"background-color\"\n *\n * For CSS style names, use `hyphenateStyleName` instead which works properly\n * with all vendor prefixes, including `ms`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction hyphenate(string) {\n  return string.replace(_uppercasePattern, '-$1').toLowerCase();\n}\n\nmodule.exports = hyphenate;\n\n},{}],133:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule hyphenateStyleName\n * @typechecks\n */\n\n\"use strict\";\n\nvar hyphenate = _dereq_(132);\n\nvar msPattern = /^ms-/;\n\n/**\n * Hyphenates a camelcased CSS property name, for example:\n *\n *   > hyphenateStyleName('backgroundColor')\n *   < \"background-color\"\n *   > hyphenateStyleName('MozTransition')\n *   < \"-moz-transition\"\n *   > hyphenateStyleName('msTransition')\n *   < \"-ms-transition\"\n *\n * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix\n * is converted to `-ms-`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction hyphenateStyleName(string) {\n  return hyphenate(string).replace(msPattern, '-ms-');\n}\n\nmodule.exports = hyphenateStyleName;\n\n},{\"132\":132}],134:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule instantiateReactComponent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar ReactCompositeComponent = _dereq_(37);\nvar ReactEmptyComponent = _dereq_(59);\nvar ReactNativeComponent = _dereq_(73);\n\nvar assign = _dereq_(27);\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\n// To avoid a cyclic dependency, we create the final class in this module\nvar ReactCompositeComponentWrapper = function() { };\nassign(\n  ReactCompositeComponentWrapper.prototype,\n  ReactCompositeComponent.Mixin,\n  {\n    _instantiateReactComponent: instantiateReactComponent\n  }\n);\n\n/**\n * Check if the type reference is a known internal type. I.e. not a user\n * provided composite type.\n *\n * @param {function} type\n * @return {boolean} Returns true if this is a valid internal type.\n */\nfunction isInternalComponentType(type) {\n  return (\n    typeof type === 'function' &&\n    typeof type.prototype !== 'undefined' &&\n    typeof type.prototype.mountComponent === 'function' &&\n    typeof type.prototype.receiveComponent === 'function'\n  );\n}\n\n/**\n * Given a ReactNode, create an instance that will actually be mounted.\n *\n * @param {ReactNode} node\n * @param {*} parentCompositeType The composite type that resolved this.\n * @return {object} A new instance of the element's constructor.\n * @protected\n */\nfunction instantiateReactComponent(node, parentCompositeType) {\n  var instance;\n\n  if (node === null || node === false) {\n    node = ReactEmptyComponent.emptyElement;\n  }\n\n  if (typeof node === 'object') {\n    var element = node;\n    if (\"production\" !== \"development\") {\n      (\"production\" !== \"development\" ? warning(\n        element && (typeof element.type === 'function' ||\n                    typeof element.type === 'string'),\n        'Only functions or strings can be mounted as React components.'\n      ) : null);\n    }\n\n    // Special case string values\n    if (parentCompositeType === element.type &&\n        typeof element.type === 'string') {\n      // Avoid recursion if the wrapper renders itself.\n      instance = ReactNativeComponent.createInternalComponent(element);\n      // All native components are currently wrapped in a composite so we're\n      // safe to assume that this is what we should instantiate.\n    } else if (isInternalComponentType(element.type)) {\n      // This is temporarily available for custom components that are not string\n      // represenations. I.e. ART. Once those are updated to use the string\n      // representation, we can drop this code path.\n      instance = new element.type(element);\n    } else {\n      instance = new ReactCompositeComponentWrapper();\n    }\n  } else if (typeof node === 'string' || typeof node === 'number') {\n    instance = ReactNativeComponent.createInstanceForText(node);\n  } else {\n    (\"production\" !== \"development\" ? invariant(\n      false,\n      'Encountered invalid React node of type %s',\n      typeof node\n    ) : invariant(false));\n  }\n\n  if (\"production\" !== \"development\") {\n    (\"production\" !== \"development\" ? warning(\n      typeof instance.construct === 'function' &&\n      typeof instance.mountComponent === 'function' &&\n      typeof instance.receiveComponent === 'function' &&\n      typeof instance.unmountComponent === 'function',\n      'Only React Components can be mounted.'\n    ) : null);\n  }\n\n  // Sets up the instance. This can probably just move into the constructor now.\n  instance.construct(node);\n\n  // These two fields are used by the DOM and ART diffing algorithms\n  // respectively. Instead of using expandos on components, we should be\n  // storing the state needed by the diffing algorithms elsewhere.\n  instance._mountIndex = 0;\n  instance._mountImage = null;\n\n  if (\"production\" !== \"development\") {\n    instance._isOwnerNecessary = false;\n    instance._warnedAboutRefsInRender = false;\n  }\n\n  // Internal instances should fully constructed at this point, so they should\n  // not get any new fields added to them at this point.\n  if (\"production\" !== \"development\") {\n    if (Object.preventExtensions) {\n      Object.preventExtensions(instance);\n    }\n  }\n\n  return instance;\n}\n\nmodule.exports = instantiateReactComponent;\n\n},{\"135\":135,\"154\":154,\"27\":27,\"37\":37,\"59\":59,\"73\":73}],135:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule invariant\n */\n\n\"use strict\";\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n  if (\"production\" !== \"development\") {\n    if (format === undefined) {\n      throw new Error('invariant requires an error message argument');\n    }\n  }\n\n  if (!condition) {\n    var error;\n    if (format === undefined) {\n      error = new Error(\n        'Minified exception occurred; use the non-minified dev environment ' +\n        'for the full error message and additional helpful warnings.'\n      );\n    } else {\n      var args = [a, b, c, d, e, f];\n      var argIndex = 0;\n      error = new Error(\n        'Invariant Violation: ' +\n        format.replace(/%s/g, function() { return args[argIndex++]; })\n      );\n    }\n\n    error.framesToPop = 1; // we don't care about invariant's own frame\n    throw error;\n  }\n};\n\nmodule.exports = invariant;\n\n},{}],136:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule isEventSupported\n */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar useHasFeature;\nif (ExecutionEnvironment.canUseDOM) {\n  useHasFeature =\n    document.implementation &&\n    document.implementation.hasFeature &&\n    // always returns true in newer browsers as per the standard.\n    // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature\n    document.implementation.hasFeature('', '') !== true;\n}\n\n/**\n * Checks if an event is supported in the current execution environment.\n *\n * NOTE: This will not work correctly for non-generic events such as `change`,\n * `reset`, `load`, `error`, and `select`.\n *\n * Borrows from Modernizr.\n *\n * @param {string} eventNameSuffix Event name, e.g. \"click\".\n * @param {?boolean} capture Check if the capture phase is supported.\n * @return {boolean} True if the event is supported.\n * @internal\n * @license Modernizr 3.0.0pre (Custom Build) | MIT\n */\nfunction isEventSupported(eventNameSuffix, capture) {\n  if (!ExecutionEnvironment.canUseDOM ||\n      capture && !('addEventListener' in document)) {\n    return false;\n  }\n\n  var eventName = 'on' + eventNameSuffix;\n  var isSupported = eventName in document;\n\n  if (!isSupported) {\n    var element = document.createElement('div');\n    element.setAttribute(eventName, 'return;');\n    isSupported = typeof element[eventName] === 'function';\n  }\n\n  if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {\n    // This is the only way to test support for the `wheel` event in IE9+.\n    isSupported = document.implementation.hasFeature('Events.wheel', '3.0');\n  }\n\n  return isSupported;\n}\n\nmodule.exports = isEventSupported;\n\n},{\"21\":21}],137:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule isNode\n * @typechecks\n */\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM node.\n */\nfunction isNode(object) {\n  return !!(object && (\n    ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&\n    typeof object.nodeType === 'number' &&\n    typeof object.nodeName === 'string'))\n  ));\n}\n\nmodule.exports = isNode;\n\n},{}],138:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule isTextInputElement\n */\n\n'use strict';\n\n/**\n * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n */\nvar supportedInputTypes = {\n  'color': true,\n  'date': true,\n  'datetime': true,\n  'datetime-local': true,\n  'email': true,\n  'month': true,\n  'number': true,\n  'password': true,\n  'range': true,\n  'search': true,\n  'tel': true,\n  'text': true,\n  'time': true,\n  'url': true,\n  'week': true\n};\n\nfunction isTextInputElement(elem) {\n  return elem && (\n    (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')\n  );\n}\n\nmodule.exports = isTextInputElement;\n\n},{}],139:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule isTextNode\n * @typechecks\n */\n\nvar isNode = _dereq_(137);\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM text node.\n */\nfunction isTextNode(object) {\n  return isNode(object) && object.nodeType == 3;\n}\n\nmodule.exports = isTextNode;\n\n},{\"137\":137}],140:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule keyMirror\n * @typechecks static-only\n */\n\n'use strict';\n\nvar invariant = _dereq_(135);\n\n/**\n * Constructs an enumeration with keys equal to their value.\n *\n * For example:\n *\n *   var COLORS = keyMirror({blue: null, red: null});\n *   var myColor = COLORS.blue;\n *   var isColorValid = !!COLORS[myColor];\n *\n * The last line could not be performed if the values of the generated enum were\n * not equal to their keys.\n *\n *   Input:  {key1: val1, key2: val2}\n *   Output: {key1: key1, key2: key2}\n *\n * @param {object} obj\n * @return {object}\n */\nvar keyMirror = function(obj) {\n  var ret = {};\n  var key;\n  (\"production\" !== \"development\" ? invariant(\n    obj instanceof Object && !Array.isArray(obj),\n    'keyMirror(...): Argument must be an object.'\n  ) : invariant(obj instanceof Object && !Array.isArray(obj)));\n  for (key in obj) {\n    if (!obj.hasOwnProperty(key)) {\n      continue;\n    }\n    ret[key] = key;\n  }\n  return ret;\n};\n\nmodule.exports = keyMirror;\n\n},{\"135\":135}],141:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule keyOf\n */\n\n/**\n * Allows extraction of a minified key. Let's the build system minify keys\n * without loosing the ability to dynamically use key strings as values\n * themselves. Pass in an object with a single key/val pair and it will return\n * you the string key of that single record. Suppose you want to grab the\n * value for a key 'className' inside of an object. Key/val minification may\n * have aliased that key to be 'xa12'. keyOf({className: null}) will return\n * 'xa12' in that case. Resolve keys you want to use once at startup time, then\n * reuse those resolutions.\n */\nvar keyOf = function(oneKeyObj) {\n  var key;\n  for (key in oneKeyObj) {\n    if (!oneKeyObj.hasOwnProperty(key)) {\n      continue;\n    }\n    return key;\n  }\n  return null;\n};\n\n\nmodule.exports = keyOf;\n\n},{}],142:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule mapObject\n */\n\n'use strict';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * Executes the provided `callback` once for each enumerable own property in the\n * object and constructs a new object from the results. The `callback` is\n * invoked with three arguments:\n *\n *  - the property value\n *  - the property name\n *  - the object being traversed\n *\n * Properties that are added after the call to `mapObject` will not be visited\n * by `callback`. If the values of existing properties are changed, the value\n * passed to `callback` will be the value at the time `mapObject` visits them.\n * Properties that are deleted before being visited are not visited.\n *\n * @grep function objectMap()\n * @grep function objMap()\n *\n * @param {?object} object\n * @param {function} callback\n * @param {*} context\n * @return {?object}\n */\nfunction mapObject(object, callback, context) {\n  if (!object) {\n    return null;\n  }\n  var result = {};\n  for (var name in object) {\n    if (hasOwnProperty.call(object, name)) {\n      result[name] = callback.call(context, object[name], name, object);\n    }\n  }\n  return result;\n}\n\nmodule.exports = mapObject;\n\n},{}],143:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule memoizeStringOnly\n * @typechecks static-only\n */\n\n'use strict';\n\n/**\n * Memoizes the return value of a function that accepts one string argument.\n *\n * @param {function} callback\n * @return {function}\n */\nfunction memoizeStringOnly(callback) {\n  var cache = {};\n  return function(string) {\n    if (!cache.hasOwnProperty(string)) {\n      cache[string] = callback.call(this, string);\n    }\n    return cache[string];\n  };\n}\n\nmodule.exports = memoizeStringOnly;\n\n},{}],144:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule onlyChild\n */\n'use strict';\n\nvar ReactElement = _dereq_(57);\n\nvar invariant = _dereq_(135);\n\n/**\n * Returns the first child in a collection of children and verifies that there\n * is only one child in the collection. The current implementation of this\n * function assumes that a single child gets passed without a wrapper, but the\n * purpose of this helper function is to abstract away the particular structure\n * of children.\n *\n * @param {?object} children Child collection structure.\n * @return {ReactComponent} The first and only `ReactComponent` contained in the\n * structure.\n */\nfunction onlyChild(children) {\n  (\"production\" !== \"development\" ? invariant(\n    ReactElement.isValidElement(children),\n    'onlyChild must be passed a children with exactly one child.'\n  ) : invariant(ReactElement.isValidElement(children)));\n  return children;\n}\n\nmodule.exports = onlyChild;\n\n},{\"135\":135,\"57\":57}],145:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule performance\n * @typechecks\n */\n\n\"use strict\";\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar performance;\n\nif (ExecutionEnvironment.canUseDOM) {\n  performance =\n    window.performance ||\n    window.msPerformance ||\n    window.webkitPerformance;\n}\n\nmodule.exports = performance || {};\n\n},{\"21\":21}],146:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule performanceNow\n * @typechecks\n */\n\nvar performance = _dereq_(145);\n\n/**\n * Detect if we can use `window.performance.now()` and gracefully fallback to\n * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now\n * because of Facebook's testing infrastructure.\n */\nif (!performance || !performance.now) {\n  performance = Date;\n}\n\nvar performanceNow = performance.now.bind(performance);\n\nmodule.exports = performanceNow;\n\n},{\"145\":145}],147:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule quoteAttributeValueForBrowser\n */\n\n'use strict';\n\nvar escapeTextContentForBrowser = _dereq_(116);\n\n/**\n * Escapes attribute value to prevent scripting attacks.\n *\n * @param {*} value Value to escape.\n * @return {string} An escaped string.\n */\nfunction quoteAttributeValueForBrowser(value) {\n  return '\"' + escapeTextContentForBrowser(value) + '\"';\n}\n\nmodule.exports = quoteAttributeValueForBrowser;\n\n},{\"116\":116}],148:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule setInnerHTML\n */\n\n/* globals MSApp */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\n\nvar WHITESPACE_TEST = /^[ \\r\\n\\t\\f]/;\nvar NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \\r\\n\\t\\f\\/>]/;\n\n/**\n * Set the innerHTML property of a node, ensuring that whitespace is preserved\n * even in IE8.\n *\n * @param {DOMElement} node\n * @param {string} html\n * @internal\n */\nvar setInnerHTML = function(node, html) {\n  node.innerHTML = html;\n};\n\n// Win8 apps: Allow all html to be inserted\nif (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {\n  setInnerHTML = function(node, html) {\n    MSApp.execUnsafeLocalFunction(function() {\n      node.innerHTML = html;\n    });\n  };\n}\n\nif (ExecutionEnvironment.canUseDOM) {\n  // IE8: When updating a just created node with innerHTML only leading\n  // whitespace is removed. When updating an existing node with innerHTML\n  // whitespace in root TextNodes is also collapsed.\n  // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html\n\n  // Feature detection; only IE8 is known to behave improperly like this.\n  var testElement = document.createElement('div');\n  testElement.innerHTML = ' ';\n  if (testElement.innerHTML === '') {\n    setInnerHTML = function(node, html) {\n      // Magic theory: IE8 supposedly differentiates between added and updated\n      // nodes when processing innerHTML, innerHTML on updated nodes suffers\n      // from worse whitespace behavior. Re-adding a node like this triggers\n      // the initial and more favorable whitespace behavior.\n      // TODO: What to do on a detached node?\n      if (node.parentNode) {\n        node.parentNode.replaceChild(node, node);\n      }\n\n      // We also implement a workaround for non-visible tags disappearing into\n      // thin air on IE8, this only happens if there is no visible text\n      // in-front of the non-visible tags. Piggyback on the whitespace fix\n      // and simply check if any non-visible tags appear in the source.\n      if (WHITESPACE_TEST.test(html) ||\n          html[0] === '<' && NONVISIBLE_TEST.test(html)) {\n        // Recover leading whitespace by temporarily prepending any character.\n        // \\uFEFF has the potential advantage of being zero-width/invisible.\n        node.innerHTML = '\\uFEFF' + html;\n\n        // deleteData leaves an empty `TextNode` which offsets the index of all\n        // children. Definitely want to avoid this.\n        var textNode = node.firstChild;\n        if (textNode.data.length === 1) {\n          node.removeChild(textNode);\n        } else {\n          textNode.deleteData(0, 1);\n        }\n      } else {\n        node.innerHTML = html;\n      }\n    };\n  }\n}\n\nmodule.exports = setInnerHTML;\n\n},{\"21\":21}],149:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule setTextContent\n */\n\n'use strict';\n\nvar ExecutionEnvironment = _dereq_(21);\nvar escapeTextContentForBrowser = _dereq_(116);\nvar setInnerHTML = _dereq_(148);\n\n/**\n * Set the textContent property of a node, ensuring that whitespace is preserved\n * even in IE8. innerText is a poor substitute for textContent and, among many\n * issues, inserts <br> instead of the literal newline chars. innerHTML behaves\n * as it should.\n *\n * @param {DOMElement} node\n * @param {string} text\n * @internal\n */\nvar setTextContent = function(node, text) {\n  node.textContent = text;\n};\n\nif (ExecutionEnvironment.canUseDOM) {\n  if (!('textContent' in document.documentElement)) {\n    setTextContent = function(node, text) {\n      setInnerHTML(node, escapeTextContentForBrowser(text));\n    };\n  }\n}\n\nmodule.exports = setTextContent;\n\n},{\"116\":116,\"148\":148,\"21\":21}],150:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule shallowEqual\n */\n\n'use strict';\n\n/**\n * Performs equality by iterating through keys on an object and returning\n * false when any key has values which are not strictly equal between\n * objA and objB. Returns true when the values of all keys are strictly equal.\n *\n * @return {boolean}\n */\nfunction shallowEqual(objA, objB) {\n  if (objA === objB) {\n    return true;\n  }\n  var key;\n  // Test for A's keys different from B.\n  for (key in objA) {\n    if (objA.hasOwnProperty(key) &&\n        (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {\n      return false;\n    }\n  }\n  // Test for B's keys missing from A.\n  for (key in objB) {\n    if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nmodule.exports = shallowEqual;\n\n},{}],151:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule shouldUpdateReactComponent\n * @typechecks static-only\n */\n\n'use strict';\n\nvar warning = _dereq_(154);\n\n/**\n * Given a `prevElement` and `nextElement`, determines if the existing\n * instance should be updated as opposed to being destroyed or replaced by a new\n * instance. Both arguments are elements. This ensures that this logic can\n * operate on stateless trees without any backing instance.\n *\n * @param {?object} prevElement\n * @param {?object} nextElement\n * @return {boolean} True if the existing instance should be updated.\n * @protected\n */\nfunction shouldUpdateReactComponent(prevElement, nextElement) {\n  if (prevElement != null && nextElement != null) {\n    var prevType = typeof prevElement;\n    var nextType = typeof nextElement;\n    if (prevType === 'string' || prevType === 'number') {\n      return (nextType === 'string' || nextType === 'number');\n    } else {\n      if (nextType === 'object' &&\n          prevElement.type === nextElement.type &&\n          prevElement.key === nextElement.key) {\n        var ownersMatch = prevElement._owner === nextElement._owner;\n        var prevName = null;\n        var nextName = null;\n        var nextDisplayName = null;\n        if (\"production\" !== \"development\") {\n          if (!ownersMatch) {\n            if (prevElement._owner != null &&\n                prevElement._owner.getPublicInstance() != null &&\n                prevElement._owner.getPublicInstance().constructor != null) {\n              prevName =\n                prevElement._owner.getPublicInstance().constructor.displayName;\n            }\n            if (nextElement._owner != null &&\n                nextElement._owner.getPublicInstance() != null &&\n                nextElement._owner.getPublicInstance().constructor != null) {\n              nextName =\n                nextElement._owner.getPublicInstance().constructor.displayName;\n            }\n            if (nextElement.type != null &&\n                nextElement.type.displayName != null) {\n              nextDisplayName = nextElement.type.displayName;\n            }\n            if (nextElement.type != null && typeof nextElement.type === 'string') {\n              nextDisplayName = nextElement.type;\n            }\n            if (typeof nextElement.type !== 'string' ||\n                nextElement.type === 'input' ||\n                nextElement.type === 'textarea') {\n              if ((prevElement._owner != null &&\n                  prevElement._owner._isOwnerNecessary === false) ||\n                  (nextElement._owner != null &&\n                  nextElement._owner._isOwnerNecessary === false)) {\n                if (prevElement._owner != null) {\n                  prevElement._owner._isOwnerNecessary = true;\n                }\n                if (nextElement._owner != null) {\n                  nextElement._owner._isOwnerNecessary = true;\n                }\n                (\"production\" !== \"development\" ? warning(\n                  false,\n                  '<%s /> is being rendered by both %s and %s using the same ' +\n                  'key (%s) in the same place. Currently, this means that ' +\n                  'they don\\'t preserve state. This behavior should be very ' +\n                  'rare so we\\'re considering deprecating it. Please contact ' +\n                  'the React team and explain your use case so that we can ' +\n                  'take that into consideration.',\n                  nextDisplayName || 'Unknown Component',\n                  prevName || '[Unknown]',\n                  nextName || '[Unknown]',\n                  prevElement.key\n                ) : null);\n              }\n            }\n          }\n        }\n        return ownersMatch;\n      }\n    }\n  }\n  return false;\n}\n\nmodule.exports = shouldUpdateReactComponent;\n\n},{\"154\":154}],152:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule toArray\n * @typechecks\n */\n\nvar invariant = _dereq_(135);\n\n/**\n * Convert array-like objects to arrays.\n *\n * This API assumes the caller knows the contents of the data type. For less\n * well defined inputs use createArrayFromMixed.\n *\n * @param {object|function|filelist} obj\n * @return {array}\n */\nfunction toArray(obj) {\n  var length = obj.length;\n\n  // Some browse builtin objects can report typeof 'function' (e.g. NodeList in\n  // old versions of Safari).\n  (\"production\" !== \"development\" ? invariant(\n    !Array.isArray(obj) &&\n    (typeof obj === 'object' || typeof obj === 'function'),\n    'toArray: Array-like object expected'\n  ) : invariant(!Array.isArray(obj) &&\n  (typeof obj === 'object' || typeof obj === 'function')));\n\n  (\"production\" !== \"development\" ? invariant(\n    typeof length === 'number',\n    'toArray: Object needs a length property'\n  ) : invariant(typeof length === 'number'));\n\n  (\"production\" !== \"development\" ? invariant(\n    length === 0 ||\n    (length - 1) in obj,\n    'toArray: Object should have keys for indices'\n  ) : invariant(length === 0 ||\n  (length - 1) in obj));\n\n  // Old IE doesn't give collections access to hasOwnProperty. Assume inputs\n  // without method will throw during the slice call and skip straight to the\n  // fallback.\n  if (obj.hasOwnProperty) {\n    try {\n      return Array.prototype.slice.call(obj);\n    } catch (e) {\n      // IE < 9 does not support Array#slice on collections objects\n    }\n  }\n\n  // Fall back to copying key by key. This assumes all keys have a value,\n  // so will not preserve sparsely populated inputs.\n  var ret = Array(length);\n  for (var ii = 0; ii < length; ii++) {\n    ret[ii] = obj[ii];\n  }\n  return ret;\n}\n\nmodule.exports = toArray;\n\n},{\"135\":135}],153:[function(_dereq_,module,exports){\n/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule traverseAllChildren\n */\n\n'use strict';\n\nvar ReactElement = _dereq_(57);\nvar ReactFragment = _dereq_(63);\nvar ReactInstanceHandles = _dereq_(66);\n\nvar getIteratorFn = _dereq_(126);\nvar invariant = _dereq_(135);\nvar warning = _dereq_(154);\n\nvar SEPARATOR = ReactInstanceHandles.SEPARATOR;\nvar SUBSEPARATOR = ':';\n\n/**\n * TODO: Test that a single child and an array with one item have the same key\n * pattern.\n */\n\nvar userProvidedKeyEscaperLookup = {\n  '=': '=0',\n  '.': '=1',\n  ':': '=2'\n};\n\nvar userProvidedKeyEscapeRegex = /[=.:]/g;\n\nvar didWarnAboutMaps = false;\n\nfunction userProvidedKeyEscaper(match) {\n  return userProvidedKeyEscaperLookup[match];\n}\n\n/**\n * Generate a key string that identifies a component within a set.\n *\n * @param {*} component A component that could contain a manual key.\n * @param {number} index Index that is used if a manual key is not provided.\n * @return {string}\n */\nfunction getComponentKey(component, index) {\n  if (component && component.key != null) {\n    // Explicit key\n    return wrapUserProvidedKey(component.key);\n  }\n  // Implicit key determined by the index in the set\n  return index.toString(36);\n}\n\n/**\n * Escape a component key so that it is safe to use in a reactid.\n *\n * @param {*} key Component key to be escaped.\n * @return {string} An escaped string.\n */\nfunction escapeUserProvidedKey(text) {\n  return ('' + text).replace(\n    userProvidedKeyEscapeRegex,\n    userProvidedKeyEscaper\n  );\n}\n\n/**\n * Wrap a `key` value explicitly provided by the user to distinguish it from\n * implicitly-generated keys generated by a component's index in its parent.\n *\n * @param {string} key Value of a user-provided `key` attribute\n * @return {string}\n */\nfunction wrapUserProvidedKey(key) {\n  return '$' + escapeUserProvidedKey(key);\n}\n\n/**\n * @param {?*} children Children tree container.\n * @param {!string} nameSoFar Name of the key path so far.\n * @param {!number} indexSoFar Number of children encountered until this point.\n * @param {!function} callback Callback to invoke with each child found.\n * @param {?*} traverseContext Used to pass information throughout the traversal\n * process.\n * @return {!number} The number of children in this subtree.\n */\nfunction traverseAllChildrenImpl(\n  children,\n  nameSoFar,\n  indexSoFar,\n  callback,\n  traverseContext\n) {\n  var type = typeof children;\n\n  if (type === 'undefined' || type === 'boolean') {\n    // All of the above are perceived as null.\n    children = null;\n  }\n\n  if (children === null ||\n      type === 'string' ||\n      type === 'number' ||\n      ReactElement.isValidElement(children)) {\n    callback(\n      traverseContext,\n      children,\n      // If it's the only child, treat the name as if it was wrapped in an array\n      // so that it's consistent if the number of children grows.\n      nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,\n      indexSoFar\n    );\n    return 1;\n  }\n\n  var child, nextName, nextIndex;\n  var subtreeCount = 0; // Count of children found in the current subtree.\n\n  if (Array.isArray(children)) {\n    for (var i = 0; i < children.length; i++) {\n      child = children[i];\n      nextName = (\n        (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +\n        getComponentKey(child, i)\n      );\n      nextIndex = indexSoFar + subtreeCount;\n      subtreeCount += traverseAllChildrenImpl(\n        child,\n        nextName,\n        nextIndex,\n        callback,\n        traverseContext\n      );\n    }\n  } else {\n    var iteratorFn = getIteratorFn(children);\n    if (iteratorFn) {\n      var iterator = iteratorFn.call(children);\n      var step;\n      if (iteratorFn !== children.entries) {\n        var ii = 0;\n        while (!(step = iterator.next()).done) {\n          child = step.value;\n          nextName = (\n            (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +\n            getComponentKey(child, ii++)\n          );\n          nextIndex = indexSoFar + subtreeCount;\n          subtreeCount += traverseAllChildrenImpl(\n            child,\n            nextName,\n            nextIndex,\n            callback,\n            traverseContext\n          );\n        }\n      } else {\n        if (\"production\" !== \"development\") {\n          (\"production\" !== \"development\" ? warning(\n            didWarnAboutMaps,\n            'Using Maps as children is not yet fully supported. It is an ' +\n            'experimental feature that might be removed. Convert it to a ' +\n            'sequence / iterable of keyed ReactElements instead.'\n          ) : null);\n          didWarnAboutMaps = true;\n        }\n        // Iterator will provide entry [k,v] tuples rather than values.\n        while (!(step = iterator.next()).done) {\n          var entry = step.value;\n          if (entry) {\n            child = entry[1];\n            nextName = (\n              (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +\n              wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +\n              getComponentKey(child, 0)\n            );\n            nextIndex = indexSoFar + subtreeCount;\n            subtreeCount += traverseAllChildrenImpl(\n              child,\n              nextName,\n              nextIndex,\n              callback,\n              traverseContext\n            );\n          }\n        }\n      }\n    } else if (type === 'object') {\n      (\"production\" !== \"development\" ? invariant(\n        children.nodeType !== 1,\n        'traverseAllChildren(...): Encountered an invalid child; DOM ' +\n        'elements are not valid children of React components.'\n      ) : invariant(children.nodeType !== 1));\n      var fragment = ReactFragment.extract(children);\n      for (var key in fragment) {\n        if (fragment.hasOwnProperty(key)) {\n          child = fragment[key];\n          nextName = (\n            (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +\n            wrapUserProvidedKey(key) + SUBSEPARATOR +\n            getComponentKey(child, 0)\n          );\n          nextIndex = indexSoFar + subtreeCount;\n          subtreeCount += traverseAllChildrenImpl(\n            child,\n            nextName,\n            nextIndex,\n            callback,\n            traverseContext\n          );\n        }\n      }\n    }\n  }\n\n  return subtreeCount;\n}\n\n/**\n * Traverses children that are typically specified as `props.children`, but\n * might also be specified through attributes:\n *\n * - `traverseAllChildren(this.props.children, ...)`\n * - `traverseAllChildren(this.props.leftPanelChildren, ...)`\n *\n * The `traverseContext` is an optional argument that is passed through the\n * entire traversal. It can be used to store accumulations or anything else that\n * the callback might find relevant.\n *\n * @param {?*} children Children tree object.\n * @param {!function} callback To invoke upon traversing each child.\n * @param {?*} traverseContext Context for traversal.\n * @return {!number} The number of children in this subtree.\n */\nfunction traverseAllChildren(children, callback, traverseContext) {\n  if (children == null) {\n    return 0;\n  }\n\n  return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);\n}\n\nmodule.exports = traverseAllChildren;\n\n},{\"126\":126,\"135\":135,\"154\":154,\"57\":57,\"63\":63,\"66\":66}],154:[function(_dereq_,module,exports){\n/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule warning\n */\n\n\"use strict\";\n\nvar emptyFunction = _dereq_(114);\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar warning = emptyFunction;\n\nif (\"production\" !== \"development\") {\n  warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);\n    if (format === undefined) {\n      throw new Error(\n        '`warning(condition, format, ...args)` requires a warning ' +\n        'message argument'\n      );\n    }\n\n    if (format.length < 10 || /^[s\\W]*$/.test(format)) {\n      throw new Error(\n        'The warning format should be able to uniquely identify this ' +\n        'warning. Please, use a more descriptive format than: ' + format\n      );\n    }\n\n    if (format.indexOf('Failed Composite propType: ') === 0) {\n      return; // Ignore CompositeComponent proptype check.\n    }\n\n    if (!condition) {\n      var argIndex = 0;\n      var message = 'Warning: ' + format.replace(/%s/g, function()  {return args[argIndex++];});\n      console.warn(message);\n      try {\n        // --- Welcome to debugging React ---\n        // This error was thrown as a convenience so that you can use this stack\n        // to find the callsite that caused this warning to fire.\n        throw new Error(message);\n      } catch(x) {}\n    }\n  };\n}\n\nmodule.exports = warning;\n\n},{\"114\":114}]},{},[1])(1)\n});"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/base.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n{% load staticfiles %}\n{% load bootstrap_themes %}\n    <head>\n    <title>{{ atc_demo_ui_settings.SHORT_TILE }}</title>\n    <meta charset=\"utf-8\" />\n    <meta name=\"description\" content=\"{{ atc_demo_ui_settings.TITLE }}\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n\n    <!-- React.js -->\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-shim.min.js\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-sham.min.js\"></script>\n    <script src=\"{% static 'vendor/react/react-0.13.3.js' %}\"></script>\n    <script src=\"{% static 'vendor/react/JSXTransformer-0.13.3.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-api.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-profile-storage.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-utils.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-auth.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-profiles.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc-shaping.js' %}\"></script>\n    <script type=\"text/jsx\" src=\"{% static 'js/atc.js' %}\"></script>\n    <link rel=\"stylesheet\" href=\"{% static 'css/atc.css' %}\" />\n    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->\n    <script src=\"{% static 'static_jquery/js/jquery.min.js' %}\"></script>\n\n    <!-- Bootstrap CSS -->\n    {% bootstrap_styles theme='default' type='min.css' %}\n    <!-- Bootstrap JS -->\n    {% bootstrap_script use_min=True %}\n    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->\n    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n    <!--[if lt IE 9]>\n        <script src=\"https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js\"></script>\n        <script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\"></script>\n    <![endif]-->\n    </head>\n    <body>\n        <div class=\"container\">\n        <div class=\"starter-template\">\n        <h1>{{ atc_demo_ui_settings.TITLE }}</h1>\n        {% block content %}{% endblock %}\n        </div>\n        </div>\n    </body>\n</html>\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/index.html",
    "content": "{% extends \"atc_demo_ui/base.html\" %}\n{% block content %}\n<div id=\"atc_demo_ui\">\n\n\n</div>\n\n<script type=\"text/jsx\">\n    React.render(\n        <Atc endpoint=\"{{ atc_demo_ui_settings.REST_ENDPOINT }}\"/>,\n        document.getElementById('atc_demo_ui')\n);\n</script>\n{% endblock %}\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/templates/atc_demo_ui/shaping_settings.html",
    "content": "<form class=\"form-horizontal\" role=\"form\">\n{% with 'up down' as links %}\n{% for link in links.split %}\n    <div class=\"form-group\">\n        <label for=\"inputEmail3\" class=\"col-sm-2 control-label\">Email</label>\n        <div class=\"col-sm-10\">\n            <input type=\"email\" class=\"form-control\" id=\"inputEmail3\" placeholder=\"Email\">\n        </div>\n    </div>\n    <div class=\"form-group\">\n        <label for=\"inputPassword3\" class=\"col-sm-2 control-label\">Password</label>\n        <div class=\"col-sm-10\">\n            <input type=\"text\" class=\"form-control\" id=\"inputPassword3\" placeholder=\"Password\">\n        </div>\n    </div>\n{% endfor %}\n{% endwith %}\n</form>\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/urls.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom django.conf.urls import url\nfrom atc_demo_ui.views import index\n\n\nurlpatterns = [\n    url(r'^$', index, name='atc-demo-ui-index'),\n]\n"
  },
  {
    "path": "atc/django-atc-demo-ui/atc_demo_ui/views.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_demo_ui.settings import atc_demo_ui_settings\n\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\n\ndef index(request):\n    context = {'atc_demo_ui_settings': atc_demo_ui_settings}\n    return render_to_response(\n        'atc_demo_ui/index.html',\n        context,\n        RequestContext(request)\n    )\n"
  },
  {
    "path": "atc/django-atc-demo-ui/requirements.txt",
    "content": "--index-url https://pypi.python.org/simple/\n\n-e .\n"
  },
  {
    "path": "atc/django-atc-demo-ui/setup.cfg",
    "content": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-demo-ui/setup.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport os\nimport re\nimport sys\n\nfrom setuptools import setup\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:\n    README = readme.read()\n\n\ninstall_requires = [\n    'django-atc-api',\n    'django-static-jquery==1.11.1',\n    'django-bootstrap-themes==3.3.6',\n]\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py).group(1)\n\n\ndef get_packages(package):\n    \"\"\"\n    Return root package and all sub-packages.\n    \"\"\"\n    return [dirpath\n            for dirpath, dirnames, filenames in os.walk(package)\n            if os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n\ndef get_package_data(package):\n    \"\"\"\n    Return all files under the root package, that are not in a\n    package themselves.\n    \"\"\"\n    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)\n            for dirpath, dirnames, filenames in os.walk(package)\n            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n    filepaths = []\n    for base, filenames in walk:\n        filepaths.extend([os.path.join(base, filename)\n                          for filename in filenames])\n    return {package: filepaths}\n\n\nversion = get_version('atc_demo_ui')\n\nif sys.argv[-1] == 'publish':\n    if os.system(\"pip freeze | grep wheel\"):\n        print(\"wheel not installed.\\nUse `pip install wheel`.\\nExiting.\")\n        sys.exit()\n    if os.system(\"pip freeze | grep twine\"):\n        print(\"twine not installed.\\nUse `pip install twine`.\\nExiting.\")\n        sys.exit()\n    os.system(\"python setup.py sdist bdist_wheel\")\n    os.system(\"twine upload dist/*\")\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %s -m 'version %s'\" % (version, version))\n    print(\"  git push --tags\")\n    sys.exit()\n\n\nsetup(\n    name='django-atc-demo-ui',\n    version=version,\n    description='Demo Web UI for ATC',\n    author='Emmanuel Bretelle',\n    author_email='chantra@fb.com',\n    url='https://github.com/facebook/augmented-traffic-control',\n    packages=get_packages('atc_demo_ui'),\n    package_data=get_package_data('atc_demo_ui'),\n    classifiers=['Programming Language :: Python', ],\n    long_description=README,\n    install_requires=install_requires,\n)\n"
  },
  {
    "path": "atc/django-atc-profile-storage/MANIFEST.in",
    "content": "include README.md\n"
  },
  {
    "path": "atc/django-atc-profile-storage/README.md",
    "content": "# ATC Profile Storage\n\nATC Profile Storage is a Django app that allows to store predefined ATC profiles in DB.\n\n## Requirements\n\n* [Django 1.10](https://github.com/django/django)\n* [atc_api](../django-atc-api)\n\n`ATC Profile Storage` depends on `ATC API` so make sure you have installed and configured [ATC API](../django-atc-api) first.\n\n## Installation\n\nThe easiest way to install `django-atc-profile-storage` is to install it directly from [pip](https://pypi.python.org/pypi).\n\n### From pip\n```bash\npip install django-atc-profile-storage\n```\n\n### From source\n```bash\ncd path/to/django-atc-profile-storage\npip install .\n```\n\n## Configuration\n\n1. Add `atc_profile_storage` to your `INSTALLED_APPS`' `settings.py` like this:\n```python\n    INSTALLED_APPS = (\n        ...\n        'atc_profile_storage',\n        'rest_framework',\n    )\n```\n\n2. Include the `atc_profile_storage` URLconf in your project `urls.py` like this:\n```python\n    ...\n    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),\n    ...\n```\n\n3. Migrate the Django DB:\n```bash\npython manage.py migrate\n```\n\n4. Start the development server\n```bash\npython manage.py runserver 0.0.0.0:8000\n```\n\n5. Visit http://127.0.0.1:8000/api/v1/profiles .\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/__init__.py",
    "content": "__version__ = '0.1.6'\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/migrations/0001_initial.py",
    "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='Profile',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('name', models.CharField(max_length=100)),\n                ('content', models.CharField(max_length=1024)),\n            ],\n            options={\n            },\n            bases=(models.Model,),\n        ),\n    ]\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/migrations/__init__.py",
    "content": ""
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/models.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom django.db import models\n\n\nclass Profile(models.Model):\n    name = models.CharField(max_length=100, blank=False, null=False)\n    content = models.CharField(max_length=1024, blank=False, null=False)\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/serializers.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom atc_profile_storage.models import Profile\nfrom rest_framework import serializers\nimport ast\n\n\nclass ProfileSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Profile\n        fields = ('id', 'name', 'content')\n\n    def to_representation(self, instance):\n        sup = super(serializers.ModelSerializer, self)\n        ret = sup.to_representation(instance)\n        ret['content'] = ast.literal_eval(ret['content'])\n        return ret\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/static/js/atc-profile-storage.js",
    "content": "/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\nAtcRestClient.prototype.new_profile = function (callback, data) {\n    this.api_call('POST', 'profiles', callback, data);\n};\n\nAtcRestClient.prototype.delete_profile = function (callback, id) {\n    this.api_call('DELETE', 'profiles/' + id.toString() + '/', callback);\n};\n\nAtcRestClient.prototype.get_profile = function (callback, id) {\n    this.api_call('GET', 'profiles/' + id.toString() + '/', callback);\n};\n\nAtcRestClient.prototype.get_profiles = function (callback) {\n    this.api_call('GET', 'profiles/', callback);\n};\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/urls.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom django.conf.urls import url\nfrom atc_profile_storage import views\n\nurlpatterns = [\n    url(r'^$', views.profile_list),\n    url(r'^(?P<pk>[0-9]+)/$', views.profile_detail),\n]\n"
  },
  {
    "path": "atc/django-atc-profile-storage/atc_profile_storage/views.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nfrom django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt\nfrom rest_framework.renderers import JSONRenderer\nfrom rest_framework.parsers import JSONParser\nfrom atc_profile_storage.models import Profile\nfrom atc_profile_storage.serializers import ProfileSerializer\n\n\nclass JSONResponse(HttpResponse):\n    def __init__(self, data, **kwargs):\n        content = JSONRenderer().render(data)\n        kwargs['content_type'] = 'application/json'\n        super(JSONResponse, self).__init__(content, **kwargs)\n\n\n@csrf_exempt\ndef profile_list(request):\n    if request.method == 'GET':\n        profiles = Profile.objects.all()\n        serializer = ProfileSerializer(profiles, many=True)\n        return JSONResponse(serializer.data)\n\n    elif request.method == 'POST':\n        data = JSONParser().parse(request)\n        data['content'] = str(data['content'])\n        serializer = ProfileSerializer(data=data)\n        if serializer.is_valid():\n            serializer.save()\n            return JSONResponse(serializer.data, status=201)\n        return JSONResponse(serializer.errors, status=400)\n\n    else:\n        return HttpResponse(status=405)\n\n\n@csrf_exempt\ndef profile_detail(request, pk):\n    try:\n        profile = Profile.objects.get(pk=pk)\n    except Profile.DoesNotExist:\n        return HttpResponse(status=404)\n\n    if request.method == 'GET':\n        serializer = ProfileSerializer(profile)\n        return JSONResponse(serializer.data)\n\n    elif request.method == 'POST':\n        data = JSONParser().parse(request)\n        serializer = ProfileSerializer(profile, data=data)\n        if serializer.is_valid():\n            serializer.save()\n            return JSONResponse(serializer.data)\n        return JSONResponse(serializer.errors, status=400)\n\n    elif request.method == 'DELETE':\n        profile.delete()\n        return HttpResponse(status=204)\n\n    else:\n        return HttpResponse(status=405)\n"
  },
  {
    "path": "atc/django-atc-profile-storage/setup.cfg",
    "content": "[wheel]\nuniversal = 1\n[build]\nexecutable = /usr/bin/env python\n"
  },
  {
    "path": "atc/django-atc-profile-storage/setup.py",
    "content": "#!/usr/bin/env python\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nimport os\nimport re\nimport sys\n\nfrom setuptools import setup\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:\n    README = readme.read()\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py).group(1)\n\n\ndef get_packages(package):\n    \"\"\"\n    Return root package and all sub-packages.\n    \"\"\"\n    return [dirpath\n            for dirpath, dirnames, filenames in os.walk(package)\n            if os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n\ndef get_package_data(package):\n    \"\"\"\n    Return all files under the root package, that are not in a\n    package themselves.\n    \"\"\"\n    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)\n            for dirpath, dirnames, filenames in os.walk(package)\n            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n    filepaths = []\n    for base, filenames in walk:\n        filepaths.extend([os.path.join(base, filename)\n                          for filename in filenames])\n    return {package: filepaths}\n\n\nversion = get_version('atc_profile_storage')\n\nif sys.argv[-1] == 'publish':\n    if os.system(\"pip freeze | grep wheel\"):\n        print(\"wheel not installed.\\nUse `pip install wheel`.\\nExiting.\")\n        sys.exit()\n    if os.system(\"pip freeze | grep twine\"):\n        print(\"twine not installed.\\nUse `pip install twine`.\\nExiting.\")\n        sys.exit()\n    os.system(\"python setup.py sdist bdist_wheel\")\n    os.system(\"twine upload dist/*\")\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %s -m 'version %s'\" % (version, version))\n    print(\"  git push --tags\")\n    sys.exit()\n\n\nsetup(\n    name='django-atc-profile-storage',\n    version=version,\n    description='ATC Profile storage app',\n    author='Emmanuel Bretelle',\n    author_email='chantra@fb.com',\n    url='https://github.com/facebook/augmented-traffic-control',\n    packages=get_packages('atc_profile_storage'),\n    package_data=get_package_data('atc_profile_storage'),\n    classifiers=['Programming Language :: Python', ],\n    long_description=README,\n    install_requires=['djangorestframework']\n)\n"
  },
  {
    "path": "chef/atc/.gitignore",
    "content": ".vagrant\nBerksfile.lock\n*~\n*#\n.#*\n\\#*#\n.*.sw[a-z]\n*.un~\n/cookbooks\n\n# Bundler\nGemfile.lock\nbin/*\n.bundle/*\n\n"
  },
  {
    "path": "chef/atc/.kitchen.yml",
    "content": "---\ndriver:\n    name: vagrant\n    synced_folders:\n        - [\"../../atc\", \"/usr/local/src/atc/atc\"]\n    network:\n        - [\"private_network\", {type: \"dhcp\"}]\n\nprovisioner:\n    name: chef_solo\n\nplatforms:\n    - name: ubuntu-12.04\n    - name: ubuntu-14.04\n    - name: centos-6.6\n      attributes:\n        python:\n            install_method: \"source\"\n            distribute_install_py_version: \"2.7\"\n#    - name: centos-7.0\n\nsuites:\n    - name: default\n      run_list:\n        - recipe[python]\n        - recipe[atc::default]\n"
  },
  {
    "path": "chef/atc/Berksfile",
    "content": "site :opscode\n\nmetadata\ncookbook 'simple_iptables', git: 'https://github.com/rtkwlf/cookbook-simple-iptables.git', tag: '0.6.4'\ncookbook 'python', git: 'https://github.com/poise/python.git', branch: 'master'\n"
  },
  {
    "path": "chef/atc/Gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'berkshelf'\n"
  },
  {
    "path": "chef/atc/LICENSE",
    "content": "Copyright (C) 2014 YOUR_NAME\n\nAll rights reserved - Do Not Redistribute\n"
  },
  {
    "path": "chef/atc/README.md",
    "content": "# atc cookbook\n\nInstall and configure atc\n\n# Requirements\n## Platforms\n- Centos 6\n- Ubuntu\n\n## Cookbooks\n- python\n- yum-epel\n- sysctl\n\nNOTE: The `yum-epel` is only used on CentOS\n\n# Usage\n\npython recipe must be included before any atc related ones.\n\nIf you want to install both `atcd` and `atcui` include the default `atc` recipe in your run list\nIf you only want the `atcd` daemon, include `atc::atcd` in your run list\nFor the `atcui` only, include `atc::atcui` in your run list\n\n# Attributes\n\n# Recipes\n\n## atc::default\nInstall both the daemon and the ui\n## atc::atcd\nInstall the daemon only\n## atc::atcui\nInstall the UI only\n\n# Author\n\nAuthor:: Emmanuel Bretelle (<chantra@fb.com>)\n"
  },
  {
    "path": "chef/atc/Thorfile",
    "content": "# encoding: utf-8\n\nrequire 'bundler'\nrequire 'bundler/setup'\nrequire 'berkshelf/thor'\n"
  },
  {
    "path": "chef/atc/Vagrantfile",
    "content": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\nboxes = [\n    {\n        :name => :precise,\n        :box    => 'bento/ubuntu-12.04',\n        :chef_version => :latest,\n    },\n    {\n        :name => :centos6,\n        :box    => 'bento/centos-6.6',\n        :chef_version => :latest,\n        :python_from_source => true,\n    },\n    {\n        :name => :trusty,\n        :box    => 'bento/ubuntu-14.04',\n        :chef_version => :latest,\n    },\n]\n\n# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!\nVAGRANTFILE_API_VERSION = \"2\"\n\nVagrant.configure(VAGRANTFILE_API_VERSION) do |config|\n    boxes.each do |opts|\n        config.vm.define opts[:name] do |box|\n            box.vm.box = opts[:box]\n            box.vm.synced_folder '../..', '/usr/local/src/atc'\n            # Chef install\n            box.omnibus.chef_version = opts.fetch(:chef_version, :latest)\n            # hostname\n            box.vm.hostname = opts[:name].to_s\n            # Berks\n            box.berkshelf.enabled = true\n            box.vm.provision :chef_solo do |chef|\n                chef.run_list = [\n                    \"recipe[atc::default]\"\n                ]\n                if opts.fetch(:python_from_source, false)\n                    chef.json = {\n                        \"python\" => {\n                          \"install_method\" => \"source\",\n                          \"distribute_install_py_version\" => \"2.7\",\n                        }\n                    }\n                end\n                chef.json.update(\n                  {\n                    \"atc\" => {\n                      \"atcd\" => {\n                        \"mode\" => \"unsecure\"\n                      }\n                    }\n                  }\n                )\n            end\n            # port forwarding\n            box.vm.network :forwarded_port, guest: 8000, host: 8080, auto_correct: true\n            # extra interface\n            box.vm.network :private_network, ip: opts.fetch(:priv_network, '100.64.33.3')\n            box.vm.provider \"virtualbox\" do |v|\n                v.customize [\"modifyvm\", :id, \"--usbehci\", opts.fetch(:usbehci, \"on\")]\n            end\n        end\n    end\nend\n"
  },
  {
    "path": "chef/atc/attributes/default.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\npackages = %w(\n  git\n)\nbase_dir = '/usr/local/atc'\nsrc_dir = '/usr/local/src/atc'\n\ndefault['atc']['src_dir'] = src_dir\ndefault['atc']['packages'] = packages\ndefault['atc']['base_dir'] = base_dir\ndefault['atc']['venv']['interpreter'] = 'python2.7'\ndefault['atc']['venv']['path'] = File.join(base_dir, 'venv')\ndefault['atc']['venv']['atcd']['packages'] = {\n  \"file://#{File.join(src_dir, 'atc/atc_thrift/')}\" =>\n    { :action => :install, :options => '-e' },\n  \"file://#{File.join(src_dir, 'atc/atcd/')}\" =>\n    { :action => :install, :options => '-e' }\n}\n\n# 'pyroute2' => {:action => :upgrade, :version => \"0.1.12\"},\ndefault['atc']['venv']['atcui']['packages'] = {\n  'django' => { :version => '1.10' },\n  'gunicorn' => {},\n  \"file://#{File.join(src_dir, 'atc/atc_thrift/')}\" =>\n    { :action => :install, :options => '-e' },\n  \"file://#{File.join(src_dir, 'atc/django-atc-api')}\" =>\n    { :action => :install, :options => '-e' },\n  \"file://#{File.join(src_dir, 'atc/django-atc-demo-ui')}\" =>\n    { :action => :install, :options => '-e' },\n  \"file://#{File.join(src_dir, 'atc/django-atc-profile-storage')}\" =>\n    { :action => :install, :options => '-e' },\n  'mock' => {}\n}\n\ndefault['atc']['atcd']['listen']['address'] = '0.0.0.0'\ndefault['atc']['atcd']['listen']['port'] = '9090'\ndefault['atc']['atcd']['sqlite'] = '/var/lib/atc/atcd.db'\ndefault['atc']['atcd']['interface']['wan'] = 'eth0'\ndefault['atc']['atcd']['interface']['lan'] = 'eth1'\ndefault['atc']['atcd']['mode'] = 'secure'\n\ndefault['atc']['atcui']['workers'] = 2\ndefault['atc']['atcui']['listen']['address'] = '0.0.0.0'\ndefault['atc']['atcui']['listen']['port'] = '8000'\ndefault['atc']['atcui']['base_dir'] = '/var/django/atc_ui'\ndefault['atc']['atcui']['user'] = 'atc'\ndefault['atc']['atcui']['group'] = 'atc'\n\ncase node['platform_family']\nwhen 'rhel'\n  default['atc']['atcui']['config_file'] = '/etc/sysconfig/atcui'\n  default['atc']['atcd']['config_file'] = '/etc/sysconfig/atcd'\nwhen 'debian'\n  default['atc']['atcui']['config_file'] = '/etc/default/atcui'\n  default['atc']['atcd']['config_file'] = '/etc/default/atcd'\nend\n\n# django app settings\ndefault['atc']['atc_api']['default_timeout'] = 24 * 60 * 60\n\nif platform?('centos') && node['platform_version'].to_i < 7\n  # setuid not supported by the upstart version centos6 uses.\n  default['atc']['atcui']['user'] = 'root'\n  default['atc']['atcui']['group'] = 'root'\nend\n"
  },
  {
    "path": "chef/atc/chefignore",
    "content": "# Put files/directories that should be ignored in this file when uploading\n# or sharing to the community site.\n# Lines that start with '# ' are comments.\n\n# OS generated files #\n######################\n.DS_Store\nIcon?\nnohup.out\nehthumbs.db\nThumbs.db\n\n# SASS #\n########\n.sass-cache\n\n# EDITORS #\n###########\n\\#*\n.#*\n*~\n*.sw[a-z]\n*.bak\nREVISION\nTAGS*\ntmtags\n*_flymake.*\n*_flymake\n*.tmproj\n.project\n.settings\nmkmf.log\n\n## COMPILED ##\n##############\na.out\n*.o\n*.pyc\n*.so\n*.com\n*.class\n*.dll\n*.exe\n*/rdoc/\n\n# Testing #\n###########\n.watchr\n.rspec\nspec/*\nspec/fixtures/*\ntest/*\nfeatures/*\nGuardfile\nProcfile\n\n# SCM #\n#######\n.git\n*/.git\n.gitignore\n.gitmodules\n.gitconfig\n.gitattributes\n.svn\n*/.bzr/*\n*/.hg/*\n*/.svn/*\n\n# Berkshelf #\n#############\nBerksfile\nBerksfile.lock\ncookbooks/*\ntmp\n\n# Cookbooks #\n#############\nCONTRIBUTING\nCHANGELOG*\n\n# Strainer #\n############\nColanderfile\nStrainerfile\n.colander\n.strainer\n\n# Vagrant #\n###########\n.vagrant\nVagrantfile\n\n# Travis #\n##########\n.travis.yml\n"
  },
  {
    "path": "chef/atc/files/default/init.d/atcd.debian",
    "content": "#!/bin/sh\n#\n# atcd - this script starts and stops the atcd traffic shaping daemon\n#\n# config: /etc/default/atcd /etc/atcd.conf\n# pidfile: /var/run/atcd.pid\n#\n### BEGIN INIT INFO\n# Provides:       atcd\n# Required-Start:\n# Required-Stop:\n# Default-Start:  2 3 4 5\n# Default-Stop:   0 1 6\n# Description:    ATCD is a thrift service that applies traffic shaping rules\n### END INIT INFO\n\n# Source function library\n. /lib/lsb/init-functions\n\nPATH=\"/usr/local/sbin:/usr/local/bin:${PATH}\"\nname=\"atcd\"\n\nATCD_LISTEN_ADDRESS=127.0.0.1\nATCD_LISTEN_PORT=9090\nATCD_VENV=\nATCD_SQLITE=/var/lib/atc/atcd.db\nATCD_WAN=eth0\nATCD_LAN=eth1\nATCD_MODE=secure\n\nsysconfig=\"/etc/default/${name}\"\nlockfile=\"/var/lock/${name}\"\npidfile=\"/var/run/${name}.pid\"\n\n[ -f $sysconfig ] && . $sysconfig\n\nstart() {\n    [ ${ATCD_VENV} ] && . ${ATCD_VENV}/bin/activate\n    atcd=\"$(which ${name})\"\n    [ -x $atcd ] || exit 5\n    echo -n \"Starting $name: \"\n    start-stop-daemon --start --pidfile $pidfile --exec $atcd -- --pidfile $pidfile --daemon --thrift-host ${ATCD_LISTEN_ADDRESS} --thrift-port ${ATCD_LISTEN_PORT} --sqlite-file ${ATCD_SQLITE} --atcd-lan ${ATCD_LAN} --atcd-wan ${ATCD_WAN} --atcd-mode ${ATCD_MODE}\n    retval=$?\n    echo\n    [ $retval -eq 0 ] && touch $lockfile\n    return $retval\n}\n\nstop() {\n    echo -n \"Stopping $name: \"\n    start-stop-daemon --stop --pidfile $pidfile\n    retval=$?\n    echo\n    [ $retval -eq 0 ] && rm -f $lockfile\n    return $retval\n}\n\nrestart() {\n    stop\n    start\n}\n\ncase \"$1\" in\n    start)\n        $1\n        ;;\n    stop)\n        $1\n        ;;\n    restart)\n        $1\n        ;;\n    condrestart|try-restart)\n        rh_status_q || exit 7\n        restart\n\t    ;;\n    *)\n        echo $\"Usage: $0 {start|stop|restart}\"\n        exit 2\nesac\n"
  },
  {
    "path": "chef/atc/files/default/init.d/atcd.rhel",
    "content": "#!/bin/sh\n#\n# atcd - this script starts and stops the atcd traffic shaping daemon\n#\n# chkconfig:   2345 80 20\n# description:  ATCD is a thrift service that applies traffic shaping rules\n# processname: atcd\n# config:      /etc/sysconfig/atcd /etc/atcd.conf\n# pidfile:     /var/run/atcd.pid\n#\n\n# Source function library.\n. /etc/rc.d/init.d/functions\n\n# Source networking configuration.\n. /etc/sysconfig/network\n\n# Check that networking is up.\n[ \"$NETWORKING\" = \"no\" ] && exit 0\n\nPATH=\"/usr/local/sbin:/usr/local/bin:${PATH}\"\nname=\"atcd\"\nprog=${name}\n\nATCD_LISTEN_ADDRESS=127.0.0.1\nATCD_LISTEN_PORT=9090\nATCD_VENV=\nATCD_SQLITE=/var/lib/atc/atcd.db\nATCD_WAN=eth0\nATCD_LAN=eth1\nATCD_MODE=secure\n\nsysconfig=\"/etc/sysconfig/${name}\"\nlockfile=\"/var/lock/subsys/${name}\"\npidfile=\"/var/run/${name}.pid\"\n\n[ -f $sysconfig ] && . $sysconfig\n\n\nstart() {\n    [ ${ATCD_VENV} ] && . ${ATCD_VENV}/bin/activate\n    atcd=\"$(which ${name})\"\n    [ -x $atcd ] || exit 5\n    echo -n \"Starting $name: \"\n    daemon $atcd --pidfile $pidfile --daemon --thrift-host ${ATCD_LISTEN_ADDRESS} --thrift-port ${ATCD_LISTEN_PORT} --sqlite-file ${ATCD_SQLITE} --atcd-wan ${ATCD_WAN} --atcd-lan ${ATCD_LAN} --atcd-mode ${ATCD_MODE}\n    retval=$?\n    echo\n    [ $retval -eq 0 ] && touch $lockfile\n    return $retval\n}\n\nstop() {\n    echo -n \"Stopping $name: \"\n    killproc -p $pidfile $prog\n    retval=$?\n    echo\n    [ $retval -eq 0 ] && rm -f $lockfile\n    return $retval\n}\n\nrestart() {\n    stop\n    start\n}\n\nrh_status() {\n    status $prog\n}\n\nrh_status_q() {\n    rh_status >/dev/null 2>&1\n}\n\ncase \"$1\" in\n    start)\n        rh_status_q && exit 0\n        $1\n        ;;\n    stop)\n        rh_status_q || exit 0\n        $1\n        ;;\n    restart)\n        $1\n        ;;\n    status|status_q)\n        rh_$1\n        ;;\n    condrestart|try-restart)\n        rh_status_q || exit 7\n        restart\n\t    ;;\n    *)\n        echo $\"Usage: $0 {start|stop|status|restart}\"\n        exit 2\nesac\n"
  },
  {
    "path": "chef/atc/genymotion.sh",
    "content": "#!/bin/bash\n\nPLATFORM=$(uname -s)\n\nif [[ \"${PLATFORM}\" == 'Darwin' ]]; then\n    VBOXMANAGE='/Applications/VirtualBox.app/Contents/MacOS/VBoxManage'\nelse\n    VBOXMANAGE='/usr/lib/virtualbox/VBoxManage'\nfi\n\nfunction get_genymotion_uids () {\n    ${VBOXMANAGE} list vms | grep 'API' | awk -F'[{}]' '{print $2}'\n}\n\nfunction get_atc_uid () {\n    ${VBOXMANAGE} list vms | egrep 'atc(centos|ubuntu)' | awk -F'[{}]' '{print $2}'\n}\n\nget_genymotion_uids\nget_atc_uid\n"
  },
  {
    "path": "chef/atc/libraries/default.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nclass Chef\n  # Some helper functions\n  class Node\n    def virtualized?\n      if self.key?('virtualization') && \\\n         virtualization.key?('system')\n        return true\n      end\n      false\n    end\n\n    def vagrant?\n      virtualized? && etc.passwd.key?('vagrant')\n    end\n\n    def default_user\n      return 'vagrant' if vagrant?\n      'root'\n    end\n\n    def repo_basedir\n      node['atc']['src_dir']\n    end\n\n    def selinux?\n      if File.exist?('/selinux/enforce')\n        return File.read('/selinux/enforce') == '1'\n      end\n      false\n    end\n  end\nend\n"
  },
  {
    "path": "chef/atc/metadata.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nname             'atc'\nmaintainer       'Facebook, Inc.'\nmaintainer_email ''\nlicense          'BSD'\ndescription      'Installs/Configures atc'\nlong_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))\nversion          '0.1.0'\n\ndepends 'apt'\ndepends 'dhcp', '~> 2.2.2'\ndepends 'python'\ndepends 'simple_iptables', '~> 0.6.4'\ndepends 'sysctl', '~> 0.6.0'\ndepends 'yum-epel'\n"
  },
  {
    "path": "chef/atc/providers/install_packages.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Provider:: install_packages\n#\n#\naction :install do\n  new_resource.packages.each do |pkg|\n    package pkg do\n      action :install\n    end\n  end\n  new_resource.updated_by_last_action(true)\nend\n"
  },
  {
    "path": "chef/atc/providers/install_virtualenv_packages.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Provider:: install_virtualenv_packages\n#\n\ndef handle_packages(packages, virtualenv)\n  packages.each do |k, v|\n    python_pip k do\n      version v[:version] if v.key?(:version)\n      action v[:action] if v.key?(:action)\n      options v[:options] if v.key?(:options)\n      virtualenv virtualenv unless  v.fetch(:global, false)\n    end\n  end\nend\n\naction :install do\n  handle_packages(\n    new_resource.packages,\n    new_resource.virtualenv\n  )\n  new_resource.updated_by_last_action(true)\nend\n"
  },
  {
    "path": "chef/atc/recipes/_common_system.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n# Cookbook Name:: atc\n# Recipe:: _common_system\n#\n\ncase node['platform_family']\nwhen 'rhel'\n  include_recipe 'yum-epel'\nwhen 'debian'\n  include_recipe 'apt'\nend\n\ninclude_recipe 'python'\n\ngroup node['atc']['atcui']['group'] do\n  system\nend\n\nuser node['atc']['atcui']['user'] do\n  system\n  gid node['atc']['atcui']['group']\n  shell '/sbin/nologin'\nend\n\ncase node['platform_family']\nwhen 'rhel'\n  execute 'yum makecache'\nwhen 'debian'\n  execute 'apt-get update'\nelse\n  log 'Not updating package cache.' do\n    level :warn\n  end\nend\n\natc_install_packages 'p' do\n  packages node['atc']['packages']\nend\n"
  },
  {
    "path": "chef/atc/recipes/_virtualenv.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Recipe:: _virtualenv\n#\natcui_user = node['atc']['atcui']['user']\natcui_group = node['atc']['atcui']['group']\n\ndirectory node['atc']['base_dir'] do\n  owner atcui_user\n  group atcui_group\n  mode 00755\n  action :create\n  recursive true\nend\n\n# FIXME\n# setuptools fail to install a package in virtual mode as it looks for\n# Makefile in /usr/atc...\nlink node['atc']['base_dir'].gsub('/usr/local', '/usr') do\n  to node['atc']['base_dir']\nend\n\npython_virtualenv node['atc']['venv']['path'] do\n  interpreter node['atc']['venv']['interpreter']\n  owner atcui_user\n  group atcui_group\n  action :create\nend\n"
  },
  {
    "path": "chef/atc/recipes/atcd.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Recipe:: atcd\n#\ninclude_recipe 'atc::_common_system'\ninclude_recipe 'atc::_virtualenv'\n\n# Set sysctl values.\nnode.default['sysctl']['params']['net']['ipv4']['ip_forward'] = 1\nnode.default['sysctl']['allow_sysctl_conf'] = true\nnode['network']['interfaces'].each do |name, eth|\n  next if eth.encapsulation != 'Ethernet'\n  node.default['sysctl']['params']['net']['ipv4']['conf']\\\n    [name]['arp_ignore'] = 1\n  node.default['sysctl']['params']['net']['ipv4']['conf']\\\n    [name]['arp_announce'] = 2\nend\n\n# If we're in a sandbox, i.e. vagrant, we want to set up NAT\n# But if we're not, we will let the user handle that themselves.\n# We need NAT because we have just a bunch of VMs (atcclients) without a router\n# so the atcd box need to handle the routing/NAT\nif node.vagrant?\n\n  # Try to guess the correct interfaces.\n  lan_iface = ''\n  wan_iface = node['network']['default_interface']\n  node['network']['interfaces'].each do |name, eth|\n    next if (eth.encapsulation != 'Ethernet') || (name == wan_iface)\n    lan_iface = name\n    break\n  end\n\n  if lan_iface == ''\n    log 'You only have 1 network interface. '\\\n      'ATCD requires 2 network interfaces. '\\\n      'Chef will likely fail.'\n    lan_iface = 'eth1'\n  end\n\n  log \"Using interfaces lan=>#{lan_iface}, wan=>#{wan_iface}\"\n\n  # NAT\n  include_recipe 'simple_iptables'\n  simple_iptables_rule 'nat' do\n    table 'nat'\n    direction 'POSTROUTING'\n    jump 'MASQUERADE'\n    rule \"-o #{node['network']['default_interface']}\"\n  end\n\n  # DHCP\n  # By providing IP on the lan interface,\n  # we can get Genymotion instances to route through atc\n  require 'ipaddr'\n  node.default['dhcp']['interfaces'] = [lan_iface]\n  include_recipe 'dhcp::server'\n\n  ipv4 = node['network']['interfaces'][lan_iface]['addresses'].select do |_, v|\n    v.family == 'inet'\n  end\n  ip = ipv4.keys[0]\n  ipaddr = IPAddr.new \"#{ip}/#{ipv4[ip]['prefixlen']}\"\n  range_start = ipaddr | 100\n  range_end = ipaddr | 200\n  dhcp_subnet ipaddr.to_s do\n    range \"#{range_start} #{range_end}\"\n    broadcast ipv4[ip]['broadcast']\n    netmask ipv4[ip]['netmask']\n    routers [ip]\n  end\n\n  # When running under vagrant, atcd depends on the mounts and will not start\n  # unless those are up. The mount is happening after the system is up.\n  # We can use udev to trigger starting/stopping atcd when amount/umount event\n  # happens.\n  template '/etc/udev/rules.d/50-vagrant-mount-atcd.rules' do\n    source 'mount-udev.rules.erb'\n    variables(\n      :service => 'atcd'\n    )\n  end\nend\n\ninclude_recipe 'sysctl::apply'\n\n# Set python environment.\natc_install_virtualenv_packages 'atcd_packages' do\n  packages node['atc']['venv']['atcd']['packages']\n  virtualenv node['atc']['venv']['path']\nend\n\n# Ensure the Sqlite directory exists\ndirectory File.dirname(node['atc']['atcd']['sqlite']) do\n  owner 'root'\n  group 'root'\n  mode 00755\n  recursive true\nend\n\ntemplate node['atc']['atcd']['config_file'] do\n  source 'config/atcd.erb'\n  mode 0755\n  owner 'root'\n  group 'root'\n  notifies :restart, 'service[atcd]', :delayed\nend\n\ncookbook_file '/etc/init.d/atcd' do\n  source \"init.d/atcd.#{node['platform_family']}\"\n  mode 0755\n  owner 'root'\n  group 'root'\n  notifies :restart, 'service[atcd]', :delayed\nend\n\nservice 'atcd' do\n  supports :restart => true\n  action [:enable, :start]\nend\n"
  },
  {
    "path": "chef/atc/recipes/atcui.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Recipe:: atcui\n#\ninclude_recipe 'atc::_common_system'\ninclude_recipe 'atc::_virtualenv'\n\natcui_user = node['atc']['atcui']['user']\nactui_group = node['atc']['atcui']['group']\n\n# Set python environment.\natc_install_virtualenv_packages 'atcui_packages' do\n  packages node['atc']['venv']['atcui']['packages']\n  virtualenv node['atc']['venv']['path']\nend\n\ndjango_root = File.dirname(node['atc']['atcui']['base_dir'])\ndjango_project = File.basename(node['atc']['atcui']['base_dir'])\n\ndirectory django_root do\n  owner atcui_user\n  group actui_group\n  mode 00755\n  recursive true\nend\n\ndirectory '/var/log/atc' do\n  owner atcui_user\n  group actui_group\n  mode 00750\nend\n\nexecute 'install django' do\n  command \"#{File.join(node['atc']['venv']['path'], 'bin', 'django-admin')} \" \\\n    \"startproject #{django_project} .\"\n  cwd django_root\n  user atcui_user\n  group actui_group\n  not_if { ::File.exist?(File.join(django_root, 'manage.py')) }\nend\n\n%w(urls settings).each do |file|\n  template File.join(node['atc']['atcui']['base_dir'], \"#{file}.py\") do\n    source \"django/#{file}.py.erb\"\n    mode 0644\n    owner atcui_user\n    group actui_group\n    notifies :restart, 'service[atcui]', :delayed\n  end\nend\n\ntemplate node['atc']['atcui']['config_file'] do\n  source 'config/atcui.erb'\n  mode 0755\n  owner atcui_user\n  group actui_group\n  notifies :restart, 'service[atcui]', :delayed\nend\n\nif Chef::Platform::ServiceHelpers.service_resource_providers.include? :upstart\n  template '/etc/init/atcui.conf' do\n    source 'upstart/atcui.conf.erb'\n    mode 0644\n    owner 'root'\n    group 'root'\n    notifies :restart, 'service[atcui]', :delayed\n  end\nelsif Chef::Platform::ServiceHelpers.service_resource_providers.include? \\\n  :systemd\n  log 'systemd not currently supported.' do\n    level :warn\n  end\nelse\n  log 'Unsupported init system: ' +\n    Chef::Platform::ServiceHelpers.service_resource_providers.to_s do\n    level :warn\n  end\nend\n\nservice 'atcui' do\n  provider Chef::Provider::Service::Upstart\n  supports :restart => true\n  action [:enable, :start]\nend\n\natcui_setup_file = '/usr/local/bin/atcui-setup'\ntemplate atcui_setup_file do\n  source 'atcui-setup.erb'\n  mode 0755\n  owner atcui_user\n  group actui_group\nend\n\n# Setup atcui if it is the first time it is installed\natcui_configured_file = '/.atcui_configured'\nunless File.exist?(atcui_configured_file)\n  execute 'atcui setup' do\n    command atcui_setup_file\n    user atcui_user\n    group actui_group\n  end\n  file atcui_configured_file do\n    action :touch\n  end\nend\n# When running under vagrant, atcui depends on the mounts and will not start\n# unless those are up. The mount is happening after the system is up.\n# We can use udev to trigger starting/stopping atcui when amount/umount event\n# happens.\ntemplate '/etc/udev/rules.d/50-vagrant-mount-atcui.rules' do\n  only_if { node.vagrant? }\n  source 'mount-udev.rules.erb'\n  variables(\n    :service => 'atcui'\n  )\nend\n"
  },
  {
    "path": "chef/atc/recipes/default.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Recipe:: default\n#\ninclude_recipe 'atc::_common_system'\ninclude_recipe 'atc::atcd'\ninclude_recipe 'atc::atcui'\n"
  },
  {
    "path": "chef/atc/resources/install_packages.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Resources:: install_packages\n#\n\nactions :install\nattribute :packages, :kind_of => Array, :default => []\ndefault_action :install\n"
  },
  {
    "path": "chef/atc/resources/install_virtualenv_packages.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atc\n# Resources:: install_virtualenv_packages\n#\n\nactions :install\nattribute :packages, :kind_of => Hash, :default => {}\nattribute :virtualenv, :kind_of => String, :default => nil\ndefault_action :install\n"
  },
  {
    "path": "chef/atc/templates/default/atcui-setup.erb",
    "content": "#!/bin/bash\n\nRED=\"\\e[0;31m\"\nGREEN=\"\\e[0;32m\"\nNC=\"\\e[00m\"\n\nUSER=\"<%= node['atc']['atcui']['user'] %>\"\n\n# Allow either $USER or root to run this script.\nif [ \"$(whoami)\" == \"$USER\" ] ; then\n    USER=\"\"\nelif [ \"$EUID\" != \"0\" ] ; then\n   echo -e \"${RED}$0 must be run as root or $USER.${NC}\"\n   exit 1\nfi\n\nVENV=\"<%= File.join(node['atc']['venv']['path'], 'bin', 'activate') %>\"\n\nfunction p() {\n    echo -e \"${GREEN}${1}${NC}\"\n}\n\nfunction managepy() {\n    C=\"cd /var/django && . \\\"$VENV\\\" && python manage.py $@\"\n    if [ -z \"$USER\" ] ; then\n        /bin/bash -c \"$C\"\n    else\n        sudo -u \"$USER\" /bin/bash -c \"$C\"\n    fi\n}\n\np \"Migrating DB\"\nmanagepy migrate\n\np \"Loading Samples\"\nmanagepy loaddata sample\n\np \"Generating static files\"\nmanagepy collectstatic --noinput\n"
  },
  {
    "path": "chef/atc/templates/default/config/atcd.erb",
    "content": "<% if node['atc']['atcd']['listen']['address'] %>\nATCD_LISTEN_ADDRESS=<%= node['atc']['atcd']['listen']['address'] %>\n<% end %>\n<% if node['atc']['atcd']['listen']['port'] %>\nATCD_LISTEN_PORT=<%= node['atc']['atcd']['listen']['port'] %>\n<% end %>\n<% if node['atc']['venv']['path'] %>\nATCD_VENV=<%= node['atc']['venv']['path'] %>\n<% end %>\n<% if node['atc']['atcd']['sqlite'] %>\nATCD_SQLITE=<%= node['atc']['atcd']['sqlite'] %>\n<% end %>\n<% if node['atc']['atcd']['interface']['wan'] %>\nATCD_WAN=<%= node['atc']['atcd']['interface']['wan'] %>\n<% end %>\n<% if node['atc']['atcd']['interface']['lan'] %>\nATCD_LAN=<%= node['atc']['atcd']['interface']['lan'] %>\n<% end %>\n<% if node['atc']['atcd']['mode'] %>\nATCD_MODE=<%= node['atc']['atcd']['mode'] %>\n<% end %>\n"
  },
  {
    "path": "chef/atc/templates/default/config/atcui.erb",
    "content": "<% if node['atc']['atcui']['listen']['address'] %>\nATCUI_LISTEN_ADDRESS=<%= node['atc']['atcui']['listen']['address'] %>\n<% end %>\n<% if node['atc']['atcui']['listen']['port'] %>\nATCUI_LISTEN_PORT=<%= node['atc']['atcui']['listen']['port'] %>\n<% end %>\n<% if node['atc']['atcui']['workers'] %>\nATCUI_WORKERS=<%= node['atc']['atcui']['workers'] %>\n<% end %>\n<% if node['atc']['atcui']['base_dir'] %>\nATCUI_SETTINGS_PATH=<%= node['atc']['atcui']['base_dir'] %>\n<% end %>\n<% if node['atc']['venv']['path'] %>\nATCUI_VENV=<%= node['atc']['venv']['path'] %>\n<% end %>\n"
  },
  {
    "path": "chef/atc/templates/default/django/settings.py.erb",
    "content": "# Django settings for atc_ui project.\n\nimport os\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\n# Uncomment the following to run django-coverage during unit tests\n# requires coverage and django-coverage modules\n# TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'\n\nBASE_DIR = os.path.abspath(os.path.dirname(__file__))\n\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3',\n        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),\n        # The following settings are not used with sqlite3:\n        'USER': '',\n        'PASSWORD': '',\n        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.\n        'PORT': '',                      # Set to empty string for default.\n    }\n}\n\nATC_API = {\n    'DEFAULT_TC_TIMEOUT': <%= node['atc']['atc_api']['default_timeout'] %>,\n}\n\n# Hosts/domain names that are valid for this site; required if DEBUG is False\n# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts\nALLOWED_HOSTS = ['*']\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# In a Windows environment this must be set to your system time zone.\nTIME_ZONE = 'America/Los_Angeles'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\nSITE_ID = 1\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# If you set this to False, Django will not format dates, numbers and\n# calendars according to the current locale.\nUSE_L10N = True\n\n# If you set this to False, Django will not use timezone-aware datetimes.\nUSE_TZ = True\n\n# Absolute filesystem path to the directory that will hold user-uploaded files.\n# Example: \"/var/www/example.com/media/\"\nMEDIA_ROOT = ''\n\n# URL that handles the media served from MEDIA_ROOT. Make sure to use a\n# trailing slash.\n# Examples: \"http://example.com/media/\", \"http://media.example.com/\"\nMEDIA_URL = ''\n\n# Absolute path to the directory static files should be collected to.\n# Don't put anything in this directory yourself; store your static files\n# in apps' \"static/\" subdirectories and in STATICFILES_DIRS.\n# Example: \"/var/www/example.com/static/\"\nSTATIC_ROOT = os.path.join(BASE_DIR, 'collected_static')\n\n# URL prefix for static files.\n# Example: \"http://example.com/static/\", \"http://static.example.com/\"\nSTATIC_URL = '/static/'\n\n# Additional locations of static files\nSTATICFILES_DIRS = (\n)\n\nEXTERNAL_DIRS = (\n    os.path.join(BASE_DIR, 'external')\n)\n\n# List of finder classes that know how to find static files in\n# various locations.\nSTATICFILES_FINDERS = (\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n    # 'django.contrib.staticfiles.finders.DefaultStorageFinder',\n)\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = '#g^0#9qe7b=$t_=z2-a5_=$=g8+0-gl-_^3rdtn83z8wk%h&@9'\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'APP_DIRS': True,\n    },\n]\n\n# List of callables that know how to import templates from various sources.\nTEMPLATE_LOADERS = (\n    'django.template.loaders.filesystem.Loader',\n    'django.template.loaders.app_directories.Loader',\n    # 'django.template.loaders.eggs.Loader',\n)\n\nMIDDLEWARE_CLASSES = (\n    'django.middleware.common.CommonMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.csrf.CsrfViewMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    # Uncomment the next line for simple clickjacking protection:\n    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',\n)\n\nROOT_URLCONF = 'atc_ui.urls'\n\n# Python dotted path to the WSGI application used by Django's runserver.\nWSGI_APPLICATION = 'atc_ui.wsgi.application'\n\nTEMPLATE_DIRS = (\n    os.path.join(BASE_DIR, 'templates'),\n)\n\nINSTALLED_APPS = (\n    'django_static_jquery',\n    'bootstrap_themes',\n    'atc_api',\n    'atc_demo_ui',\n    'atc_profile_storage',\n    'rest_framework',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.sites',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    'django.contrib.admin',\n)\n\nREST_FRAMEWORK = {\n    'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny',),\n    'PAGINATE_BY': 20,\n    'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',)\n}\n\n# A sample logging configuration. The only tangible logging\n# performed by this configuration is to send an email to\n# the site admins on every HTTP 500 error when DEBUG=False.\n# See http://docs.djangoproject.com/en/dev/topics/logging for\n# more details on how to customize your logging configuration.\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'filters': {\n        'require_debug_false': {\n            '()': 'django.utils.log.RequireDebugFalse'\n        }\n    },\n    'handlers': {\n        'mail_admins': {\n            'level': 'ERROR',\n            'filters': ['require_debug_false'],\n            'class': 'django.utils.log.AdminEmailHandler'\n        }\n    },\n    'loggers': {\n        'django.request': {\n            'handlers': ['mail_admins'],\n            'level': 'INFO',\n            'propagate': True,\n        },\n    }\n}\n"
  },
  {
    "path": "chef/atc/templates/default/django/urls.py.erb",
    "content": "from django.conf.urls import include\nfrom django.conf.urls import url\nfrom django.contrib import admin\nfrom django.views.generic import RedirectView\n\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\nadmin.autodiscover()\n\nurlpatterns = [\n    url(r'^admin/', include(admin.site.urls)),\n    url(r'^api/v1/', include('atc_api.urls')),\n    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),\n    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),\n    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),\n]\nurlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n"
  },
  {
    "path": "chef/atc/templates/default/mount-udev.rules.erb",
    "content": "# File generated by chef, do not edit\n\n# Start <%= @service %> on vagrant mount\nSUBSYSTEM==\"bdi\",ACTION==\"add\",RUN+=\"/etc/init.d/<%= @service %> start\"\n\n# Stop <%= @service %> on vagrant unmount\nSUBSYSTEM==\"bdi\",ACTION==\"remove\",RUN+=\"/etc/init.d/<%= @service %> stop\"\n"
  },
  {
    "path": "chef/atc/templates/default/upstart/atcui.conf.erb",
    "content": "# Augmented Traffic Control User Interface\n\n#author \"Author Here\"\nversion \"0.0.1\"\ndescription \"Augmented Traffic Control User Interface\"\n\nstart on (started networking)\nstop on (stopped networking)\n\n<% if node['atc']['atcui']['user'] != 'root' %>\nsetuid <%= node['atc']['atcui']['user'] %>\n<% end %>\n<% if node['atc']['atcui']['group'] != 'root' %>\nsetgid <%= node['atc']['atcui']['group'] %>\n<% end %>\nchdir /var/django\n\nrespawn\nrespawn limit 2 1\n\n# Defaults\n# Can be overridden in /etc/default/atcui\nenv ATCUI_LOG_FILE=/var/log/atc/atcui.log\nenv ATCUI_LISTEN_ADDRESS=0.0.0.0\nenv ATCUI_LISTEN_PORT=8000\nenv ATCUI_WORKERS=2\nenv ATCUI_VENV=/usr/local/atc/venv\n\nscript\n    [ -f \"/etc/default/atcui\" ] && . /etc/default/atcui\n\n    [ -d \"$ATCUI_VENV\" ] && . \"$ATCUI_VENV/bin/activate\"\n\n    gunicorn -w $ATCUI_WORKERS --log-file=\"$ATCUI_LOG_FILE\" -b \"$ATCUI_LISTEN_ADDRESS:$ATCUI_LISTEN_PORT\" atc_ui.wsgi:application\nend script\n"
  },
  {
    "path": "chef/atcclient/.gitignore",
    "content": ".vagrant\nBerksfile.lock\n*~\n*#\n.#*\n\\#*#\n.*.sw[a-z]\n*.un~\n/cookbooks\n\n# Bundler\nGemfile.lock\nbin/*\n.bundle/*\n\n"
  },
  {
    "path": "chef/atcclient/Berksfile",
    "content": "site :opscode\n\nmetadata\n"
  },
  {
    "path": "chef/atcclient/Gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'berkshelf'\n"
  },
  {
    "path": "chef/atcclient/LICENSE",
    "content": "Copyright (C) 2014 YOUR_NAME\n\nAll rights reserved - Do Not Redistribute\n"
  },
  {
    "path": "chef/atcclient/README.md",
    "content": "# atcclient cookbook\n\n# Requirements\n\n# Usage\n\n# Attributes\n\n# Recipes\n\n# Author\n\nAuthor:: YOUR_NAME (<YOUR_EMAIL>)\n"
  },
  {
    "path": "chef/atcclient/Thorfile",
    "content": "# encoding: utf-8\n\nrequire 'bundler'\nrequire 'bundler/setup'\nrequire 'berkshelf/thor'\n"
  },
  {
    "path": "chef/atcclient/Vagrantfile",
    "content": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\nDFT_BOX = 'chef/ubuntu-12.04'\nTOTAL_BOXES = 5\nbox = {\n    :box    => DFT_BOX,\n    :chef_version => :latest,\n}\n# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!\nVAGRANTFILE_API_VERSION = \"2\"\n\ndef make_vm(config, opts, number)\n    name = \"atcclient0#{number}\"\n    config.vm.define name do |box|\n        box.vm.box = opts.fetch(:box, DFT_BOX)\n        box.vm.synced_folder '../../atc', '/vagrant_data/atc'\n        # Chef install\n        box.omnibus.chef_version = opts.fetch(:chef_version, :latest)\n        # hostname\n        box.vm.hostname = name.to_s\n        # Berks\n        box.berkshelf.enabled = true\n        box.vm.provision :chef_solo do |chef|\n            chef.run_list = [\n                \"recipe[atcclient::default]\"\n            ]\n        end\n        box.vm.provider :virtualbox do |vb|\n            vb.gui = true\n        end\n        box.vm.provision :shell, :inline => \"ip r replace default via 100.64.33.3\"\n        # extra interface\n        last_octet = 100 + number\n        box.vm.network :private_network, ip: \"100.64.33.#{last_octet}\"\n    end\nend\n\nVagrant.configure(VAGRANTFILE_API_VERSION) do |config|\n  for i in 1..TOTAL_BOXES\n    make_vm(config, box, i)\n  end\n  # All Vagrant configuration is done here. The most common configuration\n  # options are documented and commented below. For a complete reference,\n  # please see the online documentation at vagrantup.com.\n\n  # Every Vagrant virtual environment requires a box to build off of.\n  # config.vm.box = \"base\"\n\n  # The url from where the 'config.vm.box' box will be fetched if it\n  # doesn't already exist on the user's system.\n  # config.vm.box_url = \"http://domain.com/path/to/above.box\"\n\n  # Create a forwarded port mapping which allows access to a specific port\n  # within the machine from a port on the host machine. In the example below,\n  # accessing \"localhost:8080\" will access port 80 on the guest machine.\n  # config.vm.network :forwarded_port, guest: 80, host: 8080\n\n  # Create a private network, which allows host-only access to the machine\n  # using a specific IP.\n  # config.vm.network :private_network, ip: \"192.168.33.10\"\n\n  # Create a public network, which generally matched to bridged network.\n  # Bridged networks make the machine appear as another physical device on\n  # your network.\n  # config.vm.network :public_network\n\n  # If true, then any SSH connections made will enable agent forwarding.\n  # Default value: false\n  # config.ssh.forward_agent = true\n\n  # Share an additional folder to the guest VM. The first argument is\n  # the path on the host to the actual folder. The second argument is\n  # the path on the guest to mount the folder. And the optional third\n  # argument is a set of non-required options.\n  # config.vm.synced_folder \"../data\", \"/vagrant_data\"\n\n  # Provider-specific configuration so you can fine-tune various\n  # backing providers for Vagrant. These expose provider-specific options.\n  # Example for VirtualBox:\n  #\n  # config.vm.provider :virtualbox do |vb|\n  #   # Don't boot with headless mode\n  #   vb.gui = true\n  #\n  #   # Use VBoxManage to customize the VM. For example to change memory:\n  #   vb.customize [\"modifyvm\", :id, \"--memory\", \"1024\"]\n  # end\n  #\n  # View the documentation for the provider you're using for more\n  # information on available options.\n\n  # Enable provisioning with Puppet stand alone.  Puppet manifests\n  # are contained in a directory path relative to this Vagrantfile.\n  # You will need to create the manifests directory and a manifest in\n  # the file base.pp in the manifests_path directory.\n  #\n  # An example Puppet manifest to provision the message of the day:\n  #\n  # # group { \"puppet\":\n  # #   ensure => \"present\",\n  # # }\n  # #\n  # # File { owner => 0, group => 0, mode => 0644 }\n  # #\n  # # file { '/etc/motd':\n  # #   content => \"Welcome to your Vagrant-built virtual machine!\n  # #               Managed by Puppet.\\n\"\n  # # }\n  #\n  # config.vm.provision :puppet do |puppet|\n  #   puppet.manifests_path = \"manifests\"\n  #   puppet.manifest_file  = \"site.pp\"\n  # end\n\n  # Enable provisioning with chef solo, specifying a cookbooks path, roles\n  # path, and data_bags path (all relative to this Vagrantfile), and adding\n  # some recipes and/or roles.\n  #\n  # config.vm.provision :chef_solo do |chef|\n  #   chef.cookbooks_path = \"../my-recipes/cookbooks\"\n  #   chef.roles_path = \"../my-recipes/roles\"\n  #   chef.data_bags_path = \"../my-recipes/data_bags\"\n  #   chef.add_recipe \"mysql\"\n  #   chef.add_role \"web\"\n  #\n  #   # You may also specify custom JSON attributes:\n  #   chef.json = { :mysql_password => \"foo\" }\n  # end\n\n  # Enable provisioning with chef server, specifying the chef server URL,\n  # and the path to the validation key (relative to this Vagrantfile).\n  #\n  # The Opscode Platform uses HTTPS. Substitute your organization for\n  # ORGNAME in the URL and validation key.\n  #\n  # If you have your own Chef Server, use the appropriate URL, which may be\n  # HTTP instead of HTTPS depending on your configuration. Also change the\n  # validation key to validation.pem.\n  #\n  # config.vm.provision :chef_client do |chef|\n  #   chef.chef_server_url = \"https://api.opscode.com/organizations/ORGNAME\"\n  #   chef.validation_key_path = \"ORGNAME-validator.pem\"\n  # end\n  #\n  # If you're using the Opscode platform, your validator client is\n  # ORGNAME-validator, replacing ORGNAME with your organization name.\n  #\n  # If you have your own Chef Server, the default validation client name is\n  # chef-validator, unless you changed the configuration.\n  #\n  #   chef.validation_client_name = \"ORGNAME-validator\"\nend\n"
  },
  {
    "path": "chef/atcclient/chefignore",
    "content": "# Put files/directories that should be ignored in this file when uploading\n# or sharing to the community site.\n# Lines that start with '# ' are comments.\n\n# OS generated files #\n######################\n.DS_Store\nIcon?\nnohup.out\nehthumbs.db\nThumbs.db\n\n# SASS #\n########\n.sass-cache\n\n# EDITORS #\n###########\n\\#*\n.#*\n*~\n*.sw[a-z]\n*.bak\nREVISION\nTAGS*\ntmtags\n*_flymake.*\n*_flymake\n*.tmproj\n.project\n.settings\nmkmf.log\n\n## COMPILED ##\n##############\na.out\n*.o\n*.pyc\n*.so\n*.com\n*.class\n*.dll\n*.exe\n*/rdoc/\n\n# Testing #\n###########\n.watchr\n.rspec\nspec/*\nspec/fixtures/*\ntest/*\nfeatures/*\nGuardfile\nProcfile\n\n# SCM #\n#######\n.git\n*/.git\n.gitignore\n.gitmodules\n.gitconfig\n.gitattributes\n.svn\n*/.bzr/*\n*/.hg/*\n*/.svn/*\n\n# Berkshelf #\n#############\nBerksfile\nBerksfile.lock\ncookbooks/*\ntmp\n\n# Cookbooks #\n#############\nCONTRIBUTING\nCHANGELOG*\n\n# Strainer #\n############\nColanderfile\nStrainerfile\n.colander\n.strainer\n\n# Vagrant #\n###########\n.vagrant\nVagrantfile\n\n# Travis #\n##########\n.travis.yml\n"
  },
  {
    "path": "chef/atcclient/libraries/patch.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n# Monkey patch to allow installing unbuntu-desktop without timeouting until it is fixed upstream\n# see https://github.com/test-kitchen/test-kitchen/issues/380#issuecomment-41359083\nclass ::Chef::Provider::Package::Apt\n  def run_noninteractive(command)\n    # There are some mighty big packages in this recipe, and 600s is just not enough!\n    shell_out!(command, :env => { \"DEBIAN_FRONTEND\" => \"noninteractive\", \"LC_ALL\" => nil }, :log_level => :info, :timeout => 216000)\n  end\nend\n\n"
  },
  {
    "path": "chef/atcclient/metadata.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\nname             'atcclient'\nmaintainer       'Facebook, Inc.'\nmaintainer_email ''\nlicense          'BSD'\ndescription      'Installs/Configures atcclient'\nlong_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))\nversion          '0.1.0'\ndepends 'apt', '= 2.4.0'\n"
  },
  {
    "path": "chef/atcclient/recipes/default.rb",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n#\n# Cookbook Name:: atcclient\n# Recipe:: default\n#\ninclude_recipe 'apt'\npackage 'ubuntu-desktop'\n\n# Force the window manager to start\nservice 'lightdm' do\n  action [:enable, :start]\nend\n"
  },
  {
    "path": "tests/Vagrantfile",
    "content": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nboxinfo = {\n    :box => 'chef/ubuntu-12.04',\n    :usbehci => 'on',\n}\n\n# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!\nVAGRANTFILE_API_VERSION = \"2\"\n\nVagrant.configure(VAGRANTFILE_API_VERSION) do |config|\n    config.vm.define 'gateway' do |box|\n        box.vm.box = boxinfo[:box]\n        box.vm.synced_folder '../atc', '/usr/local/src/atc/atc'\n        box.vm.hostname = 'gateway'\n        box.vm.provider \"virtualbox\" do |v|\n            v.customize [\"modifyvm\", :id, \"--usbehci\", boxinfo.fetch(:usbehci, \"on\")]\n        end\n\n        # Chef / Berkshelf\n        box.omnibus.chef_version = :latest\n        box.berkshelf.berksfile_path = \"../chef/atc/Berksfile\"\n        box.berkshelf.enabled = true\n        box.vm.provision :chef_solo do |chef|\n            chef.run_list = [\n                \"recipe[python]\",\n                \"recipe[atc::default]\"\n            ]\n            if box.vm.box == 'centos65'\n                chef.json = {\n                    \"python\" => {\n                      \"install_method\" => \"source\",\n                      \"distribute_install_py_version\" => \"2.7\",\n                    }\n                }\n            end\n        end\n        box.vm.provision 'shell', path: 'provision.sh'\n\n        # Networking\n        # Not sure if forwarded port is necessary or not\n        box.vm.network :forwarded_port, guest: 8000, host: 8080, auto_correct: true\n        box.vm.network :private_network, ip: '192.168.10.2'\n        box.vm.network :private_network, ip: '192.168.20.2'\n    end\n\n    config.vm.define 'client' do |box|\n        box.vm.box = boxinfo[:box]\n        box.vm.hostname = 'client'\n        box.vm.provider \"virtualbox\" do |v|\n            v.customize [\"modifyvm\", :id, \"--usbehci\", boxinfo.fetch(:usbehci, \"on\")]\n        end\n\n        # Provisioner\n        box.vm.provision 'shell', path: 'provision.sh'\n\n        # Networking\n        box.vm.network :private_network, ip: '192.168.20.10'\n    end\n\n    config.vm.define 'server' do |box|\n        box.vm.box = boxinfo[:box]\n        box.vm.hostname = 'server'\n        box.vm.provider \"virtualbox\" do |v|\n            v.customize [\"modifyvm\", :id, \"--usbehci\", boxinfo.fetch(:usbehci, \"on\")]\n        end\n\n        # Provisioner\n        box.vm.provision 'shell', path: 'provision.sh'\n\n        # Networking\n        box.vm.network :private_network, ip: '192.168.10.10'\n    end\nend\n"
  },
  {
    "path": "tests/__init__.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n"
  },
  {
    "path": "tests/host.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nimport paramiko\nimport logging\n\n# size of receive buffers for stdout/stderr\nBUFFER_SIZE = 1024 * 1024\n\n# reduce paramiko logging spew\nlogging.getLogger('paramiko').setLevel(logging.WARNING)\n\n\n# A class which does nothing\nclass Nothing(object):\n\n    def __getattr__(self, name):\n        def noop(*args, **kwargs):\n            pass\n        return noop\n\n\nclass Host(paramiko.SSHClient):\n    name = ''\n    client = None\n    config = None\n\n    def __init__(self, ssh_config):\n        self.config = ssh_config\n        self.name = ssh_config['hostname']\n        self.client = paramiko.SSHClient()\n        self.client.set_missing_host_key_policy(Nothing())\n\n        self.client.connect(\n            hostname=self.name,\n            port=int(ssh_config['port']),\n            username=ssh_config['user'],\n            key_filename=ssh_config['identityfile'],\n            )\n\n    def getIp(self, prefix='192.168.'):\n        # ip addr | grep 'inet' | awk '{print $2}' \\\n        #    | awk -F/ '{print $1}' | fgrep '192.168.' | head -n1\n        out = self.cmd('ip addr')\n        for line in out.splitlines():\n            line = line.strip()\n            if line.startswith('inet'):\n                ip = line.split()[1].split('/')[0]\n                if ip.startswith(prefix):\n                    return ip\n        raise RuntimeError('Could not determine ip of host ' + repr(self.name))\n\n    def cmd(self, command):\n        '''Runs the command over ssh. Returns stdout as a string'''\n        return self.client.exec_command(command)[1].read()\n\n    def proc(self, command):\n        '''Runs the command in a pty.\n        Returns a Process object representing the server-side process'''\n        return Process(self, command)\n\n    def close(self):\n        self.client.close()\n\n    def __exit__(self, type, val, tb):\n        self.close()\n        return False\n\n    def __str__(self):\n        return 'Host<' + self.name + '>'\n\n\nclass Process(object):\n    commandName = ''\n    channel = None\n    host = None\n\n    def __init__(self, host, command):\n        self.host = host\n\n        xport = self.host.client.get_transport()\n        self.channel = xport.open_session()\n        self.commandName = command.strip().split()[0]\n\n        self.channel.exec_command(command)\n\n    def stdout(self):\n        return self.channel.recv(BUFFER_SIZE)\n\n    def kill(self):\n        self.channel.close()\n        # FIXME: channel.close() will close the socket,\n        # but not kill the remote process.\n        # This is a simple workaround, but won't work in all cases.\n        self.host.cmd('killall ' + self.commandName)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, val, tb):\n        self.kill()\n        return False\n"
  },
  {
    "path": "tests/local-test.py",
    "content": "#!/usr/bin/env python\n\nfrom subprocess import Popen, PIPE\nimport argparse\n\nfrom speed import Speed, parseIPerfSpeed, KILOBITS\nfrom vms import shape\n\n\nATC = '192.168.20.2'\nIPERF = '192.168.10.10'\nRATES = [\n    Speed(10000, KILOBITS),\n    Speed(1000, KILOBITS),\n    Speed(100, KILOBITS),\n    Speed(50, KILOBITS),\n    Speed(25, KILOBITS),\n    Speed(10, KILOBITS),\n    Speed(5, KILOBITS),\n]\nNTESTS = 10\n\n\n# fixme: move to test utils\ndef parseIPerfPrefix(s):\n    b = s.find('0.0-')\n    e = s.find(' sec', b)+4\n    interval = s[b:e].split('-')[1]\n\n    b = e + 4\n    transfer = ' '.join(s[b:].split()[:2])\n\n    return interval, transfer\n\n\n# fixme: move to test utils\ndef parseIPerfOutput(stdout):\n    line = stdout.splitlines()[-1].strip()\n    interval, transfer = parseIPerfPrefix(line)\n    speed = parseIPerfSpeed(line)\n    return interval, transfer, speed\n\n\ndef run_iperf(server):\n    p = Popen(['iperf', '-c', server],\n              stdout=PIPE,\n              stderr=None,\n              stdin=None,\n              )\n    p.wait()\n    if p.returncode != 0:\n        raise RuntimeError('Could not run iperf')\n    stdout = p.stdout.read()\n    return parseIPerfOutput(stdout)\n\n\ndef test_network(gateway, server, rate):\n    shape(gateway, None, rate)\n    print_results(rate, run_iperf(server))\n\n\ndef print_header():\n    print 'Shaping         Interval        Transfer        Bandwidth'\n\n\ndef print_results(rate, things):\n    interval, transfer, speed = (things)\n    print '%s\\t%s\\t%s\\t%s' % (rate, interval, transfer, speed)\n\n\ndef rateList(rate_str):\n    results = []\n    for r in rate_str.split(','):\n        results.append(Speed(int(r), KILOBITS))\n    return results\n\n\ndef getGateway(server):\n    p = Popen(['ip', 'route', 'get', server],\n              stdout=PIPE,\n              stderr=None,\n              stdin=None,\n              )\n    p.wait()\n    if p.returncode != 0:\n        raise RuntimeError('Could not get route to server')\n    stdout = p.stdout.read()\n    return stdout.split()[2]\n\n\ndef main():\n    parser = argparse.ArgumentParser()\n    parser.add_argument('-r', '--rates',\n                        default=rateList('10000,1000,100,50,25,10,5'),\n                        type=rateList,\n                        help='comma-separated list of rates in Kbps')\n    parser.add_argument('-n', '--count',\n                        type=int, default=10,\n                        help='number of runs for each rate')\n    parser.add_argument('--atc', default=None,\n                        type=str,\n                        help='IP address of ATC gateway')\n    parser.add_argument('iperf',\n                        type=str, help='IP address of iperf server')\n    args = parser.parse_args()\n\n    iperf = args.iperf\n    if args.atc is None:\n        atc = getGateway(iperf)\n    else:\n        atc = args.atc\n\n    print_header()\n    for rate in args.rates:\n        for i in range(args.count):\n            test_network(atc, iperf, rate)\n\n\nif __name__ == '__main__':\n    main()\n"
  },
  {
    "path": "tests/provision.sh",
    "content": "#!/bin/bash -eu\n\n#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nif [[ \"$(hostname)\" == \"gateway\" ]] ; then\n    # change interfaces, and put atcd in insecure mode\n    sed -i -e 's/ATCD_WAN=eth[012]/ATCD_WAN=eth1/' -e 's/ATCD_LAN=eth[012]/ATCD_LAN=eth2/' -e 's/ATCD_MODE=secure/ATCD_MODE=unsecure/g' /etc/default/atcd\n\n    /etc/init.d/atcd restart\n\n    su -s '/bin/bash' -c '/usr/local/bin/atcui-setup' - atc\nelse\n    if [[ \"$(hostname)\" == \"client\" ]] ; then\n        ip route add 192.168.10.0/24 via 192.168.20.2\n    elif [[ \"$(hostname)\" == \"server\" ]] ; then\n        ip route add 192.168.20.0/24 via 192.168.10.2\n    fi\n\n    apt-get install iperf\nfi\n"
  },
  {
    "path": "tests/speed.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nBITS = long(1)\nKILOBITS = BITS * 1024\nMEGABITS = KILOBITS * 1024\nGIGABITS = MEGABITS * 1024\n\n\nclass Speed(object):\n    value = 0\n\n    def __init__(self, value, unit=BITS):\n        self.value = long(value * unit)\n\n    def faster(self, other):\n        return self.value > other.value\n\n    def slower(self, other):\n        return self.value < other.value\n\n    def kbps(self):\n        return int(self.value / KILOBITS)\n\n    def __str__(self):\n        i = 0\n        value = self.value\n        while i < 3 and value % KILOBITS == 0:\n            i += 1\n            value = value / 1024\n        if i == 0:\n            return str(value) + ' bits/sec'\n        if i == 1:\n            return str(value) + ' Kbits/sec'\n        if i == 2:\n            return str(value) + ' Mbits/sec'\n        return str(value) + ' Gbits/sec'\n\n    def __add__(self, other):\n        if isinstance(other, Speed):\n            return Speed(self.value + other.value)\n        else:\n            return Speed(self.value + other)\n\n    def __sub__(self, other):\n        if isinstance(other, Speed):\n            return Speed(self.value - other.value)\n        else:\n            return Speed(self.value - other)\n\n    def __div__(self, other):\n        if isinstance(other, Speed):\n            return Speed(self.value / other.value)\n        else:\n            return Speed(self.value / other)\n\n    def __mul__(self, other):\n        if isinstance(other, Speed):\n            return Speed(self.value * other.value)\n        else:\n            return Speed(self.value * other)\n\n\nKilobit = Speed(1, KILOBITS)\nMegabit = Speed(1, MEGABITS)\nGigabit = Speed(1, GIGABITS)\n\n\ndef parseIPerfSpeed(s):\n    speeds, unit = s.split()[-2:]\n    try:\n        speed = float(speeds)\n    except:\n        print 'Invalid speed line: ' + repr(s)\n        raise\n    if speed > GIGABITS:\n        # something is likely fishy with this value.\n        # Print it incase the test fails.\n        print 'bad iperf speed(?):', str(s)\n    if unit == 'bits/sec':\n        return Speed(speed)\n    if unit == 'Bytes/sec':\n        return Speed(speed, 8)\n    if unit == 'Kbits/sec':\n        return Speed(speed, KILOBITS)\n    if unit == 'Mbits/sec':\n        return Speed(speed, MEGABITS)\n    if unit == 'Gbits/sec':\n        return Speed(speed, GIGABITS)\n    print 'Invalid speed line: ' + repr(s)\n    raise ValueError('Unknown unit for network speed: ' + unit)\n"
  },
  {
    "path": "tests/tests.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nimport unittest\n\nfrom vagrant import Vagrant\nfrom vms import speedBetween, shape, unshape\nfrom speed import Megabit\n\n\nIPERF_OPTS = {\n    'udp': False,\n    'time': 30\n}\n\n\nclass TestAtcdE2E(unittest.TestCase):\n\n    def test_shapesBandwidth(self):\n        '''\n        Tests that bandwidth shaping works.\n\n        Examines the network speed before, during, and after shaping.\n\n        Fails if the network speeds do not reflect expected results.\n        '''\n        with Vagrant.ssh('gateway', 'client', 'server') as machines:\n            gateway, client, server = machines\n\n            before = speedBetween(client, server, **IPERF_OPTS)\n\n            print 'Actual speed before shaping:', before\n\n            shapedSpeed = before / 1024\n\n            print 'Desired shaping speed:', shapedSpeed\n\n            shape(gateway, client, shapedSpeed)\n\n            during = speedBetween(client, server, **IPERF_OPTS)\n\n            print 'Actual speed during shaping:', during\n\n            unshape(gateway, client)\n\n            after = speedBetween(client, server, **IPERF_OPTS)\n\n            print 'Actual speed after shaping:', after\n\n            if before.slower(Megabit):\n                self.fail(\n                    'Actual speed before shaping is too slow for shape'\n                    ' testing. (is it already being shaped?)')\n\n            if during.faster(shapedSpeed):\n                self.fail(\n                    'Actual speed during shaping exceeded'\n                    ' shaping speed.')\n\n            if after.slower(shapedSpeed * 2):\n                self.fail(\n                    'Actual speed after shaping appears'\n                    ' to still be shaped.')\n\n            if after.slower(before * 0.7):\n                self.fail(\n                    'Actual speed after shaping did not return'\n                    ' to normal value after shaping.')\n"
  },
  {
    "path": "tests/vagrant.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nfrom subprocess import Popen, PIPE\nimport paramiko\n\nfrom host import Host\n\n\n# For use with the 'with' python feature.\nclass _sshGroup(object):\n\n    @classmethod\n    def closeAll(cls, clients):\n        if len(clients) == 0:\n            return\n        try:\n            clients[0].close()\n        finally:\n            cls.closeAll(clients[1:])\n\n    def __init__(self):\n        self.clients = []\n\n    def append(self, client):\n        self.clients.append(client)\n\n    def __enter__(self):\n        return tuple(self.clients)\n\n    def __exit__(self, type, value, tb):\n        _sshGroup.closeAll(self.clients)\n        return False\n\n\nclass _vagrant(object):\n    vms = []\n\n    def ssh(self, *names):\n        clients = _sshGroup()\n        for name in names:\n            ssh_config = self.sshConfig(name)\n            clients.append(Host(ssh_config))\n        return clients\n\n    def sshConfig(self, name):\n        p = Popen(['vagrant', 'ssh-config', name],\n                  stdout=PIPE,\n                  stderr=None,\n                  stdin=None,\n                  cwd='tests/',\n                  )\n        p.wait()\n        if p.returncode != 0:\n            raise RuntimeError('Could not get ssh-config for ' + repr(name))\n        ssh_config = paramiko.SSHConfig()\n        ssh_config.parse(p.stdout)\n        p.stdout.close()\n        return ssh_config.lookup(name)\n\n\nVagrant = _vagrant()\n"
  },
  {
    "path": "tests/vms.py",
    "content": "#\n#  Copyright (c) 2014, Facebook, Inc.\n#  All rights reserved.\n#\n#  This source code is licensed under the BSD-style license found in the\n#  LICENSE file in the root directory of this source tree. An additional grant\n#  of patent rights can be found in the PATENTS file in the same directory.\n#\n#\n\nfrom speed import parseIPerfSpeed\nimport httplib\nimport json\nimport time\n\n\ndef speedBetween(client, server, time=30, udp=False):\n    server_ip = server.getIp()\n\n    srv_cmd = 'iperf -s' + (' -u' if udp else '') + ' -p 5001'\n    cli_cmd = 'iperf -t ' + str(time) + (' -u' if udp else '') + \\\n        ' -c ' + server_ip + ' 5001'\n\n    with server.proc(srv_cmd):\n        s = client.cmd(cli_cmd)\n        return parseIPerfSpeed(s.splitlines()[-1])\n\n\ndef shape(gateway, host, speed):\n    '''\n    Shape the provided host using the given gateway to the provided speed.\n\n    If host is None, the gateway will use the HTTP request's remote IP.\n\n    Gateway may be either a Host object or an IP address string.\n    '''\n    if isinstance(gateway, str):\n        gw_ip = gateway\n    else:\n        gw_ip = gateway.getIp()\n\n    shaping = {\n        'down': {\n            'rate': speed.kbps(),\n            'loss': {\n                'percentage': 0.0,\n                'correlation': 0.0\n            },\n            'delay': {\n                'delay': 0,\n                'jitter': 0,\n                'correlation': 0.0\n            },\n            'corruption': {\n                'percentage': 0.0,\n                'correlation': 0.0\n            },\n            'reorder': {\n                'percentage': 0.0,\n                'correlation': 0.0,\n                'gap': 0\n            },\n            'iptables_options': []\n        },\n        'up': {\n            'rate': speed.kbps(),\n            'loss': {\n                'percentage': 0.0,\n                'correlation': 0.0\n            },\n            'delay': {\n                'delay': 0,\n                'jitter': 0,\n                'correlation': 0.0\n            },\n            'corruption': {\n                'percentage': 0.0,\n                'correlation': 0.0\n            },\n            'reorder': {\n                'percentage': 0.0,\n                'correlation': 0.0,\n                'gap': 0\n            },\n            'iptables_options': []\n        }\n    }\n\n    url = '/api/v1/shape/'\n    exc_f = 'Could not shape host: {}'\n    if host is not None:\n        shaped_ip = host.getIp()\n        exc_f = 'Could not shape host %s: {}' % shaped_ip\n        url += shaped_ip + '/'\n\n    h = httplib.HTTPConnection(gw_ip, 8000, timeout=3)\n    try:\n        h.request(\n            'POST',\n            url,\n            json.dumps(shaping),\n            {'Content-Type': 'application/json'})\n        r = h.getresponse()\n        if r.status != httplib.CREATED:\n            raise RuntimeError(\n                exc_f.format(shaped_ip, r.status))\n    finally:\n        h.close()\n\n\ndef unshape(gateway, host):\n    gw_ip = gateway.getIp()\n    shaped_ip = host.getIp()\n\n    h = httplib.HTTPConnection(gw_ip, 8000, timeout=3)\n    try:\n        h.request('DELETE', '/api/v1/shape/{}/'.format(shaped_ip))\n        r = h.getresponse()\n        if r.status != httplib.NO_CONTENT:\n            raise RuntimeError(\n                'Could not shape host {}: {}'.format(shaped_ip, r.status))\n    finally:\n        h.close()\n\n    # Atcd takes some time to start affecting traffic.\n    time.sleep(3.0)\n"
  },
  {
    "path": "tox.ini",
    "content": "[flake8]\nexclude = migrations,settings.py,*/atc_thrift/atc_thrift\n"
  },
  {
    "path": "utils/dump_system_info.sh",
    "content": "#!/bin/bash\n\nWAN=${1:-eth0}\nLAN=${2:-eth1}\n\nfunction title {\n    echo\n    echo \"######### $1 #########\"\n    echo\n}\n\nfunction run_cmd {\n    title \"$1\"\n    $@\n}\n\nfunction run_cmd_filtered {\n    title \"$1\"\n    $@ | egrep -v '(ether|inet6.*scope link)'\n}\n\nfor cmd in \"uname -a\" \"cat /etc/os-release\" \"python -V\" \"pip freeze\" \\\n    \"ip r\" \"iptables-save\" \"ip r\"\ndo\n    run_cmd \"${cmd}\"\ndone\n\nrun_cmd_filtered \"ip a\"\n\nfor netif in ${WAN} ${LAN}\ndo\n    for object in qdisc class filter\n    do\n        cmd=\"tc ${object} show dev ${netif}\"\n        run_cmd \"${cmd}\"\n    done\ndone\n"
  },
  {
    "path": "utils/profiles/2G-DevelopingRural.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"650\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"2\"\n            },\n            \"rate\": \"20\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"650\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"2\"\n            },\n            \"rate\": \"18\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 6,\n    \"name\": \"2G - Developing Rural\"\n}\n"
  },
  {
    "path": "utils/profiles/2G-DevelopingUrban.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"650\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"35\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"650\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"32\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 5,\n    \"name\": \"2G - Developing Urban\"\n}\n"
  },
  {
    "path": "utils/profiles/3G-Average.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"100\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"780\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"100\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"330\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 1,\n    \"name\": \"3G - Average\"\n}\n"
  },
  {
    "path": "utils/profiles/3G-Good.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"90\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"850\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"100\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"420\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 2,\n    \"name\": \"3G - Good\"\n}\n"
  },
  {
    "path": "utils/profiles/Cable.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"2\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"6000\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"2\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"1000\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 3,\n    \"name\": \"Cable\"\n}\n"
  },
  {
    "path": "utils/profiles/DSL.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"5\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"2000\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"5\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"rate\": \"256\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 4,\n    \"name\": \"DSL\"\n}\n"
  },
  {
    "path": "utils/profiles/Edge-Average.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"400\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"240\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"440\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"200\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 7,\n    \"name\": \"Edge - Average\"\n}\n"
  },
  {
    "path": "utils/profiles/Edge-Good.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"350\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"250\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"370\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"200\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 8,\n    \"name\": \"Edge - Good\"\n}\n"
  },
  {
    "path": "utils/profiles/Edge-Lossy.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"400\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"1\"\n            },\n            \"rate\": \"240\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"440\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"1\"\n            },\n            \"rate\": \"200\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 9,\n    \"name\": \"Edge - Lossy\"\n}\n"
  },
  {
    "path": "utils/profiles/NoConnectivity.json",
    "content": "{\n    \"content\": {\n        \"down\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"0\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"1\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        },\n        \"up\": {\n            \"corruption\": {\n                \"correlation\": 0,\n                \"percentage\": 0\n            },\n            \"delay\": {\n                \"correlation\": 0,\n                \"delay\": \"0\",\n                \"jitter\": 0\n            },\n            \"iptables_options\": [],\n            \"loss\": {\n                \"correlation\": 0,\n                \"percentage\": \"0\"\n            },\n            \"rate\": \"1\",\n            \"reorder\": {\n                \"correlation\": 0,\n                \"gap\": 0,\n                \"percentage\": 0\n            }\n        }\n    },\n    \"id\": 10,\n    \"name\": \"No Connectivity\"\n}\n"
  },
  {
    "path": "utils/restore-profiles.sh",
    "content": "#!/usr/bin/env bash\n\nATC_HOST=\"$1\"\n\nif [ -z \"$ATC_HOST\" ] ; then\n    echo \"usage: $0 HOST\"\n    echo \"    HOST should be of the form <hostname>:<port>\"\n    echo \"    e.g. localhost:8080\"\n    exit 1\nfi\n\nfor x in $(git rev-parse --show-toplevel)/utils/profiles/* ; do\n    out=$(curl --silent http://\"$ATC_HOST\"/api/v1/profiles/ -d \"@${x}\")\n    rc=\"$?\"\n    if [ \"$rc\" -ne \"0\" ] ; then\n        echo \"Could not add profile $x (curl exit code $rc)\"\n        if [ -n \"$out\" ] ; then\n            echo \"$out\"\n            echo\n        fi\n    else\n        echo \"Added profile $x\"\n    fi\ndone\n"
  }
]