diff --git a/blog/2013/06/02/jsfiddle-integration.html b/blog/2013/06/02/jsfiddle-integration.html index 65a49dc0a6..851195626e 100644 --- a/blog/2013/06/02/jsfiddle-integration.html +++ b/blog/2013/06/02/jsfiddle-integration.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/06/05/why-react.html b/blog/2013/06/05/why-react.html index e86c3a5151..cf244dfb71 100644 --- a/blog/2013/06/05/why-react.html +++ b/blog/2013/06/05/why-react.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/06/12/community-roundup.html b/blog/2013/06/12/community-roundup.html index 79bd304ebd..7618fd983b 100644 --- a/blog/2013/06/12/community-roundup.html +++ b/blog/2013/06/12/community-roundup.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/06/19/community-roundup-2.html b/blog/2013/06/19/community-roundup-2.html index c3ca2f7da5..a64463fc28 100644 --- a/blog/2013/06/19/community-roundup-2.html +++ b/blog/2013/06/19/community-roundup-2.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/06/21/react-v0-3-3.html b/blog/2013/06/21/react-v0-3-3.html index 625010a0e6..f93f049527 100644 --- a/blog/2013/06/21/react-v0-3-3.html +++ b/blog/2013/06/21/react-v0-3-3.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/06/27/community-roundup-3.html b/blog/2013/06/27/community-roundup-3.html index bb5885fd8f..c5d354cf2b 100644 --- a/blog/2013/06/27/community-roundup-3.html +++ b/blog/2013/06/27/community-roundup-3.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/02/react-v0-4-autobind-by-default.html b/blog/2013/07/02/react-v0-4-autobind-by-default.html index d3146f4df5..fc2677e186 100644 --- a/blog/2013/07/02/react-v0-4-autobind-by-default.html +++ b/blog/2013/07/02/react-v0-4-autobind-by-default.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/03/community-roundup-4.html b/blog/2013/07/03/community-roundup-4.html index f33dfa6861..596d1737fa 100644 --- a/blog/2013/07/03/community-roundup-4.html +++ b/blog/2013/07/03/community-roundup-4.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html b/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html index d942b85eaf..994b4e2684 100644 --- a/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html +++ b/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/17/react-v0-4-0.html b/blog/2013/07/17/react-v0-4-0.html index 4b861b0974..ce71547eaa 100644 --- a/blog/2013/07/17/react-v0-4-0.html +++ b/blog/2013/07/17/react-v0-4-0.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/23/community-roundup-5.html b/blog/2013/07/23/community-roundup-5.html index 2645d449da..0b60555797 100644 --- a/blog/2013/07/23/community-roundup-5.html +++ b/blog/2013/07/23/community-roundup-5.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/26/react-v0-4-1.html b/blog/2013/07/26/react-v0-4-1.html index f13f458ed6..1e6a99426f 100644 --- a/blog/2013/07/26/react-v0-4-1.html +++ b/blog/2013/07/26/react-v0-4-1.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/07/30/use-react-and-jsx-in-ruby-on-rails.html b/blog/2013/07/30/use-react-and-jsx-in-ruby-on-rails.html index b5e927f194..46d66c2069 100644 --- a/blog/2013/07/30/use-react-and-jsx-in-ruby-on-rails.html +++ b/blog/2013/07/30/use-react-and-jsx-in-ruby-on-rails.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/08/05/community-roundup-6.html b/blog/2013/08/05/community-roundup-6.html index 862c7d90a0..4103f9a11a 100644 --- a/blog/2013/08/05/community-roundup-6.html +++ b/blog/2013/08/05/community-roundup-6.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/08/19/use-react-and-jsx-in-python-applications.html b/blog/2013/08/19/use-react-and-jsx-in-python-applications.html index 003830ea99..7ef75b8ee4 100644 --- a/blog/2013/08/19/use-react-and-jsx-in-python-applications.html +++ b/blog/2013/08/19/use-react-and-jsx-in-python-applications.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/08/26/community-roundup-7.html b/blog/2013/08/26/community-roundup-7.html index d9869432c0..7a016d3c2a 100644 --- a/blog/2013/08/26/community-roundup-7.html +++ b/blog/2013/08/26/community-roundup-7.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/09/24/community-roundup-8.html b/blog/2013/09/24/community-roundup-8.html index d3409a670b..823ae88f8f 100644 --- a/blog/2013/09/24/community-roundup-8.html +++ b/blog/2013/09/24/community-roundup-8.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/10/03/community-roundup-9.html b/blog/2013/10/03/community-roundup-9.html index 8d3b4eb899..1ffe5e36cc 100644 --- a/blog/2013/10/03/community-roundup-9.html +++ b/blog/2013/10/03/community-roundup-9.html @@ -58,6 +58,8 @@

Recent posts

diff --git a/blog/2013/10/16/react-v0.5.0.html b/blog/2013/10/16/react-v0.5.0.html new file mode 100644 index 0000000000..8587be9f7e --- /dev/null +++ b/blog/2013/10/16/react-v0.5.0.html @@ -0,0 +1,168 @@ + + + + + + React | React v0.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+

React v0.5

+

October 16, 2013 by Paul O'Shannessy

+ +
+ +
+

This release is the result of several months of hard work from members of the team and the community. While there are no groundbreaking changes in core, we've worked hard to improve performance and memory usage. We've also worked hard to make sure we are being consistent in our usage of DOM properties.

+ +

The biggest change you'll notice as a developer is that we no longer support class in JSX as a way to provide CSS classes. Since this prop was being converted to className at the transform step, it caused some confusion when trying to access it in composite components. As a result we decided to make our DOM properties mirror their counterparts in the JS DOM API. There are a few exceptions where we deviate slightly in an attempt to be consistent internally.

+ +

The other major change in v0.5 is that we've added an additional build - react-with-addons - which adds support for some extras that we've been working on including animations and two-way binding. Read more about these addons in the docs.

+

Thanks to Our Community

+

We added 22 new people to the list of authors since we launched React v0.4.1 nearly 3 months ago. With a total of 48 names in our AUTHORS file, that means we've nearly doubled the number of contributors in that time period. We've seen the number of people contributing to discussion on IRC, mailing lists, Stack Overflow, and GitHub continue rising. We've also had people tell us about talks they've given in their local community about React.

+ +

It's been awesome to see the things that people are building with React, and we can't wait to see what you come up with next!

+

Changelog

React

+
    +
  • Memory usage improvements - reduced allocations in core which will help with GC pauses
  • +
  • Performance improvements - in addition to speeding things up, we made some tweaks to stay out of slow path code in V8 and Nitro.
  • +
  • Standardized prop -> DOM attribute process. This previously resulting in additional type checking and overhead as well as confusing cases for users. Now we will always convert your value to a string before inserting it into the DOM.
  • +
  • Support for Selection events.
  • +
  • Support for Composition events.
  • +
  • Support for additional DOM properties (charSet, content, form, httpEquiv, rowSpan, autoCapitalize).
  • +
  • Support for additional SVG properties (rx, ry).
  • +
  • Support for using getInitialState and getDefaultProps in mixins.
  • +
  • Support mounting into iframes.
  • +
  • Bug fixes for controlled form components.
  • +
  • Bug fixes for SVG element creation.
  • +
  • Added React.version.
  • +
  • Added React.isValidClass - Used to determine if a value is a valid component constructor.
  • +
  • Removed React.autoBind - This was deprecated in v0.4 and now properly removed.
  • +
  • Renamed React.unmountAndReleaseReactRootNode to React.unmountComponentAtNode.
  • +
  • Began laying down work for refined performance analysis.
  • +
  • Better support for server-side rendering - react-page has helped improve the stability for server-side rendering.
  • +
  • Made it possible to use React in environments enforcing a strict Content Security Policy. This also makes it possible to use React to build Chrome extensions.
  • +
+

React with Addons (New!)

+
    +
  • Introduced a separate build with several "addons" which we think can help improve the React experience. We plan to deprecate this in the long-term, instead shipping each as standalone pieces. Read more in the docs.
  • +
+

JSX

+
    +
  • No longer transform class to className as part of the transform! This is a breaking change - if you were using class, you must change this to className or your components will be visually broken.
  • +
  • Added warnings to the in-browser transformer to make it clear it is not intended for production use.
  • +
  • Improved compatibility for Windows
  • +
  • Improved support for maintaining line numbers when transforming.
  • +
+ +
+ +
+
+
+
+ + + +
+
+ + + diff --git a/blog/all.html b/blog/all.html index 9d70184f2d..6ec5937502 100644 --- a/blog/all.html +++ b/blog/all.html @@ -56,6 +56,8 @@

All Posts

+

React v0.5 on October 16, 2013 by Paul O'Shannessy

+

Community Round-up #9 on October 3, 2013 by Vjeux

Community Round-up #8 on September 24, 2013 by Vjeux

diff --git a/blog/index.html b/blog/index.html index 0e2116e042..7003626e4d 100644 --- a/blog/index.html +++ b/blog/index.html @@ -58,6 +58,8 @@

Recent posts

@@ -85,6 +85,56 @@
+
+

React v0.5

+

October 16, 2013 by Paul O'Shannessy

+
+
+

This release is the result of several months of hard work from members of the team and the community. While there are no groundbreaking changes in core, we've worked hard to improve performance and memory usage. We've also worked hard to make sure we are being consistent in our usage of DOM properties.

+ +

The biggest change you'll notice as a developer is that we no longer support class in JSX as a way to provide CSS classes. Since this prop was being converted to className at the transform step, it caused some confusion when trying to access it in composite components. As a result we decided to make our DOM properties mirror their counterparts in the JS DOM API. There are a few exceptions where we deviate slightly in an attempt to be consistent internally.

+ +

The other major change in v0.5 is that we've added an additional build - react-with-addons - which adds support for some extras that we've been working on including animations and two-way binding. Read more about these addons in the docs.

+

Thanks to Our Community

+

We added 22 new people to the list of authors since we launched React v0.4.1 nearly 3 months ago. With a total of 48 names in our AUTHORS file, that means we've nearly doubled the number of contributors in that time period. We've seen the number of people contributing to discussion on IRC, mailing lists, Stack Overflow, and GitHub continue rising. We've also had people tell us about talks they've given in their local community about React.

+ +

It's been awesome to see the things that people are building with React, and we can't wait to see what you come up with next!

+

Changelog

React

+
    +
  • Memory usage improvements - reduced allocations in core which will help with GC pauses
  • +
  • Performance improvements - in addition to speeding things up, we made some tweaks to stay out of slow path code in V8 and Nitro.
  • +
  • Standardized prop -> DOM attribute process. This previously resulting in additional type checking and overhead as well as confusing cases for users. Now we will always convert your value to a string before inserting it into the DOM.
  • +
  • Support for Selection events.
  • +
  • Support for Composition events.
  • +
  • Support for additional DOM properties (charSet, content, form, httpEquiv, rowSpan, autoCapitalize).
  • +
  • Support for additional SVG properties (rx, ry).
  • +
  • Support for using getInitialState and getDefaultProps in mixins.
  • +
  • Support mounting into iframes.
  • +
  • Bug fixes for controlled form components.
  • +
  • Bug fixes for SVG element creation.
  • +
  • Added React.version.
  • +
  • Added React.isValidClass - Used to determine if a value is a valid component constructor.
  • +
  • Removed React.autoBind - This was deprecated in v0.4 and now properly removed.
  • +
  • Renamed React.unmountAndReleaseReactRootNode to React.unmountComponentAtNode.
  • +
  • Began laying down work for refined performance analysis.
  • +
  • Better support for server-side rendering - react-page has helped improve the stability for server-side rendering.
  • +
  • Made it possible to use React in environments enforcing a strict Content Security Policy. This also makes it possible to use React to build Chrome extensions.
  • +
+

React with Addons (New!)

+
    +
  • Introduced a separate build with several "addons" which we think can help improve the React experience. We plan to deprecate this in the long-term, instead shipping each as standalone pieces. Read more in the docs.
  • +
+

JSX

+
    +
  • No longer transform class to className as part of the transform! This is a breaking change - if you were using class, you must change this to className or your components will be visually broken.
  • +
  • Added warnings to the in-browser transformer to make it clear it is not intended for production use.
  • +
  • Improved compatibility for Windows
  • +
  • Improved support for maintaining line numbers when transforming.
  • +
+ +
+
+

Community Round-up #9

October 3, 2013 by Vjeux

@@ -357,79 +407,6 @@
-
-

Community Round-up #6

-

August 5, 2013 by Vjeux

-
-
-

This is the first Community Round-up where none of the items are from Facebook/Instagram employees. It's great to see the adoption of React growing.

-

React Game Tutorial

-

Caleb Cassel wrote a step-by-step tutorial about making a small game. It covers JSX, State and Events, Embedded Components and Integration with Backbone. -

-

Reactify

-

Andrey Popp created a Browserify helper to compile JSX files.

- -
-

Browserify v2 transform for text/jsx. Basic usage is:

-
% browserify -t reactify main.jsx
-
-

reactify transform activates for files with either .jsx extension or /** @jsx React.DOM */ pragma as a first line for any .js file.

- -

Check it out on Github...

-
-

React Integration with Este

-

Daniel Steigerwald is now using React within Este, which is a development stack for web apps in CoffeeScript that are statically typed using the Closure Library.

-
este.demos.react.todoApp = este.react.create (`/** @lends {React.ReactComponent.prototype} */`)
-  render: ->
-    @div [
-      este.demos.react.todoList 'items': @state['items']
-      if @state['items'].length
-        @p "#{@state['items'].length} items."
-      @form 'onSubmit': @onFormSubmit, [
-        @input
-          'onChange': @onChange
-          'value': @state['text']
-          'autoFocus': true
-          'ref': 'textInput'
-        @button "Add ##{@state['items'].length + 1}"
-      ]
-    ]
-
-

Check it out on Github...

-

React Stylus Boilerplate

-

Zaim Bakar shared his boilerplate to get started with Stylus CSS processor.

- -
-

This is my boilerplate React project using Grunt as the build tool, and Stylus as my CSS preprocessor.

- -
    -
  • Very minimal HTML boilerplate
  • -
  • Uses Stylus, with nib included
  • -
  • Uses two build targets: - -
      -
    • grunt build to compile JSX and Stylus into a development build
    • -
    • grunt dist to minify and optimize the development build for production
    • -
  • -
- -

Check it out on Github...

-
-

WebFUI

-

Conrad Barski, author of the popular book Land of Lisp, wants to use React for his ClojureScript library called WebFUI.

- -
-

I'm the author of "Land of Lisp" and I love your framework. I built a somewhat similar framework a year ago WebFUI aimed at ClojureScript. My framework also uses global event delegates, a global "render" function, DOM reconciliation, etc just like react.js. (Of course these ideas all have been floating around the ether for ages, always great to see more people building on them.)

- -

Your implementation is more robust, and so I think the next point release of webfui will simply delegate all the "hard work" to react.js and will only focus on the areas where it adds value (enabling purely functional UI programming in clojurescript, and some other stuff related to streamlining event handling) -

- -

Read the full post...

-
- -
-
- @@ -85,6 +85,79 @@
+
+

Community Round-up #6

+

August 5, 2013 by Vjeux

+
+
+

This is the first Community Round-up where none of the items are from Facebook/Instagram employees. It's great to see the adoption of React growing.

+

React Game Tutorial

+

Caleb Cassel wrote a step-by-step tutorial about making a small game. It covers JSX, State and Events, Embedded Components and Integration with Backbone. +

+

Reactify

+

Andrey Popp created a Browserify helper to compile JSX files.

+ +
+

Browserify v2 transform for text/jsx. Basic usage is:

+
% browserify -t reactify main.jsx
+
+

reactify transform activates for files with either .jsx extension or /** @jsx React.DOM */ pragma as a first line for any .js file.

+ +

Check it out on Github...

+
+

React Integration with Este

+

Daniel Steigerwald is now using React within Este, which is a development stack for web apps in CoffeeScript that are statically typed using the Closure Library.

+
este.demos.react.todoApp = este.react.create (`/** @lends {React.ReactComponent.prototype} */`)
+  render: ->
+    @div [
+      este.demos.react.todoList 'items': @state['items']
+      if @state['items'].length
+        @p "#{@state['items'].length} items."
+      @form 'onSubmit': @onFormSubmit, [
+        @input
+          'onChange': @onChange
+          'value': @state['text']
+          'autoFocus': true
+          'ref': 'textInput'
+        @button "Add ##{@state['items'].length + 1}"
+      ]
+    ]
+
+

Check it out on Github...

+

React Stylus Boilerplate

+

Zaim Bakar shared his boilerplate to get started with Stylus CSS processor.

+ +
+

This is my boilerplate React project using Grunt as the build tool, and Stylus as my CSS preprocessor.

+ +
    +
  • Very minimal HTML boilerplate
  • +
  • Uses Stylus, with nib included
  • +
  • Uses two build targets: + +
      +
    • grunt build to compile JSX and Stylus into a development build
    • +
    • grunt dist to minify and optimize the development build for production
    • +
  • +
+ +

Check it out on Github...

+
+

WebFUI

+

Conrad Barski, author of the popular book Land of Lisp, wants to use React for his ClojureScript library called WebFUI.

+ +
+

I'm the author of "Land of Lisp" and I love your framework. I built a somewhat similar framework a year ago WebFUI aimed at ClojureScript. My framework also uses global event delegates, a global "render" function, DOM reconciliation, etc just like react.js. (Of course these ideas all have been floating around the ether for ages, always great to see more people building on them.)

+ +

Your implementation is more robust, and so I think the next point release of webfui will simply delegate all the "hard work" to react.js and will only focus on the areas where it adds value (enabling purely functional UI programming in clojurescript, and some other stuff related to streamlining event handling) +

+ +

Read the full post...

+
+ +
+
+

Use React and JSX in Ruby on Rails

July 30, 2013 by Paul O'Shannessy

@@ -285,57 +358,6 @@ If you were using React without JSX previously, your code should still work.
-
-

New in React v0.4: Prop Validation and Default Values

-

July 11, 2013 by Paul O'Shannessy

-
-
-

Many of the questions we got following the public launch of React revolved around props, specifically that people wanted to do validation and to make sure their components had sensible defaults.

-

Validation

-

Oftentimes you want to validate your props before you use them. Perhaps you want to ensure they are a specific type. Or maybe you want to restrict your prop to specific values. Or maybe you want to make a specific prop required. This was always possible — you could have written validations in your render or componentWillReceiveProps functions, but that gets clunky fast.

- -

React v0.4 will provide a nice easy way for you to use built-in validators, or to even write your own.

-
React.createClass({
-  propTypes: {
-    // An optional string prop named "description".
-    description: React.PropTypes.string,
-
-    // A required enum prop named "category".
-    category: React.PropTypes.oneOf(['News','Photos']).isRequired,
-
-    // A prop named "dialog" that requires an instance of Dialog.
-    dialog: React.PropTypes.instanceOf(Dialog).isRequired
-  },
-  ...
-});
-

Default Values

-

One common pattern we've seen with our React code is to do something like this:

-
React.createClass({
-  render: function() {
-    var value = this.props.value || 'default value';
-    return <div>{value}</div>;
-  }
-});
-
-

Do this for a few props across a few components and now you have a lot of redundant code. Starting with React v0.4, you can provide default values in a declarative way:

-
React.createClass({
-  getDefaultProps: function() {
-    return {
-      value: 'default value'
-    };
-  }
-  ...
-});
-
-

We will use the cached result of this function before each render. We also perform all validations before each render to ensure that you have all of the data you need in the right form before you try to use it.

- -
- -

Both of these features are entirely optional. We've found them to be increasingly valuable at Facebook as our applications grow and evolve, and we hope others find them useful as well.

- -
-
- @@ -85,6 +85,57 @@
+
+

New in React v0.4: Prop Validation and Default Values

+

July 11, 2013 by Paul O'Shannessy

+
+
+

Many of the questions we got following the public launch of React revolved around props, specifically that people wanted to do validation and to make sure their components had sensible defaults.

+

Validation

+

Oftentimes you want to validate your props before you use them. Perhaps you want to ensure they are a specific type. Or maybe you want to restrict your prop to specific values. Or maybe you want to make a specific prop required. This was always possible — you could have written validations in your render or componentWillReceiveProps functions, but that gets clunky fast.

+ +

React v0.4 will provide a nice easy way for you to use built-in validators, or to even write your own.

+
React.createClass({
+  propTypes: {
+    // An optional string prop named "description".
+    description: React.PropTypes.string,
+
+    // A required enum prop named "category".
+    category: React.PropTypes.oneOf(['News','Photos']).isRequired,
+
+    // A prop named "dialog" that requires an instance of Dialog.
+    dialog: React.PropTypes.instanceOf(Dialog).isRequired
+  },
+  ...
+});
+

Default Values

+

One common pattern we've seen with our React code is to do something like this:

+
React.createClass({
+  render: function() {
+    var value = this.props.value || 'default value';
+    return <div>{value}</div>;
+  }
+});
+
+

Do this for a few props across a few components and now you have a lot of redundant code. Starting with React v0.4, you can provide default values in a declarative way:

+
React.createClass({
+  getDefaultProps: function() {
+    return {
+      value: 'default value'
+    };
+  }
+  ...
+});
+
+

We will use the cached result of this function before each render. We also perform all validations before each render to ensure that you have all of the data you need in the right form before you try to use it.

+ +
+ +

Both of these features are entirely optional. We've found them to be increasingly valuable at Facebook as our applications grow and evolve, and we hope others find them useful as well.

+ +
+
+

Community Round-up #4

July 3, 2013 by Vjeux

@@ -301,80 +352,6 @@
-
-

Community Round-up #2

-

June 19, 2013 by Vjeux

-
-
-

Since the launch we have received a lot of feedback and are actively working on React 0.4. In the meantime, here are the highlights of this week.

-

Some quick thoughts on React

-

Andrew Greig made a blog post that gives a high level description of what React is.

- -
-

I have been using Facebooks recently released Javascript framework called React.js for the last few days and have managed to obtain a rather high level understanding of how it works and formed a good perspective on how it fits in to the entire javascript framework ecosystem.

- -

Basically, React is not an MVC framework. It is not a replacement for Backbone or Knockout or Angular, instead it is designed to work with existing frameworks and help extend their functionality.

- -

It is designed for building big UIs. The type where you have lots of reusable components that are handling events and presenting and changing some backend data. In a traditional MVC app, React fulfils the role of the View. So you would still need to handle the Model and Controller on your own.

- -

I found the best way to utilise React was to pair it with Backbone, with React replacing the Backbone View, or to write your own Model/Data object and have React communicate with that.

- -

Read the full post...

-
-

React and Socket.IO Chat Application

-

Danial Khosravi made a real-time chat application that interacts with the back-end using Socket.IO.

- -
-

A week ago I was playing with AngularJS and this little chat application which uses socket.io and nodejs for realtime communication. Yesterday I saw a post about ReactJS in EchoJS and started playing with this UI library. After playing a bit with React, I decided to write and chat application using React and I used Bran Ford's Backend for server side of this little app. -

- -

Read the full post...

-
-

React and Other Frameworks

-

Pete Hunt wrote an answer on Quora comparing React and Angular directives. At the end, he explains how you can make an Angular directive that is in fact being rendered with React.

- -
-

To set the record straight: React components are far more powerful than Angular templates; they should be compared with Angular's directives instead. So I took the first Google hit for "AngularJS directive tutorial" (AngularJS Directives Tutorial - Fundoo Solutions), rewrote it in React and compared them. [...]

- -

We've designed React from the beginning to work well with other libraries. Angular is no exception. Let's take the original Angular example and use React to implement the fundoo-rating directive.

- -

Read the full post...

-
- -

In the same vein, Markov Twain re-implemented the examples on the front-page with Ember and Vlad Yazhbin re-implemented the tutorial with Angular.

-

Web Components: React & x-tags

-

Mozilla and Google are actively working on Web Components. Vjeux wrote a proof of concept that shows how to implement them using React.

- -
-

Using x-tags from Mozilla, we can write custom tags within the DOM. This is a great opportunity to be able to write reusable components without being tied to a particular library. I wrote x-react to have them being rendered in React. -

- -

Read the full post...

-
-

React TodoMVC Example

-

TodoMVC.com is a website that collects various implementations of the same basic Todo app. Pete Hunt wrote an idiomatic React version.

- -
-

Developers these days are spoiled with choice when it comes to selecting an MV* framework for structuring and organizing their JavaScript web apps.

- -

To help solve this problem, we created TodoMVC - a project which offers the same Todo application implemented using MV* concepts in most of the popular JavaScript MV* frameworks of today. -

- -

Read the source code...

-
-

JSX is not HTML

-

Many of you pointed out differences between JSX and HTML. In order to clear up some confusion, we have added some documentation that covers the four main differences:

- - - -
-
- @@ -85,6 +85,80 @@
+
+

Community Round-up #2

+

June 19, 2013 by Vjeux

+
+
+

Since the launch we have received a lot of feedback and are actively working on React 0.4. In the meantime, here are the highlights of this week.

+

Some quick thoughts on React

+

Andrew Greig made a blog post that gives a high level description of what React is.

+ +
+

I have been using Facebooks recently released Javascript framework called React.js for the last few days and have managed to obtain a rather high level understanding of how it works and formed a good perspective on how it fits in to the entire javascript framework ecosystem.

+ +

Basically, React is not an MVC framework. It is not a replacement for Backbone or Knockout or Angular, instead it is designed to work with existing frameworks and help extend their functionality.

+ +

It is designed for building big UIs. The type where you have lots of reusable components that are handling events and presenting and changing some backend data. In a traditional MVC app, React fulfils the role of the View. So you would still need to handle the Model and Controller on your own.

+ +

I found the best way to utilise React was to pair it with Backbone, with React replacing the Backbone View, or to write your own Model/Data object and have React communicate with that.

+ +

Read the full post...

+
+

React and Socket.IO Chat Application

+

Danial Khosravi made a real-time chat application that interacts with the back-end using Socket.IO.

+ +
+

A week ago I was playing with AngularJS and this little chat application which uses socket.io and nodejs for realtime communication. Yesterday I saw a post about ReactJS in EchoJS and started playing with this UI library. After playing a bit with React, I decided to write and chat application using React and I used Bran Ford's Backend for server side of this little app. +

+ +

Read the full post...

+
+

React and Other Frameworks

+

Pete Hunt wrote an answer on Quora comparing React and Angular directives. At the end, he explains how you can make an Angular directive that is in fact being rendered with React.

+ +
+

To set the record straight: React components are far more powerful than Angular templates; they should be compared with Angular's directives instead. So I took the first Google hit for "AngularJS directive tutorial" (AngularJS Directives Tutorial - Fundoo Solutions), rewrote it in React and compared them. [...]

+ +

We've designed React from the beginning to work well with other libraries. Angular is no exception. Let's take the original Angular example and use React to implement the fundoo-rating directive.

+ +

Read the full post...

+
+ +

In the same vein, Markov Twain re-implemented the examples on the front-page with Ember and Vlad Yazhbin re-implemented the tutorial with Angular.

+

Web Components: React & x-tags

+

Mozilla and Google are actively working on Web Components. Vjeux wrote a proof of concept that shows how to implement them using React.

+ +
+

Using x-tags from Mozilla, we can write custom tags within the DOM. This is a great opportunity to be able to write reusable components without being tied to a particular library. I wrote x-react to have them being rendered in React. +

+ +

Read the full post...

+
+

React TodoMVC Example

+

TodoMVC.com is a website that collects various implementations of the same basic Todo app. Pete Hunt wrote an idiomatic React version.

+ +
+

Developers these days are spoiled with choice when it comes to selecting an MV* framework for structuring and organizing their JavaScript web apps.

+ +

To help solve this problem, we created TodoMVC - a project which offers the same Todo application implemented using MV* concepts in most of the popular JavaScript MV* frameworks of today. +

+ +

Read the source code...

+
+

JSX is not HTML

+

Many of you pointed out differences between JSX and HTML. In order to clear up some confusion, we have added some documentation that covers the four main differences:

+ + + +
+
+

Community Round-up #1

June 12, 2013 by Vjeux

diff --git a/docs/OUTLINE.html b/docs/OUTLINE.html index 0d35e617ff..15979f6699 100644 --- a/docs/OUTLINE.html +++ b/docs/OUTLINE.html @@ -162,6 +162,13 @@ +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/addons.html b/docs/addons.html new file mode 100644 index 0000000000..5259e72076 --- /dev/null +++ b/docs/addons.html @@ -0,0 +1,439 @@ + + + + + + React | Add-ons + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + +
    +

    Add-ons

    +
    +

    React.addons is where we park some useful utilities for building React apps. These should be considered experimental but will eventually be rolled into core or a blessed utilities library.

    +

    CSS Animation and Transitions

    +

    ReactTransitions is an easy way to perform CSS transitions and animations when a React component enters or leaves the DOM. ReactTransitions is inspired by the excellent ng-animate library.

    +

    Getting Started

    +

    ReactTransitionGroup is the interface to ReactTransitions. This is a simple element that wraps all of the components you are interested in animating. Here's an example where we fade list items in and out.

    +
    /** @jsx React.DOM */
    +
    +var ReactTransitionGroup = React.addons.TransitionGroup;
    +
    +var TodoList = React.createClass({
    +  getInitialState: function() {
    +    return {items: ['hello', 'world', 'click', 'me']};
    +  },
    +  handleAdd: function() {
    +    var newItems =
    +      this.state.items.concat([prompt('Enter some text')]);
    +    this.setState({items: newItems});
    +  },
    +  handleRemove: function(i) {
    +    var newItems = this.state.items;
    +    newItems.splice(i, 0)
    +    this.setState({items: newItems});
    +  },
    +  render: function() {
    +    var items = this.state.items.map(function(item, i) {
    +      return (
    +        <div key={i} onClick={this.handleRemove.bind(this, i)}>
    +          {item}}
    +        </div>
    +      );
    +    }.bind(this));
    +    return (
    +      <div>
    +        <div><button onClick={this.handleAdd} /></div>
    +        <ReactTransitionGroup transitionName="example">
    +          {items}
    +        </ReactTransitionGroup>
    +      </div>
    +    );
    +  }
    +});
    +
    +

    In this component, when a new item is added ReactTransitionGroup it will get the example-enter CSS class and the example-enter-active CSS class added in the next tick. This is a convention based on the transitionName prop.

    + +

    You can use these classes to trigger a CSS animation or transition. For example, try adding this CSS and adding a new list item:

    +
    .example-enter {
    +  opacity: 0.01;
    +  transition: opacity .5s ease-in;
    +}
    +
    +.example-enter.example-enter-active {
    +  opacity: 0.99;
    +}
    +
    +

    You'll notice that when you try to remove an item ReactTransitionGroup keeps it in the DOM. If you're using an unminified build of React you'll see a warning that React was expecting an animation or transition to occur. That's because ReactTransitionGroup keeps your DOM elements on the page until the animation completes. Try adding this CSS:

    +
    .example-leave {
    +  opacity: 0.99;
    +  transition: opacity .5s ease-in;
    +}
    +
    +.example-leave.example-leave-active {
    +  opacity: 0.01;
    +}
    +

    Disabling Animations

    +

    You can disable animating enter or leave animations if you want. For example, sometimes you may want an enter animation and no leave animation, but ReactTransitionGroup waits for an animation to complete before removing your DOM node. You can add transitionEnter={false} or transitionLeave={false} props to ReactTransitionGroup to disable these animations.

    +

    Rendering a Different Component

    +

    By default ReactTransitionGroup renders as a span. You can change this behavior by providing a component prop. For example, here's how you would render a <ul>:

    +
    <ReactTransitionGroup
    +  transitionName="example"
    +  component={React.DOM.ul}>
    +  ...
    +</ReactTransitionGroup>
    +
    +

    component does not need to be a DOM component. It can be any component you want; even one you've written yourself!

    + +

    ReactLink is an easy way to express two-way binding with React.

    + +

    In React, data flows one way: from owner to child. This is because data only flows one direction in the Von Neumann model of computing. You can think of it as "one-way data binding."

    + +

    However, there are lots of applications that require you to read some data and flow it back into your program. For example, when developing forms, you'll often want to update some React state when you receive user input. Or perhaps you want to perform layout in JavaScript and react to changes in some DOM element size.

    + +

    In React, you would implement this by listening to a "change" event, read from your data source (usually the DOM) and call setState() on one of your components. "Closing the data flow loop" explicitly leads to more understandable and easier-to-maintain programs. See our forms documentation for more information.

    + +

    Two-way binding -- implicitly enforcing that some value in the DOM is always consistent with some React state -- is concise and supports a wide variety of applications. We've provided ReactLink: syntactic sugar for setting up the common data flow loop pattern described above, or "linking" some data source to React state.

    + +
    +

    Note:

    + +

    ReactLink is just a thin wrapper and convention around the onChange/setState() pattern. It doesn't fundamentally change how data flows in your React application.

    +
    + +

    Here's a simple form example without using ReactLink:

    +
    /** @jsx React.DOM */
    +
    +var NoLink = React.createClass({
    +  getInitialState: function() {
    +    return {value: 'Hello!'};
    +  },
    +  handleChange: function(event) {
    +    this.setState({value: event.target.value});
    +  },
    +  render: function() {
    +    var value = this.state.value;
    +    return <input type="text" value={value} onChange={this.handleChange} />;
    +  }
    +});
    +
    +

    This works really well and it's very clear how data is flowing, however with a lot of form fields it could get a bit verbose. Let's use ReactLink to save us some typing:

    +
    /** @jsx React.DOM */
    +
    +var WithLink = React.createClass({
    +  mixins: [React.addons.LinkedStateMixin],
    +  getInitialState: function() {
    +    return {value: 'Hello!'};
    +  },
    +  render: function() {
    +    return <input type="text" valueLink={this.linkState('value')} />;
    +  }
    +});
    +
    +

    LinkedStateMixin adds a method ot your React component called linkState(). linkState() returns a ReactLink object which contains the current value of the React state and a callback to change it.

    + +

    ReactLink objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy.

    +

    Under the Hood

    +

    There are two sides to ReactLink: the place where you create the ReactLink instance and the place where you use it. To prove how simple ReactLink is, let's rewrite each side separately to be more explicit.

    +
    /** @jsx React.DOM */
    +
    +var WithoutMixin = React.createClass({
    +  getInitialState: function() {
    +    return {value: 'Hello!'};
    +  },
    +  handleChange: function(newValue) {
    +    this.setState({value: newValue});
    +  },
    +  render: function() {
    +    var valueLink = {
    +      value: this.state.value,
    +      requestChange: this.handleChange
    +    };
    +    return <input type="text" valueLink={valueLink} />;
    +  }
    +});
    +
    +

    As you can see, ReactLink objects are very simple objects that just have a value and requestChange prop. And LinkedStateMixin is similarly simple: it just populates those fields with a value from this.state and a callback that calls this.setState().

    +
    /** @jsx React.DOM */
    +
    +var WithoutLink = React.createClass({
    +  mixins: [React.addons.LinkedStateMixin],
    +  getInitialState: function() {
    +    return {value: 'Hello!'};
    +  },
    +  render: function() {
    +    var valueLink = this.linkState('value');
    +    var handleChange = function(e) {
    +      valueLink.requestChange(e.target.value);
    +    };
    +    return <input type="text" value={valueLink.value} onChange={handleChange} />;
    +  }
    +});
    +
    +

    The valueLink prop is also quite simple. It simply handles the onChange event and calls this.props.valueLink.requestChange() and also uses this.props.valueLink.value instead of this.props.value. That's it!

    + + +
    + + ← Prev + + + Next → + +
    + +
    +
    +
    + + +
    +
    A Facebook & Instagram collaboration.
    +
    © 2013 Facebook Inc.
    +
    +
    +
    + + + diff --git a/docs/component-api.html b/docs/component-api.html index ccf6ec7a40..0445a3e894 100644 --- a/docs/component-api.html +++ b/docs/component-api.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/component-specs.html b/docs/component-specs.html index 058763e7d1..e688ee1484 100644 --- a/docs/component-specs.html +++ b/docs/component-specs.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/displaying-data.html b/docs/displaying-data.html index 08aebeb8e3..a8fcaa4065 100644 --- a/docs/displaying-data.html +++ b/docs/displaying-data.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples @@ -234,8 +241,8 @@ <html> <head> <title>Hello React</title> - <script src="http://fb.me/react-0.4.1.min.js"></script> - <script src="http://fb.me/JSXTransformer-0.4.1.js"></script> + <script src="http://fb.me/react-0.5.0.min.js"></script> + <script src="http://fb.me/JSXTransformer-0.5.0.js"></script> </head> <body> <div id="example"></div> diff --git a/docs/dom-differences.html b/docs/dom-differences.html index 7dccf0f7b7..e15a2d8fb4 100644 --- a/docs/dom-differences.html +++ b/docs/dom-differences.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/events.html b/docs/events.html index 1ae1717dea..94d9eb5492 100644 --- a/docs/events.html +++ b/docs/events.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/examples.html b/docs/examples.html index 5a0e1e6dd1..6596dd26b5 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples @@ -231,7 +238,7 @@

    Sample Code

  • diff --git a/docs/top-level-api.html b/docs/top-level-api.html index 8acc8e0d2b..eb7932f5d2 100644 --- a/docs/top-level-api.html +++ b/docs/top-level-api.html @@ -162,6 +162,13 @@ +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/tutorial.html b/docs/tutorial.html index 97c8309554..d7349b7b5b 100644 --- a/docs/tutorial.html +++ b/docs/tutorial.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples @@ -252,8 +259,8 @@ <html> <head> <title>Hello React</title> - <script src="http://fb.me/react-0.4.1.js"></script> - <script src="http://fb.me/JSXTransformer-0.4.1.js"></script> + <script src="http://fb.me/react-0.5.0.js"></script> + <script src="http://fb.me/JSXTransformer-0.5.0.js"></script> </head> <body> <div id="content"></div> @@ -393,8 +400,8 @@
    <!-- template.html -->
     <head>
       <title>Hello React</title>
    -  <script src="http://fb.me/react-0.4.1.js"></script>
    -  <script src="http://fb.me/JSXTransformer-0.4.1.js"></script>
    +  <script src="http://fb.me/react-0.5.0.js"></script>
    +  <script src="http://fb.me/JSXTransformer-0.5.0.js"></script>
       <script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
     </head>
     
    diff --git a/docs/why-react.html b/docs/why-react.html index b6932ad3ba..45388f5171 100644 --- a/docs/why-react.html +++ b/docs/why-react.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/docs/working-with-the-browser.html b/docs/working-with-the-browser.html index 9e962b42a3..0351aa5272 100644 --- a/docs/working-with-the-browser.html +++ b/docs/working-with-the-browser.html @@ -162,6 +162,13 @@
  • +
  • + + Add-ons + + +
  • +
  • Examples diff --git a/downloads.html b/downloads.html index c163cb4a74..886981e87e 100644 --- a/downloads.html +++ b/downloads.html @@ -60,19 +60,19 @@ get started with React.

    -

    Individual Downloads

    React Core 0.4.1 (production)

    +

    Individual Downloads

    React Core 0.5.0 (production)

    The compressed, production version of React core

    -
    <script src="http://fb.me/react-0.4.1.min.js"></script>
    -

    React Core 0.4.1 (development)

    +
    <script src="http://fb.me/react-0.5.0.min.js"></script>
    +

    React Core 0.5.0 (development)

    The uncompressed, development version of React core with inline documentation.

    -
    <script src="http://fb.me/react-0.4.1.js"></script>
    -

    JSX Transform

    +
    <script src="http://fb.me/react-0.5.0.js"></script>
    +

    JSX Transform

    The JSX transformer used to support XML syntax in JavaScript.

    -
    <script src="http://fb.me/JSXTransformer-0.4.1.js"></script>
    +
    <script src="http://fb.me/JSXTransformer-0.5.0.js"></script>
     

    All scripts are also available via CDNJS.

    Bower

    $ bower install --save react
    diff --git a/downloads/react-0.5.0.zip b/downloads/react-0.5.0.zip
    new file mode 100644
    index 0000000000..09859382f2
    Binary files /dev/null and b/downloads/react-0.5.0.zip differ
    diff --git a/feed.xml b/feed.xml
    index c9d8e15cc7..d7d3ac42d3 100644
    --- a/feed.xml
    +++ b/feed.xml
    @@ -6,6 +6,55 @@
     		http://facebook.github.io/react
     		
     		
    +			
    +				React v0.5
    +				<p>This release is the result of several months of hard work from members of the team and the community. While there are no groundbreaking changes in core, we&#39;ve worked hard to improve performance and memory usage. We&#39;ve also worked hard to make sure we are being consistent in our usage of DOM properties.</p>
    +
    +<p>The biggest change you&#39;ll notice as a developer is that we no longer support <code>class</code> in JSX as a way to provide CSS classes. Since this prop was being converted to <code>className</code> at the transform step, it caused some confusion when trying to access it in composite components. As a result we decided to make our DOM properties mirror their counterparts in the JS DOM API. There are <a href="https://github.com/facebook/react/blob/master/src/dom/DefaultDOMPropertyConfig.js#L156">a few exceptions</a> where we deviate slightly in an attempt to be consistent internally.</p>
    +
    +<p>The other major change in v0.5 is that we&#39;ve added an additional build - <code>react-with-addons</code> - which adds support for some extras that we&#39;ve been working on including animations and two-way binding. <a href="/react/docs/addons.html">Read more about these addons in the docs</a>.</p>
    +<h2 id="thanks-to-our-community">Thanks to Our Community</h2>
    +<p>We added <em>22 new people</em> to the list of authors since we launched React v0.4.1 nearly 3 months ago. With a total of 48 names in our <code>AUTHORS</code> file, that means we&#39;ve nearly doubled the number of contributors in that time period. We&#39;ve seen the number of people contributing to discussion on IRC, mailing lists, Stack Overflow, and GitHub continue rising. We&#39;ve also had people tell us about talks they&#39;ve given in their local community about React.</p>
    +
    +<p>It&#39;s been awesome to see the things that people are building with React, and we can&#39;t wait to see what you come up with next!</p>
    +<h2 id="changelog">Changelog</h2><h3 id="react">React</h3>
    +<ul>
    +<li>Memory usage improvements - reduced allocations in core which will help with GC pauses</li>
    +<li>Performance improvements - in addition to speeding things up, we made some tweaks to stay out of slow path code in V8 and Nitro.</li>
    +<li>Standardized prop -&gt; DOM attribute process. This previously resulting in additional type checking and overhead as well as confusing cases for users. Now we will always convert your value to a string before inserting it into the DOM.</li>
    +<li>Support for Selection events.</li>
    +<li>Support for <a href="https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent">Composition events</a>.</li>
    +<li>Support for additional DOM properties (<code>charSet</code>, <code>content</code>, <code>form</code>, <code>httpEquiv</code>, <code>rowSpan</code>, <code>autoCapitalize</code>).</li>
    +<li>Support for additional SVG properties (<code>rx</code>, <code>ry</code>).</li>
    +<li>Support for using <code>getInitialState</code> and <code>getDefaultProps</code> in mixins.</li>
    +<li>Support mounting into iframes.</li>
    +<li>Bug fixes for controlled form components.</li>
    +<li>Bug fixes for SVG element creation.</li>
    +<li>Added <code>React.version</code>.</li>
    +<li>Added <code>React.isValidClass</code> - Used to determine if a value is a valid component constructor.</li>
    +<li>Removed <code>React.autoBind</code> - This was deprecated in v0.4 and now properly removed.</li>
    +<li>Renamed  <code>React.unmountAndReleaseReactRootNode</code> to <code>React.unmountComponentAtNode</code>.</li>
    +<li>Began laying down work for refined performance analysis.</li>
    +<li>Better support for server-side rendering - <a href="https://github.com/facebook/react-page">react-page</a> has helped improve the stability for server-side rendering.</li>
    +<li>Made it possible to use React in environments enforcing a strict <a href="https://developer.mozilla.org/en-US/docs/Security/CSP/Introducing_Content_Security_Policy">Content Security Policy</a>. This also makes it possible to use React to build Chrome extensions.</li>
    +</ul>
    +<h3 id="react-with-addons-new">React with Addons (New!)</h3>
    +<ul>
    +<li>Introduced a separate build with several &quot;addons&quot; which we think can help improve the React experience. We plan to deprecate this in the long-term, instead shipping each as standalone pieces. <a href="/react/docs/addons.html">Read more in the docs</a>.</li>
    +</ul>
    +<h3 id="jsx">JSX</h3>
    +<ul>
    +<li>No longer transform <code>class</code> to <code>className</code> as part of the transform! This is a breaking change - if you were using <code>class</code>, you <em>must</em> change this to <code>className</code> or your components will be visually broken.</li>
    +<li>Added warnings to the in-browser transformer to make it clear it is not intended for production use.</li>
    +<li>Improved compatibility for Windows</li>
    +<li>Improved support for maintaining line numbers when transforming.</li>
    +</ul>
    +
    +				2013-10-16T00:00:00-07:00
    +				http://facebook.github.io/react/blog/2013/10/16/react-v0.5.0.html
    +				http://facebook.github.io/react/blog/2013/10/16/react-v0.5.0.html
    +			
    +		
     			
     				Community Round-up #9
     				<p>We organized a React hackathon last week-end in the Facebook Seattle office. 50 people, grouped into 15 teams, came to hack for a day on React. It was a lot of fun and we&#39;ll probably organize more in the future.</p>
    @@ -542,55 +591,5 @@ If you were using React without JSX previously, your code should still work.<
     				http://facebook.github.io/react/blog/2013/07/17/react-v0-4-0.html
     			
     		
    -			
    -				New in React v0.4: Prop Validation and Default Values
    -				<p>Many of the questions we got following the public launch of React revolved around <code>props</code>, specifically that people wanted to do validation and to make sure their components had sensible defaults.</p>
    -<h2 id="validation">Validation</h2>
    -<p>Oftentimes you want to validate your <code>props</code> before you use them. Perhaps you want to ensure they are a specific type. Or maybe you want to restrict your prop to specific values. Or maybe you want to make a specific prop required. This was always possible — you could have written validations in your <code>render</code> or <code>componentWillReceiveProps</code> functions, but that gets clunky fast.</p>
    -
    -<p>React v0.4 will provide a nice easy way for you to use built-in validators, or to even write your own.</p>
    -<div class="highlight"><pre><code class="js language-js" data-lang="js"><span class="nx">React</span><span class="p">.</span><span class="nx">createClass</span><span class="p">({</span>
    -  <span class="nx">propTypes</span><span class="o">:</span> <span class="p">{</span>
    -    <span class="c1">// An optional string prop named &quot;description&quot;.</span>
    -    <span class="nx">description</span><span class="o">:</span> <span class="nx">React</span><span class="p">.</span><span class="nx">PropTypes</span><span class="p">.</span><span class="nx">string</span><span class="p">,</span>
    -
    -    <span class="c1">// A required enum prop named &quot;category&quot;.</span>
    -    <span class="nx">category</span><span class="o">:</span> <span class="nx">React</span><span class="p">.</span><span class="nx">PropTypes</span><span class="p">.</span><span class="nx">oneOf</span><span class="p">([</span><span class="s1">&#39;News&#39;</span><span class="p">,</span><span class="s1">&#39;Photos&#39;</span><span class="p">]).</span><span class="nx">isRequired</span><span class="p">,</span>
    -
    -    <span class="c1">// A prop named &quot;dialog&quot; that requires an instance of Dialog.</span>
    -    <span class="nx">dialog</span><span class="o">:</span> <span class="nx">React</span><span class="p">.</span><span class="nx">PropTypes</span><span class="p">.</span><span class="nx">instanceOf</span><span class="p">(</span><span class="nx">Dialog</span><span class="p">).</span><span class="nx">isRequired</span>
    -  <span class="p">},</span>
    -  <span class="p">...</span>
    -<span class="p">});</span>
    -</code></pre></div><h2 id="default-values">Default Values</h2>
    -<p>One common pattern we&#39;ve seen with our React code is to do something like this:</p>
    -<div class="highlight"><pre><code class="js language-js" data-lang="js"><span class="nx">React</span><span class="p">.</span><span class="nx">createClass</span><span class="p">({</span>
    -  <span class="nx">render</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    -    <span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">value</span> <span class="o">||</span> <span class="s1">&#39;default value&#39;</span><span class="p">;</span>
    -    <span class="k">return</span> <span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span><span class="p">{</span><span class="nx">value</span><span class="p">}</span><span class="o">&lt;</span><span class="err">/div&gt;;</span>
    -  <span class="p">}</span>
    -<span class="p">});</span>
    -</code></pre></div>
    -<p>Do this for a few <code>props</code> across a few components and now you have a lot of redundant code. Starting with React v0.4, you can provide default values in a declarative way:</p>
    -<div class="highlight"><pre><code class="js language-js" data-lang="js"><span class="nx">React</span><span class="p">.</span><span class="nx">createClass</span><span class="p">({</span>
    -  <span class="nx">getDefaultProps</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    -    <span class="k">return</span> <span class="p">{</span>
    -      <span class="nx">value</span><span class="o">:</span> <span class="s1">&#39;default value&#39;</span>
    -    <span class="p">};</span>
    -  <span class="p">}</span>
    -  <span class="p">...</span>
    -<span class="p">});</span>
    -</code></pre></div>
    -<p>We will use the cached result of this function before each <code>render</code>. We also perform all validations before each <code>render</code> to ensure that you have all of the data you need in the right form before you try to use it.</p>
    -
    -<hr>
    -
    -<p>Both of these features are entirely optional. We&#39;ve found them to be increasingly valuable at Facebook as our applications grow and evolve, and we hope others find them useful as well.</p>
    -
    -				2013-07-11T00:00:00-07:00
    -				http://facebook.github.io/react/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html
    -				http://facebook.github.io/react/blog/2013/07/11/react-v0-4-prop-validation-and-default-values.html
    -			
    -		
     	
     
    diff --git a/index.html b/index.html
    index 14b6c78438..a3fa695116 100644
    --- a/index.html
    +++ b/index.html
    @@ -60,7 +60,7 @@
     
             
           
    @@ -146,7 +146,7 @@

    diff --git a/js/JSXTransformer.js b/js/JSXTransformer.js index c02587f8ec..fdb470c851 100644 --- a/js/JSXTransformer.js +++ b/js/JSXTransformer.js @@ -1,43 +1,249 @@ /** - * JSXTransformer v0.4.1 + * JSXTransformer v0.5.0 */ -(function(e){if("function"==typeof bootstrap)bootstrap("jsxtransformer",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJSXTransformer=e}else"undefined"!=typeof window?window.JSXTransformer=e():global.JSXTransformer=e()})(function(){var define,ses,bootstrap,module,exports; -return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s 0) { - s = this.chars[i % 62] + s - i = Math.floor(i/62) - } - return s - }; - my.decode = function(a,b,c,d){ - for ( - b = c = ( - a === (/\W|_|^$/.test(a += "") || a) - ) - 1; - d = a.charCodeAt(c++); - ) - b = b * 62 + d - [, 48, 29, 87][d >> 5]; - return b - }; - return my; -}({})); +// +// The shims in this file are not fully implemented shims for the ES5 +// features, but do work for the particular usecases there is in +// the other modules. +// -module.exports = Base62 -},{}],2:[function(require,module,exports){ -(function(process){function filter (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - if (fn(xs[i], i, xs)) res.push(xs[i]); - } - return res; +var toString = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; + +// Array.isArray is supported in IE9 +function isArray(xs) { + return toString.call(xs) === '[object Array]'; } +exports.isArray = typeof Array.isArray === 'function' ? Array.isArray : isArray; + +// Array.prototype.indexOf is supported in IE9 +exports.indexOf = function indexOf(xs, x) { + if (xs.indexOf) return xs.indexOf(x); + for (var i = 0; i < xs.length; i++) { + if (x === xs[i]) return i; + } + return -1; +}; + +// Array.prototype.filter is supported in IE9 +exports.filter = function filter(xs, fn) { + if (xs.filter) return xs.filter(fn); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (fn(xs[i], i, xs)) res.push(xs[i]); + } + return res; +}; + +// Array.prototype.forEach is supported in IE9 +exports.forEach = function forEach(xs, fn, self) { + if (xs.forEach) return xs.forEach(fn, self); + for (var i = 0; i < xs.length; i++) { + fn.call(self, xs[i], i, xs); + } +}; + +// Array.prototype.map is supported in IE9 +exports.map = function map(xs, fn) { + if (xs.map) return xs.map(fn); + var out = new Array(xs.length); + for (var i = 0; i < xs.length; i++) { + out[i] = fn(xs[i], i, xs); + } + return out; +}; + +// Array.prototype.reduce is supported in IE9 +exports.reduce = function reduce(array, callback, opt_initialValue) { + if (array.reduce) return array.reduce(callback, opt_initialValue); + var value, isValueSet = false; + + if (2 < arguments.length) { + value = opt_initialValue; + isValueSet = true; + } + for (var i = 0, l = array.length; l > i; ++i) { + if (array.hasOwnProperty(i)) { + if (isValueSet) { + value = callback(value, array[i], i, array); + } + else { + value = array[i]; + isValueSet = true; + } + } + } + + return value; +}; + +// String.prototype.substr - negative index don't work in IE8 +if ('ab'.substr(-1) !== 'b') { + exports.substr = function (str, start, length) { + // did we get a negative start, calculate how much it is from the beginning of the string + if (start < 0) start = str.length + start; + + // call the original function + return str.substr(start, length); + }; +} else { + exports.substr = function (str, start, length) { + return str.substr(start, length); + }; +} + +// String.prototype.trim is supported in IE9 +exports.trim = function (str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +}; + +// Function.prototype.bind is supported in IE9 +exports.bind = function () { + var args = Array.prototype.slice.call(arguments); + var fn = args.shift(); + if (fn.bind) return fn.bind.apply(fn, args); + var self = args.shift(); + return function () { + fn.apply(self, args.concat([Array.prototype.slice.call(arguments)])); + }; +}; + +// Object.create is supported in IE9 +function create(prototype, properties) { + var object; + if (prototype === null) { + object = { '__proto__' : null }; + } + else { + if (typeof prototype !== 'object') { + throw new TypeError( + 'typeof prototype[' + (typeof prototype) + '] != \'object\'' + ); + } + var Type = function () {}; + Type.prototype = prototype; + object = new Type(); + object.__proto__ = prototype; + } + if (typeof properties !== 'undefined' && Object.defineProperties) { + Object.defineProperties(object, properties); + } + return object; +} +exports.create = typeof Object.create === 'function' ? Object.create : create; + +// Object.keys and Object.getOwnPropertyNames is supported in IE9 however +// they do show a description and number property on Error objects +function notObject(object) { + return ((typeof object != "object" && typeof object != "function") || object === null); +} + +function keysShim(object) { + if (notObject(object)) { + throw new TypeError("Object.keys called on a non-object"); + } + + var result = []; + for (var name in object) { + if (hasOwnProperty.call(object, name)) { + result.push(name); + } + } + return result; +} + +// getOwnPropertyNames is almost the same as Object.keys one key feature +// is that it returns hidden properties, since that can't be implemented, +// this feature gets reduced so it just shows the length property on arrays +function propertyShim(object) { + if (notObject(object)) { + throw new TypeError("Object.getOwnPropertyNames called on a non-object"); + } + + var result = keysShim(object); + if (exports.isArray(object) && exports.indexOf(object, 'length') === -1) { + result.push('length'); + } + return result; +} + +var keys = typeof Object.keys === 'function' ? Object.keys : keysShim; +var getOwnPropertyNames = typeof Object.getOwnPropertyNames === 'function' ? + Object.getOwnPropertyNames : propertyShim; + +if (new Error().hasOwnProperty('description')) { + var ERROR_PROPERTY_FILTER = function (obj, array) { + if (toString.call(obj) === '[object Error]') { + array = exports.filter(array, function (name) { + return name !== 'description' && name !== 'number' && name !== 'message'; + }); + } + return array; + }; + + exports.keys = function (object) { + return ERROR_PROPERTY_FILTER(object, keys(object)); + }; + exports.getOwnPropertyNames = function (object) { + return ERROR_PROPERTY_FILTER(object, getOwnPropertyNames(object)); + }; +} else { + exports.keys = keys; + exports.getOwnPropertyNames = getOwnPropertyNames; +} + +// Object.getOwnPropertyDescriptor - supported in IE8 but only on dom elements +function valueObject(value, key) { + return { value: value[key] }; +} + +if (typeof Object.getOwnPropertyDescriptor === 'function') { + try { + Object.getOwnPropertyDescriptor({'a': 1}, 'a'); + exports.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + } catch (e) { + // IE8 dom element issue - use a try catch and default to valueObject + exports.getOwnPropertyDescriptor = function (value, key) { + try { + return Object.getOwnPropertyDescriptor(value, key); + } catch (e) { + return valueObject(value, key); + } + }; + } +} else { + exports.getOwnPropertyDescriptor = valueObject; +} + +},{}],2:[function(require,module,exports){ +var process=require("__browserify_process");// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var util = require('util'); +var shims = require('_shims'); // resolves . and .. elements in a path array with directory names there // must be no slashes, empty elements, or device names (c:\) in the array @@ -46,9 +252,9 @@ module.exports = Base62 function normalizeArray(parts, allowAboveRoot) { // if the path tries to go above the root, `up` ends up > 0 var up = 0; - for (var i = parts.length; i >= 0; i--) { + for (var i = parts.length - 1; i >= 0; i--) { var last = parts[i]; - if (last == '.') { + if (last === '.') { parts.splice(i, 1); } else if (last === '..') { parts.splice(i, 1); @@ -69,35 +275,39 @@ function normalizeArray(parts, allowAboveRoot) { return parts; } -// Regex to split a filename into [*, dir, basename, ext] -// posix version -var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/; +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; // path.resolve([from ...], to) // posix version exports.resolve = function() { -var resolvedPath = '', - resolvedAbsolute = false; + var resolvedPath = '', + resolvedAbsolute = false; -for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) - ? arguments[i] - : process.cwd(); + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); - // Skip empty and invalid entries - if (typeof path !== 'string' || !path) { - continue; + // Skip empty and invalid entries + if (!util.isString(path)) { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; } - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; -} + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) -// At this point the path should be resolved to a full absolute path, but -// handle relative paths to be safe (might happen when process.cwd() fails) - -// Normalize the path -resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + // Normalize the path + resolvedPath = normalizeArray(shims.filter(resolvedPath.split('/'), function(p) { return !!p; }), !resolvedAbsolute).join('/'); @@ -107,11 +317,11 @@ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { // path.normalize(path) // posix version exports.normalize = function(path) { -var isAbsolute = path.charAt(0) === '/', - trailingSlash = path.slice(-1) === '/'; + var isAbsolute = exports.isAbsolute(path), + trailingSlash = shims.substr(path, -1) === '/'; -// Normalize the path -path = normalizeArray(filter(path.split('/'), function(p) { + // Normalize the path + path = normalizeArray(shims.filter(path.split('/'), function(p) { return !!p; }), !isAbsolute).join('/'); @@ -121,51 +331,29 @@ path = normalizeArray(filter(path.split('/'), function(p) { if (path && trailingSlash) { path += '/'; } - + return (isAbsolute ? '/' : '') + path; }; +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; // posix version exports.join = function() { var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - return p && typeof p === 'string'; + return exports.normalize(shims.filter(paths, function(p, index) { + if (!util.isString(p)) { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; }).join('/')); }; -exports.dirname = function(path) { - var dir = splitPathRe.exec(path)[1] || ''; - var isWindows = false; - if (!dir) { - // No dirname - return '.'; - } else if (dir.length === 1 || - (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) { - // It is just a slash or a drive letter with a slash - return dir; - } else { - // It is a full dirname, strip trailing slash - return dir.substring(0, dir.length - 1); - } -}; - - -exports.basename = function(path, ext) { - var f = splitPathRe.exec(path)[2] || ''; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPathRe.exec(path)[3] || ''; -}; - +// path.relative(from, to) +// posix version exports.relative = function(from, to) { from = exports.resolve(from).substr(1); to = exports.resolve(to).substr(1); @@ -207,8 +395,2964 @@ exports.relative = function(from, to) { return outputParts.join('/'); }; -})(require("__browserify_process")) -},{"__browserify_process":3}],3:[function(require,module,exports){ +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +},{"__browserify_process":5,"_shims":1,"util":3}],3:[function(require,module,exports){ +var Buffer=require("__browserify_Buffer").Buffer;// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var shims = require('_shims'); + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + shims.forEach(array, function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = shims.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = shims.getOwnPropertyNames(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + + shims.forEach(keys, function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = shims.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (shims.indexOf(ctx.seen, desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = shims.reduce(output, function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return shims.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && objectToString(e) === '[object Error]'; +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +function isBuffer(arg) { + return arg instanceof Buffer; +} +exports.isBuffer = isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = shims.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +}; + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = shims.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +},{"__browserify_Buffer":4,"_shims":1}],4:[function(require,module,exports){ +require=(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 1, + nBits = -7, + i = isBE ? 0 : (nBytes - 1), + d = isBE ? 1 : -1, + s = buffer[offset + i]; + + i += d; + + e = s & ((1 << (-nBits)) - 1); + s >>= (-nBits); + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); + + m = e & ((1 << (-nBits)) - 1); + e >>= (-nBits); + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity); + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; + +exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) { + var e, m, c, + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), + i = isBE ? (nBytes - 1) : 0, + d = isBE ? -1 : 1, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); + + buffer[offset + i - d] |= s * 128; +}; + +},{}],"q9TxCC":[function(require,module,exports){ +var assert; +exports.Buffer = Buffer; +exports.SlowBuffer = Buffer; +Buffer.poolSize = 8192; +exports.INSPECT_MAX_BYTES = 50; + +function stringtrim(str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +} + +function Buffer(subject, encoding, offset) { + if(!assert) assert= require('assert'); + if (!(this instanceof Buffer)) { + return new Buffer(subject, encoding, offset); + } + this.parent = this; + this.offset = 0; + + // Work-around: node's base64 implementation + // allows for non-padded strings while base64-js + // does not.. + if (encoding == "base64" && typeof subject == "string") { + subject = stringtrim(subject); + while (subject.length % 4 != 0) { + subject = subject + "="; + } + } + + var type; + + // Are we slicing? + if (typeof offset === 'number') { + this.length = coerce(encoding); + // slicing works, with limitations (no parent tracking/update) + // check https://github.com/toots/buffer-browserify/issues/19 + for (var i = 0; i < this.length; i++) { + this[i] = subject.get(i+offset); + } + } else { + // Find the length + switch (type = typeof subject) { + case 'number': + this.length = coerce(subject); + break; + + case 'string': + this.length = Buffer.byteLength(subject, encoding); + break; + + case 'object': // Assume object is an array + this.length = coerce(subject.length); + break; + + default: + throw new Error('First argument needs to be a number, ' + + 'array or string.'); + } + + // Treat array-ish objects as a byte array. + if (isArrayIsh(subject)) { + for (var i = 0; i < this.length; i++) { + if (subject instanceof Buffer) { + this[i] = subject.readUInt8(i); + } + else { + this[i] = subject[i]; + } + } + } else if (type == 'string') { + // We are a string + this.length = this.write(subject, 0, encoding); + } else if (type === 'number') { + for (var i = 0; i < this.length; i++) { + this[i] = 0; + } + } + } +} + +Buffer.prototype.get = function get(i) { + if (i < 0 || i >= this.length) throw new Error('oob'); + return this[i]; +}; + +Buffer.prototype.set = function set(i, v) { + if (i < 0 || i >= this.length) throw new Error('oob'); + return this[i] = v; +}; + +Buffer.byteLength = function (str, encoding) { + switch (encoding || "utf8") { + case 'hex': + return str.length / 2; + + case 'utf8': + case 'utf-8': + return utf8ToBytes(str).length; + + case 'ascii': + case 'binary': + return str.length; + + case 'base64': + return base64ToBytes(str).length; + + default: + throw new Error('Unknown encoding'); + } +}; + +Buffer.prototype.utf8Write = function (string, offset, length) { + var bytes, pos; + return Buffer._charsWritten = blitBuffer(utf8ToBytes(string), this, offset, length); +}; + +Buffer.prototype.asciiWrite = function (string, offset, length) { + var bytes, pos; + return Buffer._charsWritten = blitBuffer(asciiToBytes(string), this, offset, length); +}; + +Buffer.prototype.binaryWrite = Buffer.prototype.asciiWrite; + +Buffer.prototype.base64Write = function (string, offset, length) { + var bytes, pos; + return Buffer._charsWritten = blitBuffer(base64ToBytes(string), this, offset, length); +}; + +Buffer.prototype.base64Slice = function (start, end) { + var bytes = Array.prototype.slice.apply(this, arguments) + return require("base64-js").fromByteArray(bytes); +}; + +Buffer.prototype.utf8Slice = function () { + var bytes = Array.prototype.slice.apply(this, arguments); + var res = ""; + var tmp = ""; + var i = 0; + while (i < bytes.length) { + if (bytes[i] <= 0x7F) { + res += decodeUtf8Char(tmp) + String.fromCharCode(bytes[i]); + tmp = ""; + } else + tmp += "%" + bytes[i].toString(16); + + i++; + } + + return res + decodeUtf8Char(tmp); +} + +Buffer.prototype.asciiSlice = function () { + var bytes = Array.prototype.slice.apply(this, arguments); + var ret = ""; + for (var i = 0; i < bytes.length; i++) + ret += String.fromCharCode(bytes[i]); + return ret; +} + +Buffer.prototype.binarySlice = Buffer.prototype.asciiSlice; + +Buffer.prototype.inspect = function() { + var out = [], + len = this.length; + for (var i = 0; i < len; i++) { + out[i] = toHex(this[i]); + if (i == exports.INSPECT_MAX_BYTES) { + out[i + 1] = '...'; + break; + } + } + return ''; +}; + + +Buffer.prototype.hexSlice = function(start, end) { + var len = this.length; + + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + + var out = ''; + for (var i = start; i < end; i++) { + out += toHex(this[i]); + } + return out; +}; + + +Buffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + start = +start || 0; + if (typeof end == 'undefined') end = this.length; + + // Fastpath empty strings + if (+end == start) { + return ''; + } + + switch (encoding) { + case 'hex': + return this.hexSlice(start, end); + + case 'utf8': + case 'utf-8': + return this.utf8Slice(start, end); + + case 'ascii': + return this.asciiSlice(start, end); + + case 'binary': + return this.binarySlice(start, end); + + case 'base64': + return this.base64Slice(start, end); + + case 'ucs2': + case 'ucs-2': + return this.ucs2Slice(start, end); + + default: + throw new Error('Unknown encoding'); + } +}; + + +Buffer.prototype.hexWrite = function(string, offset, length) { + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + + // must be an even number of digits + var strLen = string.length; + if (strLen % 2) { + throw new Error('Invalid hex string'); + } + if (length > strLen / 2) { + length = strLen / 2; + } + for (var i = 0; i < length; i++) { + var byte = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(byte)) throw new Error('Invalid hex string'); + this[offset + i] = byte; + } + Buffer._charsWritten = i * 2; + return i; +}; + + +Buffer.prototype.write = function(string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + encoding = String(encoding || 'utf8').toLowerCase(); + + switch (encoding) { + case 'hex': + return this.hexWrite(string, offset, length); + + case 'utf8': + case 'utf-8': + return this.utf8Write(string, offset, length); + + case 'ascii': + return this.asciiWrite(string, offset, length); + + case 'binary': + return this.binaryWrite(string, offset, length); + + case 'base64': + return this.base64Write(string, offset, length); + + case 'ucs2': + case 'ucs-2': + return this.ucs2Write(string, offset, length); + + default: + throw new Error('Unknown encoding'); + } +}; + +// slice(start, end) +function clamp(index, len, defaultValue) { + if (typeof index !== 'number') return defaultValue; + index = ~~index; // Coerce to integer. + if (index >= len) return len; + if (index >= 0) return index; + index += len; + if (index >= 0) return index; + return 0; +} + +Buffer.prototype.slice = function(start, end) { + var len = this.length; + start = clamp(start, len, 0); + end = clamp(end, len, len); + return new Buffer(this, end - start, +start); +}; + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function(target, target_start, start, end) { + var source = this; + start || (start = 0); + if (end === undefined || isNaN(end)) { + end = this.length; + } + target_start || (target_start = 0); + + if (end < start) throw new Error('sourceEnd < sourceStart'); + + // Copy 0 bytes; we're done + if (end === start) return 0; + if (target.length == 0 || source.length == 0) return 0; + + if (target_start < 0 || target_start >= target.length) { + throw new Error('targetStart out of bounds'); + } + + if (start < 0 || start >= source.length) { + throw new Error('sourceStart out of bounds'); + } + + if (end < 0 || end > source.length) { + throw new Error('sourceEnd out of bounds'); + } + + // Are we oob? + if (end > this.length) { + end = this.length; + } + + if (target.length - target_start < end - start) { + end = target.length - target_start + start; + } + + var temp = []; + for (var i=start; i= this.length) { + throw new Error('start out of bounds'); + } + + if (end < 0 || end > this.length) { + throw new Error('end out of bounds'); + } + + for (var i = start; i < end; i++) { + this[i] = value; + } +} + +// Static methods +Buffer.isBuffer = function isBuffer(b) { + return b instanceof Buffer || b instanceof Buffer; +}; + +Buffer.concat = function (list, totalLength) { + if (!isArray(list)) { + throw new Error("Usage: Buffer.concat(list, [totalLength])\n \ + list should be an Array."); + } + + if (list.length === 0) { + return new Buffer(0); + } else if (list.length === 1) { + return list[0]; + } + + if (typeof totalLength !== 'number') { + totalLength = 0; + for (var i = 0; i < list.length; i++) { + var buf = list[i]; + totalLength += buf.length; + } + } + + var buffer = new Buffer(totalLength); + var pos = 0; + for (var i = 0; i < list.length; i++) { + var buf = list[i]; + buf.copy(buffer, pos); + pos += buf.length; + } + return buffer; +}; + +Buffer.isEncoding = function(encoding) { + switch ((encoding + '').toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + case 'raw': + return true; + + default: + return false; + } +}; + +// helpers + +function coerce(length) { + // Coerce length to a number (possibly NaN), round up + // in case it's fractional (e.g. 123.456) then do a + // double negate to coerce a NaN to 0. Easy, right? + length = ~~Math.ceil(+length); + return length < 0 ? 0 : length; +} + +function isArray(subject) { + return (Array.isArray || + function(subject){ + return {}.toString.apply(subject) == '[object Array]' + }) + (subject) +} + +function isArrayIsh(subject) { + return isArray(subject) || Buffer.isBuffer(subject) || + subject && typeof subject === 'object' && + typeof subject.length === 'number'; +} + +function toHex(n) { + if (n < 16) return '0' + n.toString(16); + return n.toString(16); +} + +function utf8ToBytes(str) { + var byteArray = []; + for (var i = 0; i < str.length; i++) + if (str.charCodeAt(i) <= 0x7F) + byteArray.push(str.charCodeAt(i)); + else { + var h = encodeURIComponent(str.charAt(i)).substr(1).split('%'); + for (var j = 0; j < h.length; j++) + byteArray.push(parseInt(h[j], 16)); + } + + return byteArray; +} + +function asciiToBytes(str) { + var byteArray = [] + for (var i = 0; i < str.length; i++ ) + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push( str.charCodeAt(i) & 0xFF ); + + return byteArray; +} + +function base64ToBytes(str) { + return require("base64-js").toByteArray(str); +} + +function blitBuffer(src, dst, offset, length) { + var pos, i = 0; + while (i < length) { + if ((i+offset >= dst.length) || (i >= src.length)) + break; + + dst[i + offset] = src[i]; + i++; + } + return i; +} + +function decodeUtf8Char(str) { + try { + return decodeURIComponent(str); + } catch (err) { + return String.fromCharCode(0xFFFD); // UTF 8 invalid char + } +} + +// read/write bit-twiddling + +Buffer.prototype.readUInt8 = function(offset, noAssert) { + var buffer = this; + + if (!noAssert) { + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset < buffer.length, + 'Trying to read beyond buffer length'); + } + + if (offset >= buffer.length) return; + + return buffer[offset]; +}; + +function readUInt16(buffer, offset, isBigEndian, noAssert) { + var val = 0; + + + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 1 < buffer.length, + 'Trying to read beyond buffer length'); + } + + if (offset >= buffer.length) return 0; + + if (isBigEndian) { + val = buffer[offset] << 8; + if (offset + 1 < buffer.length) { + val |= buffer[offset + 1]; + } + } else { + val = buffer[offset]; + if (offset + 1 < buffer.length) { + val |= buffer[offset + 1] << 8; + } + } + + return val; +} + +Buffer.prototype.readUInt16LE = function(offset, noAssert) { + return readUInt16(this, offset, false, noAssert); +}; + +Buffer.prototype.readUInt16BE = function(offset, noAssert) { + return readUInt16(this, offset, true, noAssert); +}; + +function readUInt32(buffer, offset, isBigEndian, noAssert) { + var val = 0; + + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 3 < buffer.length, + 'Trying to read beyond buffer length'); + } + + if (offset >= buffer.length) return 0; + + if (isBigEndian) { + if (offset + 1 < buffer.length) + val = buffer[offset + 1] << 16; + if (offset + 2 < buffer.length) + val |= buffer[offset + 2] << 8; + if (offset + 3 < buffer.length) + val |= buffer[offset + 3]; + val = val + (buffer[offset] << 24 >>> 0); + } else { + if (offset + 2 < buffer.length) + val = buffer[offset + 2] << 16; + if (offset + 1 < buffer.length) + val |= buffer[offset + 1] << 8; + val |= buffer[offset]; + if (offset + 3 < buffer.length) + val = val + (buffer[offset + 3] << 24 >>> 0); + } + + return val; +} + +Buffer.prototype.readUInt32LE = function(offset, noAssert) { + return readUInt32(this, offset, false, noAssert); +}; + +Buffer.prototype.readUInt32BE = function(offset, noAssert) { + return readUInt32(this, offset, true, noAssert); +}; + + +/* + * Signed integer types, yay team! A reminder on how two's complement actually + * works. The first bit is the signed bit, i.e. tells us whether or not the + * number should be positive or negative. If the two's complement value is + * positive, then we're done, as it's equivalent to the unsigned representation. + * + * Now if the number is positive, you're pretty much done, you can just leverage + * the unsigned translations and return those. Unfortunately, negative numbers + * aren't quite that straightforward. + * + * At first glance, one might be inclined to use the traditional formula to + * translate binary numbers between the positive and negative values in two's + * complement. (Though it doesn't quite work for the most negative value) + * Mainly: + * - invert all the bits + * - add one to the result + * + * Of course, this doesn't quite work in Javascript. Take for example the value + * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of + * course, Javascript will do the following: + * + * > ~0xff80 + * -65409 + * + * Whoh there, Javascript, that's not quite right. But wait, according to + * Javascript that's perfectly correct. When Javascript ends up seeing the + * constant 0xff80, it has no notion that it is actually a signed number. It + * assumes that we've input the unsigned value 0xff80. Thus, when it does the + * binary negation, it casts it into a signed value, (positive 0xff80). Then + * when you perform binary negation on that, it turns it into a negative number. + * + * Instead, we're going to have to use the following general formula, that works + * in a rather Javascript friendly way. I'm glad we don't support this kind of + * weird numbering scheme in the kernel. + * + * (BIT-MAX - (unsigned)val + 1) * -1 + * + * The astute observer, may think that this doesn't make sense for 8-bit numbers + * (really it isn't necessary for them). However, when you get 16-bit numbers, + * you do. Let's go back to our prior example and see how this will look: + * + * (0xffff - 0xff80 + 1) * -1 + * (0x007f + 1) * -1 + * (0x0080) * -1 + */ +Buffer.prototype.readInt8 = function(offset, noAssert) { + var buffer = this; + var neg; + + if (!noAssert) { + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset < buffer.length, + 'Trying to read beyond buffer length'); + } + + if (offset >= buffer.length) return; + + neg = buffer[offset] & 0x80; + if (!neg) { + return (buffer[offset]); + } + + return ((0xff - buffer[offset] + 1) * -1); +}; + +function readInt16(buffer, offset, isBigEndian, noAssert) { + var neg, val; + + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 1 < buffer.length, + 'Trying to read beyond buffer length'); + } + + val = readUInt16(buffer, offset, isBigEndian, noAssert); + neg = val & 0x8000; + if (!neg) { + return val; + } + + return (0xffff - val + 1) * -1; +} + +Buffer.prototype.readInt16LE = function(offset, noAssert) { + return readInt16(this, offset, false, noAssert); +}; + +Buffer.prototype.readInt16BE = function(offset, noAssert) { + return readInt16(this, offset, true, noAssert); +}; + +function readInt32(buffer, offset, isBigEndian, noAssert) { + var neg, val; + + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 3 < buffer.length, + 'Trying to read beyond buffer length'); + } + + val = readUInt32(buffer, offset, isBigEndian, noAssert); + neg = val & 0x80000000; + if (!neg) { + return (val); + } + + return (0xffffffff - val + 1) * -1; +} + +Buffer.prototype.readInt32LE = function(offset, noAssert) { + return readInt32(this, offset, false, noAssert); +}; + +Buffer.prototype.readInt32BE = function(offset, noAssert) { + return readInt32(this, offset, true, noAssert); +}; + +function readFloat(buffer, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset + 3 < buffer.length, + 'Trying to read beyond buffer length'); + } + + return require('./buffer_ieee754').readIEEE754(buffer, offset, isBigEndian, + 23, 4); +} + +Buffer.prototype.readFloatLE = function(offset, noAssert) { + return readFloat(this, offset, false, noAssert); +}; + +Buffer.prototype.readFloatBE = function(offset, noAssert) { + return readFloat(this, offset, true, noAssert); +}; + +function readDouble(buffer, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset + 7 < buffer.length, + 'Trying to read beyond buffer length'); + } + + return require('./buffer_ieee754').readIEEE754(buffer, offset, isBigEndian, + 52, 8); +} + +Buffer.prototype.readDoubleLE = function(offset, noAssert) { + return readDouble(this, offset, false, noAssert); +}; + +Buffer.prototype.readDoubleBE = function(offset, noAssert) { + return readDouble(this, offset, true, noAssert); +}; + + +/* + * We have to make sure that the value is a valid integer. This means that it is + * non-negative. It has no fractional component and that it does not exceed the + * maximum allowed value. + * + * value The number to check for validity + * + * max The maximum value + */ +function verifuint(value, max) { + assert.ok(typeof (value) == 'number', + 'cannot write a non-number as a number'); + + assert.ok(value >= 0, + 'specified a negative value for writing an unsigned value'); + + assert.ok(value <= max, 'value is larger than maximum value for type'); + + assert.ok(Math.floor(value) === value, 'value has a fractional component'); +} + +Buffer.prototype.writeUInt8 = function(value, offset, noAssert) { + var buffer = this; + + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset < buffer.length, + 'trying to write beyond buffer length'); + + verifuint(value, 0xff); + } + + if (offset < buffer.length) { + buffer[offset] = value; + } +}; + +function writeUInt16(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 1 < buffer.length, + 'trying to write beyond buffer length'); + + verifuint(value, 0xffff); + } + + for (var i = 0; i < Math.min(buffer.length - offset, 2); i++) { + buffer[offset + i] = + (value & (0xff << (8 * (isBigEndian ? 1 - i : i)))) >>> + (isBigEndian ? 1 - i : i) * 8; + } + +} + +Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) { + writeUInt16(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) { + writeUInt16(this, value, offset, true, noAssert); +}; + +function writeUInt32(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 3 < buffer.length, + 'trying to write beyond buffer length'); + + verifuint(value, 0xffffffff); + } + + for (var i = 0; i < Math.min(buffer.length - offset, 4); i++) { + buffer[offset + i] = + (value >>> (isBigEndian ? 3 - i : i) * 8) & 0xff; + } +} + +Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) { + writeUInt32(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) { + writeUInt32(this, value, offset, true, noAssert); +}; + + +/* + * We now move onto our friends in the signed number category. Unlike unsigned + * numbers, we're going to have to worry a bit more about how we put values into + * arrays. Since we are only worrying about signed 32-bit values, we're in + * slightly better shape. Unfortunately, we really can't do our favorite binary + * & in this system. It really seems to do the wrong thing. For example: + * + * > -32 & 0xff + * 224 + * + * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of + * this aren't treated as a signed number. Ultimately a bad thing. + * + * What we're going to want to do is basically create the unsigned equivalent of + * our representation and pass that off to the wuint* functions. To do that + * we're going to do the following: + * + * - if the value is positive + * we can pass it directly off to the equivalent wuint + * - if the value is negative + * we do the following computation: + * mb + val + 1, where + * mb is the maximum unsigned value in that byte size + * val is the Javascript negative integer + * + * + * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If + * you do out the computations: + * + * 0xffff - 128 + 1 + * 0xffff - 127 + * 0xff80 + * + * You can then encode this value as the signed version. This is really rather + * hacky, but it should work and get the job done which is our goal here. + */ + +/* + * A series of checks to make sure we actually have a signed 32-bit number + */ +function verifsint(value, max, min) { + assert.ok(typeof (value) == 'number', + 'cannot write a non-number as a number'); + + assert.ok(value <= max, 'value larger than maximum allowed value'); + + assert.ok(value >= min, 'value smaller than minimum allowed value'); + + assert.ok(Math.floor(value) === value, 'value has a fractional component'); +} + +function verifIEEE754(value, max, min) { + assert.ok(typeof (value) == 'number', + 'cannot write a non-number as a number'); + + assert.ok(value <= max, 'value larger than maximum allowed value'); + + assert.ok(value >= min, 'value smaller than minimum allowed value'); +} + +Buffer.prototype.writeInt8 = function(value, offset, noAssert) { + var buffer = this; + + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset < buffer.length, + 'Trying to write beyond buffer length'); + + verifsint(value, 0x7f, -0x80); + } + + if (value >= 0) { + buffer.writeUInt8(value, offset, noAssert); + } else { + buffer.writeUInt8(0xff + value + 1, offset, noAssert); + } +}; + +function writeInt16(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 1 < buffer.length, + 'Trying to write beyond buffer length'); + + verifsint(value, 0x7fff, -0x8000); + } + + if (value >= 0) { + writeUInt16(buffer, value, offset, isBigEndian, noAssert); + } else { + writeUInt16(buffer, 0xffff + value + 1, offset, isBigEndian, noAssert); + } +} + +Buffer.prototype.writeInt16LE = function(value, offset, noAssert) { + writeInt16(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeInt16BE = function(value, offset, noAssert) { + writeInt16(this, value, offset, true, noAssert); +}; + +function writeInt32(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 3 < buffer.length, + 'Trying to write beyond buffer length'); + + verifsint(value, 0x7fffffff, -0x80000000); + } + + if (value >= 0) { + writeUInt32(buffer, value, offset, isBigEndian, noAssert); + } else { + writeUInt32(buffer, 0xffffffff + value + 1, offset, isBigEndian, noAssert); + } +} + +Buffer.prototype.writeInt32LE = function(value, offset, noAssert) { + writeInt32(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeInt32BE = function(value, offset, noAssert) { + writeInt32(this, value, offset, true, noAssert); +}; + +function writeFloat(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 3 < buffer.length, + 'Trying to write beyond buffer length'); + + verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38); + } + + require('./buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian, + 23, 4); +} + +Buffer.prototype.writeFloatLE = function(value, offset, noAssert) { + writeFloat(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeFloatBE = function(value, offset, noAssert) { + writeFloat(this, value, offset, true, noAssert); +}; + +function writeDouble(buffer, value, offset, isBigEndian, noAssert) { + if (!noAssert) { + assert.ok(value !== undefined && value !== null, + 'missing value'); + + assert.ok(typeof (isBigEndian) === 'boolean', + 'missing or invalid endian'); + + assert.ok(offset !== undefined && offset !== null, + 'missing offset'); + + assert.ok(offset + 7 < buffer.length, + 'Trying to write beyond buffer length'); + + verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308); + } + + require('./buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian, + 52, 8); +} + +Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) { + writeDouble(this, value, offset, false, noAssert); +}; + +Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) { + writeDouble(this, value, offset, true, noAssert); +}; + +},{"./buffer_ieee754":1,"assert":6,"base64-js":4}],"buffer-browserify":[function(require,module,exports){ +module.exports=require('q9TxCC'); +},{}],4:[function(require,module,exports){ +(function (exports) { + 'use strict'; + + var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + + function b64ToByteArray(b64) { + var i, j, l, tmp, placeHolders, arr; + + if (b64.length % 4 > 0) { + throw 'Invalid string. Length must be a multiple of 4'; + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + placeHolders = b64.indexOf('='); + placeHolders = placeHolders > 0 ? b64.length - placeHolders : 0; + + // base64 is 4/3 + up to two characters of the original data + arr = [];//new Uint8Array(b64.length * 3 / 4 - placeHolders); + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? b64.length - 4 : b64.length; + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (lookup.indexOf(b64[i]) << 18) | (lookup.indexOf(b64[i + 1]) << 12) | (lookup.indexOf(b64[i + 2]) << 6) | lookup.indexOf(b64[i + 3]); + arr.push((tmp & 0xFF0000) >> 16); + arr.push((tmp & 0xFF00) >> 8); + arr.push(tmp & 0xFF); + } + + if (placeHolders === 2) { + tmp = (lookup.indexOf(b64[i]) << 2) | (lookup.indexOf(b64[i + 1]) >> 4); + arr.push(tmp & 0xFF); + } else if (placeHolders === 1) { + tmp = (lookup.indexOf(b64[i]) << 10) | (lookup.indexOf(b64[i + 1]) << 4) | (lookup.indexOf(b64[i + 2]) >> 2); + arr.push((tmp >> 8) & 0xFF); + arr.push(tmp & 0xFF); + } + + return arr; + } + + function uint8ToBase64(uint8) { + var i, + extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes + output = "", + temp, length; + + function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; + }; + + // go through the array every three bytes, we'll deal with trailing stuff later + for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { + temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]); + output += tripletToBase64(temp); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + switch (extraBytes) { + case 1: + temp = uint8[uint8.length - 1]; + output += lookup[temp >> 2]; + output += lookup[(temp << 4) & 0x3F]; + output += '=='; + break; + case 2: + temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]); + output += lookup[temp >> 10]; + output += lookup[(temp >> 4) & 0x3F]; + output += lookup[(temp << 2) & 0x3F]; + output += '='; + break; + } + + return output; + } + + module.exports.toByteArray = b64ToByteArray; + module.exports.fromByteArray = uint8ToBase64; +}()); + +},{}],5:[function(require,module,exports){ + + +// +// The shims in this file are not fully implemented shims for the ES5 +// features, but do work for the particular usecases there is in +// the other modules. +// + +var toString = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; + +// Array.isArray is supported in IE9 +function isArray(xs) { + return toString.call(xs) === '[object Array]'; +} +exports.isArray = typeof Array.isArray === 'function' ? Array.isArray : isArray; + +// Array.prototype.indexOf is supported in IE9 +exports.indexOf = function indexOf(xs, x) { + if (xs.indexOf) return xs.indexOf(x); + for (var i = 0; i < xs.length; i++) { + if (x === xs[i]) return i; + } + return -1; +}; + +// Array.prototype.filter is supported in IE9 +exports.filter = function filter(xs, fn) { + if (xs.filter) return xs.filter(fn); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (fn(xs[i], i, xs)) res.push(xs[i]); + } + return res; +}; + +// Array.prototype.forEach is supported in IE9 +exports.forEach = function forEach(xs, fn, self) { + if (xs.forEach) return xs.forEach(fn, self); + for (var i = 0; i < xs.length; i++) { + fn.call(self, xs[i], i, xs); + } +}; + +// Array.prototype.map is supported in IE9 +exports.map = function map(xs, fn) { + if (xs.map) return xs.map(fn); + var out = new Array(xs.length); + for (var i = 0; i < xs.length; i++) { + out[i] = fn(xs[i], i, xs); + } + return out; +}; + +// Array.prototype.reduce is supported in IE9 +exports.reduce = function reduce(array, callback, opt_initialValue) { + if (array.reduce) return array.reduce(callback, opt_initialValue); + var value, isValueSet = false; + + if (2 < arguments.length) { + value = opt_initialValue; + isValueSet = true; + } + for (var i = 0, l = array.length; l > i; ++i) { + if (array.hasOwnProperty(i)) { + if (isValueSet) { + value = callback(value, array[i], i, array); + } + else { + value = array[i]; + isValueSet = true; + } + } + } + + return value; +}; + +// String.prototype.substr - negative index don't work in IE8 +if ('ab'.substr(-1) !== 'b') { + exports.substr = function (str, start, length) { + // did we get a negative start, calculate how much it is from the beginning of the string + if (start < 0) start = str.length + start; + + // call the original function + return str.substr(start, length); + }; +} else { + exports.substr = function (str, start, length) { + return str.substr(start, length); + }; +} + +// String.prototype.trim is supported in IE9 +exports.trim = function (str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +}; + +// Function.prototype.bind is supported in IE9 +exports.bind = function () { + var args = Array.prototype.slice.call(arguments); + var fn = args.shift(); + if (fn.bind) return fn.bind.apply(fn, args); + var self = args.shift(); + return function () { + fn.apply(self, args.concat([Array.prototype.slice.call(arguments)])); + }; +}; + +// Object.create is supported in IE9 +function create(prototype, properties) { + var object; + if (prototype === null) { + object = { '__proto__' : null }; + } + else { + if (typeof prototype !== 'object') { + throw new TypeError( + 'typeof prototype[' + (typeof prototype) + '] != \'object\'' + ); + } + var Type = function () {}; + Type.prototype = prototype; + object = new Type(); + object.__proto__ = prototype; + } + if (typeof properties !== 'undefined' && Object.defineProperties) { + Object.defineProperties(object, properties); + } + return object; +} +exports.create = typeof Object.create === 'function' ? Object.create : create; + +// Object.keys and Object.getOwnPropertyNames is supported in IE9 however +// they do show a description and number property on Error objects +function notObject(object) { + return ((typeof object != "object" && typeof object != "function") || object === null); +} + +function keysShim(object) { + if (notObject(object)) { + throw new TypeError("Object.keys called on a non-object"); + } + + var result = []; + for (var name in object) { + if (hasOwnProperty.call(object, name)) { + result.push(name); + } + } + return result; +} + +// getOwnPropertyNames is almost the same as Object.keys one key feature +// is that it returns hidden properties, since that can't be implemented, +// this feature gets reduced so it just shows the length property on arrays +function propertyShim(object) { + if (notObject(object)) { + throw new TypeError("Object.getOwnPropertyNames called on a non-object"); + } + + var result = keysShim(object); + if (exports.isArray(object) && exports.indexOf(object, 'length') === -1) { + result.push('length'); + } + return result; +} + +var keys = typeof Object.keys === 'function' ? Object.keys : keysShim; +var getOwnPropertyNames = typeof Object.getOwnPropertyNames === 'function' ? + Object.getOwnPropertyNames : propertyShim; + +if (new Error().hasOwnProperty('description')) { + var ERROR_PROPERTY_FILTER = function (obj, array) { + if (toString.call(obj) === '[object Error]') { + array = exports.filter(array, function (name) { + return name !== 'description' && name !== 'number' && name !== 'message'; + }); + } + return array; + }; + + exports.keys = function (object) { + return ERROR_PROPERTY_FILTER(object, keys(object)); + }; + exports.getOwnPropertyNames = function (object) { + return ERROR_PROPERTY_FILTER(object, getOwnPropertyNames(object)); + }; +} else { + exports.keys = keys; + exports.getOwnPropertyNames = getOwnPropertyNames; +} + +// Object.getOwnPropertyDescriptor - supported in IE8 but only on dom elements +function valueObject(value, key) { + return { value: value[key] }; +} + +if (typeof Object.getOwnPropertyDescriptor === 'function') { + try { + Object.getOwnPropertyDescriptor({'a': 1}, 'a'); + exports.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + } catch (e) { + // IE8 dom element issue - use a try catch and default to valueObject + exports.getOwnPropertyDescriptor = function (value, key) { + try { + return Object.getOwnPropertyDescriptor(value, key); + } catch (e) { + return valueObject(value, key); + } + }; + } +} else { + exports.getOwnPropertyDescriptor = valueObject; +} + +},{}],6:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// UTILITY +var util = require('util'); +var shims = require('_shims'); +var pSlice = Array.prototype.slice; + +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({ message: message, +// actual: actual, +// expected: expected }) + +assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + this.message = options.message || getMessage(this); +}; + +// assert.AssertionError instanceof Error +util.inherits(assert.AssertionError, Error); + +function replacer(key, value) { + if (util.isUndefined(value)) { + return '' + value; + } + if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { + return value.toString(); + } + if (util.isFunction(value) || util.isRegExp(value)) { + return value.toString(); + } + return value; +} + +function truncate(s, n) { + if (util.isString(s)) { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } +} + +function getMessage(self) { + return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + + self.operator + ' ' + + truncate(JSON.stringify(self.expected, replacer), 128); +} + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, !!guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); +} +assert.ok = ok; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } +}; + +function _deepEqual(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (util.isBuffer(actual) && util.isBuffer(expected)) { + if (actual.length != expected.length) return false; + + for (var i = 0; i < actual.length; i++) { + if (actual[i] !== expected[i]) return false; + } + + return true; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (!util.isObject(actual) && !util.isObject(expected)) { + return actual == expected; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv(a, b) { + if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b); + } + try { + var ka = shims.keys(a), + kb = shims.keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key])) return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } +}; + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as +// determined by !==. assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } else if (actual instanceof expected) { + return true; + } else if (expected.call({}, actual) === true) { + return true; + } + + return false; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (util.isString(expected)) { + message = expected; + expected = null; + } + + try { + block(); + } catch (e) { + actual = e; + } + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + if (!shouldThrow && expectedException(actual, expected)) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [true].concat(pSlice.call(arguments))); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/message) { + _throws.apply(this, [false].concat(pSlice.call(arguments))); +}; + +assert.ifError = function(err) { if (err) {throw err;}}; +},{"_shims":5,"util":7}],7:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var shims = require('_shims'); + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + shims.forEach(array, function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = shims.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = shims.getOwnPropertyNames(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + + shims.forEach(keys, function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = shims.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (shims.indexOf(ctx.seen, desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = shims.reduce(output, function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return shims.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && objectToString(e) === '[object Error]'; +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +function isBuffer(arg) { + return arg instanceof Buffer; +} +exports.isBuffer = isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = shims.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +}; + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = shims.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +},{"_shims":5}]},{},[]) +;;module.exports=require("buffer-browserify") + +},{}],5:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -262,8 +3406,9 @@ process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; -},{}],4:[function(require,module,exports){ -(function(){/* +},{}],6:[function(require,module,exports){ +/* + Copyright (C) 2013 Ariya Hidayat Copyright (C) 2013 Thaddee Tyl Copyright (C) 2012 Ariya Hidayat Copyright (C) 2012 Mathias Bynens @@ -409,15 +3554,14 @@ parseYieldExpression: true DoWhileStatement: 'DoWhileStatement', EmptyStatement: 'EmptyStatement', ExportDeclaration: 'ExportDeclaration', + ExportBatchSpecifier: 'ExportBatchSpecifier', ExportSpecifier: 'ExportSpecifier', - ExportSpecifierSet: 'ExportSpecifierSet', ExpressionStatement: 'ExpressionStatement', ForInStatement: 'ForInStatement', ForOfStatement: 'ForOfStatement', ForStatement: 'ForStatement', FunctionDeclaration: 'FunctionDeclaration', FunctionExpression: 'FunctionExpression', - Glob: 'Glob', Identifier: 'Identifier', IfStatement: 'IfStatement', ImportDeclaration: 'ImportDeclaration', @@ -431,7 +3575,6 @@ parseYieldExpression: true NewExpression: 'NewExpression', ObjectExpression: 'ObjectExpression', ObjectPattern: 'ObjectPattern', - Path: 'Path', Program: 'Program', Property: 'Property', ReturnStatement: 'ReturnStatement', @@ -445,6 +3588,8 @@ parseYieldExpression: true ThisExpression: 'ThisExpression', ThrowStatement: 'ThrowStatement', TryStatement: 'TryStatement', + TypeAnnotatedIdentifier: 'TypeAnnotatedIdentifier', + TypeAnnotation: 'TypeAnnotation', UnaryExpression: 'UnaryExpression', UpdateExpression: 'UpdateExpression', VariableDeclaration: 'VariableDeclaration', @@ -504,6 +3649,7 @@ parseYieldExpression: true StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', StrictParamDupe: 'Strict mode function may not have duplicate parameter names', ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list', + DefaultRestParameter: 'Rest parameter can not have a default value', ElementAfterSpreadElement: 'Spread must be the final element of an element list', ObjectPatternAsRestParameter: 'Invalid rest parameter', ObjectPatternAsSpread: 'Invalid spread argument', @@ -517,7 +3663,10 @@ parseYieldExpression: true StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', StrictReservedWord: 'Use of future reserved word in strict mode', + NewlineAfterModule: 'Illegal newline after module', NoFromAfterImport: 'Missing from after import', + InvalidModuleSpecifier: 'Invalid module specifier', + NestedModule: 'Module declaration can not be nested', NoYieldInGenerator: 'Missing yield in generator', NoUnintializedConst: 'Const must be initialized', ComprehensionRequiresBlock: 'Comprehension must have at least one block', @@ -1476,6 +4625,7 @@ parseYieldExpression: true if (ch === '\r' && source[index] === '\n') { ++index; } + cooked += '\n'; } else { cooked += ch; } @@ -1945,12 +5095,14 @@ parseYieldExpression: true }; }, - createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression) { + createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression, + returnTypeAnnotation) { return { type: Syntax.FunctionDeclaration, id: id, params: params, defaults: defaults, + returnType: returnTypeAnnotation, body: body, rest: rest, generator: generator, @@ -1958,12 +5110,14 @@ parseYieldExpression: true }; }, - createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) { + createFunctionExpression: function (id, params, defaults, body, rest, generator, expression, + returnTypeAnnotation) { return { type: Syntax.FunctionExpression, id: id, params: params, defaults: defaults, + returnType: returnTypeAnnotation, body: body, rest: rest, generator: generator, @@ -1978,6 +5132,28 @@ parseYieldExpression: true }; }, + createTypeAnnotatedIdentifier: function (annotation, identifier) { + return { + type: Syntax.TypeAnnotatedIdentifier, + annotation: annotation, + identifier: identifier + }; + }, + + createTypeAnnotation: function (annotatedType, templateTypes, + paramTypes, returnType, unionType, + nullable) { + return { + type: Syntax.TypeAnnotation, + annotatedType: annotatedType, + templateTypes: templateTypes, + paramTypes: paramTypes, + returnType: returnType, + unionType: unionType, + nullable: nullable + }; + }, + createXJSAttribute: function (name, value) { return { type: Syntax.XJSAttribute, @@ -2291,55 +5467,44 @@ parseYieldExpression: true }; }, - createPath: function (body) { - return { - type: Syntax.Path, - body: body - }; - }, - - createGlob: function () { - return { - type: Syntax.Glob - }; - }, - - createExportSpecifier: function (id, from) { + createExportSpecifier: function (id, name) { return { type: Syntax.ExportSpecifier, id: id, - from: from + name: name }; }, - createExportSpecifierSet: function (specifiers) { + createExportBatchSpecifier: function () { return { - type: Syntax.ExportSpecifierSet, - specifiers: specifiers + type: Syntax.ExportBatchSpecifier }; }, - createExportDeclaration: function (declaration, specifiers) { + createExportDeclaration: function (def, declaration, specifiers, source) { return { type: Syntax.ExportDeclaration, declaration: declaration, - specifiers: specifiers + default: def, + specifiers: specifiers, + source: source }; }, - createImportSpecifier: function (id, from) { + createImportSpecifier: function (id, name) { return { type: Syntax.ImportSpecifier, id: id, - from: from + name: name }; }, - createImportDeclaration: function (specifiers, from) { + createImportDeclaration: function (specifiers, kind, source) { return { type: Syntax.ImportDeclaration, specifiers: specifiers, - from: from + kind: kind, + source: source }; }, @@ -2351,11 +5516,11 @@ parseYieldExpression: true }; }, - createModuleDeclaration: function (id, from, body) { + createModuleDeclaration: function (id, source, body) { return { type: Syntax.ModuleDeclaration, id: id, - from: from, + source: source, body: body }; } @@ -2627,24 +5792,26 @@ parseYieldExpression: true // 11.1.5 Object Initialiser function parsePropertyFunction(options) { - var previousStrict, previousYieldAllowed, params, body; + var previousStrict, previousYieldAllowed, params, defaults, body; previousStrict = strict; previousYieldAllowed = state.yieldAllowed; state.yieldAllowed = options.generator; params = options.params || []; + defaults = options.defaults || []; body = parseConciseBody(); if (options.name && strict && isRestrictedWord(params[0].name)) { throwErrorTolerant(options.name, Messages.StrictParamName); } if (state.yieldAllowed && !state.yieldFound) { - throwError({}, Messages.NoYieldInGenerator); + throwErrorTolerant({}, Messages.NoYieldInGenerator); } strict = previousStrict; state.yieldAllowed = previousYieldAllowed; - return delegate.createFunctionExpression(null, params, [], body, options.rest || null, options.generator, body.type !== Syntax.BlockStatement); + return delegate.createFunctionExpression(null, params, defaults, body, options.rest || null, options.generator, body.type !== Syntax.BlockStatement, + options.returnTypeAnnotation); } @@ -2663,8 +5830,10 @@ parseYieldExpression: true method = parsePropertyFunction({ params: tmp.params, + defaults: tmp.defaults, rest: tmp.rest, - generator: options.generator + generator: options.generator, + returnTypeAnnotation: tmp.returnTypeAnnotation }); strict = previousStrict; @@ -3320,9 +6489,11 @@ parseYieldExpression: true } function reinterpretAsCoverFormalsList(expressions) { - var i, len, param, params, options, rest; + var i, len, param, params, defaults, defaultCount, options, rest; params = []; + defaults = []; + defaultCount = 0; rest = null; options = { paramSet: {} @@ -3332,14 +6503,20 @@ parseYieldExpression: true param = expressions[i]; if (param.type === Syntax.Identifier) { params.push(param); + defaults.push(null); validateParam(options, param, param.name); } else if (param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression) { reinterpretAsDestructuredParameter(options, param); params.push(param); + defaults.push(null); } else if (param.type === Syntax.SpreadElement) { assert(i === len - 1, "It is guaranteed that SpreadElement is last element by parseExpression"); reinterpretAsDestructuredParameter(options, param.argument); rest = param.argument; + } else if (param.type === Syntax.AssignmentExpression) { + params.push(param.left); + defaults.push(param.right); + ++defaultCount; } else { return null; } @@ -3352,7 +6529,11 @@ parseYieldExpression: true throwErrorTolerant(options.stricted, options.message); } - return { params: params, rest: rest }; + if (defaultCount === 0) { + defaults = []; + } + + return { params: params, defaults: defaults, rest: rest }; } function parseArrowFunctionExpression(options) { @@ -3368,7 +6549,7 @@ parseYieldExpression: true strict = previousStrict; state.yieldAllowed = previousYieldAllowed; - return delegate.createArrowFunctionExpression(options.params, [], body, options.rest, body.type !== Syntax.BlockStatement); + return delegate.createArrowFunctionExpression(options.params, options.defaults, body, options.rest, body.type !== Syntax.BlockStatement); } function parseAssignmentExpression() { @@ -3399,7 +6580,7 @@ parseYieldExpression: true if (isRestrictedWord(expr.name)) { throwError({}, Messages.StrictParamName); } - return parseArrowFunctionExpression({ params: [ expr ], rest: null }); + return parseArrowFunctionExpression({ params: [ expr ], defaults: [], rest: null }); } } @@ -3519,6 +6700,100 @@ parseYieldExpression: true return delegate.createIdentifier(token.value); } + function parseTypeAnnotation() { + var isNullable = false, paramTypes = null, returnType = null, + templateTypes = null, type, unionType = null; + + if (match('?')) { + lex(); + isNullable = true; + } + + type = parseVariableIdentifier(); + + if (match('<')) { + lex(); + templateTypes = []; + while (lookahead.type === Token.Identifier || match('?')) { + templateTypes.push(parseTypeAnnotation()); + if (!match('>')) { + expect(','); + } + } + expect('>'); + } + + if (match('(')) { + lex(); + paramTypes = []; + while (lookahead.type === Token.Identifier || match('?')) { + paramTypes.push(parseTypeAnnotation()); + if (!match(')')) { + expect(','); + } + } + expect(')'); + + if (match(':')) { + lex(); + returnType = parseTypeAnnotation(); + } + } + + if (match('|')) { + lex(); + unionType = parseTypeAnnotation(); + } + + return delegate.createTypeAnnotation( + type, + templateTypes, + paramTypes, + returnType, + unionType, + isNullable + ); + } + + function parseAnnotatableIdentifier() { + var annotation, annotationLookahead, annotationPresent, identifier, + matchesNullableToken; + + matchesNullableToken = match('?'); + + if (lookahead.type !== Token.Identifier && !matchesNullableToken) { + throwUnexpected(lookahead); + } + + if (!matchesNullableToken) { + annotationLookahead = lookahead2(); + } + + annotationPresent = + matchesNullableToken + + // function (number numVal) {} + || annotationLookahead.type === Token.Identifier + + // function (fn(number)|array param) {} + || (annotationLookahead.type === Token.Punctuator + && (annotationLookahead.value === '(' + || annotationLookahead.value === '<' + || annotationLookahead.value === '|')); + + if (!annotationPresent) { + return parseVariableIdentifier(); + } + + annotation = parseTypeAnnotation(); + identifier = parseVariableIdentifier(); + + return delegate.createTypeAnnotatedIdentifier( + annotation, + identifier + ); + } + function parseVariableDeclaration(kind) { var id, init = null; @@ -3529,7 +6804,11 @@ parseYieldExpression: true id = parseArrayInitialiser(); reinterpretAsAssignmentBindingPattern(id); } else { - id = parseVariableIdentifier(); + if (state.allowDefault) { + id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); + } else { + id = parseVariableIdentifier(); + } // 12.2.1 if (strict && isRestrictedWord(id.name)) { throwErrorTolerant({}, Messages.StrictVarName); @@ -3594,182 +6873,179 @@ parseYieldExpression: true // http://wiki.ecmascript.org/doku.php?id=harmony:modules - function parsePath() { - var body = []; + function parseModuleDeclaration() { + var id, src, body; - while (true) { - body.push(parseVariableIdentifier()); - if (!match('.')) { - break; + lex(); // 'module' + + if (peekLineTerminator()) { + throwError({}, Messages.NewlineAfterModule); + } + + switch (lookahead.type) { + + case Token.StringLiteral: + id = parsePrimaryExpression(); + body = parseModuleBlock(); + src = null; + break; + + case Token.Identifier: + id = parseVariableIdentifier(); + body = null; + if (!matchContextualKeyword('from')) { + throwUnexpected(lex()); } lex(); - } - - return delegate.createPath(body); - } - - function parseGlob() { - expect('*'); - return delegate.createGlob(); - } - - function parseModuleDeclaration() { - var id, token, from = null; - - lex(); - - id = parseVariableIdentifier(); - - if (match('{')) { - return delegate.createModuleDeclaration(id, from, parseModuleBlock()); - } - - expect('='); - - token = lookahead; - if (token.type === Token.StringLiteral) { - from = parsePrimaryExpression(); - } else { - from = parsePath(); + src = parsePrimaryExpression(); + if (src.type !== Syntax.Literal) { + throwError({}, Messages.InvalidModuleSpecifier); + } + break; } consumeSemicolon(); - - return delegate.createModuleDeclaration(id, from, null); + return delegate.createModuleDeclaration(id, src, body); } - function parseExportSpecifierSetProperty() { - var id, from = null; - - id = parseVariableIdentifier(); - - if (match(':')) { - lex(); - from = parsePath(); - } - - return delegate.createExportSpecifier(id, from); + function parseExportBatchSpecifier() { + expect('*'); + return delegate.createExportBatchSpecifier(); } function parseExportSpecifier() { - var specifiers, id, from; + var id, name = null; - if (match('{')) { + id = parseVariableIdentifier(); + if (matchContextualKeyword('as')) { lex(); - specifiers = []; - - do { - specifiers.push(parseExportSpecifierSetProperty()); - } while (match(',') && lex()); - - expect('}'); - - return delegate.createExportSpecifierSet(specifiers); + name = parseNonComputedProperty(); } - from = null; - - if (match('*')) { - id = parseGlob(); - if (matchContextualKeyword('from')) { - lex(); - from = parsePath(); - } - } else { - id = parseVariableIdentifier(); - } - return delegate.createExportSpecifier(id, from); + return delegate.createExportSpecifier(id, name); } function parseExportDeclaration() { - var token, specifiers; + var previousAllowDefault, decl, def, src, specifiers; expectKeyword('export'); - token = lookahead; + if (matchKeyword('default')) { + lex(); + if (match('=')) { + lex(); + def = parseAssignmentExpression(); + } else if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { + case 'let': + case 'const': + case 'var': + case 'class': + def = parseSourceElement(); + break; + case 'function': + def = parseFunctionExpression(); + break; + default: + throwUnexpected(lex()); + } + } else { + def = parseAssignmentExpression(); + } + consumeSemicolon(); + return delegate.createExportDeclaration(true, def, null, null); + } - if (token.type === Token.Keyword || (token.type === Token.Identifier && token.value === 'module')) { - switch (token.value) { - case 'function': - return delegate.createExportDeclaration(parseFunctionDeclaration(), null); - case 'module': - return delegate.createExportDeclaration(parseModuleDeclaration(), null); + if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { case 'let': case 'const': - return delegate.createExportDeclaration(parseConstLetDeclaration(token.value), null); case 'var': - return delegate.createExportDeclaration(parseStatement(), null); case 'class': - return delegate.createExportDeclaration(parseClassDeclaration(), null); + case 'function': + previousAllowDefault = state.allowDefault; + state.allowDefault = true; + decl = delegate.createExportDeclaration(false, parseSourceElement(), null, null); + state.allowDefault = previousAllowDefault; + return decl; } throwUnexpected(lex()); } - specifiers = [ parseExportSpecifier() ]; - if (match(',')) { - while (index < length) { - if (!match(',')) { - break; - } - lex(); + specifiers = []; + src = null; + + if (match('*')) { + specifiers.push(parseExportBatchSpecifier()); + } else { + expect('{'); + do { specifiers.push(parseExportSpecifier()); + } while (match(',') && lex()); + expect('}'); + } + + if (matchContextualKeyword('from')) { + lex(); + src = parsePrimaryExpression(); + if (src.type !== Syntax.Literal) { + throwError({}, Messages.InvalidModuleSpecifier); } } consumeSemicolon(); - return delegate.createExportDeclaration(null, specifiers); + return delegate.createExportDeclaration(false, null, specifiers, src); } function parseImportDeclaration() { - var specifiers, from; + var specifiers, kind, src; expectKeyword('import'); + specifiers = []; - if (match('*')) { - specifiers = [parseGlob()]; + if (isIdentifierName(lookahead)) { + kind = 'default'; + specifiers.push(parseImportSpecifier()); + + if (!matchContextualKeyword('from')) { + throwError({}, Messages.NoFromAfterImport); + } + lex(); } else if (match('{')) { + kind = 'named'; lex(); - specifiers = []; - do { specifiers.push(parseImportSpecifier()); } while (match(',') && lex()); - expect('}'); - } else { - specifiers = [parseVariableIdentifier()]; + + if (!matchContextualKeyword('from')) { + throwError({}, Messages.NoFromAfterImport); + } + lex(); } - if (!matchContextualKeyword('from')) { - throwError({}, Messages.NoFromAfterImport); - } - - lex(); - - if (lookahead.type === Token.StringLiteral) { - from = parsePrimaryExpression(); - } else { - from = parsePath(); + src = parsePrimaryExpression(); + if (src.type !== Syntax.Literal) { + throwError({}, Messages.InvalidModuleSpecifier); } consumeSemicolon(); - return delegate.createImportDeclaration(specifiers, from); + return delegate.createImportDeclaration(specifiers, kind, src); } function parseImportSpecifier() { - var id, from; + var id, name = null; - id = parseVariableIdentifier(); - from = null; - - if (match(':')) { + id = parseNonComputedProperty(); + if (matchContextualKeyword('as')) { lex(); - from = parsePath(); + name = parseVariableIdentifier(); } - return delegate.createImportSpecifier(id, from); + return delegate.createImportSpecifier(id, name); } // 12.3 Empty Statement @@ -4148,13 +7424,13 @@ parseYieldExpression: true expect('{'); + cases = []; + if (match('}')) { lex(); - return delegate.createSwitchStatement(discriminant); + return delegate.createSwitchStatement(discriminant, cases); } - cases = []; - oldInSwitch = state.inSwitch; state.inSwitch = true; defaultFound = false; @@ -4439,7 +7715,7 @@ parseYieldExpression: true } function parseParam(options) { - var token, rest, param; + var token, rest, param, def; token = lookahead; if (token.value === '...') { @@ -4457,8 +7733,21 @@ parseYieldExpression: true param = parseObjectInitialiser(); reinterpretAsDestructuredParameter(options, param); } else { - param = parseVariableIdentifier(); + // We don't currently support typed rest params because doing so is + // a bit awkward. We may come back to this, but for now we'll punt + // on it. + param = rest + ? parseVariableIdentifier() + : parseAnnotatableIdentifier(); validateParam(options, token, token.value); + if (match('=')) { + if (rest) { + throwErrorTolerant(lookahead, Messages.DefaultRestParameter); + } + lex(); + def = parseAssignmentExpression(); + ++options.defaultCount; + } } if (rest) { @@ -4470,6 +7759,7 @@ parseYieldExpression: true } options.params.push(param); + options.defaults.push(def); return !match(')'); } @@ -4478,6 +7768,8 @@ parseYieldExpression: true options = { params: [], + defaultCount: 0, + defaults: [], rest: null, firstRestricted: firstRestricted }; @@ -4496,6 +7788,15 @@ parseYieldExpression: true expect(')'); + if (options.defaultCount === 0) { + options.defaults = []; + } + + if (match(':')) { + lex(); + options.returnTypeAnnotation = parseTypeAnnotation(); + } + return options; } @@ -4512,7 +7813,11 @@ parseYieldExpression: true token = lookahead; - id = parseVariableIdentifier(); + if (state.allowDefault) { + id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); + } else { + id = parseVariableIdentifier(); + } if (strict) { if (isRestrictedWord(token.value)) { throwErrorTolerant(token, Messages.StrictFunctionName); @@ -4548,12 +7853,13 @@ parseYieldExpression: true throwErrorTolerant(tmp.stricted, message); } if (state.yieldAllowed && !state.yieldFound) { - throwError({}, Messages.NoYieldInGenerator); + throwErrorTolerant({}, Messages.NoYieldInGenerator); } strict = previousStrict; state.yieldAllowed = previousYieldAllowed; - return delegate.createFunctionDeclaration(id, tmp.params, [], body, tmp.rest, generator, expression); + return delegate.createFunctionDeclaration(id, tmp.params, tmp.defaults, body, tmp.rest, generator, expression, + tmp.returnTypeAnnotation); } function parseFunctionExpression() { @@ -4607,12 +7913,13 @@ parseYieldExpression: true throwErrorTolerant(tmp.stricted, message); } if (state.yieldAllowed && !state.yieldFound) { - throwError({}, Messages.NoYieldInGenerator); + throwErrorTolerant({}, Messages.NoYieldInGenerator); } strict = previousStrict; state.yieldAllowed = previousYieldAllowed; - return delegate.createFunctionExpression(id, tmp.params, [], body, tmp.rest, generator, expression); + return delegate.createFunctionExpression(id, tmp.params, tmp.defaults, body, tmp.rest, generator, expression, + tmp.returnTypeAnnotation); } function parseYieldExpression() { @@ -4798,12 +8105,15 @@ parseYieldExpression: true } function parseClassDeclaration() { - var token, id, previousYieldAllowed, superClass = null; + var id, previousYieldAllowed, superClass = null; expectKeyword('class'); - token = lookahead; - id = parseVariableIdentifier(); + if (state.allowDefault) { + id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); + } else { + id = parseVariableIdentifier(); + } if (matchKeyword('extends')) { expectKeyword('extends'); @@ -4818,6 +8128,15 @@ parseYieldExpression: true // 15 Program + function matchModuleDeclaration() { + var id; + if (matchContextualKeyword('module')) { + id = lookahead2(); + return id.type === Token.StringLiteral || id.type === Token.Identifier; + } + return false; + } + function parseSourceElement() { if (lookahead.type === Token.Keyword) { switch (lookahead.value) { @@ -4826,19 +8145,25 @@ parseYieldExpression: true return parseConstLetDeclaration(lookahead.value); case 'function': return parseFunctionDeclaration(); + case 'export': + return parseExportDeclaration(); + case 'import': + return parseImportDeclaration(); default: return parseStatement(); } } + if (matchModuleDeclaration()) { + throwError({}, Messages.NestedModule); + } + if (lookahead.type !== Token.EOF) { return parseStatement(); } } function parseProgramElement() { - var lineNumber, token; - if (lookahead.type === Token.Keyword) { switch (lookahead.value) { case 'export': @@ -4848,12 +8173,8 @@ parseYieldExpression: true } } - if (lookahead.value === 'module' && lookahead.type === Token.Identifier) { - lineNumber = lookahead.lineNumber; - token = lookahead2(); - if (token.type === Token.Identifier && token.lineNumber === lineNumber) { - return parseModuleDeclaration(); - } + if (matchModuleDeclaration()) { + return parseModuleDeclaration(); } return parseSourceElement(); @@ -4898,7 +8219,7 @@ parseYieldExpression: true } function parseModuleElement() { - return parseProgramElement(); + return parseSourceElement(); } function parseModuleElements() { @@ -5507,7 +8828,7 @@ parseYieldExpression: true var token; if (lookahead.type !== Token.XJSIdentifier) { - throwError({}, Messages.InvalidXJSTagName); + throwUnexpected(lookahead); } token = lex(); @@ -5754,11 +9075,9 @@ parseYieldExpression: true extra.tokens = tokens; } - function createLocationMarker() { - var marker = {}; - - marker.range = [index, index]; - marker.loc = { + function LocationMarker() { + this.range = [index, index]; + this.loc = { start: { line: lineNumber, column: index - lineStart @@ -5768,14 +9087,18 @@ parseYieldExpression: true column: index - lineStart } }; + } - marker.end = function () { + LocationMarker.prototype = { + constructor: LocationMarker, + + end: function () { this.range[1] = index; this.loc.end.line = lineNumber; this.loc.end.column = index - lineStart; - }; + }, - marker.applyGroup = function (node) { + applyGroup: function (node) { if (extra.range) { node.groupRange = [this.range[0], this.range[1]]; } @@ -5792,9 +9115,9 @@ parseYieldExpression: true }; node = delegate.postProcess(node); } - }; + }, - marker.apply = function (node) { + apply: function (node) { var nodeType = typeof node; assert(nodeType === "object", "Applying location marker to an unexpected node type: " + @@ -5816,9 +9139,11 @@ parseYieldExpression: true }; node = delegate.postProcess(node); } - }; + } + }; - return marker; + function createLocationMarker() { + return new LocationMarker(); } function trackGroupExpression() { @@ -6029,15 +9354,14 @@ parseYieldExpression: true extra.parseComputedMember = parseComputedMember; extra.parseConditionalExpression = parseConditionalExpression; extra.parseConstLetDeclaration = parseConstLetDeclaration; + extra.parseExportBatchSpecifier = parseExportBatchSpecifier; extra.parseExportDeclaration = parseExportDeclaration; extra.parseExportSpecifier = parseExportSpecifier; - extra.parseExportSpecifierSetProperty = parseExportSpecifierSetProperty; extra.parseExpression = parseExpression; extra.parseForVariableDeclaration = parseForVariableDeclaration; extra.parseFunctionDeclaration = parseFunctionDeclaration; extra.parseFunctionExpression = parseFunctionExpression; extra.parseParams = parseParams; - extra.parseGlob = parseGlob; extra.parseImportDeclaration = parseImportDeclaration; extra.parseImportSpecifier = parseImportSpecifier; extra.parseModuleDeclaration = parseModuleDeclaration; @@ -6046,7 +9370,6 @@ parseYieldExpression: true extra.parseNonComputedProperty = parseNonComputedProperty; extra.parseObjectProperty = parseObjectProperty; extra.parseObjectPropertyKey = parseObjectPropertyKey; - extra.parsePath = parsePath; extra.parsePostfixExpression = parsePostfixExpression; extra.parsePrimaryExpression = parsePrimaryExpression; extra.parseProgram = parseProgram; @@ -6059,6 +9382,8 @@ parseYieldExpression: true extra.parseUnaryExpression = parseUnaryExpression; extra.parseVariableDeclaration = parseVariableDeclaration; extra.parseVariableIdentifier = parseVariableIdentifier; + extra.parseAnnotatableIdentifier = parseAnnotatableIdentifier; + extra.parseTypeAnnotation = parseTypeAnnotation; extra.parseMethodDefinition = parseMethodDefinition; extra.parseClassDeclaration = parseClassDeclaration; extra.parseClassExpression = parseClassExpression; @@ -6081,15 +9406,14 @@ parseYieldExpression: true parseComputedMember = wrapTracking(extra.parseComputedMember); parseConditionalExpression = wrapTracking(extra.parseConditionalExpression); parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration); + parseExportBatchSpecifier = wrapTracking(parseExportBatchSpecifier); parseExportDeclaration = wrapTracking(parseExportDeclaration); parseExportSpecifier = wrapTracking(parseExportSpecifier); - parseExportSpecifierSetProperty = wrapTracking(parseExportSpecifierSetProperty); parseExpression = wrapTracking(extra.parseExpression); parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration); parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration); parseFunctionExpression = wrapTracking(extra.parseFunctionExpression); parseParams = wrapTracking(extra.parseParams); - parseGlob = wrapTracking(extra.parseGlob); parseImportDeclaration = wrapTracking(extra.parseImportDeclaration); parseImportSpecifier = wrapTracking(extra.parseImportSpecifier); parseModuleDeclaration = wrapTracking(extra.parseModuleDeclaration); @@ -6099,7 +9423,6 @@ parseYieldExpression: true parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty); parseObjectProperty = wrapTracking(extra.parseObjectProperty); parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey); - parsePath = wrapTracking(extra.parsePath); parsePostfixExpression = wrapTracking(extra.parsePostfixExpression); parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression); parseProgram = wrapTracking(extra.parseProgram); @@ -6112,6 +9435,8 @@ parseYieldExpression: true parseUnaryExpression = wrapTracking(extra.parseUnaryExpression); parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration); parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier); + parseAnnotatableIdentifier = wrapTracking(extra.parseAnnotatableIdentifier); + parseTypeAnnotation = wrapTracking(extra.parseTypeAnnotation); parseMethodDefinition = wrapTracking(extra.parseMethodDefinition); parseClassDeclaration = wrapTracking(extra.parseClassDeclaration); parseClassExpression = wrapTracking(extra.parseClassExpression); @@ -6150,14 +9475,13 @@ parseYieldExpression: true parseComputedMember = extra.parseComputedMember; parseConditionalExpression = extra.parseConditionalExpression; parseConstLetDeclaration = extra.parseConstLetDeclaration; + parseExportBatchSpecifier = extra.parseExportBatchSpecifier; parseExportDeclaration = extra.parseExportDeclaration; parseExportSpecifier = extra.parseExportSpecifier; - parseExportSpecifierSetProperty = extra.parseExportSpecifierSetProperty; parseExpression = extra.parseExpression; parseForVariableDeclaration = extra.parseForVariableDeclaration; parseFunctionDeclaration = extra.parseFunctionDeclaration; parseFunctionExpression = extra.parseFunctionExpression; - parseGlob = extra.parseGlob; parseImportDeclaration = extra.parseImportDeclaration; parseImportSpecifier = extra.parseImportSpecifier; parseGroupExpression = extra.parseGroupExpression; @@ -6169,7 +9493,6 @@ parseYieldExpression: true parseNonComputedProperty = extra.parseNonComputedProperty; parseObjectProperty = extra.parseObjectProperty; parseObjectPropertyKey = extra.parseObjectPropertyKey; - parsePath = extra.parsePath; parsePostfixExpression = extra.parsePostfixExpression; parsePrimaryExpression = extra.parsePrimaryExpression; parseProgram = extra.parseProgram; @@ -6182,6 +9505,8 @@ parseYieldExpression: true parseUnaryExpression = extra.parseUnaryExpression; parseVariableDeclaration = extra.parseVariableDeclaration; parseVariableIdentifier = extra.parseVariableIdentifier; + parseAnnotatableIdentifier = extra.parseAnnotatableIdentifier; + parseTypeAnnotation = extra.parseTypeAnnotation; parseMethodDefinition = extra.parseMethodDefinition; parseClassDeclaration = extra.parseClassDeclaration; parseClassExpression = extra.parseClassExpression; @@ -6241,6 +9566,7 @@ parseYieldExpression: true length = source.length; lookahead = null; state = { + allowDefault: true, allowIn: true, labelSet: {}, inFunctionBody: false, @@ -6341,6 +9667,7 @@ parseYieldExpression: true length = source.length; lookahead = null; state = { + allowDefault: false, allowIn: true, labelSet: {}, parenthesizedCount: 0, @@ -6445,8 +9772,35 @@ parseYieldExpression: true })); /* vim: set sw=4 ts=4 et tw=80 : */ -})() -},{}],5:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ +var Base62 = (function (my) { + 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"] + + my.encode = function(i){ + if (i === 0) {return '0'} + var s = '' + while (i > 0) { + s = this.chars[i % 62] + s + i = Math.floor(i/62) + } + return s + }; + my.decode = function(a,b,c,d){ + for ( + b = c = ( + a === (/\W|_|^$/.test(a += "") || a) + ) - 1; + d = a.charCodeAt(c++); + ) + b = b * 62 + d - [, 48, 29, 87][d >> 5]; + return b + }; + + return my; +}({})); + +module.exports = Base62 +},{}],8:[function(require,module,exports){ /* * Copyright 2009-2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE.txt or: @@ -6456,7 +9810,7 @@ exports.SourceMapGenerator = require('./source-map/source-map-generator').Source exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer; exports.SourceNode = require('./source-map/source-node').SourceNode; -},{"./source-map/source-map-consumer":10,"./source-map/source-map-generator":11,"./source-map/source-node":12}],6:[function(require,module,exports){ +},{"./source-map/source-map-consumer":13,"./source-map/source-map-generator":14,"./source-map/source-node":15}],9:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -6464,12 +9818,10 @@ exports.SourceNode = require('./source-map/source-node').SourceNode; * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { - var util = require('./util'); - /** * A data structure which is a combination of an array and a set. Adding a new * member is O(1), testing for membership is O(1), and finding the index of an @@ -6492,6 +9844,19 @@ define(function (require, exports, module) { return set; }; + /** + * Because behavior goes wacky when you set `__proto__` on `this._set`, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + ArraySet.prototype._toSetString = function ArraySet__toSetString (aStr) { + return "$" + aStr; + }; + /** * Add the given string to this set. * @@ -6504,7 +9869,7 @@ define(function (require, exports, module) { } var idx = this._array.length; this._array.push(aStr); - this._set[util.toSetString(aStr)] = idx; + this._set[this._toSetString(aStr)] = idx; }; /** @@ -6514,7 +9879,7 @@ define(function (require, exports, module) { */ ArraySet.prototype.has = function ArraySet_has(aStr) { return Object.prototype.hasOwnProperty.call(this._set, - util.toSetString(aStr)); + this._toSetString(aStr)); }; /** @@ -6524,7 +9889,7 @@ define(function (require, exports, module) { */ ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { if (this.has(aStr)) { - return this._set[util.toSetString(aStr)]; + return this._set[this._toSetString(aStr)]; } throw new Error('"' + aStr + '" is not in the set.'); }; @@ -6554,7 +9919,7 @@ define(function (require, exports, module) { }); -},{"./util":13,"amdefine":14}],7:[function(require,module,exports){ +},{"amdefine":17}],10:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -6592,7 +9957,7 @@ define(function (require, exports, module) { * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -6700,7 +10065,7 @@ define(function (require, exports, module) { }); -},{"./base64":8,"amdefine":14}],8:[function(require,module,exports){ +},{"./base64":11,"amdefine":17}],11:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -6708,7 +10073,7 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -6744,7 +10109,7 @@ define(function (require, exports, module) { }); -},{"amdefine":14}],9:[function(require,module,exports){ +},{"amdefine":17}],12:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -6752,7 +10117,7 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -6827,7 +10192,7 @@ define(function (require, exports, module) { }); -},{"amdefine":14}],10:[function(require,module,exports){ +},{"amdefine":17}],13:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -6835,7 +10200,7 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -6857,7 +10222,6 @@ define(function (require, exports, module) { * - sources: An array of URLs to the original source files. * - names: An array of identifiers which can be referrenced by individual mappings. * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. * - mappings: A string of base64 VLQs which contain the actual mappings. * - file: The generated file this source map is associated with. * @@ -6884,9 +10248,8 @@ define(function (require, exports, module) { var sources = util.getArg(sourceMap, 'sources'); var names = util.getArg(sourceMap, 'names'); var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); + var file = util.getArg(sourceMap, 'file'); if (version !== this._version) { throw new Error('Unsupported version: ' + version); @@ -6894,8 +10257,7 @@ define(function (require, exports, module) { this._names = ArraySet.fromArray(names); this._sources = ArraySet.fromArray(sources); - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; + this._sourceRoot = sourceRoot; this.file = file; // `this._generatedMappings` and `this._originalMappings` hold the parsed @@ -6937,7 +10299,7 @@ define(function (require, exports, module) { Object.defineProperty(SourceMapConsumer.prototype, 'sources', { get: function () { return this._sources.toArray().map(function (s) { - return this.sourceRoot ? util.join(this.sourceRoot, s) : s; + return this._sourceRoot ? util.join(this._sourceRoot, s) : s; }, this); } }); @@ -6981,7 +10343,12 @@ define(function (require, exports, module) { if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) { // Original source. temp = base64VLQ.decode(str); - mapping.source = this._sources.at(previousSource + temp.value); + if (aSourceRoot) { + mapping.source = util.join(aSourceRoot, this._sources.at(previousSource + temp.value)); + } + else { + mapping.source = this._sources.at(previousSource + temp.value); + } previousSource += temp.value; str = temp.rest; if (str.length === 0 || mappingSeparator.test(str.charAt(0))) { @@ -7015,9 +10382,7 @@ define(function (require, exports, module) { } this._generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - this._originalMappings.push(mapping); - } + this._originalMappings.push(mapping); } } @@ -7104,15 +10469,11 @@ define(function (require, exports, module) { this._generatedMappings, "generatedLine", "generatedColumn", - this._compareGeneratedPositions); + this._compareGeneratedPositions) if (mapping) { - var source = util.getArg(mapping, 'source', null); - if (source && this.sourceRoot) { - source = util.join(this.sourceRoot, source); - } return { - source: source, + source: util.getArg(mapping, 'source', null), line: util.getArg(mapping, 'originalLine', null), column: util.getArg(mapping, 'originalColumn', null), name: util.getArg(mapping, 'name', null) @@ -7127,47 +10488,6 @@ define(function (require, exports, module) { }; }; - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * availible. - */ - SourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - throw new Error('"' + aSource + '" is not in the SourceMap.'); - }; - /** * Returns the generated line and column information for the original source, * line, and column positions provided. The only argument is an object with @@ -7190,15 +10510,11 @@ define(function (require, exports, module) { originalColumn: util.getArg(aArgs, 'column') }; - if (this.sourceRoot) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - var mapping = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", - this._compareOriginalPositions); + this._compareOriginalPositions) if (mapping) { return { @@ -7221,7 +10537,8 @@ define(function (require, exports, module) { * generated line/column in this source map. * * @param Function aCallback - * The function that is called with each mapping. + * The function that is called with each mapping. This function should + * not mutate the mapping. * @param Object aContext * Optional. If specified, this object will be the value of `this` every * time that `aCallback` is called. @@ -7249,28 +10566,14 @@ define(function (require, exports, module) { throw new Error("Unknown order of iteration."); } - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source; - if (source && sourceRoot) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name - }; - }).forEach(aCallback, context); + mappings.forEach(aCallback, context); }; exports.SourceMapConsumer = SourceMapConsumer; }); -},{"./array-set":6,"./base64-vlq":7,"./binary-search":9,"./util":13,"amdefine":14}],11:[function(require,module,exports){ +},{"./array-set":9,"./base64-vlq":10,"./binary-search":12,"./util":16,"amdefine":17}],14:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -7278,7 +10581,7 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -7300,58 +10603,10 @@ define(function (require, exports, module) { this._sources = new ArraySet(); this._names = new ArraySet(); this._mappings = []; - this._sourcesContents = null; } SourceMapGenerator.prototype._version = 3; - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source) { - newMapping.source = mapping.source; - if (sourceRoot) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - /** * Add a single mapping from original source line and column to the generated * source's line and column for this source map being created. The mapping @@ -7387,110 +10642,6 @@ define(function (require, exports, module) { }); }; - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent !== null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) { - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (!aSourceFile) { - aSourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "aSourceFile" relative if an absolute Url is passed. - if (sourceRoot) { - aSourceFile = util.relative(sourceRoot, aSourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "aSourceFile" - this._mappings.forEach(function (mapping) { - if (mapping.source === aSourceFile && mapping.original) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.original.line, - column: mapping.original.column - }); - if (original.source !== null) { - // Copy mapping - if (sourceRoot) { - mapping.source = util.relative(sourceRoot, original.source); - } else { - mapping.source = original.source; - } - mapping.original.line = original.line; - mapping.original.column = original.column; - if (original.name !== null && mapping.name !== null) { - // Only use the identifier name if it's an identifier - // in both SourceMaps - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content) { - if (sourceRoot) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - /** * A mapping can have one of the three levels of data: * @@ -7524,24 +10675,6 @@ define(function (require, exports, module) { } }; - function cmpLocation(loc1, loc2) { - var cmp = (loc1 && loc1.line) - (loc2 && loc2.line); - return cmp ? cmp : (loc1 && loc1.column) - (loc2 && loc2.column); - } - - function strcmp(str1, str2) { - str1 = str1 || ''; - str2 = str2 || ''; - return (str1 > str2) - (str1 < str2); - } - - function cmpMapping(mappingA, mappingB) { - return cmpLocation(mappingA.generated, mappingB.generated) || - cmpLocation(mappingA.original, mappingB.original) || - strcmp(mappingA.source, mappingB.source) || - strcmp(mappingA.name, mappingB.name); - } - /** * Serialize the accumulated mappings in to the stream of base 64 VLQs * specified by the source map format. @@ -7557,12 +10690,17 @@ define(function (require, exports, module) { var result = ''; var mapping; - // The mappings must be guaranteed to be in sorted order before we start + // The mappings must be guarenteed to be in sorted order before we start // serializing them or else the generated line numbers (which are defined // via the ';' separators) will be all messed up. Note: it might be more // performant to maintain the sorting as we insert them, rather than as we // serialize them, but the big O is the same either way. - this._mappings.sort(cmpMapping); + this._mappings.sort(function (mappingA, mappingB) { + var cmp = mappingA.generated.line - mappingB.generated.line; + return cmp === 0 + ? mappingA.generated.column - mappingB.generated.column + : cmp; + }); for (var i = 0, len = this._mappings.length; i < len; i++) { mapping = this._mappings[i]; @@ -7576,9 +10714,6 @@ define(function (require, exports, module) { } else { if (i > 0) { - if (!cmpMapping(mapping, this._mappings[i - 1])) { - continue; - } result += ','; } } @@ -7627,17 +10762,6 @@ define(function (require, exports, module) { if (this._sourceRoot) { map.sourceRoot = this._sourceRoot; } - if (this._sourcesContents) { - map.sourcesContent = map.sources.map(function (source) { - if (map.sourceRoot) { - source = util.relative(map.sourceRoot, source); - } - return Object.prototype.hasOwnProperty.call( - this._sourcesContents, util.toSetString(source)) - ? this._sourcesContents[util.toSetString(source)] - : null; - }, this); - } return map; }; @@ -7653,7 +10777,7 @@ define(function (require, exports, module) { }); -},{"./array-set":6,"./base64-vlq":7,"./util":13,"amdefine":14}],12:[function(require,module,exports){ +},{"./array-set":9,"./base64-vlq":10,"./util":16,"amdefine":17}],15:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -7661,12 +10785,11 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; - var util = require('./util'); /** * SourceNodes provide a way to abstract over interpolating/concatenating @@ -7678,121 +10801,15 @@ define(function (require, exports, module) { * @param aSource The original source's filename. * @param aChunks Optional. An array of strings which are snippets of * generated JS, or other SourceNodes. - * @param aName The original identifier. */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + function SourceNode(aLine, aColumn, aSource, aChunks) { this.children = []; - this.sourceContents = {}; - this.line = aLine === undefined ? null : aLine; - this.column = aColumn === undefined ? null : aColumn; - this.source = aSource === undefined ? null : aSource; - this.name = aName === undefined ? null : aName; + this.line = aLine; + this.column = aColumn; + this.source = aSource; if (aChunks != null) this.add(aChunks); } - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // The generated code - // Processed fragments are removed from this array. - var remainingLines = aGeneratedCode.split('\n'); - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping === null) { - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(remainingLines.shift() + "\n"); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - } else { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - var code = ""; - // Associate full lines with "lastMapping" - do { - code += remainingLines.shift() + "\n"; - lastGeneratedLine++; - lastGeneratedColumn = 0; - } while (lastGeneratedLine < mapping.generatedLine); - // When we reached the correct line, we add code until we - // reach the correct column too. - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - code += nextLine.substr(0, mapping.generatedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - // Create the SourceNode. - addMappingWithCode(lastMapping, code); - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - } - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - // Associate the remaining code in the current line with "lastMapping" - // and add the remaining lines without any mapping - addMappingWithCode(lastMapping, remainingLines.join("\n")); - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content) { - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - mapping.source, - code, - mapping.name)); - } - } - }; - /** * Add a chunk of generated JS to this source node. * @@ -7855,10 +10872,7 @@ define(function (require, exports, module) { } else { if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); + aFn(chunk, { source: this.source, line: this.line, column: this.column }); } } }, this); @@ -7873,7 +10887,7 @@ define(function (require, exports, module) { SourceNode.prototype.join = function SourceNode_join(aSep) { var newChildren; var i; - var len = this.children.length; + var len = this.children.length if (len > 0) { newChildren = []; for (i = 0; i < len-1; i++) { @@ -7907,36 +10921,6 @@ define(function (require, exports, module) { return this; }; - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - this.children.forEach(function (chunk) { - if (chunk instanceof SourceNode) { - chunk.walkSourceContents(aFn); - } - }, this); - Object.keys(this.sourceContents).forEach(function (sourceFileKey) { - aFn(util.fromSetString(sourceFileKey), this.sourceContents[sourceFileKey]); - }, this); - }; - /** * Return the string representation of this source node. Walks over the tree * and concatenates all the various snippets together to one string. @@ -7960,36 +10944,25 @@ define(function (require, exports, module) { column: 0 }; var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; this.walk(function (chunk, original) { generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { + if (original.source != null + && original.line != null + && original.column != null) { map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ generated: { line: generated.line, column: generated.column } }); - sourceMappingActive = false; } - chunk.split('').forEach(function (ch) { - if (ch === '\n') { + chunk.split('').forEach(function (char) { + if (char === '\n') { generated.line++; generated.column = 0; } else { @@ -7997,9 +10970,6 @@ define(function (require, exports, module) { } }); }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); return { code: generated.code, map: map }; }; @@ -8008,7 +10978,7 @@ define(function (require, exports, module) { }); -},{"./source-map-generator":11,"./util":13,"amdefine":14}],13:[function(require,module,exports){ +},{"./source-map-generator":14,"amdefine":17}],16:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -8016,7 +10986,7 @@ define(function (require, exports, module) { * http://opensource.org/licenses/BSD-3-Clause */ if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + var define = require('amdefine')(module); } define(function (require, exports, module) { @@ -8041,95 +11011,18 @@ define(function (require, exports, module) { } exports.getArg = getArg; - var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[3], - host: match[4], - port: match[6], - path: match[7] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = aParsedUrl.scheme + "://"; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + "@" - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - function join(aRoot, aPath) { - var url; - - if (aPath.match(urlRegexp)) { - return aPath; - } - - if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) { - url.path = aPath; - return urlGenerate(url); - } - - return aRoot.replace(/\/$/, '') + '/' + aPath; + return aPath.charAt(0) === '/' + ? aPath + : aRoot.replace(/\/*$/, '') + '/' + aPath; } exports.join = join; - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; - - function relative(aRoot, aPath) { - aRoot = aRoot.replace(/\/$/, ''); - - var url = urlParse(aRoot); - if (aPath.charAt(0) == "/" && url && url.path == "/") { - return aPath.slice(1); - } - - return aPath.indexOf(aRoot + '/') === 0 - ? aPath.substr(aRoot.length + 1) - : aPath; - } - exports.relative = relative; - }); -},{"amdefine":14}],14:[function(require,module,exports){ -(function(process,__filename){/** vim: et:ts=4:sw=4:sts=4 - * @license amdefine 0.0.5 Copyright (c) 2011, The Dojo Foundation All Rights Reserved. +},{"amdefine":17}],17:[function(require,module,exports){ +var process=require("__browserify_process"),__filename="/../node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js";/** vim: et:ts=4:sw=4:sts=4 + * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/amdefine for details */ @@ -8138,22 +11031,22 @@ define(function (require, exports, module) { /*global module, process */ 'use strict'; -var path = require('path'); - /** * Creates a define for node. * @param {Object} module the "module" object that is defined by Node for the * current module. - * @param {Function} [require]. Node's require function for the current module. + * @param {Function} [requireFn]. Node's require function for the current module. * It only needs to be passed in Node versions before 0.5, when module.require * did not exist. * @returns {Function} a define function that is usable for the current node * module. */ -function amdefine(module, require) { +function amdefine(module, requireFn) { + 'use strict'; var defineCache = {}, loaderCache = {}, alreadyCalled = false, + path = require('path'), makeRequire, stringRequire; /** @@ -8268,7 +11161,7 @@ function amdefine(module, require) { }; //Favor explicit value, passed in if the module wants to support Node 0.4. - require = require || function req() { + requireFn = requireFn || function req() { return module.require.apply(module, arguments); }; @@ -8282,7 +11175,7 @@ function amdefine(module, require) { uri: __filename, exports: e }; - r = makeRequire(require, e, m, id); + r = makeRequire(requireFn, e, m, id); } else { //Only support one define call per file if (alreadyCalled) { @@ -8295,7 +11188,7 @@ function amdefine(module, require) { //the exports in here is amdefine exports. e = module.exports; m = module; - r = makeRequire(require, e, m, module.id); + r = makeRequire(requireFn, e, m, module.id); } //If there are dependencies, they are strings, so need @@ -8308,7 +11201,7 @@ function amdefine(module, require) { //Call the factory with the right dependencies. if (typeof factory === 'function') { - result = factory.apply(module.exports, deps); + result = factory.apply(m.exports, deps); } else { result = factory; } @@ -8428,105 +11321,7 @@ function amdefine(module, require) { module.exports = amdefine; -})(require("__browserify_process"),"/../node_modules/source-map/node_modules/amdefine/amdefine.js") -},{"__browserify_process":3,"path":2}],15:[function(require,module,exports){ -/** - * Copyright 2013 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* jshint browser: true */ -/* jslint evil: true */ - -'use strict'; -var runScripts; -var headEl; - -var transform = require('./fbtransform/lib/transform').transform; -var visitors = require('./fbtransform/visitors').transformVisitors; -var transform = transform.bind(null, visitors.react); -var docblock = require('./fbtransform/lib/docblock'); - - -exports.transform = transform; - -exports.exec = function(code) { - return eval(transform(code)); -}; - -if (typeof window === "undefined" || window === null) { - return; -} -headEl = document.getElementsByTagName('head')[0]; - -var run = exports.run = function(code) { - var jsx = docblock.parseAsObject(docblock.extract(code)).jsx; - - var functionBody = jsx ? transform(code).code : code; - var scriptEl = document.createElement('script'); - - scriptEl.innerHTML = functionBody; - headEl.appendChild(scriptEl); -}; - -var load = exports.load = function(url, callback) { - var xhr; - xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') - : new XMLHttpRequest(); - // Disable async since we need to execute scripts in the order they are in the - // DOM to mirror normal script loading. - xhr.open('GET', url, false); - if ('overrideMimeType' in xhr) { - xhr.overrideMimeType('text/plain'); - } - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 0 || xhr.status === 200) { - run(xhr.responseText); - } else { - throw new Error("Could not load " + url); - } - if (callback) { - return callback(); - } - } - }; - return xhr.send(null); -}; - -runScripts = function() { - var scripts = document.getElementsByTagName('script'); - scripts = Array.prototype.slice.call(scripts); - var jsxScripts = scripts.filter(function(script) { - return script.type === 'text/jsx'; - }); - - jsxScripts.forEach(function(script) { - if (script.src) { - load(script.src); - } else { - run(script.innerHTML); - } - }); -}; - -if (window.addEventListener) { - window.addEventListener('DOMContentLoaded', runScripts, false); -} else { - window.attachEvent('onload', runScripts); -} - -},{"./fbtransform/lib/docblock":16,"./fbtransform/lib/transform":17,"./fbtransform/visitors":23}],16:[function(require,module,exports){ +},{"__browserify_process":5,"path":2}],18:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -8543,7 +11338,7 @@ if (window.addEventListener) { * limitations under the License. */ -var docblockRe = /^\s*(\/\*\*(.|\n)*?\*\/)/; +var docblockRe = /^\s*(\/\*\*(.|\r?\n)*?\*\/)/; var ltrimRe = /^\s*/; /** * @param {String} contents @@ -8561,9 +11356,9 @@ function extract(contents) { var commentStartRe = /^\/\*\*?/; var commentEndRe = /\*\/$/; var wsRe = /[\t ]+/g; -var stringStartRe = /(\n|^) *\*/g; -var multilineRe = /(?:^|\n) *(@[^\n]*?) *\n *([^@\n\s][^@\n]+?) *\n/g; -var propertyRe = /(?:^|\n) *@(\S+) *([^\n]*)/g; +var stringStartRe = /(\r?\n|^) *\*/g; +var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g; +var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g; /** * @param {String} contents @@ -8614,8 +11409,8 @@ exports.extract = extract; exports.parse = parse; exports.parseAsObject = parseAsObject; -},{}],17:[function(require,module,exports){ -(function(){/** +},{}],19:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8630,104 +11425,197 @@ exports.parseAsObject = parseAsObject; * See the License for the specific language governing permissions and * limitations under the License. */ -/*global exports:true*/ + + /*jslint node: true*/ "use strict"; /** * Syntax transfomer for javascript. Takes the source in, spits the source - * out. Tries to maintain readability and preserve whitespace and line numbers - * where posssible. + * out. * - * Support - * - ES6 class transformation + private property munging, see ./classes.js - * - React XHP style syntax transformations, see ./react.js - * - Bolt XHP style syntax transformations, see ./bolt.js - * - * The general flow is the following: - * - Parse the source with our customized esprima-parser - * https://github.com/voloko/esprima. We have to customize the parser to - * support non-standard XHP-style syntax. We parse the source range: true - * option that forces esprima to return positions in the source within - * resulting parse tree. - * - * - Traverse resulting syntax tree, trying to apply a set of visitors to each - * node. Each visitor should provide a .test() function that tests if the - * visitor can process a given node. - * - * - Visitor is responsible for code generation for a given syntax node. - * Generated code is stored in state.g.buffer that is passed to every - * visitor. It's up to the visitor to process the code the way it sees fit. - * All of the current visitors however use both the node and the original - * source to generate transformed code. They use nodes to generate new - * code and they copy the original source, preserving whitespace and comments, - * for the parts they don't care about. + * Parses input source with esprima, applies the given list of visitors to the + * AST tree, and returns the resulting output. */ -var esprima = require('esprima'); +var esprima = require('esprima-fb'); var createState = require('./utils').createState; var catchup = require('./utils').catchup; +var updateState = require('./utils').updateState; +var analyzeAndTraverse = require('./utils').analyzeAndTraverse; + +var Syntax = esprima.Syntax; /** - * @param {object} object + * @param {object} node + * @param {object} parentNode + * @return {boolean} + */ +function _nodeIsClosureScopeBoundary(node, parentNode) { + if (node.type === Syntax.Program) { + return true; + } + + var parentIsFunction = + parentNode.type === Syntax.FunctionDeclaration + || parentNode.type === Syntax.FunctionExpression; + + return node.type === Syntax.BlockStatement && parentIsFunction; +} + +function _nodeIsBlockScopeBoundary(node, parentNode) { + if (node.type === Syntax.Program) { + return false; + } + + return node.type === Syntax.BlockStatement + && parentNode.type === Syntax.CatchClause; +} + +/** + * @param {object} node * @param {function} visitor * @param {array} path * @param {object} state */ -function traverse(object, path, state) { - var key, child; +function traverse(node, path, state) { + // Create a scope stack entry if this is the first node we've encountered in + // its local scope + var parentNode = path[0]; + if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) { + if (_nodeIsClosureScopeBoundary(node, parentNode)) { + var scopeIsStrict = + state.scopeIsStrict + || node.body.length > 0 + && node.body[0].type === Syntax.ExpressionStatement + && node.body[0].expression.type === Syntax.Literal + && node.body[0].expression.value === 'use strict'; - if (walker(traverse, object, path, state) === false) { - return; - } - path.unshift(object); - for (key in object) { - // skip obviously wrong attributes - if (key === 'range' || key === 'loc') { - continue; - } - if (object.hasOwnProperty(key)) { - child = object[key]; - if (typeof child === 'object' && child !== null) { - child.range && catchup(child.range[0], state); - traverse(child, path, state); - child.range && catchup(child.range[1], state); + if (node.type === Syntax.Program) { + state = updateState(state, { + scopeIsStrict: scopeIsStrict + }); + } else { + state = updateState(state, { + localScope: { + parentNode: parentNode, + parentScope: state.localScope, + identifiers: {} + }, + scopeIsStrict: scopeIsStrict + }); + + // All functions have an implicit 'arguments' object in scope + state.localScope.identifiers['arguments'] = true; + + // Include function arg identifiers in the scope boundaries of the + // function + if (parentNode.params.length > 0) { + var param; + for (var i = 0; i < parentNode.params.length; i++) { + param = parentNode.params[i]; + if (param.type === Syntax.Identifier) { + state.localScope.identifiers[param.name] = true; + } + } + } + + // Named FunctionExpressions scope their name within the body block of + // themselves only + if (parentNode.type === Syntax.FunctionExpression && parentNode.id) { + state.localScope.identifiers[parentNode.id.name] = true; + } } + + // Traverse and find all local identifiers in this closure first to + // account for function/variable declaration hoisting + collectClosureIdentsAndTraverse(node, path, state); + } + + if (_nodeIsBlockScopeBoundary(node, parentNode)) { + state = updateState(state, { + localScope: { + parentNode: parentNode, + parentScope: state.localScope, + identifiers: {} + } + }); + + if (parentNode.type === Syntax.CatchClause) { + state.localScope.identifiers[parentNode.param.name] = true; + } + collectBlockIdentsAndTraverse(node, path, state); } } - path.shift(); + + // Only catchup() before and after traversing a child node + function traverser(node, path, state) { + node.range && catchup(node.range[0], state); + traverse(node, path, state); + node.range && catchup(node.range[1], state); + } + + analyzeAndTraverse(walker, traverser, node, path, state); } -function walker(traverse, object, path, state) { +function collectClosureIdentsAndTraverse(node, path, state) { + analyzeAndTraverse( + visitLocalClosureIdentifiers, + collectClosureIdentsAndTraverse, + node, + path, + state + ); +} + +function collectBlockIdentsAndTraverse(node, path, state) { + analyzeAndTraverse( + visitLocalBlockIdentifiers, + collectBlockIdentsAndTraverse, + node, + path, + state + ); +} + +function visitLocalClosureIdentifiers(node, path, state) { + var identifiers = state.localScope.identifiers; + switch (node.type) { + case Syntax.FunctionExpression: + // Function expressions don't get their names (if there is one) added to + // the closure scope they're defined in + return false; + case Syntax.ClassDeclaration: + case Syntax.ClassExpression: + case Syntax.FunctionDeclaration: + if (node.id) { + identifiers[node.id.name] = true; + } + return false; + case Syntax.VariableDeclarator: + if (path[0].kind === 'var') { + identifiers[node.id.name] = true; + } + break; + } +} + +function visitLocalBlockIdentifiers(node, path, state) { + // TODO: Support 'let' here...maybe...one day...or something... + if (node.type === Syntax.CatchClause) { + return false; + } +} + +function walker(node, path, state) { var visitors = state.g.visitors; for (var i = 0; i < visitors.length; i++) { - if (visitors[i].test(object, path, state)) { - return visitors[i](traverse, object, path, state); + if (visitors[i].test(node, path, state)) { + return visitors[i](traverse, node, path, state); } } } -function runPass(source, visitors, options) { - var ast; - try { - ast = esprima.parse(source, { comment: true, loc: true, range: true }); - } catch (e) { - e.message = 'Parse Error: ' + e.message; - throw e; - } - var state = createState(source, options); - state.g.originalProgramAST = ast; - state.g.visitors = visitors; - - if (options.sourceMap) { - var SourceMapGenerator = require('source-map').SourceMapGenerator; - state.g.sourceMap = new SourceMapGenerator({ file: 'transformed.js' }); - } - traverse(ast, [], state); - catchup(source.length, state); - return state; -} - /** * Applies all available transformations to the source * @param {array} visitors @@ -8738,28 +11626,40 @@ function runPass(source, visitors, options) { function transform(visitors, source, options) { options = options || {}; - var state = runPass(source, visitors, options); - var sourceMap = state.g.sourceMap; - - if (sourceMap) { - return { - sourceMap: sourceMap, - sourceMapFilename: options.filename || 'source.js', - code: state.g.buffer - }; - } else { - return { - code: state.g.buffer - }; + var ast; + try { + ast = esprima.parse(source, { + comment: true, + loc: true, + range: true + }); + } catch (e) { + e.message = 'Parse Error: ' + e.message; + throw e; } -} + var state = createState(source, ast, options); + state.g.visitors = visitors; + if (options.sourceMap) { + var SourceMapGenerator = require('source-map').SourceMapGenerator; + state.g.sourceMap = new SourceMapGenerator({file: 'transformed.js'}); + } + + traverse(ast, [], state); + catchup(source.length, state); + + var ret = {code: state.g.buffer}; + if (options.sourceMap) { + ret.sourceMap = state.g.sourceMap; + ret.sourceMapFilename = options.filename || 'source.js'; + } + return ret; +} exports.transform = transform; -})() -},{"./utils":18,"esprima":4,"source-map":5}],18:[function(require,module,exports){ -(function(){/** +},{"./utils":20,"esprima-fb":6,"source-map":8}],20:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8774,31 +11674,59 @@ exports.transform = transform; * See the License for the specific language governing permissions and * limitations under the License. */ -/*global exports:true*/ + + +/*jslint node: true*/ /** - * State represents the given parser state. It has a local and global parts. - * Global contains parser position, source, etc. Local contains scope based - * properties, like current class name. State should contain all the info - * required for transformation. It's the only mandatory object that is being - * passed to every function in transform chain. + * A `state` object represents the state of the parser. It has "local" and + * "global" parts. Global contains parser position, source, etc. Local contains + * scope based properties like current class name. State should contain all the + * info required for transformation. It's the only mandatory object that is + * being passed to every function in transform chain. * - * @param {String} source - * @param {Object} transformOptions - * @return {Object} + * @param {string} source + * @param {object} transformOptions + * @return {object} */ -function createState(source, transformOptions) { +function createState(source, rootNode, transformOptions) { return { /** - * Name of the super class variable - * @type {String} + * A tree representing the current local scope (and its lexical scope chain) + * Useful for tracking identifiers from parent scopes, etc. + * @type {Object} */ - superVar: '', + localScope: { + parentNode: rootNode, + parentScope: null, + identifiers: {} + }, /** - * Name of the enclosing class scope + * The name (and, if applicable, expression) of the super class + * @type {Object} + */ + superClass: null, + /** + * The namespace to use when munging identifiers * @type {String} */ - scopeName: '', + mungeNamespace: '', + /** + * Ref to the node for the FunctionExpression of the enclosing + * MethodDefinition + * @type {Object} + */ + methodFuncNode: null, + /** + * Name of the enclosing class + * @type {String} + */ + className: null, + /** + * Whether we're currently within a `strict` scope + * @type {Bool} + */ + scopeIsStrict: null, /** * Global state (not affected by updateState) * @type {Object} @@ -8897,25 +11825,26 @@ function createState(source, transformOptions) { /** * Updates a copy of a given state with "update" and returns an updated state. * - * @param {Object} state - * @param {Object} update - * @return {Object} + * @param {object} state + * @param {object} update + * @return {object} */ function updateState(state, update) { - return { - g: state.g, - superVar: update.superVar || state.superVar, - scopeName: update.scopeName || state.scopeName - }; + var ret = Object.create(state); + Object.keys(update).forEach(function(updatedKey) { + ret[updatedKey] = update[updatedKey]; + }); + return ret; } /** * Given a state fill the resulting buffer from the original source up to * the end - * @param {Number} end - * @param {Object} state - * @param {Function?} contentTransformer Optional callback to transform newly - * added content. + * + * @param {number} end + * @param {object} state + * @param {?function} contentTransformer Optional callback to transform newly + * added content. */ function catchup(end, state, contentTransformer) { if (end < state.g.position) { @@ -8968,26 +11897,48 @@ function catchup(end, state, contentTransformer) { } /** - * Applies `catchup` but passing in a function that removes any non-whitespace - * characters. + * Removes all non-whitespace characters */ -var re = /(\S)/g; +var reNonWhite = /(\S)/g; function stripNonWhite(value) { - return value.replace(re, function() { + return value.replace(reNonWhite, function() { return ''; }); } + /** - * Catches up as `catchup` but turns each non-white character into a space. + * Catches up as `catchup` but removes all non-whitespace characters. */ function catchupWhiteSpace(end, state) { catchup(end, state, stripNonWhite); } +/** + * Removes all non-newline characters + */ +var reNonNewline = /[^\n]/g; +function stripNonNewline(value) { + return value.replace(reNonNewline, function() { + return ''; + }); +} + +/** + * Catches up as `catchup` but removes all non-newline characters. + * + * Equivalent to appending as many newlines as there are in the original source + * between the current position and `end`. + */ +function catchupNewlines(end, state) { + catchup(end, state, stripNonNewline); +} + + /** * Same as catchup but does not touch the buffer - * @param {Number} end - * @param {Object} state + * + * @param {number} end + * @param {object} state */ function move(end, state) { // move the internal cursors @@ -9011,17 +11962,18 @@ function move(end, state) { /** * Appends a string of text to the buffer - * @param {String} string - * @param {Object} state + * + * @param {string} str + * @param {object} state */ -function append(string, state) { - if (state.g.sourceMap && string) { +function append(str, state) { + if (state.g.sourceMap && str) { state.g.sourceMap.addMapping({ generated: { line: state.g.bufferLine, column: state.g.bufferColumn }, original: { line: state.g.sourceLine, column: state.g.sourceColumn }, source: state.g.sourceMapFilename }); - var transformedLines = string.split('\n'); + var transformedLines = str.split('\n'); if (transformedLines.length > 1) { state.g.bufferLine += transformedLines.length - 1; state.g.bufferColumn = 0; @@ -9029,16 +11981,16 @@ function append(string, state) { state.g.bufferColumn += transformedLines[transformedLines.length - 1].length; } - state.g.buffer += string; + state.g.buffer += str; } /** * Update indent using state.indentBy property. Indent is measured in * double spaces. Updates a single line only. * - * @param {String} str - * @param {Object} state - * @return {String} + * @param {string} str + * @param {object} state + * @return {string} */ function updateIndent(str, state) { for (var i = 0; i < -state.g.indentBy; i++) { @@ -9056,9 +12008,9 @@ function updateIndent(str, state) { * start * indent will be 2 * - * @param {Number} start - * @param {Object} state - * @return {Number} + * @param {number} start + * @param {object} state + * @return {number} */ function indentBefore(start, state) { var end = start; @@ -9082,19 +12034,113 @@ function getDocblock(state) { return state.g.docblock; } +function identWithinLexicalScope(identName, state, stopBeforeNode) { + var currScope = state.localScope; + while (currScope) { + if (currScope.identifiers[identName] !== undefined) { + return true; + } + + if (stopBeforeNode && currScope.parentNode === stopBeforeNode) { + break; + } + + currScope = currScope.parentScope; + } + return false; +} + +function identInLocalScope(identName, state) { + return state.localScope.identifiers[identName] !== undefined; +} + +function declareIdentInLocalScope(identName, state) { + state.localScope.identifiers[identName] = true; +} + +/** + * Apply the given analyzer function to the current node. If the analyzer + * doesn't return false, traverse each child of the current node using the given + * traverser function. + * + * @param {function} analyzer + * @param {function} traverser + * @param {object} node + * @param {function} visitor + * @param {array} path + * @param {object} state + */ +function analyzeAndTraverse(analyzer, traverser, node, path, state) { + var key, child; + + if (node.type) { + if (analyzer(node, path, state) === false) { + return; + } + path.unshift(node); + } + + for (key in node) { + // skip obviously wrong attributes + if (key === 'range' || key === 'loc') { + continue; + } + if (node.hasOwnProperty(key)) { + child = node[key]; + if (typeof child === 'object' && child !== null) { + traverser(child, path, state); + } + } + } + node.type && path.shift(); +} + +/** + * Checks whether a node or any of its sub-nodes contains + * a syntactic construct of the passed type. + * @param {object} node - AST node to test. + * @param {string} type - node type to lookup. + */ +function containsChildOfType(node, type) { + var foundMatchingChild = false; + function nodeTypeAnalyzer(node) { + if (node.type === type) { + foundMatchingChild = true; + return false; + } + } + function nodeTypeTraverser(child, path, state) { + if (!foundMatchingChild) { + foundMatchingChild = containsChildOfType(child, type); + } + } + analyzeAndTraverse( + nodeTypeAnalyzer, + nodeTypeTraverser, + node, + [] + ); + return foundMatchingChild; +} + +exports.append = append; exports.catchup = catchup; exports.catchupWhiteSpace = catchupWhiteSpace; -exports.append = append; +exports.catchupNewlines = catchupNewlines; +exports.containsChildOfType = containsChildOfType; +exports.createState = createState; +exports.declareIdentInLocalScope = declareIdentInLocalScope; +exports.getDocblock = getDocblock; +exports.identWithinLexicalScope = identWithinLexicalScope; +exports.identInLocalScope = identInLocalScope; +exports.indentBefore = indentBefore; exports.move = move; exports.updateIndent = updateIndent; -exports.indentBefore = indentBefore; exports.updateState = updateState; -exports.createState = createState; -exports.getDocblock = getDocblock; +exports.analyzeAndTraverse = analyzeAndTraverse; -})() -},{"./docblock":16}],19:[function(require,module,exports){ -(function(){/** +},{"./docblock":18}],21:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9109,487 +12155,572 @@ exports.getDocblock = getDocblock; * See the License for the specific language governing permissions and * limitations under the License. */ -/*global exports:true*/ -"use strict"; + +/*jslint node:true*/ /** - * Desugarizer for ES6 minimal class proposal. See - * http://wiki.ecmascript.org/doku.php?id=harmony:proposals - * - * Does not require any runtime. Preserves whitespace and comments. - * Supports a class declaration with methods, super calls and inheritance. - * Currently does not support for getters and setters, since there's a very - * low probability we're going to use them anytime soon. - * - * Additional features: - * - Any member with private name (the name with prefix _, such _name) inside - * the class's scope will be munged. This would will to eliminate the case - * of sub-class accidentally overriding the super-class's provate properties - * also discouage people from accessing private members that they should not - * access. However, quoted property names don't get munged. - * - * class SkinnedMesh extends require('THREE').Mesh { - * - * update(camera) { - * camera.code = 'iphone' - * super.update(camera); - * } - * - * / - * * @constructor - * / - * constructor(geometry, materials) { - * super(geometry, materials); - * - * super.update(1); - * - * this.identityMatrix = new THREE.Matrix4(); - * this.bones = []; - * this.boneMatrices = []; - * this._name = 'foo'; - * } - * - * / - * * some other code - * / - * readMore() { - * - * } - * - * _doSomething() { - * - * } - * } - * - * should be converted to - * - * var SkinnedMesh = (function() { - * var __super = require('parent').Mesh; - * - * / - * * @constructor - * / - * function SkinnedMesh(geometry, materials) { - * __super.call(this, geometry, materials); - * - * __super.prototype.update.call(this, 1); - * - * this.identityMatrix = new THREE.Matrix4(); - * this.bones = []; - * this.boneMatrices = []; - * this.$SkinnedMesh_name = 'foo'; - * } - * SkinnedMesh.prototype = Object.create(__super.prototype); - * SkinnedMesh.prototype.constructor = SkinnedMesh; - * - * / - * * @param camera - * / - * SkinnedMesh.prototype.update = function(camera) { - * camera.code = 'iphone' - * __super.prototype.update.call(this, camera); - * }; - * - * SkinnedMesh.prototype.readMore = function() { - * - * }; - * - * SkinnedMesh.prototype.$SkinnedMesh_doSomething = function() { - * - * }; - * - * return SkinnedMesh; - * })(); - * + * @typechecks */ -var Syntax = require('esprima').Syntax; +'use strict'; + var base62 = require('base62'); +var Syntax = require('esprima-fb').Syntax; +var utils = require('../src/utils'); -var catchup = require('../lib/utils').catchup; -var append = require('../lib/utils').append; -var move = require('../lib/utils').move; -var indentBefore = require('../lib/utils').indentBefore; -var updateIndent = require('../lib/utils').updateIndent; -var updateState = require('../lib/utils').updateState; +var SUPER_PROTO_IDENT_PREFIX = '____SuperProtoOf'; -function findConstructorIndex(object) { - var classElements = object.body && object.body.body || []; - for (var i = 0; i < classElements.length; i++) { - if (classElements[i].type === Syntax.MethodDefinition && - classElements[i].key.name === 'constructor') { - return i; - } - } - return -1; +var _anonClassUUIDCounter = 0; +var _mungedSymbolMaps = {}; + +/** + * Used to generate a unique class for use with code-gens for anonymous class + * expressions. + * + * @param {object} state + * @return {string} + */ +function _generateAnonymousClassName(state) { + var mungeNamespace = state.mungeNamespace || ''; + return '____Class' + mungeNamespace + base62.encode(_anonClassUUIDCounter++); } -var _mungedSymbolMaps = {}; -function getMungedName(scopeName, name, minify) { - if (minify) { - if (!_mungedSymbolMaps[scopeName]) { - _mungedSymbolMaps[scopeName] = { +/** + * Given an identifier name, munge it using the current state's mungeNamespace. + * + * @param {string} identName + * @param {object} state + * @return {string} + */ +function _getMungedName(identName, state) { + var mungeNamespace = state.mungeNamespace; + var shouldMinify = state.g.opts.minify; + + if (shouldMinify) { + if (!_mungedSymbolMaps[mungeNamespace]) { + _mungedSymbolMaps[mungeNamespace] = { symbolMap: {}, - identifierUUIDCounter: 0 + identUUIDCounter: 0 }; } - var symbolMap = _mungedSymbolMaps[scopeName].symbolMap; - if (!symbolMap[name]) { - symbolMap[name] = - base62.encode(_mungedSymbolMaps[scopeName].identifierUUIDCounter); - _mungedSymbolMaps[scopeName].identifierUUIDCounter++; + var symbolMap = _mungedSymbolMaps[mungeNamespace].symbolMap; + if (!symbolMap[identName]) { + symbolMap[identName] = + base62.encode(_mungedSymbolMaps[mungeNamespace].identUUIDCounter++); } - name = symbolMap[name]; + identName = symbolMap[identName]; } - return '$' + scopeName + name; + return '$' + mungeNamespace + identName; } -function shouldMungeName(scopeName, name, state) { - // only run when @preventMunge is not present in the docblock - if (state.g.preventMunge === undefined) { - var docblock = require('../lib/docblock'); - state.g.preventMunge = docblock.parseAsObject( - docblock.extract(state.g.source)).preventMunge !== undefined; - } - // Starts with only a single underscore (i.e. don't count double-underscores) - return !state.g.preventMunge && scopeName ? /^_(?!_)/.test(name) : false; -} - - -function getProtoOfPrototypeVariableName(superVar) { - return superVar + 'ProtoOfPrototype'; -} - -function getSuperKeyName(superVar) { - return superVar + 'Key'; -} - -function getSuperProtoOfPrototypeVariable(superVariableName, indent) { - var string = (indent + - 'var $proto = $superName && $superName.prototype ? ' + - '$superName.prototype : $superName;\n' - ).replace(/\$proto/g, getProtoOfPrototypeVariableName(superVariableName)) - .replace(/\$superName/g, superVariableName); - return string; -} - - -function getInheritanceSetup(superClassToken, className, indent, superName) { - var string = ''; - if (superClassToken) { - string += getStaticMethodsOnConstructorSetup(className, indent, superName); - string += getPrototypeOnConstructorSetup(className, indent, superName); - string += getConstructorPropertySetup(className, indent); - } - return string; -} - -function getStaticMethodsOnConstructorSetup(className, indent, superName) { - var string = ( indent + - 'for (var $keyName in $superName) {\n' + indent + - ' if ($superName.hasOwnProperty($keyName)) {\n' + indent + - ' $className[$keyName] = $superName[$keyName];\n' + indent + - ' }\n' + indent + - '}\n') - .replace(/\$className/g, className) - .replace(/\$keyName/g, getSuperKeyName(superName)) - .replace(/\$superName/g, superName); - return string; -} - -function getPrototypeOnConstructorSetup(className, indent, superName) { - var string = ( indent + - '$className.prototype = Object.create($protoPrototype);\n') - .replace(/\$protoPrototype/g, getProtoOfPrototypeVariableName(superName)) - .replace(/\$className/g, className); - return string; -} - -function getConstructorPropertySetup(className, indent) { - var string = ( indent + - '$className.prototype.constructor = $className;\n') - .replace(/\$className/g, className); - - return string; -} - -function getSuperConstructorSetup(superClassToken, indent, superName) { - if (!superClassToken) return ''; - var string = ( '\n' + indent + - ' if ($superName && $superName.prototype) {\n' + indent + - ' $superName.apply(this, arguments);\n' + indent + - ' }\n' + indent) - .replace(/\$superName/g, superName); - return string; -} - -function getMemberFunctionCall(superVar, propertyName, superArgs) { - var string = ( - '$superPrototype.$propertyName.call($superArguments)') - .replace(/\$superPrototype/g, getProtoOfPrototypeVariableName(superVar)) - .replace(/\$propertyName/g, propertyName) - .replace(/\$superArguments/g, superArgs); - return string; -} - -function getCallParams(classElement, state) { - var params = classElement.value.params; - if (!params.length) { - return ''; - } - return state.g.source.substring( - params[0].range[0], - params[params.length - 1].range[1]); -} - -function getSuperArguments(callExpression, state) { - var args = callExpression.arguments; - if (!args.length) { - return 'this'; - } - return 'this, ' + state.g.source.substring( - args[0].range[0], - args[args.length - 1].range[1]); -} - -// The seed is used to generate the name for an anonymous class, -// and this seed should be unique per browser's session. -// The value of the seed looks like this: 1229588505.2969012. -var classIDSeed = Date.now() % (60 * 60 * 1000) + Math.random(); - /** - * Generates a name for an anonymous class. The generated value looks like - * this: "Classkc6pcn_mniza1yvi" - * @param {String} scopeName - * @return {string} the scope name for Anonymous Class + * Extracts super class information from a class node. + * + * Information includes name of the super class and/or the expression string + * (if extending from an expression) + * + * @param {object} node + * @param {object} state + * @return {object} */ -function generateAnonymousClassName(scopeName) { - classIDSeed++; - return 'Class' + - (classIDSeed).toString(36).replace('.', '_') + - (scopeName || ''); -} - -function renderMethods(traverse, object, name, path, state) { - var classElements = object.body && object.body.body || []; - - move(object.body.range[0] + 1, state); - for (var i = 0; i < classElements.length; i++) { - if (classElements[i].key.name !== 'constructor') { - catchup(classElements[i].range[0], state); - - var memberName = classElements[i].key.name; - if (shouldMungeName(state.scopeName, memberName, state)) { - memberName = getMungedName( - state.scopeName, - memberName, - state.g.opts.minify - ); - } - - var prototypeOrStatic; - if (classElements[i]['static']) { - prototypeOrStatic = ''; - } else { - prototypeOrStatic = 'prototype.'; - } - - append(name + '.' + prototypeOrStatic + memberName + ' = ', state); - renderMethod(traverse, classElements[i], null, path, state); - append(';', state); - } - move(classElements[i].range[1], state); - } - if (classElements.length) { - append('\n', state); - } - move(object.range[1], state); -} - -function renderMethod(traverse, method, name, path, state) { - append(name ? 'function ' + name + '(' : 'function(', state); - append(getCallParams(method, state) + ') {', state); - move(method.value.body.range[0] + 1, state); - traverse(method.value.body, path, state); - catchup(method.value.body.range[1] - 1, state); - append('}', state); -} - -function renderSuperClass(traverse, superClass, path, state) { - append('var ' + state.superVar + ' = ', state); - move(superClass.range[0], state); - traverse(superClass, path, state); - catchup(superClass.range[1], state); - append(';\n', state); -} - -function renderConstructor(traverse, object, name, indent, path, state) { - var classElements = object.body && object.body.body || []; - var constructorIndex = findConstructorIndex(object); - var constructor = constructorIndex === -1 ? - null : - classElements[constructorIndex]; - if (constructor) { - move(constructorIndex === 0 ? - object.body.range[0] + 1 : - classElements[constructorIndex - 1].range[1], state); - catchup(constructor.range[0], state); - renderMethod(traverse, constructor, name, path, state); - append('\n', state); - } else { - if (object.superClass) { - append('\n' + indent, state); - } - append('function ', state); - if (object.id) { - move(object.id.range[0], state); - } - append(name, state); - if (object.id) { - move(object.id.range[1], state); - } - append('(){ ', state); - if (object.body) { - move(object.body.range[0], state); - } - append(getSuperConstructorSetup( - object.superClass, - indent, - state.superVar), state); - append('}\n', state); - } -} - -var superId = 0; -function renderClassBody(traverse, object, path, state) { - var name = object.id ? object.id.name : 'constructor'; - var superClass = object.superClass; - var indent = updateIndent( - indentBefore(object.range[0], state) + ' ', - state); - - state = updateState( - state, - { - scopeName: object.id ? object.id.name : - generateAnonymousClassName(state.scopeName), - superVar: superClass ? '__super' + superId++ : '' - }); - - // super class - if (superClass) { - append(indent, state); - renderSuperClass(traverse, superClass, path, state); - append(getSuperProtoOfPrototypeVariable(state.superVar, indent), state); - } - - renderConstructor(traverse, object, name, indent, path, state); - append(getInheritanceSetup(superClass, name, indent, state.superVar), state); - renderMethods(traverse, object, name, path, state); -} - - -/** - * @public - */ -function visitClassExpression(traverse, object, path, state) { - var indent = updateIndent( - indentBefore(object.range[0], state) + ' ', - state); - var name = object.id ? object.id.name : 'constructor'; - - append('(function() {\n', state); - renderClassBody(traverse, object, path, state); - append(indent + 'return ' + name + ';\n', state); - append(indent.substring(0, indent.length - 2) + '})()', state); - return false -} - -visitClassExpression.test = function(object, path, state) { - return object.type === Syntax.ClassExpression; -}; - -/** - * @public - */ -function visitClassDeclaration(traverse, object, path, state) { - state.g.indentBy--; - renderClassBody(traverse, object, path, state); - state.g.indentBy++; - return false; -} - -visitClassDeclaration.test = function(object, path, state) { - return object.type === Syntax.ClassDeclaration; -}; - - -/** - * @public - */ -function visitSuperCall(traverse, object, path, state) { - if (path[0].type === Syntax.CallExpression) { - append(state.superVar + - '.call(' + getSuperArguments(path[0], state) + ')', state); - move(path[0].range[1], state); - } else if (path[0].type === Syntax.MemberExpression) { - append(getMemberFunctionCall( - state.superVar, - path[0].property.name, - getSuperArguments(path[1], state)), state); - move(path[1].range[1], state); - } - return false; -} - -visitSuperCall.test = function(object, path, state) { - return state.superVar && object.type === Syntax.Identifier && - object.name === 'super'; -}; - -/** - * @public - */ -function visitPrivateProperty(traverse, object, path, state) { - var type = path[0] ? path[0].type : null; - if (type !== Syntax.Property) { - if (type === Syntax.MemberExpression) { - type = path[0].object ? path[0].object.type : null; - if (type === Syntax.Identifier && - path[0].object.range[0] === object.range[0]) { - // Identifier is a variable that appears "private". - return; - } +function _getSuperClassInfo(node, state) { + var ret = { + name: null, + expression: null + }; + if (node.superClass) { + if (node.superClass.type === Syntax.Identifier) { + ret.name = node.superClass.name; } else { - // Other syntax that are neither Property nor MemberExpression. - return; + // Extension from an expression + ret.name = _generateAnonymousClassName(state); + ret.expression = state.g.source.substring( + node.superClass.range[0], + node.superClass.range[1] + ); } } - - var oldName = object.name; - var newName = getMungedName( - state.scopeName, - oldName, - state.g.opts.minify - ); - append(newName, state); - move(object.range[1], state); + return ret; } -visitPrivateProperty.test = function(object, path, state) { - return object.type === Syntax.Identifier && - shouldMungeName(state.scopeName, object.name, state); +/** + * Used with .filter() to find the constructor method in a list of + * MethodDefinition nodes. + * + * @param {object} classElement + * @return {boolean} + */ +function _isConstructorMethod(classElement) { + return classElement.type === Syntax.MethodDefinition && + classElement.key.type === Syntax.Identifier && + classElement.key.name === 'constructor'; +} + +/** + * @param {object} node + * @param {object} state + * @return {boolean} + */ +function _shouldMungeIdentifier(node, state) { + return ( + !!state.methodFuncNode && + !utils.getDocblock(state).hasOwnProperty('preventMunge') && + /^_(?!_)/.test(node.name) + ); +} + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitClassMethod(traverse, node, path, state) { + utils.catchup(node.range[0], state); + path.unshift(node); + traverse(node.value, path, state); + path.shift(); + return false; +} +visitClassMethod.test = function(node, path, state) { + return node.type === Syntax.MethodDefinition; }; +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitClassFunctionExpression(traverse, node, path, state) { + var methodNode = path[0]; -exports.visitClassDeclaration = visitClassDeclaration; -exports.visitClassExpression = visitClassExpression; -exports.visitSuperCall = visitSuperCall; -exports.visitPrivateProperty = visitPrivateProperty; + state = utils.updateState(state, { + methodFuncNode: node + }); -})() -},{"../lib/docblock":16,"../lib/utils":18,"base62":1,"esprima":4}],20:[function(require,module,exports){ -(function(){/** + if (methodNode.key.name === 'constructor') { + utils.append('function ' + state.className, state); + } else { + var methodName = methodNode.key.name; + if (_shouldMungeIdentifier(methodNode.key, state)) { + methodName = _getMungedName(methodName, state); + } + + var prototypeOrStatic = methodNode.static ? '' : 'prototype.'; + utils.append( + state.className + '.' + prototypeOrStatic + methodName + '=function', + state + ); + } + utils.move(methodNode.key.range[1], state); + + var params = node.params; + var paramName; + if (params.length > 0) { + for (var i = 0; i < params.length; i++) { + utils.catchup(node.params[i].range[0], state); + paramName = params[i].name; + if (_shouldMungeIdentifier(params[i], state)) { + paramName = _getMungedName(params[i].name, state); + } + utils.append(paramName, state); + utils.move(params[i].range[1], state); + } + } else { + utils.append('(', state); + } + utils.append(')', state); + utils.catchupWhiteSpace(node.body.range[0], state); + utils.append('{', state); + if (!state.scopeIsStrict) { + utils.append('"use strict";', state); + } + utils.move(node.body.range[0] + '{'.length, state); + + path.unshift(node); + traverse(node.body, path, state); + path.shift(); + utils.catchup(node.body.range[1], state); + + if (methodNode.key.name !== 'constructor') { + utils.append(';', state); + } + return false; +} +visitClassFunctionExpression.test = function(node, path, state) { + return node.type === Syntax.FunctionExpression + && path[0].type === Syntax.MethodDefinition; +}; + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function _renderClassBody(traverse, node, path, state) { + var className = state.className; + var superClass = state.superClass; + + // Set up prototype of constructor on same line as `extends` for line-number + // preservation. This relies on function-hoisting if a constructor function is + // defined in the class body. + if (superClass.name) { + // If the super class is an expression, we need to memoize the output of the + // expression into the generated class name variable and use that to refer + // to the super class going forward. Example: + // + // class Foo extends mixin(Bar, Baz) {} + // --transforms to-- + // function Foo() {} var ____Class0Blah = mixin(Bar, Baz); + if (superClass.expression !== null) { + utils.append( + 'var ' + superClass.name + '=' + superClass.expression + ';', + state + ); + } + + var keyName = superClass.name + '____Key'; + var keyNameDeclarator = ''; + if (!utils.identWithinLexicalScope(keyName, state)) { + keyNameDeclarator = 'var '; + utils.declareIdentInLocalScope(keyName, state); + } + utils.append( + 'for(' + keyNameDeclarator + keyName + ' in ' + superClass.name + '){' + + 'if(' + superClass.name + '.hasOwnProperty(' + keyName + ')){' + + className + '[' + keyName + ']=' + + superClass.name + '[' + keyName + '];' + + '}' + + '}', + state + ); + + var superProtoIdentStr = SUPER_PROTO_IDENT_PREFIX + superClass.name; + if (!utils.identWithinLexicalScope(superProtoIdentStr, state)) { + utils.append( + 'var ' + superProtoIdentStr + '=' + superClass.name + '===null?' + + 'null:' + superClass.name + '.prototype;', + state + ); + utils.declareIdentInLocalScope(superProtoIdentStr, state); + } + + utils.append( + className + '.prototype=Object.create(' + superProtoIdentStr + ');', + state + ); + utils.append( + className + '.prototype.constructor=' + className + ';', + state + ); + utils.append( + className + '.__superConstructor__=' + superClass.name + ';', + state + ); + } + + // If there's no constructor method specified in the class body, create an + // empty constructor function at the top (same line as the class keyword) + if (!node.body.body.filter(_isConstructorMethod).pop()) { + utils.append('function ' + className + '(){', state); + if (!state.scopeIsStrict) { + utils.append('"use strict";', state); + } + if (superClass.name) { + utils.append( + 'if(' + superClass.name + '!==null){' + + superClass.name + '.apply(this,arguments);}', + state + ); + } + utils.append('}', state); + } + + utils.move(node.body.range[0] + '{'.length, state); + traverse(node.body, path, state); + utils.catchupWhiteSpace(node.range[1], state); +} + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitClassDeclaration(traverse, node, path, state) { + var className = node.id.name; + var superClass = _getSuperClassInfo(node, state); + + state = utils.updateState(state, { + mungeNamespace: className, + className: className, + superClass: superClass + }); + + _renderClassBody(traverse, node, path, state); + + return false; +} +visitClassDeclaration.test = function(node, path, state) { + return node.type === Syntax.ClassDeclaration; +}; + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitClassExpression(traverse, node, path, state) { + var className = node.id && node.id.name || _generateAnonymousClassName(state); + var superClass = _getSuperClassInfo(node, state); + + utils.append('(function(){', state); + + state = utils.updateState(state, { + mungeNamespace: className, + className: className, + superClass: superClass + }); + + _renderClassBody(traverse, node, path, state); + + utils.append('return ' + className + ';})()', state); + return false; +} +visitClassExpression.test = function(node, path, state) { + return node.type === Syntax.ClassExpression; +}; + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitPrivateIdentifier(traverse, node, path, state) { + utils.append(_getMungedName(node.name, state), state); + utils.move(node.range[1], state); +} +visitPrivateIdentifier.test = function(node, path, state) { + if (node.type === Syntax.Identifier && _shouldMungeIdentifier(node, state)) { + // Always munge non-computed properties of MemberExpressions + // (a la preventing access of properties of unowned objects) + if (path[0].type === Syntax.MemberExpression && path[0].object !== node + && path[0].computed === false) { + return true; + } + + // Always munge identifiers that were declared within the method function + // scope + if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) { + return true; + } + + // Always munge private keys on object literals defined within a method's + // scope. + if (path[0].type === Syntax.Property + && path[1].type === Syntax.ObjectExpression) { + return true; + } + + // Always munge function parameters + if (path[0].type === Syntax.FunctionExpression + || path[0].type === Syntax.FunctionDeclaration) { + for (var i = 0; i < path[0].params.length; i++) { + if (path[0].params[i] === node) { + return true; + } + } + } + } + return false; +}; + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitSuperCallExpression(traverse, node, path, state) { + var superClassName = state.superClass.name; + + if (node.callee.type === Syntax.Identifier) { + utils.append(superClassName + '.call(', state); + utils.move(node.callee.range[1], state); + } else if (node.callee.type === Syntax.MemberExpression) { + utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state); + utils.move(node.callee.object.range[1], state); + + if (node.callee.computed) { + // ["a" + "b"] + utils.catchup(node.callee.property.range[1] + ']'.length, state); + } else { + // .ab + utils.append('.' + node.callee.property.name, state); + } + + utils.append('.call(', state); + utils.move(node.callee.range[1], state); + } + + utils.append('this', state); + if (node.arguments.length > 0) { + utils.append(',', state); + utils.catchupWhiteSpace(node.arguments[0].range[0], state); + traverse(node.arguments, path, state); + } + + utils.catchupWhiteSpace(node.range[1], state); + utils.append(')', state); + return false; +} +visitSuperCallExpression.test = function(node, path, state) { + if (state.superClass && node.type === Syntax.CallExpression) { + var callee = node.callee; + if (callee.type === Syntax.Identifier && callee.name === 'super' + || callee.type == Syntax.MemberExpression + && callee.object.name === 'super') { + return true; + } + } + return false; +}; + +/** + * @param {function} traverse + * @param {object} node + * @param {array} path + * @param {object} state + */ +function visitSuperMemberExpression(traverse, node, path, state) { + var superClassName = state.superClass.name; + + utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state); + utils.move(node.object.range[1], state); +} +visitSuperMemberExpression.test = function(node, path, state) { + return state.superClass + && node.type === Syntax.MemberExpression + && node.object.type === Syntax.Identifier + && node.object.name === 'super'; +}; + +exports.visitorList = [ + visitClassDeclaration, + visitClassExpression, + visitClassFunctionExpression, + visitClassMethod, + visitPrivateIdentifier, + visitSuperCallExpression, + visitSuperMemberExpression +]; + +},{"../src/utils":20,"base62":7,"esprima-fb":6}],22:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* jshint browser: true */ +/* jslint evil: true */ + +'use strict'; +var runScripts; +var headEl; + +var transform = require('jstransform').transform; +var visitors = require('./fbtransform/visitors').transformVisitors; +var transform = transform.bind(null, visitors.react); +var docblock = require('jstransform/src/docblock'); + + +exports.transform = transform; + +exports.exec = function(code) { + return eval(transform(code).code); +}; + +if (typeof window === "undefined" || window === null) { + return; +} +headEl = document.getElementsByTagName('head')[0]; + +var run = exports.run = function(code) { + var jsx = docblock.parseAsObject(docblock.extract(code)).jsx; + + var functionBody = jsx ? transform(code).code : code; + var scriptEl = document.createElement('script'); + + scriptEl.innerHTML = functionBody; + headEl.appendChild(scriptEl); +}; + +var load = exports.load = function(url, callback) { + var xhr; + xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') + : new XMLHttpRequest(); + + // Disable async since we need to execute scripts in the order they are in the + // DOM to mirror normal script loading. + xhr.open('GET', url, false); + if ('overrideMimeType' in xhr) { + xhr.overrideMimeType('text/plain'); + } + xhr.onreadystatechange = function() { + if (xhr.readyState === 4) { + if (xhr.status === 0 || xhr.status === 200) { + run(xhr.responseText); + } else { + throw new Error("Could not load " + url); + } + if (callback) { + return callback(); + } + } + }; + return xhr.send(null); +}; + +runScripts = function() { + var scripts = document.getElementsByTagName('script'); + scripts = Array.prototype.slice.call(scripts); + var jsxScripts = scripts.filter(function(script) { + return script.type === 'text/jsx'; + }); + + console.warn("You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx"); + + jsxScripts.forEach(function(script) { + if (script.src) { + load(script.src); + } else { + run(script.innerHTML); + } + }); +}; + +if (window.addEventListener) { + window.addEventListener('DOMContentLoaded', runScripts, false); +} else { + window.attachEvent('onload', runScripts); +} + +},{"./fbtransform/visitors":26,"jstransform":19,"jstransform/src/docblock":18}],23:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9607,12 +12738,13 @@ exports.visitPrivateProperty = visitPrivateProperty; /*global exports:true*/ "use strict"; -var Syntax = require('esprima').Syntax; +var Syntax = require('esprima-fb').Syntax; -var catchup = require('../lib/utils').catchup; -var append = require('../lib/utils').append; -var move = require('../lib/utils').move; -var getDocblock = require('../lib/utils').getDocblock; +var catchup = require('jstransform/src/utils').catchup; +var catchupWhiteSpace = require('jstransform/src/utils').catchupWhiteSpace; +var append = require('jstransform/src/utils').append; +var move = require('jstransform/src/utils').move; +var getDocblock = require('jstransform/src/utils').getDocblock; var FALLBACK_TAGS = require('./xjs').knownTags; var renderXJSExpressionContainer = @@ -9634,11 +12766,6 @@ var quoteAttrName = require('./xjs').quoteAttrName; * javascript since "class" is not a valid object key in javascript. */ -var JSX_ATTRIBUTE_RENAMES = { - 'class': 'className', - cxName: 'className' -}; - var JSX_ATTRIBUTE_TRANSFORMS = { cxName: function(attr) { if (attr.value.type !== Syntax.Literal) { @@ -9684,7 +12811,7 @@ function visitReactTag(traverse, object, path, state) { throw new Error( 'Namespace attributes are not supported. ReactJSX is not XML.'); } - var name = JSX_ATTRIBUTE_RENAMES[attr.name.name] || attr.name.name; + var name = attr.name.name; var isFirst = index === 0; var isLast = index === object.attributes.length - 1; @@ -9701,19 +12828,21 @@ function visitReactTag(traverse, object, path, state) { if (!isLast) { append(',', state); } - } else if (JSX_ATTRIBUTE_TRANSFORMS[attr.name.name]) { - move(attr.value.range[0], state); - append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state); - move(attr.value.range[1], state); - if (!isLast) { - append(',', state); - } - } else if (attr.value.type === Syntax.Literal) { - move(attr.value.range[0], state); - renderXJSLiteral(attr.value, isLast, state); } else { - move(attr.value.range[0], state); - renderXJSExpressionContainer(traverse, attr.value, isLast, path, state); + move(attr.name.range[1], state); + // Use catchupWhiteSpace to skip over the '=' in the attribute + catchupWhiteSpace(attr.value.range[0], state); + if (JSX_ATTRIBUTE_TRANSFORMS[attr.name.name]) { + append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state); + move(attr.value.range[1], state); + if (!isLast) { + append(',', state); + } + } else if (attr.value.type === Syntax.Literal) { + renderXJSLiteral(attr.value, isLast, state); + } else { + renderXJSExpressionContainer(traverse, attr.value, isLast, path, state); + } } if (isLast) { @@ -9778,9 +12907,8 @@ visitReactTag.test = function(object, path, state) { exports.visitReactTag = visitReactTag; -})() -},{"../lib/utils":18,"./xjs":22,"esprima":4}],21:[function(require,module,exports){ -(function(){/** +},{"./xjs":25,"esprima-fb":6,"jstransform/src/utils":20}],24:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9798,10 +12926,10 @@ exports.visitReactTag = visitReactTag; /*global exports:true*/ "use strict"; -var Syntax = require('esprima').Syntax; -var catchup = require('../lib/utils').catchup; -var append = require('../lib/utils').append; -var getDocblock = require('../lib/utils').getDocblock; +var Syntax = require('esprima-fb').Syntax; +var catchup = require('jstransform/src/utils').catchup; +var append = require('jstransform/src/utils').append; +var getDocblock = require('jstransform/src/utils').getDocblock; /** * Transforms the following: @@ -9844,9 +12972,8 @@ visitReactDisplayName.test = function(object, path, state) { exports.visitReactDisplayName = visitReactDisplayName; -})() -},{"../lib/utils":18,"esprima":4}],22:[function(require,module,exports){ -(function(){/** +},{"esprima-fb":6,"jstransform/src/utils":20}],25:[function(require,module,exports){ +/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9863,10 +12990,10 @@ exports.visitReactDisplayName = visitReactDisplayName; */ /*global exports:true*/ "use strict"; -var append = require('../lib/utils').append; -var catchup = require('../lib/utils').catchup; -var move = require('../lib/utils').move; -var Syntax = require('esprima').Syntax; +var append = require('jstransform/src/utils').append; +var catchup = require('jstransform/src/utils').catchup; +var move = require('jstransform/src/utils').move; +var Syntax = require('esprima-fb').Syntax; var knownTags = { a: true, @@ -10020,6 +13147,7 @@ function trimWithSingleSpace(string) { function renderXJSLiteral(object, isLast, state, start, end) { /** Added blank check filtering and triming*/ var trimmedChildValue = safeTrim(object.value); + var hasFinalNewLine = false; if (trimmedChildValue) { // head whitespace @@ -10039,7 +13167,7 @@ function renderXJSLiteral(object, isLast, state, start, end) { }); var hasInitialNewLine = initialLines[0] !== lines[0]; - var hasFinalNewLine = + hasFinalNewLine = initialLines[initialLines.length - 1] !== lines[lines.length - 1]; var numLines = lines.length; @@ -10051,20 +13179,18 @@ function renderXJSLiteral(object, isLast, state, start, end) { } else { var preString = ''; var postString = ''; - var leading = ''; + var leading = line.match(/^[ \t]*/)[0]; if (ii === 0) { if (hasInitialNewLine) { preString = ' '; - leading = '\n'; + leading = '\n' + leading; } if (trimmedChildValueWithSpace.substring(0, 1) === ' ') { // If this is the first line, and the original content starts with // whitespace, place a single space at the beginning. preString = ' '; } - } else { - leading = line.match(/^[ \t]*/)[0]; } if (!lastLine || trimmedChildValueWithSpace.substr( trimmedChildValueWithSpace.length - 1, 1) === ' ' || @@ -10104,6 +13230,9 @@ function renderXJSLiteral(object, isLast, state, start, end) { } // tail whitespace + if (hasFinalNewLine) { + append('\n', state); + } append(object.value.match(/[ \t]*$/)[0], state); move(object.range[1], state); } @@ -10137,10 +13266,9 @@ exports.renderXJSExpressionContainer = renderXJSExpressionContainer; exports.renderXJSLiteral = renderXJSLiteral; exports.quoteAttrName = quoteAttrName; -})() -},{"../lib/utils":18,"esprima":4}],23:[function(require,module,exports){ -(function(){/*global exports:true*/ -var classes = require('./transforms/classes'); +},{"esprima-fb":6,"jstransform/src/utils":20}],26:[function(require,module,exports){ +/*global exports:true*/ +var es6Classes = require('jstransform/visitors/es6-class-visitors').visitorList; var react = require('./transforms/react'); var reactDisplayName = require('./transforms/reactDisplayName'); @@ -10148,21 +13276,13 @@ var reactDisplayName = require('./transforms/reactDisplayName'); * Map from transformName => orderedListOfVisitors. */ var transformVisitors = { - 'es6-classes': [ - classes.visitClassExpression, - classes.visitClassDeclaration, - classes.visitSuperCall, - classes.visitPrivateProperty + 'es6-classes': es6Classes, + 'react': [ + react.visitReactTag, + reactDisplayName.visitReactDisplayName ] }; -transformVisitors.react = transformVisitors[ - "es6-classes" -].concat([ - react.visitReactTag, - reactDisplayName.visitReactDisplayName -]); - /** * Specifies the order in which each transform should run. */ @@ -10191,7 +13311,7 @@ function getVisitorsList(excludes) { exports.getVisitorsList = getVisitorsList; exports.transformVisitors = transformVisitors; -})() -},{"./transforms/classes":19,"./transforms/react":20,"./transforms/reactDisplayName":21}]},{},[15])(15) +},{"./transforms/react":23,"./transforms/reactDisplayName":24,"jstransform/visitors/es6-class-visitors":21}]},{},[22]) +(22) }); ; \ No newline at end of file diff --git a/js/live_editor.js b/js/live_editor.js index 68453e1077..dee550959a 100644 --- a/js/live_editor.js +++ b/js/live_editor.js @@ -44,7 +44,7 @@ var CodeMirrorEditor = React.createClass({displayName: 'CodeMirrorEditor', } return ( - React.DOM.div( {className:this.props.className}, + React.DOM.div( {class:this.props.className}, editor ) ); @@ -76,22 +76,22 @@ var ReactPlayground = React.createClass({displayName: 'ReactPlayground', content = CodeMirrorEditor( {onChange:this.bindState('code'), - className:"playgroundStage", + class:"playgroundStage", codeText:this.state.code} ); } else if (this.state.mode === this.MODES.JS) { content = - React.DOM.div( {className:"playgroundJS playgroundStage"}, + React.DOM.div( {class:"playgroundJS playgroundStage"}, this.getDesugaredCode() ); } return ( - React.DOM.div( {className:"playground"}, - React.DOM.div( {className:"playgroundCode"}, + React.DOM.div( {class:"playground"}, + React.DOM.div( {class:"playgroundCode"}, content ), - React.DOM.div( {className:"playgroundPreview"}, + React.DOM.div( {class:"playgroundPreview"}, React.DOM.div( {ref:"mount"} ) ) ) @@ -121,7 +121,7 @@ var ReactPlayground = React.createClass({displayName: 'ReactPlayground', } } catch (e) { React.renderComponent( - React.DOM.div( {content:e.toString(), className:"playgroundError"} ), + React.DOM.div( {content:e.toString(), class:"playgroundError"} ), mountNode ); } diff --git a/js/react.min.js b/js/react.min.js index 2c015f13ea..4e190f159d 100644 --- a/js/react.min.js +++ b/js/react.min.js @@ -1,5 +1,5 @@ /** - * React v0.4.1 + * React v0.5.0 * * Copyright 2013 Facebook, Inc. * @@ -15,6 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -!function(e){if("function"==typeof bootstrap)bootstrap("react",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeReact=e}else"undefined"!=typeof window?window.React=e():global.React=e()}(function(){return function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var a="function"==typeof require&&require;if(!i&&a)return a(n,!0);if(o)return o(n,!0);throw new Error("Cannot find module '"+n+"'")}var s=t[n]={exports:{}};e[n][0].call(s.exports,function(t){var o=e[n][1][t];return r(o?o:t)},s,s.exports)}return t[n].exports}for(var o="function"==typeof require&&require,i=0;i8));var _=!1;E.canUseDOM&&(_=D("input")&&(!("documentMode"in document)||document.documentMode>9));var x={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0},A={get:function(){return N.get.call(this)},set:function(e){T=""+e,N.set.call(this,e)}},w={eventTypes:O,extractEvents:function(e,t,r,o){var i,l;if(n(t)?S?i=a:l=s:u(t)?_?i=d:(i=f,l=h):v(t)&&(i=m),i){var c=i(e,t,r);if(c){var p=M.getPooled(O.change,c,o);return C.accumulateTwoPhaseDispatches(p),p}}l&&l(e,t,r)}};t.exports=w}()},{"./EventConstants":13,"./EventPluginHub":15,"./EventPropagators":18,"./ExecutionEnvironment":19,"./SyntheticEvent":51,"./isEventSupported":79,"./keyOf":82}],6:[function(e,t){!function(){"use strict";var n=e("./Danger"),r=e("./insertNodeAt"),o=e("./keyOf");e("./throwIf");var i=o({moveFrom:null}),a=o({insertMarkup:null}),s=o({removeAt:null}),u=function(e,t){for(var n,r,o,a=0;aa;a++)o=r(e,t[0],o||n)}function i(e,t,r){var i=n(t),a=r?e.childNodes[r-1]:null;o(e,i,a)}function a(e,t){var r=e.parentNode,o=n(t);r.replaceChild(o[0],e)}var s=e("./ExecutionEnvironment");e("./throwIf");var u=s.canUseDOM?document.createElement("div"):null,l={option:[1,'"],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "]};l.optgroup=l.option,l.tbody=l.thead,l.tfoot=l.thead,l.colgroup=l.thead,l.caption=l.thead,l.th=l.td;var c=[1,"?
    ","
    "];if(u){for(var p in l)l.hasOwnProperty(p)&&(u.innerHTML="<"+p+">",u.firstChild&&(l[p]=null));u.innerHTML="",u.firstChild&&(c=null)}var d={dangerouslyInsertMarkupAt:i,dangerouslyReplaceNodeWithMarkup:a};t.exports=d},{"./ExecutionEnvironment":19,"./throwIf":89}],10:[function(e,t){"use strict";var n=e("./DOMProperty"),r=n.injection.MUST_USE_ATTRIBUTE,o=n.injection.MUST_USE_PROPERTY,i=n.injection.HAS_BOOLEAN_VALUE,a=n.injection.HAS_SIDE_EFFECTS,s={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accessKey:null,accept:null,action:null,ajaxify:r,allowFullScreen:r|i,allowTransparency:r,alt:null,autoComplete:null,autoFocus:i,autoPlay:i,cellPadding:null,cellSpacing:null,checked:o|i,className:o,colSpan:null,contentEditable:null,contextMenu:r,controls:o|i,data:null,dateTime:r,dir:null,disabled:o|i,draggable:null,encType:null,frameBorder:r,height:r,hidden:r|i,href:null,htmlFor:null,icon:null,id:o,label:null,lang:null,list:null,max:null,maxLength:r,method:null,min:null,multiple:o|i,name:null,pattern:null,poster:null,preload:null,placeholder:null,radioGroup:null,rel:null,readOnly:o|i,required:i,role:r,scrollLeft:o,scrollTop:o,selected:o|i,size:null,spellCheck:null,src:null,step:null,style:null,tabIndex:null,target:null,title:null,type:null,value:o|a,width:r,wmode:r,cx:o,cy:o,d:o,fill:o,fx:o,fy:o,points:o,r:o,stroke:o,strokeLinecap:o,strokeWidth:o,transform:o,x:o,x1:o,x2:o,version:o,viewBox:o,y:o,y1:o,y2:o,spreadMethod:o,offset:o,stopColor:o,stopOpacity:o,gradientUnits:o,gradientTransform:o},DOMAttributeNames:{className:"class",htmlFor:"for",strokeLinecap:"stroke-linecap",strokeWidth:"stroke-width",stopColor:"stop-color",stopOpacity:"stop-opacity"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",encType:"enctype",radioGroup:"radiogroup",spellCheck:"spellcheck"},DOMMutationMethods:{className:function(e,t){e.className=t||""}}};t.exports=s},{"./DOMProperty":7}],11:[function(e,t){"use strict";var n=e("./keyOf"),r=[n({ResponderEventPlugin:null}),n({SimpleEventPlugin:null}),n({TapEventPlugin:null}),n({EnterLeaveEventPlugin:null}),n({ChangeEventPlugin:null}),n({AnalyticsEventPlugin:null}),n({MobileSafariClickEventPlugin:null})];t.exports=r},{"./keyOf":82}],12:[function(e,t){!function(){"use strict";var n=e("./EventConstants"),r=e("./EventPropagators"),o=e("./ExecutionEnvironment"),i=e("./SyntheticMouseEvent"),a=e("./ReactMount"),s=e("./keyOf"),u=n.topLevelTypes,l=a.getFirstReactDOM,c={mouseEnter:{registrationName:s({onMouseEnter:null})},mouseLeave:{registrationName:s({onMouseLeave:null})}},p={eventTypes:c,extractEvents:function(e,t,n,s){if(e===u.topMouseOver&&(s.relatedTarget||s.fromElement))return null;if(e!==u.topMouseOut&&e!==u.topMouseOver)return null;var p,d;if(e===u.topMouseOut?(p=t,d=l(s.relatedTarget||s.toElement)||o.global):(p=o.global,d=t),p===d)return null;var h=p?a.getID(p):"",f=d?a.getID(d):"",v=i.getPooled(c.mouseLeave,h,s),m=i.getPooled(c.mouseEnter,f,s);return r.accumulateEnterLeaveDispatches(v,m,h,f),[v,m]}};t.exports=p}()},{"./EventConstants":13,"./EventPropagators":18,"./ExecutionEnvironment":19,"./ReactMount":39,"./SyntheticMouseEvent":54,"./keyOf":82}],13:[function(e,t){"use strict";var n=e("./keyMirror"),r=n({bubbled:null,captured:null}),o=n({topBlur:null,topChange:null,topClick:null,topDOMCharacterDataModified:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),i={topLevelTypes:o,PropagationPhases:r};t.exports=i},{"./keyMirror":81}],14:[function(e,t){var n={listen:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)},capture:function(e,t,n){e.addEventListener&&e.addEventListener(t,n,!0)}};t.exports=n},{}],15:[function(e,t){"use strict";var n=e("./CallbackRegistry"),r=e("./EventPluginRegistry"),o=e("./EventPluginUtils"),i=e("./EventPropagators"),a=e("./ExecutionEnvironment"),s=e("./accumulate"),u=e("./forEachAccumulated"),l=e("./invariant"),c=null,p=function(e){if(e){var t=o.executeDispatch,n=r.getPluginModuleForEvent(e);n&&n.executeDispatch&&(t=n.executeDispatch),o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},d={injection:{injectInstanceHandle:i.injection.injectInstanceHandle,injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},registrationNames:r.registrationNames,putListener:n.putListener,getListener:n.getListener,deleteListener:n.deleteListener,deleteAllListeners:n.deleteAllListeners,extractEvents:function(e,t,n,o){for(var i,a=r.plugins,u=0,l=a.length;l>u;u++){var c=a[u];if(c){var p=c.extractEvents(e,t,n,o);p&&(i=s(i,p))}}return i},enqueueEvents:function(e){e&&(c=s(c,e))},processEventQueue:function(){var e=c;c=null,u(e,p),l(!c)}};a.canUseDOM&&(window.EventPluginHub=d),t.exports=d},{"./CallbackRegistry":4,"./EventPluginRegistry":16,"./EventPluginUtils":17,"./EventPropagators":18,"./ExecutionEnvironment":19,"./accumulate":61,"./forEachAccumulated":70,"./invariant":78}],16:[function(e,t){"use strict";function n(){if(a)for(var e in s){var t=s[e],n=a.indexOf(e);if(i(n>-1),!u.plugins[n]){i(t.extractEvents),u.plugins[n]=t;var o=t.eventTypes;for(var l in o)i(r(o[l],t))}}}function r(e,t){var n=e.phasedRegistrationNames;if(n){for(var r in n)if(n.hasOwnProperty(r)){var i=n[r];o(i,t)}return!0}return e.registrationName?(o(e.registrationName,t),!0):!1}function o(e,t){i(!u.registrationNames[e]),u.registrationNames[e]=t,u.registrationNamesKeys.push(e)}var i=e("./invariant"),a=null,s={},u={plugins:[],registrationNames:{},registrationNamesKeys:[],injectEventPluginOrder:function(e){i(!a),a=Array.prototype.slice.call(e),n()},injectEventPluginsByName:function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];s[r]!==o&&(i(!s[r]),s[r]=o,t=!0)}t&&n()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNames[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNames[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){a=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];u.plugins.length=0;var t=u.registrationNames;for(var n in t)t.hasOwnProperty(n)&&delete t[n];u.registrationNamesKeys.length=0}};t.exports=u},{"./invariant":78}],17:[function(e,t){"use strict";function n(e){return e===h.topMouseUp||e===h.topTouchEnd||e===h.topTouchCancel}function r(e){return e===h.topMouseMove||e===h.topTouchMove}function o(e){return e===h.topMouseDown||e===h.topTouchStart}function i(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o1){for(var o=Array(n),i=0;n>i;i++)o[i]=arguments[i+1];this.props.children=o}},mountComponent:function(e){c(!this.isMounted());var t=this.props;null!=t.ref&&s.addComponentAsRefTo(this,t.ref,t[h]),this._rootNodeID=e,this._lifeCycleState=f.MOUNTED},unmountComponent:function(){c(this.isMounted());var e=this.props;null!=e.ref&&s.removeComponentAsRefFrom(this,e.ref,e[h]),a.purgeID(this._rootNodeID),this._rootNodeID=null,this._lifeCycleState=f.UNMOUNTED},receiveProps:function(e,t){c(this.isMounted()),this._pendingProps=e,this._performUpdateIfNecessary(t)},performUpdateIfNecessary:function(){var e=v.ReactReconcileTransaction.getPooled();e.perform(this._performUpdateIfNecessary,this,e),v.ReactReconcileTransaction.release(e)},_performUpdateIfNecessary:function(e){if(null!=this._pendingProps){var t=this.props;this.props=this._pendingProps,this._pendingProps=null,this.updateComponent(e,t)}},updateComponent:function(e,t){var n=this.props;(n[h]!==t[h]||n.ref!==t.ref)&&(null!=t.ref&&s.removeComponentAsRefFrom(this,t.ref,t[h]),null!=n.ref&&s.addComponentAsRefTo(this,n.ref,n[h]))},mountComponentIntoNode:function(e,t,n){var r=v.ReactReconcileTransaction.getPooled();r.perform(this._mountComponentIntoNode,this,e,t,r,n),v.ReactReconcileTransaction.release(r)},_mountComponentIntoNode:function(e,t,r,o){c(t&&1===t.nodeType);var a=this.mountComponent(e,r);if(!o||!i.canReuseMarkup(a,n(t))){var s=t.parentNode;if(s){var u=t.nextSibling;s.removeChild(t),t.innerHTML=a,u?s.insertBefore(t,u):s.appendChild(t)}else t.innerHTML=a}},unmountComponentFromNode:function(e){for(this.unmountComponent();e.lastChild;)e.removeChild(e.lastChild)},isOwnedBy:function(e){return this.props[h]===e},getSiblingByRef:function(e){var t=this.props[h];return t&&t.refs?t.refs[e]:null}}};t.exports=v},{"./ReactCurrentOwner":25,"./ReactDOMIDOperations":28,"./ReactMarkupChecksum":38,"./ReactMount":39,"./ReactOwner":43,"./ReactReconcileTransaction":46,"./ReactUpdates":49,"./getReactRootElementInContainer":73,"./invariant":78,"./keyMirror":81,"./merge":84}],24:[function(e,t){!function(){"use strict";function n(e,t){var n=m[t];C.hasOwnProperty(t)&&p(n===v.OVERRIDE_BASE),e.hasOwnProperty(t)&&p(n===v.DEFINE_MANY)}function r(e){var t=e._compositeLifeCycleState;p(e.isMounted()||t===y.MOUNTING),p(t!==y.RECEIVING_STATE&&t!==y.UNMOUNTING)}function o(e,t){var r=e.prototype;for(var o in t){var a=t[o];if(t.hasOwnProperty(o)&&a)if(n(r,o),g.hasOwnProperty(o))g[o](e,a);else{var s=o in m,u=o in r,l=a.__reactDontBind,c="function"==typeof a,p=c&&!s&&!u&&!l;p?(r.__reactAutoBindMap||(r.__reactAutoBindMap={}),r.__reactAutoBindMap[o]=a,r[o]=a):r[o]=u?i(r[o],a):a}}}function i(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}var a=e("./ReactComponent"),s=e("./ReactCurrentOwner"),u=e("./ReactOwner"),l=e("./ReactPropTransferer"),c=e("./ReactUpdates"),p=e("./invariant"),d=e("./keyMirror"),h=e("./merge"),f=e("./mixInto"),v=d({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null}),m={mixins:v.DEFINE_MANY,propTypes:v.DEFINE_ONCE,getDefaultProps:v.DEFINE_ONCE,getInitialState:v.DEFINE_ONCE,render:v.DEFINE_ONCE,componentWillMount:v.DEFINE_MANY,componentDidMount:v.DEFINE_MANY,componentWillReceiveProps:v.DEFINE_MANY,shouldComponentUpdate:v.DEFINE_ONCE,componentWillUpdate:v.DEFINE_MANY,componentDidUpdate:v.DEFINE_MANY,componentWillUnmount:v.DEFINE_MANY,updateComponent:v.OVERRIDE_BASE},g={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;nn;n++){var o=this.props.multiple?t.indexOf(e[n].value)>=0:o=e[n].value===t;o!==e[n].selected&&(e[n].selected=o)}}var o=e("./ReactCompositeComponent"),i=e("./ReactDOM"),a=e("./invariant"),s=e("./merge"),u=i.select,l=o.createClass({propTypes:{defaultValue:n,value:n},getInitialState:function(){return{value:this.props.defaultValue||(this.props.multiple?[]:"")}},componentWillReceiveProps:function(e){!this.props.multiple&&e.multiple?this.setState({value:[this.state.value]}):this.props.multiple&&!e.multiple&&this.setState({value:this.state.value[0]})},shouldComponentUpdate:function(){return!this._isChanging},render:function(){var e=s(this.props);return e.onChange=this.handleChange,e.value=null,u(e,this.props.children)},componentDidMount:r,componentDidUpdate:r,handleChange:function(e){var t;this.props.onChange&&(this._isChanging=!0,t=this.props.onChange(e),this._isChanging=!1);var n;if(this.props.multiple){n=[];for(var r=e.target.options,o=0,i=r.length;i>o;o++)r[o].selected&&n.push(r[o].value)}else n=e.target.value;return this.setState({value:n}),t}});t.exports=l},{"./ReactCompositeComponent":24,"./ReactDOM":26,"./invariant":78,"./merge":84}],32:[function(e,t){"use strict";var n=e("./DOMPropertyOperations"),r=e("./ReactCompositeComponent"),o=e("./ReactDOM"),i=e("./invariant"),a=e("./merge"),s=o.textarea,u={string:!0,number:!0},l=r.createClass({getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;return null!=t&&(i(null==e),Array.isArray(t)&&(i(t.length<=1),t=t[0]),i(u[typeof t]),e=""+t),e=e||"",{initialValue:null!=this.props.value?this.props.value:e,value:e}},shouldComponentUpdate:function(){return!this._isChanging},getValue:function(){return null!=this.props.value?this.props.value:this.state.value},render:function(){var e=a(this.props);return i(null==e.dangerouslySetInnerHTML),e.value=this.getValue(),e.onChange=this.handleChange,s(e,this.state.initialValue)},componentDidUpdate:function(e,t,r){null!=this.props.value&&n.setValueForProperty(r,"value",this.props.value||"")},handleChange:function(e){var t;return this.props.onChange&&(this._isChanging=!0,t=this.props.onChange(e),this._isChanging=!1),this.setState({value:e.target.value}),t}});t.exports=l},{"./DOMPropertyOperations":8,"./ReactCompositeComponent":24,"./ReactDOM":26,"./invariant":78,"./merge":84}],33:[function(e,t){"use strict";function n(){l.TopLevelCallbackCreator=c,m.injection.injectEventPluginOrder(h),m.injection.injectInstanceHandle(g),m.injection.injectEventPluginsByName({SimpleEventPlugin:y,EnterLeaveEventPlugin:f,ChangeEventPlugin:v,MobileSafariClickEventPlugin:C}),r.injection.injectComponentClasses({form:o,input:i,option:a,select:s,textarea:u}),d.injection.injectDOMPropertyConfig(p)}var r=e("./ReactDOM"),o=e("./ReactDOMForm"),i=e("./ReactDOMInput"),a=e("./ReactDOMOption"),s=e("./ReactDOMSelect"),u=e("./ReactDOMTextarea"),l=e("./ReactEventEmitter"),c=e("./ReactEventTopLevelCallback"),p=e("./DefaultDOMPropertyConfig"),d=e("./DOMProperty"),h=e("./DefaultEventPluginOrder"),f=e("./EnterLeaveEventPlugin"),v=e("./ChangeEventPlugin"),m=e("./EventPluginHub"),g=e("./ReactInstanceHandles"),y=e("./SimpleEventPlugin"),C=e("./MobileSafariClickEventPlugin");t.exports={inject:n}},{"./ChangeEventPlugin":5,"./DOMProperty":7,"./DefaultDOMPropertyConfig":10,"./DefaultEventPluginOrder":11,"./EnterLeaveEventPlugin":12,"./EventPluginHub":15,"./MobileSafariClickEventPlugin":20,"./ReactDOM":26,"./ReactDOMForm":27,"./ReactDOMInput":29,"./ReactDOMOption":30,"./ReactDOMSelect":31,"./ReactDOMTextarea":32,"./ReactEventEmitter":34,"./ReactEventTopLevelCallback":35,"./ReactInstanceHandles":37,"./SimpleEventPlugin":50}],34:[function(e,t){!function(){"use strict";function n(e,t,n){s.listen(n,t,v.TopLevelCallbackCreator.createTopLevelCallback(e))}function r(e,t,n){s.capture(n,t,v.TopLevelCallbackCreator.createTopLevelCallback(e))}function o(){var e=p.refreshScrollValues;s.listen(window,"scroll",e),s.listen(window,"resize",e)}function i(e){d(!f);var t=a.topLevelTypes,i=document;o(),n(t.topMouseOver,"mouseover",i),n(t.topMouseDown,"mousedown",i),n(t.topMouseUp,"mouseup",i),n(t.topMouseMove,"mousemove",i),n(t.topMouseOut,"mouseout",i),n(t.topClick,"click",i),n(t.topDoubleClick,"dblclick",i),e&&(n(t.topTouchStart,"touchstart",i),n(t.topTouchEnd,"touchend",i),n(t.topTouchMove,"touchmove",i),n(t.topTouchCancel,"touchcancel",i)),n(t.topKeyUp,"keyup",i),n(t.topKeyPress,"keypress",i),n(t.topKeyDown,"keydown",i),n(t.topInput,"input",i),n(t.topChange,"change",i),n(t.topSelectionChange,"selectionchange",i),n(t.topDOMCharacterDataModified,"DOMCharacterDataModified",i),h("drag")&&(n(t.topDrag,"drag",i),n(t.topDragEnd,"dragend",i),n(t.topDragEnter,"dragenter",i),n(t.topDragExit,"dragexit",i),n(t.topDragLeave,"dragleave",i),n(t.topDragOver,"dragover",i),n(t.topDragStart,"dragstart",i),n(t.topDrop,"drop",i)),h("wheel")?n(t.topWheel,"wheel",i):h("mousewheel")?n(t.topWheel,"mousewheel",i):n(t.topWheel,"DOMMouseScroll",i),h("scroll",!0)?r(t.topScroll,"scroll",i):n(t.topScroll,"scroll",window),h("focus",!0)?(r(t.topFocus,"focus",i),r(t.topBlur,"blur",i)):h("focusin")&&(n(t.topFocus,"focusin",i),n(t.topBlur,"focusout",i))}var a=e("./EventConstants"),s=e("./EventListener"),u=e("./EventPluginHub"),l=e("./ExecutionEnvironment"),c=e("./ReactUpdates"),p=e("./ViewportMetrics"),d=e("./invariant"),h=e("./isEventSupported"),f=!1,v={TopLevelCallbackCreator:null,ensureListening:function(e){d(l.canUseDOM),d(v.TopLevelCallbackCreator),f||(i(e),f=!0)},setEnabled:function(e){d(l.canUseDOM),v.TopLevelCallbackCreator&&v.TopLevelCallbackCreator.setEnabled(e)},isEnabled:function(){return!(!v.TopLevelCallbackCreator||!v.TopLevelCallbackCreator.isEnabled())},handleTopLevel:function(e,t,n,r){var o=u.extractEvents(e,t,n,r);c.batchedUpdates(function(){u.enqueueEvents(o),u.processEventQueue()})},registrationNames:u.registrationNames,putListener:u.putListener,getListener:u.getListener,deleteListener:u.deleteListener,deleteAllListeners:u.deleteAllListeners,trapBubbledEvent:n,trapCapturedEvent:r};t.exports=v}()},{"./EventConstants":13,"./EventListener":14,"./EventPluginHub":15,"./ExecutionEnvironment":19,"./ReactUpdates":49,"./ViewportMetrics":60,"./invariant":78,"./isEventSupported":79}],35:[function(e,t){!function(){"use strict";var n=e("./ExecutionEnvironment"),r=e("./ReactEventEmitter"),o=e("./ReactMount"),i=e("./getEventTarget"),a=!0,s={setEnabled:function(e){a=!!e},isEnabled:function(){return a},createTopLevelCallback:function(e){return function(t){if(a){t.srcElement&&t.srcElement!==t.target&&(t.target=t.srcElement);var s=o.getFirstReactDOM(i(t))||n.global,u=o.getID(s)||"";r.handleTopLevel(e,s,u,t)}}}};t.exports=s}()},{"./ExecutionEnvironment":19,"./ReactEventEmitter":34,"./ReactMount":39,"./getEventTarget":72}],36:[function(e,t){"use strict";function n(){try{return document.activeElement}catch(e){}}function r(e){return document.documentElement.contains(e)}var o={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=n();return{focusedElem:e,selectionRange:o.hasSelectionCapabilities(e)?o.getSelection(e):null}},restoreSelection:function(e){var t=n(),i=e.focusedElem,a=e.selectionRange;t!==i&&r(i)&&(o.hasSelectionCapabilities(i)&&o.setSelection(i,a),i.focus())},getSelection:function(e){var t;if("true"===e.contentEditable&&window.getSelection){t=window.getSelection().getRangeAt(0);var n=t.commonAncestorContainer;return n&&3===n.nodeType&&(n=n.parentNode),n!==e?{start:0,end:0}:{start:t.startOffset,end:t.endOffset}}if(!document.selection)return{start:e.selectionStart,end:e.selectionEnd};if(t=document.selection.createRange(),t.parentElement()!==e)return{start:0,end:0};var r=e.value.length;if("INPUT"===e.nodeName)return{start:-t.moveStart("character",-r),end:-t.moveEnd("character",-r)};var o=t.duplicate();o.moveToElementText(e),o.setEndPoint("StartToEnd",t);var i=r-o.text.length;return o.setEndPoint("StartToStart",t),{start:r-o.text.length,end:i}},setSelection:function(e,t){var n,r=t.start,o=t.end;if("undefined"==typeof o&&(o=r),document.selection){if("TEXTAREA"===e.tagName){var i=(e.value.slice(0,r).match(/\r/g)||[]).length,a=(e.value.slice(r,o).match(/\r/g)||[]).length;r-=i,o-=i+a}n=e.createTextRange(),n.collapse(!0),n.moveStart("character",r),n.moveEnd("character",o-r),n.select()}else if("true"===e.contentEditable){if(1===e.childNodes.length){n=document.createRange(),n.setStart(e.childNodes[0],r),n.setEnd(e.childNodes[0],o);var s=window.getSelection();s.removeAllRanges(),s.addRange(n)}}else e.selectionStart=r,e.selectionEnd=Math.min(o,e.value.length),e.focus()}};t.exports=o},{}],37:[function(e,t){"use strict";function n(e){return p+"r["+e.toString(36)+"]"}function r(e,t){return e.charAt(t)===p||t===e.length}function o(e){return""===e||e.charAt(0)===p&&e.charAt(e.length-1)!==p}function i(e,t){return 0===t.indexOf(e)&&r(t,e.length)}function a(e){return e?e.substr(0,e.lastIndexOf(p)):""}function s(e,t){if(c(o(e)&&o(t)),c(i(e,t)),e===t)return e;for(var n=e.length+d,a=n;a=a;a++)if(r(e,a)&&r(t,a))i=a;else if(e.charAt(a)!==t.charAt(a))break;var s=e.substr(0,i);return c(o(s)),s}function l(e,t,n,r,o,u){e=e||"",t=t||"",c(e!==t);var l=i(t,e);c(l||i(e,t));for(var p=0,d=l?a:s,f=e;o&&f===e||u&&f===t||n(f,l,r),f!==t;f=d(f,t))c(p++"," "+r.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var o=t.getAttribute(r.CHECKSUM_ATTR_NAME);o=o&&parseInt(o,10);var i=n(e);return i===o}};t.exports=r},{"./adler32":62}],39:[function(e,t){!function(){"use strict";function n(e){var t=p(e);return t&&E.getID(t)}function r(e){var t=o(e);if(t)if(m.hasOwnProperty(t)){var n=m[t];n!==e&&(c(!s(n,t)),m[t]=e)}else m[t]=e;return t}function o(e){return e&&e.getAttribute&&e.getAttribute(v)||""}function i(e,t){var n=o(e);n!==t&&delete m[n],e.setAttribute(v,t),m[t]=e}function a(e){return m.hasOwnProperty(e)&&s(m[e],e)||(m[e]=E.findReactNodeByID(e)),m[e]}function s(e,t){if(e){c(o(e)===t);var n=E.findReactContainerForID(t);if(n&&u(n,e))return!0}return!1}function u(e,t){if(e.contains)return e.contains(t);if(t===e)return!0;for(3===t.nodeType&&(t=t.parentNode);t&&1===t.nodeType;){if(t===e)return!0;t=t.parentNode}return!1}function l(e){delete m[e]}var c=e("./invariant"),p=e("./getReactRootElementInContainer"),d=e("./ReactEventEmitter"),h=e("./ReactInstanceHandles"),f=h.SEPARATOR,v="data-reactid",m={},g=e("./$"),y={},C={},E={totalInstantiationTime:0,totalInjectionTime:0,useTouchEvents:!1,scrollMonitor:function(e,t){t()},prepareTopLevelEvents:function(){d.ensureListening(E.useTouchEvents)},_updateRootComponent:function(e,t,n,r){var o=t.props;return E.scrollMonitor(n,function(){e.replaceProps(o,r)}),e},_registerComponent:function(e,t){E.prepareTopLevelEvents();var n=E.registerContainer(t);return y[n]=e,n},_renderNewRootComponent:function(e,t,n){var r=E._registerComponent(e,t);return e.mountComponentIntoNode(r,t,n),e},renderComponent:function(e,t,r){var o=y[n(t)];if(o){if(o.constructor===e.constructor)return E._updateRootComponent(o,e,t,r);E.unmountAndReleaseReactRootNode(t)}var i=p(t),a=i&&E.isRenderedByReact(i),s=a&&!o,u=E._renderNewRootComponent(e,t,s);return r&&r(),u},constructAndRenderComponent:function(e,t,n){return E.renderComponent(e(t),n)},constructAndRenderComponentByID:function(e,t,n){return E.constructAndRenderComponent(e,t,g(n))},registerContainer:function(e){var t=n(e);return t&&(t=h.getReactRootIDFromNodeID(t)),t||(t=h.createReactRootID()),C[t]=e,t},unmountAndReleaseReactRootNode:function(e){var t=n(e),r=y[t];return r?(r.unmountComponentFromNode(e),delete y[t],delete C[t],!0):!1},findReactContainerForID:function(e){var t=h.getReactRootIDFromNodeID(e),n=C[t];return n},findReactNodeByID:function(e){var t=E.findReactContainerForID(e);return E.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=E.getID(e);return t?t.charAt(0)===f:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(E.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){for(var n=[e.firstChild],r=0;r",this.tagName=e.toUpperCase()}var o=e("./CSSPropertyOperations"),i=e("./DOMProperty"),a=e("./DOMPropertyOperations"),s=e("./ReactComponent"),u=e("./ReactEventEmitter"),l=e("./ReactMultiChild"),c=e("./ReactMount"),p=e("./escapeTextForBrowser"),d=e("./flattenChildren"),h=e("./invariant"),f=e("./keyOf"),v=e("./merge"),m=e("./mixInto"),g=u.putListener,y=u.deleteListener,C=u.registrationNames,E={string:!0,number:!0},M=f({dangerouslySetInnerHTML:null}),D=f({style:null});r.Mixin={mountComponent:function(e,t){return s.Mixin.mountComponent.call(this,e,t),n(this.props),this._createOpenTagMarkup()+this._createContentMarkup(t)+this._tagClose},_createOpenTagMarkup:function(){var e=this.props,t=this._tagOpen;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(null!=r)if(C[n])g(this._rootNodeID,n,r);else{n===D&&(r&&(r=e.style=v(e.style)),r=o.createMarkupForStyles(r));var i=a.createMarkupForProperty(n,r);i&&(t+=" "+i)}}var s=p(this._rootNodeID);return t+" "+c.ATTR_NAME+'="'+s+'">'},_createContentMarkup:function(e){var t=this.props.dangerouslySetInnerHTML;if(null!=t){if(null!=t.__html)return t.__html}else{var n=E[typeof this.props.children]?this.props.children:null,r=null!=n?null:this.props.children;if(null!=n)return p(n);if(null!=r)return this.mountMultiChild(d(r),e)}return""},receiveProps:function(e,t){n(e),s.Mixin.receiveProps.call(this,e,t)},updateComponent:function(e,t){s.Mixin.updateComponent.call(this,e,t),this._updateDOMProperties(t),this._updateDOMChildren(t,e)},_updateDOMProperties:function(e){var t,n,r,o=this.props;for(t in e)if(!o.hasOwnProperty(t)&&e.hasOwnProperty(t))if(t===D){var a=e[t];for(n in a)a.hasOwnProperty(n)&&(r=r||{},r[n]="")}else t===M?s.DOMIDOperations.updateTextContentByID(this._rootNodeID,""):C[t]?y(this._rootNodeID,t):s.DOMIDOperations.deletePropertyByID(this._rootNodeID,t);for(t in o){var u=o[t],l=e[t];if(o.hasOwnProperty(t)&&u!==l)if(t===D)if(u&&(u=o.style=v(u)),l){for(n in l)l.hasOwnProperty(n)&&!u.hasOwnProperty(n)&&(r=r||{},r[n]="");for(n in u)u.hasOwnProperty(n)&&l[n]!==u[n]&&(r=r||{},r[n]=u[n])}else r=u;else if(t===M){var c=l&&l.__html,p=u&&u.__html;c!==p&&s.DOMIDOperations.updateInnerHTMLByID(this._rootNodeID,u)}else C[t]?g(this._rootNodeID,t,u):(i.isStandardName[t]||i.isCustomAttribute(t))&&s.DOMIDOperations.updatePropertyByID(this._rootNodeID,t,u)}r&&s.DOMIDOperations.updateStylesByID(this._rootNodeID,r)},_updateDOMChildren:function(e,t){var n=this.props,r=E[typeof e.children]?e.children:null,o=E[typeof n.children]?n.children:null,i=null!=r?null:e.children,a=null!=o?null:n.children;if(null!=o){var u=null!=i&&null==a;u&&this.updateMultiChild(null,t),r!==o&&s.DOMIDOperations.updateTextContentByID(this._rootNodeID,""+o)}else{var l=null!=r&&null==o;l&&s.DOMIDOperations.updateTextContentByID(this._rootNodeID,""),this.updateMultiChild(d(n.children),t)}},unmountComponent:function(){u.deleteAllListeners(this._rootNodeID),s.Mixin.unmountComponent.call(this),this.unmountMultiChild()}},m(r,s.Mixin),m(r,r.Mixin),m(r,l.Mixin),t.exports=r},{"./CSSPropertyOperations":3,"./DOMProperty":7,"./DOMPropertyOperations":8,"./ReactComponent":23,"./ReactEventEmitter":34,"./ReactMount":39,"./ReactMultiChild":40,"./escapeTextForBrowser":67,"./flattenChildren":69,"./invariant":78,"./keyOf":82,"./merge":84,"./mixInto":87}],42:[function(e,t){"use strict";function n(e){this._queue=e||null}var r=e("./PooledClass"),o=e("./mixInto");o(n,{enqueue:function(e,t){this._queue=this._queue||[],this._queue.push({component:e,callback:t})},notifyAll:function(){var e=this._queue;if(e){this._queue=null;for(var t=0,n=e.length;n>t;t++){var r=e[t].component,o=e[t].callback;o.call(r,r.getDOMNode())}e.length=0}},reset:function(){this._queue=null},destructor:function(){this.reset()}}),r.addPoolingTo(n),t.exports=n},{"./PooledClass":21,"./mixInto":87}],43:[function(e,t){"use strict";var n=e("./invariant"),r={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,o){n(r.isValidOwner(o)),o.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,o){n(r.isValidOwner(o)),o.refs[t]===e&&o.detachRef(t)},Mixin:{attachRef:function(e,t){n(t.isOwnedBy(this));var r=this.refs||(this.refs={});r[e]=t},detachRef:function(e){delete this.refs[e]}}};t.exports=r},{"./invariant":78}],44:[function(e,t){"use strict";function n(e){return function(t,n,r){t[n]=t.hasOwnProperty(n)?e(t[n],r):r}}var r=e("./emptyFunction"),o=e("./joinClasses"),i=e("./merge"),a={children:r,className:n(o),ref:r,style:n(i)},s={TransferStrategies:a,Mixin:{transferPropsTo:function(e){var t={};for(var n in e.props)e.props.hasOwnProperty(n)&&(t[n]=e.props[n]);for(var r in this.props)if(this.props.hasOwnProperty(r)){var o=a[r];o?o(t,r,this.props[r]):t.hasOwnProperty(r)||(t[r]=this.props[r])}return e.props=t,e}}};t.exports=s},{"./emptyFunction":66,"./joinClasses":80,"./merge":84}],45:[function(e,t){"use strict";function n(e){function t(t){var n=typeof t;"object"===n&&Array.isArray(t)&&(n="array"),s(n===e)}return i(t)}function r(e){function t(e){s(n[e])}var n=a(e);return i(t)}function o(e){function t(t){s(t instanceof e)}return i(t)}function i(e){function t(n){function r(t,r,o){var i=t[r];null!=i?e(i,r,o||l):s(!n)}return n||(r.isRequired=t(!0)),r}return t(!1)}var a=e("./createObjectFrom"),s=e("./invariant"),u={array:n("array"),bool:n("boolean"),func:n("function"),number:n("number"),object:n("object"),string:n("string"),oneOf:r,instanceOf:o},l="<>";t.exports=u},{"./createObjectFrom":64,"./invariant":78}],46:[function(e,t){"use strict";function n(){this.reinitializeTransaction(),this.reactOnDOMReady=s.getPooled(null)}var r=e("./ExecutionEnvironment"),o=e("./PooledClass"),i=e("./ReactEventEmitter"),a=e("./ReactInputSelection"),s=e("./ReactOnDOMReady"),u=e("./Transaction"),l=e("./mixInto"),c={initialize:a.getSelectionInformation,close:a.restoreSelection},p={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},d={initialize:function(){this.reactOnDOMReady.reset()},close:function(){this.reactOnDOMReady.notifyAll()}},h=[c,p,d],f={getTransactionWrappers:function(){return r.canUseDOM?h:[]},getReactOnDOMReady:function(){return this.reactOnDOMReady},destructor:function(){s.release(this.reactOnDOMReady),this.reactOnDOMReady=null}};l(n,u.Mixin),l(n,f),o.addPoolingTo(n),t.exports=n},{"./ExecutionEnvironment":19,"./PooledClass":21,"./ReactEventEmitter":34,"./ReactInputSelection":36,"./ReactOnDOMReady":42,"./Transaction":59,"./mixInto":87}],47:[function(e,t){"use strict";function n(e,t){var n=i.createReactRootID(),a=o.getPooled();a.reinitializeTransaction();try{a.perform(function(){var o=e.mountComponent(n,a);o=r.addChecksumToMarkup(o),t(o)},null)}finally{o.release(a)}}var r=e("./ReactMarkupChecksum"),o=e("./ReactReconcileTransaction"),i=e("./ReactInstanceHandles");t.exports={renderComponentToString:n}},{"./ReactInstanceHandles":37,"./ReactMarkupChecksum":38,"./ReactReconcileTransaction":46}],48:[function(e,t){"use strict";var n=e("./ReactComponent"),r=e("./ReactMount"),o=e("./escapeTextForBrowser"),i=e("./mixInto"),a=function(e){this.construct({text:e})};i(a,n.Mixin),i(a,{mountComponent:function(e){return n.Mixin.mountComponent.call(this,e),"'+o(this.props.text)+""},receiveProps:function(e){e.text!==this.props.text&&(this.props.text=e.text,n.DOMIDOperations.updateTextContentByID(this._rootNodeID,e.text))}}),t.exports=a},{"./ReactComponent":23,"./ReactMount":39,"./escapeTextForBrowser":67,"./mixInto":87}],49:[function(e,t){"use strict";function n(e){if(i)return e(),void 0;i=!0;try{e();for(var t=0;t<"'\/]/g,n):(""+e).replace(/[&><"'\/]/g,n)}var o=e("./invariant"),i={"&":"&",">":">","<":"<",'"':""","'":"'","/":"/"};t.exports=r},{"./invariant":78}],68:[function(e,t){var n=function(e){var t=Array.prototype.slice.call(arguments).map(function(e){return String(e)}),r=e.split("%s").length-1;return r!==t.length-1?n("ex args number mismatch: %s",JSON.stringify(t)):n._prefix+JSON.stringify(t)+n._suffix};n._prefix="",t.exports=n},{}],69:[function(e,t){"use strict";function n(e,t,n){var r=e;o(!r.hasOwnProperty(n)),r[n]=t}function r(e){if(null==e)return e;var t={};return i(e,n,t),t}var o=e("./invariant"),i=e("./traverseAllChildren");t.exports=r},{"./invariant":78,"./traverseAllChildren":90}],70:[function(e,t){"use strict";var n=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=n},{}],71:[function(e,t){function n(e,t,n){return"string"!=typeof e?e:t?r(e,t,n):document.getElementById(e)}function r(e,t,n){var i,a,s;if(o(t)==e)return t;if(t.getElementsByTagName){for(a=t.getElementsByTagName(n||"*"),s=0;s=r.length?e.appendChild(t):e.insertBefore(t,r[n]),t)}t.exports=n},{}],78:[function(e,t){function n(e){if(!e)throw new Error("Invariant Violation")}t.exports=n},{}],79:[function(e,t){"use strict";function n(e,t){if(!r||t&&!r.addEventListener)return!1;var n=document.createElement("div"),i="on"+e,a=i in n;return a||(n.setAttribute(i,""),a="function"==typeof n[i],"undefined"!=typeof n[i]&&(n[i]=void 0),n.removeAttribute(i)),!a&&o&&"wheel"===e&&(a=document.implementation.hasFeature("Events.wheel","3.0")),n=null,a}var r,o,i=e("./ExecutionEnvironment");i.canUseDOM&&(r=document.createElement("div"),o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=n},{"./ExecutionEnvironment":19}],80:[function(e,t){"use strict";function n(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)t=arguments[r],t&&(e+=" "+t);return e}t.exports=n},{}],81:[function(e,t){"use strict";var n=e("./invariant"),r=function(e){var t,r={};n(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(r[t]=t);return r};t.exports=r},{"./invariant":78}],82:[function(e,t){var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=n},{}],83:[function(e,t){"use strict";function n(e){var t={};return function(n){return t.hasOwnProperty(n)?t[n]:t[n]=e.call(this,n)}}t.exports=n},{}],84:[function(e,t){"use strict";var n=e("./mergeInto"),r=function(e,t){var r={};return n(r,e),n(r,t),r};t.exports=r},{"./mergeInto":86}],85:[function(e,t){"use strict";var n=e("./invariant"),r=e("./keyMirror"),o=36,i=function(e){return"object"!=typeof e||null===e},a={MAX_MERGE_DEPTH:o,isTerminal:i,normalizeMergeArg:function(e){return void 0===e||null===e?{}:e},checkMergeArrayArgs:function(e,t){n(Array.isArray(e)&&Array.isArray(t))},checkMergeObjectArgs:function(e,t){a.checkMergeObjectArg(e),a.checkMergeObjectArg(t)},checkMergeObjectArg:function(e){n(!i(e)&&!Array.isArray(e))},checkMergeLevel:function(e){n(o>e)},checkArrayStrategy:function(e){n(void 0===e||e in a.ArrayStrategies)},ArrayStrategies:r({Clobber:!0,IndexByIndex:!0})};t.exports=a},{"./invariant":78,"./keyMirror":81}],86:[function(e,t){"use strict";function n(e,t){if(o(e),null!=t){o(t);for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}}var r=e("./mergeHelpers"),o=r.checkMergeObjectArg;t.exports=n},{"./mergeHelpers":85}],87:[function(e,t){"use strict";var n=function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e.prototype[n]=t[n])};t.exports=n},{}],88:[function(e,t){"use strict";function n(e,t,n){if(!e)return null;var r=0,o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=t.call(n,i,e[i],r++));return o}t.exports=n},{}],89:[function(e,t){"use strict";var n=function(e,t){if(e)throw new Error(t)};t.exports=n},{}],90:[function(e,t){!function(){"use strict";function n(e,t,n){null!==e&&void 0!==e&&a(e,"",0,t,n)}var r=e("./ReactComponent"),o=e("./ReactTextComponent"),i=e("./invariant"),a=function(e,t,n,s,u){var l=0;if(Array.isArray(e))for(var c=0;c8));var O=!1;C.canUseDOM&&(O=M("input")&&(!("documentMode"in document)||document.documentMode>9));var S={get:function(){return x.get.call(this)},set:function(t){I=""+t,x.set.call(this,t)}},w={eventTypes:N,extractEvents:function(t,e,r,o){var i,u;if(n(e)?P?i=a:u=s:R(e)?O?i=p:(i=h,u=d):f(e)&&(i=m),i){var c=i(t,e,r);if(c){var l=E.getPooled(N.change,c,o);return y.accumulateTwoPhaseDispatches(l),l}}u&&u(t,e,r)}};e.exports=w},{"./EventConstants":14,"./EventPluginHub":16,"./EventPropagators":19,"./ExecutionEnvironment":20,"./SyntheticEvent":64,"./isEventSupported":95,"./isTextInputElement":97,"./keyOf":101}],6:[function(t,e){"use strict";function n(t){switch(t){case v.topCompositionStart:return y.compositionStart;case v.topCompositionEnd:return y.compositionEnd;case v.topCompositionUpdate:return y.compositionUpdate}}function r(t,e){return t===v.topKeyDown&&e.keyCode===f}function o(t,e){switch(t){case v.topKeyUp:return-1!==h.indexOf(e.keyCode);case v.topKeyDown:return e.keyCode!==f;case v.topKeyPress:case v.topMouseDown:case v.topBlur:return!0;default:return!1}}function i(t){this.root=t,this.startSelection=c.getSelection(t),this.startValue=this.getText()}var a=t("./EventConstants"),s=t("./EventPropagators"),u=t("./ExecutionEnvironment"),c=t("./ReactInputSelection"),l=t("./SyntheticCompositionEvent"),p=t("./getTextContentAccessor"),d=t("./keyOf"),h=[9,13,27,32],f=229,m=u.canUseDOM&&"CompositionEvent"in window,v=a.topLevelTypes,g=null,y={compositionEnd:{phasedRegistrationNames:{bubbled:d({onCompositionEnd:null}),captured:d({onCompositionEndCapture:null})}},compositionStart:{phasedRegistrationNames:{bubbled:d({onCompositionStart:null}),captured:d({onCompositionStartCapture:null})}},compositionUpdate:{phasedRegistrationNames:{bubbled:d({onCompositionUpdate:null}),captured:d({onCompositionUpdateCapture:null})}}};i.prototype.getText=function(){return this.root.value||this.root[p()]},i.prototype.getData=function(){var t=this.getText(),e=this.startSelection.start,n=this.startValue.length-this.startSelection.end;return t.substr(e,t.length-n-e)};var C={eventTypes:y,extractEvents:function(t,e,a,u){var c,p;if(m?c=n(t):g?o(t,u)&&(c=y.compositionEnd,p=g.getData(),g=null):r(t,u)&&(c=y.start,g=new i(e)),c){var d=l.getPooled(c,a,u);return p&&(d.data=p),s.accumulateTwoPhaseDispatches(d),d}}};e.exports=C},{"./EventConstants":14,"./EventPropagators":19,"./ExecutionEnvironment":20,"./ReactInputSelection":45,"./SyntheticCompositionEvent":63,"./getTextContentAccessor":92,"./keyOf":101}],7:[function(t,e){"use strict";function n(t,e,n){var r=t.childNodes;r[n]!==e&&(e.parentNode===t&&t.removeChild(e),n>=r.length?t.appendChild(e):t.insertBefore(e,r[n]))}var r=t("./Danger"),o=t("./ReactMultiChildUpdateTypes"),i=t("./getTextContentAccessor"),a=i()||"NA",s={dangerouslyReplaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup,processUpdates:function(t,e){for(var i,s=null,u=null,c=0;i=t[c];c++)if(i.type===o.MOVE_EXISTING||i.type===o.REMOVE_NODE){var l=i.fromIndex,p=i.parentNode.childNodes[l],d=i.parentID;s=s||{},s[d]=s[d]||[],s[d][l]=p,u=u||[],u.push(p)}var h=r.dangerouslyRenderMarkup(e);if(u)for(var f=0;f]+)/,l="data-danger-index",p={dangerouslyRenderMarkup:function(t){s(r.canUseDOM);for(var e,u={},p=0;pu;u++){var l=a[u];if(l){var p=l.extractEvents(t,e,n,o);p&&(i=s(i,p))}}return i},enqueueEvents:function(t){t&&(l=s(l,t))},processEventQueue:function(){var t=l;l=null,u(t,p),c(!l)}};a.canUseDOM&&(window.EventPluginHub=d),e.exports=d},{"./CallbackRegistry":4,"./EventPluginRegistry":17,"./EventPluginUtils":18,"./EventPropagators":19,"./ExecutionEnvironment":20,"./accumulate":73,"./forEachAccumulated":85,"./invariant":94}],17:[function(t,e){"use strict";function n(){if(a)for(var t in s){var e=s[t],n=a.indexOf(t);if(i(n>-1),!u.plugins[n]){i(e.extractEvents),u.plugins[n]=e;var o=e.eventTypes;for(var c in o)i(r(o[c],e))}}}function r(t,e){var n=t.phasedRegistrationNames;if(n){for(var r in n)if(n.hasOwnProperty(r)){var i=n[r];o(i,e)}return!0}return t.registrationName?(o(t.registrationName,e),!0):!1}function o(t,e){i(!u.registrationNames[t]),u.registrationNames[t]=e,u.registrationNamesKeys.push(t)}var i=t("./invariant"),a=null,s={},u={plugins:[],registrationNames:{},registrationNamesKeys:[],injectEventPluginOrder:function(t){i(!a),a=Array.prototype.slice.call(t),n()},injectEventPluginsByName:function(t){var e=!1;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];s[r]!==o&&(i(!s[r]),s[r]=o,e=!0)}e&&n()},getPluginModuleForEvent:function(t){var e=t.dispatchConfig;if(e.registrationName)return u.registrationNames[e.registrationName]||null;for(var n in e.phasedRegistrationNames)if(e.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNames[e.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){a=null;for(var t in s)s.hasOwnProperty(t)&&delete s[t];u.plugins.length=0;var e=u.registrationNames;for(var n in e)e.hasOwnProperty(n)&&delete e[n];u.registrationNamesKeys.length=0}};e.exports=u},{"./invariant":94}],18:[function(t,e){"use strict";function n(t){return t===h.topMouseUp||t===h.topTouchEnd||t===h.topTouchCancel}function r(t){return t===h.topMouseMove||t===h.topTouchMove}function o(t){return t===h.topMouseDown||t===h.topTouchStart}function i(t,e){var n=t._dispatchListeners,r=t._dispatchIDs;if(Array.isArray(n))for(var o=0;o1){for(var o=Array(n),i=0;n>i;i++)o[i]=arguments[i+1];this.props.children=o}},mountComponent:function(t,e,n){a(!this.isMounted());var r=this.props;null!=r.ref&&o.addComponentAsRefTo(this,r.ref,r.__owner__),this._rootNodeID=t,this._lifeCycleState=c.MOUNTED,this._mountDepth=n},unmountComponent:function(){a(this.isMounted());var t=this.props;null!=t.ref&&o.removeComponentAsRefFrom(this,t.ref,t.__owner__),l.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._lifeCycleState=c.UNMOUNTED},receiveProps:function(t,e){a(this.isMounted()),this._pendingProps=t,this._performUpdateIfNecessary(e)},performUpdateIfNecessary:function(){var t=l.ReactReconcileTransaction.getPooled();t.perform(this._performUpdateIfNecessary,this,t),l.ReactReconcileTransaction.release(t)},_performUpdateIfNecessary:function(t){if(null!=this._pendingProps){var e=this.props;this.props=this._pendingProps,this._pendingProps=null,this.updateComponent(t,e)}},updateComponent:function(t,e){var n=this.props;(n.__owner__!==e.__owner__||n.ref!==e.ref)&&(null!=e.ref&&o.removeComponentAsRefFrom(this,e.ref,e.__owner__),null!=n.ref&&o.addComponentAsRefTo(this,n.ref,n.__owner__))},mountComponentIntoNode:function(t,e,n){var r=l.ReactReconcileTransaction.getPooled();r.perform(this._mountComponentIntoNode,this,t,e,r,n),l.ReactReconcileTransaction.release(r)},_mountComponentIntoNode:function(t,e,n,r){var o=this.mountComponent(t,n,0);l.mountImageIntoNode(o,e,r)},isOwnedBy:function(t){return this.props.__owner__===t},getSiblingByRef:function(t){var e=this.props.__owner__;return e&&e.refs?e.refs[t]:null}})};e.exports=l},{"./ReactComponentEnvironment":27,"./ReactCurrentOwner":29,"./ReactOwner":52,"./ReactUpdates":59,"./invariant":94,"./keyMirror":100,"./merge":103}],26:[function(t,e){"use strict";var n=t("./ReactDOMIDOperations"),r=t("./ReactMarkupChecksum"),o=t("./ReactMount"),i=t("./ReactReconcileTransaction"),a=t("./getReactRootElementInContainer"),s=t("./invariant"),u=t("./mutateHTMLNodeWithMarkup"),c=1,l=9,p={Mixin:{getDOMNode:function(){return s(this.isMounted()),o.getNode(this._rootNodeID)}},ReactReconcileTransaction:i,DOMIDOperations:n,unmountIDFromEnvironment:function(t){o.purgeID(t)},mountImageIntoNode:function(t,e,n){if(s(e&&(e.nodeType===c||e.nodeType===l&&o.allowFullPageRender)),!n||!r.canReuseMarkup(t,a(e))){if(e.nodeType===l)return u(e.documentElement,t),void 0;var i=e.parentNode;if(i){var p=e.nextSibling;i.removeChild(e),e.innerHTML=t,p?i.insertBefore(e,p):i.appendChild(e)}else e.innerHTML=t}}};e.exports=p},{"./ReactDOMIDOperations":34,"./ReactMarkupChecksum":47,"./ReactMount":48,"./ReactReconcileTransaction":56,"./getReactRootElementInContainer":91,"./invariant":94,"./mutateHTMLNodeWithMarkup":107}],27:[function(t,e){var n=t("./ReactComponentBrowserEnvironment"),r=n;e.exports=r},{"./ReactComponentBrowserEnvironment":26}],28:[function(t,e){"use strict";function n(t,e){var n=E[e];D.hasOwnProperty(e)&&f(n===C.OVERRIDE_BASE),t.hasOwnProperty(e)&&f(n===C.DEFINE_MANY||n===C.DEFINE_MANY_MERGED)}function r(t){var e=t._compositeLifeCycleState;f(t.isMounted()||e===R.MOUNTING),f(e!==R.RECEIVING_STATE&&e!==R.UNMOUNTING)}function o(t,e){var r=t.prototype;for(var o in e){var i=e[o];if(e.hasOwnProperty(o)&&i)if(n(r,o),M.hasOwnProperty(o))M[o](t,i);else{var u=o in E,c=o in r,l=i.__reactDontBind,p="function"==typeof i,d=p&&!u&&!c&&!l;d?(r.__reactAutoBindMap||(r.__reactAutoBindMap={}),r.__reactAutoBindMap[o]=i,r[o]=i):r[o]=c?E[o]===C.DEFINE_MANY_MERGED?a(r[o],i):s(r[o],i):i}}}function i(t,e){return f(t&&e&&"object"==typeof t&&"object"==typeof e),y(e,function(e,n){f(void 0===t[n]),t[n]=e}),t}function a(t,e){return function(){return i(t.apply(this,arguments),e.apply(this,arguments))}}function s(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}var u=t("./ReactComponent"),c=t("./ReactCurrentOwner"),l=t("./ReactOwner"),p=t("./ReactPerf"),d=t("./ReactPropTransferer"),h=t("./ReactUpdates"),f=t("./invariant"),m=t("./keyMirror"),v=t("./merge"),g=t("./mixInto"),y=t("./objMap"),C=m({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),E={mixins:C.DEFINE_MANY,propTypes:C.DEFINE_ONCE,getDefaultProps:C.DEFINE_MANY_MERGED,getInitialState:C.DEFINE_MANY_MERGED,render:C.DEFINE_ONCE,componentWillMount:C.DEFINE_MANY,componentDidMount:C.DEFINE_MANY,componentWillReceiveProps:C.DEFINE_MANY,shouldComponentUpdate:C.DEFINE_ONCE,componentWillUpdate:C.DEFINE_MANY,componentDidUpdate:C.DEFINE_MANY,componentWillUnmount:C.DEFINE_MANY,updateComponent:C.OVERRIDE_BASE},M={displayName:function(t,e){t.displayName=e},mixins:function(t,e){if(e)for(var n=0;n",this.tagName=t.toUpperCase()}var o=t("./CSSPropertyOperations"),i=t("./DOMProperty"),a=t("./DOMPropertyOperations"),s=t("./ReactComponent"),u=t("./ReactEventEmitter"),c=t("./ReactMultiChild"),l=t("./ReactMount"),p=t("./ReactPerf"),d=t("./escapeTextForBrowser"),h=t("./invariant"),f=t("./keyOf"),m=t("./merge"),v=t("./mixInto"),g=u.putListener,y=u.deleteListener,C=u.registrationNames,E={string:!0,number:!0},M=f({style:null});r.Mixin={mountComponent:p.measure("ReactDOMComponent","mountComponent",function(t,e,r){return s.Mixin.mountComponent.call(this,t,e,r),n(this.props),this._createOpenTagMarkup()+this._createContentMarkup(e)+this._tagClose}),_createOpenTagMarkup:function(){var t=this.props,e=this._tagOpen;for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(null!=r)if(C[n])g(this._rootNodeID,n,r);else{n===M&&(r&&(r=t.style=m(t.style)),r=o.createMarkupForStyles(r));var i=a.createMarkupForProperty(n,r);i&&(e+=" "+i)}}var s=d(this._rootNodeID);return e+" "+l.ATTR_NAME+'="'+s+'">'},_createContentMarkup:function(t){var e=this.props.dangerouslySetInnerHTML;if(null!=e){if(null!=e.__html)return e.__html}else{var n=E[typeof this.props.children]?this.props.children:null,r=null!=n?null:this.props.children;if(null!=n)return d(n);if(null!=r){var o=this.mountChildren(r,t);return o.join("")}}return""},receiveProps:function(t,e){n(t),s.Mixin.receiveProps.call(this,t,e)},updateComponent:p.measure("ReactDOMComponent","updateComponent",function(t,e){s.Mixin.updateComponent.call(this,t,e),this._updateDOMProperties(e),this._updateDOMChildren(e,t)}),_updateDOMProperties:function(t){var e,n,r,o=this.props;for(e in t)if(!o.hasOwnProperty(e)&&t.hasOwnProperty(e))if(e===M){var a=t[e];for(n in a)a.hasOwnProperty(n)&&(r=r||{},r[n]="")}else C[e]?y(this._rootNodeID,e):(i.isStandardName[e]||i.isCustomAttribute(e))&&s.DOMIDOperations.deletePropertyByID(this._rootNodeID,e);for(e in o){var u=o[e],c=t[e];if(o.hasOwnProperty(e)&&u!==c)if(e===M)if(u&&(u=o.style=m(u)),c){for(n in c)c.hasOwnProperty(n)&&!u.hasOwnProperty(n)&&(r=r||{},r[n]="");for(n in u)u.hasOwnProperty(n)&&c[n]!==u[n]&&(r=r||{},r[n]=u[n])}else r=u;else C[e]?g(this._rootNodeID,e,u):(i.isStandardName[e]||i.isCustomAttribute(e))&&s.DOMIDOperations.updatePropertyByID(this._rootNodeID,e,u)}r&&s.DOMIDOperations.updateStylesByID(this._rootNodeID,r)},_updateDOMChildren:function(t,e){var n=this.props,r=E[typeof t.children]?t.children:null,o=E[typeof n.children]?n.children:null,i=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,a=n.dangerouslySetInnerHTML&&n.dangerouslySetInnerHTML.__html,u=null!=r?null:t.children,c=null!=o?null:n.children,l=null!=r||null!=i,p=null!=o||null!=a;null!=u&&null==c?this.updateChildren(null,e):l&&!p&&this.updateTextContent(""),null!=o?r!==o&&this.updateTextContent(""+o):null!=a?i!==a&&s.DOMIDOperations.updateInnerHTMLByID(this._rootNodeID,a):null!=c&&this.updateChildren(c,e)},unmountComponent:function(){u.deleteAllListeners(this._rootNodeID),s.Mixin.unmountComponent.call(this),this.unmountChildren()}},v(r,s.Mixin),v(r,r.Mixin),v(r,c.Mixin),e.exports=r},{"./CSSPropertyOperations":3,"./DOMProperty":8,"./DOMPropertyOperations":9,"./ReactComponent":25,"./ReactEventEmitter":42,"./ReactMount":48,"./ReactMultiChild":50,"./ReactPerf":53,"./escapeTextForBrowser":81,"./invariant":94,"./keyOf":101,"./merge":103,"./mixInto":106}],33:[function(t,e){"use strict";var n=t("./ReactCompositeComponent"),r=t("./ReactDOM"),o=t("./ReactEventEmitter"),i=t("./EventConstants"),a=r.form,s=n.createClass({render:function(){return this.transferPropsTo(a(null,this.props.children))},componentDidMount:function(t){o.trapBubbledEvent(i.topLevelTypes.topSubmit,"submit",t)}});e.exports=s},{"./EventConstants":14,"./ReactCompositeComponent":28,"./ReactDOM":30,"./ReactEventEmitter":42}],34:[function(t,e){"use strict";var n=t("./CSSPropertyOperations"),r=t("./DOMChildrenOperations"),o=t("./DOMPropertyOperations"),i=t("./ReactMount"),a=t("./getTextContentAccessor"),s=t("./invariant"),u={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},c=a()||"NA",l=/^ /,p={updatePropertyByID:function(t,e,n){var r=i.getNode(t);s(!u.hasOwnProperty(e)),null!=n?o.setValueForProperty(r,e,n):o.deleteValueForProperty(r,e)},deletePropertyByID:function(t,e,n){var r=i.getNode(t);s(!u.hasOwnProperty(e)),o.deleteValueForProperty(r,e,n)},updatePropertiesByID:function(t,e){for(var n in e)e.hasOwnProperty(n)&&p.updatePropertiesByID(t,n,e[n])},updateStylesByID:function(t,e){var r=i.getNode(t);n.setValueForStyles(r,e)},updateInnerHTMLByID:function(t,e){var n=i.getNode(t);n.innerHTML=e.replace(l," ")},updateTextContentByID:function(t,e){var n=i.getNode(t);n[c]=e},dangerouslyReplaceNodeWithMarkupByID:function(t,e){var n=i.getNode(t);r.dangerouslyReplaceNodeWithMarkup(n,e)},dangerouslyProcessChildrenUpdates:function(t,e){for(var n=0;nu;u++){var p=i[u];if(p!==o&&"INPUT"===p.nodeName&&"radio"===p.type&&p.form===o.form){var d=a.getID(p);s(d);var h=l[d];s(h),h.setState({checked:!1})}}return e}});e.exports=p},{"./DOMPropertyOperations":9,"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./ReactMount":48,"./invariant":94,"./merge":103}],36:[function(t,e){"use strict";var n=t("./ReactCompositeComponent"),r=t("./ReactDOM"),o=r.option,i=n.createClass({componentWillMount:function(){null!=this.props.selected},render:function(){return o(this.props,this.props.children)}});e.exports=i},{"./ReactCompositeComponent":28,"./ReactDOM":30}],37:[function(t,e){"use strict";function n(t,e){null!=t[e]&&(t.multiple?s(Array.isArray(t[e])):s(!Array.isArray(t[e])))}function r(){for(var t=this.getValue(),e=null!=t?t:this.state.value,n=this.getDOMNode().options,r=""+e,o=0,i=n.length;i>o;o++){var a=this.props.multiple?r.indexOf(n[o].value)>=0:a=n[o].value===r;a!==n[o].selected&&(n[o].selected=a)}}var o=t("./LinkedValueMixin"),i=t("./ReactCompositeComponent"),a=t("./ReactDOM"),s=t("./invariant"),u=t("./merge"),c=a.select,l=i.createClass({mixins:[o],propTypes:{defaultValue:n,value:n},getInitialState:function(){return{value:this.props.defaultValue||(this.props.multiple?[]:"")}},componentWillReceiveProps:function(t){!this.props.multiple&&t.multiple?this.setState({value:[this.state.value]}):this.props.multiple&&!t.multiple&&this.setState({value:this.state.value[0]})},shouldComponentUpdate:function(){return!this._isChanging},render:function(){var t=u(this.props);return t.onChange=this._handleChange,t.value=null,c(t,this.props.children)},componentDidMount:r,componentDidUpdate:r,_handleChange:function(t){var e,n=this.getOnChange();n&&(this._isChanging=!0,e=n(t),this._isChanging=!1);var r;if(this.props.multiple){r=[];for(var o=t.target.options,i=0,a=o.length;a>i;i++)o[i].selected&&r.push(o[i].value)}else r=t.target.value;return this.setState({value:r}),e}});e.exports=l},{"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./invariant":94,"./merge":103}],38:[function(t,e){"use strict";function n(t){var e=document.selection,n=e.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(t),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function r(t){var e=window.getSelection();if(0===e.rangeCount)return null;var n=e.anchorNode,r=e.anchorOffset,o=e.focusNode,i=e.focusOffset,a=e.getRangeAt(0),s=a.toString().length,u=a.cloneRange();u.selectNodeContents(t),u.setEnd(a.startContainer,a.startOffset);var c=u.toString().length,l=c+s,p=document.createRange();p.setStart(n,r),p.setEnd(o,i);var d=p.collapsed;return p.detach(),{start:d?l:c,end:d?c:l}}function o(t,e){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof e.end?(n=e.start,r=n):e.start>e.end?(n=e.end,r=e.start):(n=e.start,r=e.end),o.moveToElementText(t),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function i(t,e){var n=window.getSelection(),r=t[s()].length,o=Math.min(e.start,r),i="undefined"==typeof e.end?o:Math.min(e.end,r),u=a(t,o),c=a(t,i);if(u&&c){var l=document.createRange();l.setStart(u.node,u.offset),n.removeAllRanges(),n.addRange(l),n.extend(c.node,c.offset),l.detach()}}var a=t("./getNodeForCharacterOffset"),s=t("./getTextContentAccessor"),u={getOffsets:function(t){var e=document.selection?n:r;return e(t)},setOffsets:function(t,e){var n=document.selection?o:i;n(t,e)}};e.exports=u},{"./getNodeForCharacterOffset":90,"./getTextContentAccessor":92}],39:[function(t,e){"use strict";var n=t("./DOMPropertyOperations"),r=t("./LinkedValueMixin"),o=t("./ReactCompositeComponent"),i=t("./ReactDOM"),a=t("./invariant"),s=t("./merge"),u=i.textarea,c=o.createClass({mixins:[r],getInitialState:function(){var t=this.props.defaultValue,e=this.props.children;null!=e&&(a(null==t),Array.isArray(e)&&(a(e.length<=1),e=e[0]),t=""+e),null==t&&(t="");var n=this.getValue();return{initialValue:""+(null!=n?n:t),value:t}},shouldComponentUpdate:function(){return!this._isChanging},render:function(){var t=s(this.props),e=this.getValue();return a(null==t.dangerouslySetInnerHTML),t.defaultValue=null,t.value=null!=e?e:this.state.value,t.onChange=this._handleChange,u(t,this.state.initialValue)},componentDidUpdate:function(t,e,r){var o=this.getValue();null!=o&&n.setValueForProperty(r,"value",""+o)},_handleChange:function(t){var e,n=this.getOnChange();return n&&(this._isChanging=!0,e=n(t),this._isChanging=!1),this.setState({value:t.target.value}),e}});e.exports=c},{"./DOMPropertyOperations":9,"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./invariant":94,"./merge":103}],40:[function(t,e){"use strict";function n(){this.reinitializeTransaction()}var r=t("./ReactUpdates"),o=t("./Transaction"),i=t("./emptyFunction"),a=t("./mixInto"),s={initialize:i,close:function(){p.isBatchingUpdates=!1}},u={initialize:i,close:r.flushBatchedUpdates.bind(r)},c=[u,s];a(n,o.Mixin),a(n,{getTransactionWrappers:function(){return c}});var l=new n,p={isBatchingUpdates:!1,batchedUpdates:function(t,e){var n=p.isBatchingUpdates;p.isBatchingUpdates=!0,n?t(e):l.perform(t,null,e)}};e.exports=p},{"./ReactUpdates":59,"./Transaction":71,"./emptyFunction":80,"./mixInto":106}],41:[function(t,e){"use strict";function n(){l.TopLevelCallbackCreator=p,y.injection.injectEventPluginOrder(v),y.injection.injectInstanceHandle(E),y.injection.injectEventPluginsByName({SimpleEventPlugin:R,EnterLeaveEventPlugin:g,ChangeEventPlugin:f,CompositionEventPlugin:m,MobileSafariClickEventPlugin:C,SelectEventPlugin:M}),r.injection.injectComponentClasses({button:o,form:i,input:a,option:s,select:u,textarea:c}),h.injection.injectDOMPropertyConfig(d),b.injection.injectBatchingStrategy(D)}var r=t("./ReactDOM"),o=t("./ReactDOMButton"),i=t("./ReactDOMForm"),a=t("./ReactDOMInput"),s=t("./ReactDOMOption"),u=t("./ReactDOMSelect"),c=t("./ReactDOMTextarea"),l=t("./ReactEventEmitter"),p=t("./ReactEventTopLevelCallback");t("./ReactPerf");var d=t("./DefaultDOMPropertyConfig"),h=t("./DOMProperty"),f=t("./ChangeEventPlugin"),m=t("./CompositionEventPlugin"),v=t("./DefaultEventPluginOrder"),g=t("./EnterLeaveEventPlugin"),y=t("./EventPluginHub"),C=t("./MobileSafariClickEventPlugin"),E=t("./ReactInstanceHandles"),M=t("./SelectEventPlugin"),R=t("./SimpleEventPlugin"),D=t("./ReactDefaultBatchingStrategy"),b=t("./ReactUpdates");e.exports={inject:n}},{"./ChangeEventPlugin":5,"./CompositionEventPlugin":6,"./DOMProperty":8,"./DefaultDOMPropertyConfig":11,"./DefaultEventPluginOrder":12,"./EnterLeaveEventPlugin":13,"./EventPluginHub":16,"./MobileSafariClickEventPlugin":22,"./ReactDOM":30,"./ReactDOMButton":31,"./ReactDOMForm":33,"./ReactDOMInput":35,"./ReactDOMOption":36,"./ReactDOMSelect":37,"./ReactDOMTextarea":39,"./ReactDefaultBatchingStrategy":40,"./ReactEventEmitter":42,"./ReactEventTopLevelCallback":44,"./ReactInstanceHandles":46,"./ReactPerf":53,"./ReactUpdates":59,"./SelectEventPlugin":60,"./SimpleEventPlugin":61}],42:[function(t,e){"use strict";function n(t,e,n){a.listen(n,e,f.TopLevelCallbackCreator.createTopLevelCallback(t))}function r(t,e,n){a.capture(n,e,f.TopLevelCallbackCreator.createTopLevelCallback(t))}function o(){var t=l.refreshScrollValues;a.listen(window,"scroll",t),a.listen(window,"resize",t)}var i=t("./EventConstants"),a=t("./EventListener"),s=t("./EventPluginHub"),u=t("./ExecutionEnvironment"),c=t("./ReactEventEmitterMixin"),l=t("./ViewportMetrics"),p=t("./invariant"),d=t("./isEventSupported"),h=t("./merge"),f=h(c,{TopLevelCallbackCreator:null,ensureListening:function(t,e){p(u.canUseDOM),p(f.TopLevelCallbackCreator),c.ensureListening.call(f,{touchNotMouse:t,contentDocument:e})},setEnabled:function(t){p(u.canUseDOM),f.TopLevelCallbackCreator&&f.TopLevelCallbackCreator.setEnabled(t)},isEnabled:function(){return!(!f.TopLevelCallbackCreator||!f.TopLevelCallbackCreator.isEnabled())},listenAtTopLevel:function(t,e){p(!e._isListening);var a=i.topLevelTypes,s=e;o(),n(a.topMouseOver,"mouseover",s),n(a.topMouseDown,"mousedown",s),n(a.topMouseUp,"mouseup",s),n(a.topMouseMove,"mousemove",s),n(a.topMouseOut,"mouseout",s),n(a.topClick,"click",s),n(a.topDoubleClick,"dblclick",s),t&&(n(a.topTouchStart,"touchstart",s),n(a.topTouchEnd,"touchend",s),n(a.topTouchMove,"touchmove",s),n(a.topTouchCancel,"touchcancel",s)),n(a.topKeyUp,"keyup",s),n(a.topKeyPress,"keypress",s),n(a.topKeyDown,"keydown",s),n(a.topInput,"input",s),n(a.topChange,"change",s),n(a.topSelectionChange,"selectionchange",s),n(a.topCompositionEnd,"compositionend",s),n(a.topCompositionStart,"compositionstart",s),n(a.topCompositionUpdate,"compositionupdate",s),d("drag")&&(n(a.topDrag,"drag",s),n(a.topDragEnd,"dragend",s),n(a.topDragEnter,"dragenter",s),n(a.topDragExit,"dragexit",s),n(a.topDragLeave,"dragleave",s),n(a.topDragOver,"dragover",s),n(a.topDragStart,"dragstart",s),n(a.topDrop,"drop",s)),d("wheel")?n(a.topWheel,"wheel",s):d("mousewheel")?n(a.topWheel,"mousewheel",s):n(a.topWheel,"DOMMouseScroll",s),d("scroll",!0)?r(a.topScroll,"scroll",s):n(a.topScroll,"scroll",window),d("focus",!0)?(r(a.topFocus,"focus",s),r(a.topBlur,"blur",s)):d("focusin")&&(n(a.topFocus,"focusin",s),n(a.topBlur,"focusout",s)),d("copy")&&(n(a.topCopy,"copy",s),n(a.topCut,"cut",s),n(a.topPaste,"paste",s))},registrationNames:s.registrationNames,putListener:s.putListener,getListener:s.getListener,deleteListener:s.deleteListener,deleteAllListeners:s.deleteAllListeners,trapBubbledEvent:n,trapCapturedEvent:r});e.exports=f},{"./EventConstants":14,"./EventListener":15,"./EventPluginHub":16,"./ExecutionEnvironment":20,"./ReactEventEmitterMixin":43,"./ViewportMetrics":72,"./invariant":94,"./isEventSupported":95,"./merge":103}],43:[function(t,e){"use strict";function n(t){r.enqueueEvents(t),r.processEventQueue()}var r=t("./EventPluginHub"),o=t("./ReactUpdates"),i={_isListening:!1,ensureListening:function(t){t.contentDocument._reactIsListening||(this.listenAtTopLevel(t.touchNotMouse,t.contentDocument),t.contentDocument._reactIsListening=!0)},handleTopLevel:function(t,e,i,a){var s=r.extractEvents(t,e,i,a);o.batchedUpdates(n,s)}};e.exports=i},{"./EventPluginHub":16,"./ReactUpdates":59}],44:[function(t,e){"use strict";var n=t("./ReactEventEmitter"),r=t("./ReactMount"),o=t("./getEventTarget"),i=!0,a={setEnabled:function(t){i=!!t},isEnabled:function(){return i},createTopLevelCallback:function(t){return function(e){if(i){e.srcElement&&e.srcElement!==e.target&&(e.target=e.srcElement);var a=r.getFirstReactDOM(o(e))||window,s=r.getID(a)||"";n.handleTopLevel(t,a,s,e)}}}};e.exports=a},{"./ReactEventEmitter":42,"./ReactMount":48,"./getEventTarget":88}],45:[function(t,e){"use strict";function n(t){return i(document.documentElement,t)}var r=t("./ReactDOMSelection"),o=t("./getActiveElement"),i=t("./nodeContains"),a={hasSelectionCapabilities:function(t){return t&&("INPUT"===t.nodeName&&"text"===t.type||"TEXTAREA"===t.nodeName||"true"===t.contentEditable)},getSelectionInformation:function(){var t=o();return{focusedElem:t,selectionRange:a.hasSelectionCapabilities(t)?a.getSelection(t):null}},restoreSelection:function(t){var e=o(),r=t.focusedElem,i=t.selectionRange;e!==r&&n(r)&&(a.hasSelectionCapabilities(r)&&a.setSelection(r,i),r.focus())},getSelection:function(t){var e;if("selectionStart"in t)e={start:t.selectionStart,end:t.selectionEnd};else if(document.selection&&"INPUT"===t.nodeName){var n=document.selection.createRange();n.parentElement()===t&&(e={start:-n.moveStart("character",-t.value.length),end:-n.moveEnd("character",-t.value.length)})}else e=r.getOffsets(t);return e||{start:0,end:0}},setSelection:function(t,e){var n=e.start,o=e.end;if("undefined"==typeof o&&(o=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(o,t.value.length);else if(document.selection&&"INPUT"===t.nodeName){var i=t.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",o-n),i.select()}else r.setOffsets(t,e)}};e.exports=a},{"./ReactDOMSelection":38,"./getActiveElement":87,"./nodeContains":108}],46:[function(t,e){"use strict";function n(t){return p+"r["+t.toString(36)+"]"}function r(t,e){return t.charAt(e)===p||e===t.length}function o(t){return""===t||t.charAt(0)===p&&t.charAt(t.length-1)!==p}function i(t,e){return 0===e.indexOf(t)&&r(e,t.length)}function a(t){return t?t.substr(0,t.lastIndexOf(p)):""}function s(t,e){if(l(o(t)&&o(e)),l(i(t,e)),t===e)return t;for(var n=t.length+d,a=n;a=a;a++)if(r(t,a)&&r(e,a))i=a;else if(t.charAt(a)!==e.charAt(a))break;var s=t.substr(0,i);return l(o(s)),s}function c(t,e,n,r,o,u){t=t||"",e=e||"",l(t!==e);var c=i(e,t);l(c||i(t,e));for(var p=0,d=c?a:s,f=t;o&&f===t||u&&f===e||n(f,c,r),f!==e;f=d(f,e))l(p++"," "+r.CHECKSUM_ATTR_NAME+'="'+e+'">')},canReuseMarkup:function(t,e){var o=e.getAttribute(r.CHECKSUM_ATTR_NAME);o=o&&parseInt(o,10);var i=n(t);return i===o}};e.exports=r},{"./adler32":74}],48:[function(t,e){"use strict";function n(t){var e=d(t);return e&&R.getID(e)}function r(t){var e=o(t);if(e)if(g.hasOwnProperty(e)){var n=g[e];n!==t&&(h(!s(n,e)),g[e]=t)}else g[e]=t;return e}function o(t){return t&&t.getAttribute&&t.getAttribute(v)||""}function i(t,e){var n=o(t);n!==e&&delete g[n],t.setAttribute(v,e),g[e]=t}function a(t){return g.hasOwnProperty(t)&&s(g[t],t)||(g[t]=R.findReactNodeByID(t)),g[t]}function s(t,e){if(t){h(o(t)===e);var n=R.findReactContainerForID(e);if(n&&f(n,t))return!0}return!1}function u(t){delete g[t]}var c=t("./ReactEventEmitter"),l=t("./ReactInstanceHandles"),p=t("./$"),d=t("./getReactRootElementInContainer"),h=t("./invariant"),f=t("./nodeContains"),m=l.SEPARATOR,v="data-reactid",g={},y=1,C=9,E={},M={},R={allowFullPageRender:!1,totalInstantiationTime:0,totalInjectionTime:0,useTouchEvents:!1,_instancesByReactRootID:E,scrollMonitor:function(t,e){e()},prepareEnvironmentForDOM:function(t){h(t&&(t.nodeType===y||t.nodeType===C));var e=t.nodeType===y?t.ownerDocument:t;c.ensureListening(R.useTouchEvents,e)},_updateRootComponent:function(t,e,n,r){var o=e.props;return R.scrollMonitor(n,function(){t.replaceProps(o,r)}),t},_registerComponent:function(t,e){R.prepareEnvironmentForDOM(e);var n=R.registerContainer(e);return E[n]=t,n},_renderNewRootComponent:function(t,e,n){var r=R._registerComponent(t,e);return t.mountComponentIntoNode(r,e,n),t},renderComponent:function(t,e,r){var o=E[n(e)];if(o){if(o.constructor===t.constructor)return R._updateRootComponent(o,t,e,r);R.unmountComponentAtNode(e)}var i=d(e),a=i&&R.isRenderedByReact(i),s=a&&!o,u=R._renderNewRootComponent(t,e,s);return r&&r(),u},constructAndRenderComponent:function(t,e,n){return R.renderComponent(t(e),n)},constructAndRenderComponentByID:function(t,e,n){return R.constructAndRenderComponent(t,e,p(n))},registerContainer:function(t){var e=n(t);return e&&(e=l.getReactRootIDFromNodeID(e)),e||(e=l.createReactRootID()),M[e]=t,e},unmountComponentAtNode:function(t){var e=n(t),r=E[e];return r?(R.unmountComponentFromNode(r,t),delete E[e],delete M[e],!0):!1},unmountAndReleaseReactRootNode:function(){return R.unmountComponentAtNode.apply(this,arguments)},unmountComponentFromNode:function(t,e){for(t.unmountComponent();e.lastChild;)e.removeChild(e.lastChild)},findReactContainerForID:function(t){var e=l.getReactRootIDFromNodeID(t),n=M[e];return n},findReactNodeByID:function(t){var e=R.findReactContainerForID(t);return R.findComponentRoot(e,t)},isRenderedByReact:function(t){if(1!==t.nodeType)return!1;var e=R.getID(t);return e?e.charAt(0)===m:!1},getFirstReactDOM:function(t){for(var e=t;e&&e.parentNode!==e;){if(R.isRenderedByReact(e))return e;e=e.parentNode}return null},findComponentRoot:function(t,e){for(var n=[t.firstChild],r=0;re;e++){var r=t[e].component,o=t[e].callback;o.call(r,r.getDOMNode())}t.length=0}},reset:function(){this._queue=null},destructor:function(){this.reset()}}),r.addPoolingTo(n),e.exports=n},{"./PooledClass":23,"./mixInto":106}],50:[function(t,e){"use strict";function n(t,e){return t&&e&&t.constructor===e.constructor}function r(t,e,n){h.push({parentID:t,parentNode:null,type:l.INSERT_MARKUP,markupIndex:f.push(e)-1,fromIndex:null,textContent:null,toIndex:n})}function o(t,e,n){h.push({parentID:t,parentNode:null,type:l.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:e,toIndex:n})}function i(t,e){h.push({parentID:t,parentNode:null,type:l.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:e,toIndex:null})}function a(t,e){h.push({parentID:t,parentNode:null,type:l.TEXT_CONTENT,markupIndex:null,textContent:e,fromIndex:null,toIndex:null})}function s(){h.length&&(c.DOMIDOperations.dangerouslyProcessChildrenUpdates(h,f),u())}function u(){h.length=0,f.length=0}var c=t("./ReactComponent"),l=t("./ReactMultiChildUpdateTypes"),p=t("./flattenChildren"),d=0,h=[],f=[],m={Mixin:{mountChildren:function(t,e){var n=p(t),r=[],o=0;this._renderedChildren=n;for(var i in n){var a=n[i];if(n.hasOwnProperty(i)&&a){var s=this._rootNodeID+"."+i,u=a.mountComponent(s,e,this._mountDepth+1);a._mountImage=u,a._mountIndex=o,r.push(u),o++}}return r},updateTextContent:function(t){d++;try{var e=this._renderedChildren;for(var n in e)e.hasOwnProperty(n)&&e[n]&&this._unmountChildByName(e[n],n);this.setTextContent(t)}catch(r){throw d--,d||u(),r}d--,d||s()},updateChildren:function(t,e){d++;try{this._updateChildren(t,e)}catch(n){throw d--,d||u(),n}d--,d||s()},_updateChildren:function(t,e){var r=p(t),o=this._renderedChildren;if(r||o){var i,a=0,s=0;for(i in r)if(r.hasOwnProperty(i)){var u=o&&o[i],c=r[i];n(u,c)?(this.moveChild(u,s,a),a=Math.max(u._mountIndex,a),u.receiveProps(c.props,e),u._mountIndex=s):(u&&(a=Math.max(u._mountIndex,a),this._unmountChildByName(u,i)),c&&this._mountChildByNameAtIndex(c,i,s,e)),c&&s++}for(i in o)!o.hasOwnProperty(i)||!o[i]||r&&r[i]||this._unmountChildByName(o[i],i)}},unmountChildren:function(){var t=this._renderedChildren;for(var e in t){var n=t[e];n&&n.unmountComponent&&n.unmountComponent()}this._renderedChildren=null},moveChild:function(t,e,n){t._mountIndex>";e.exports=u},{"./createObjectFrom":78,"./invariant":94}],56:[function(t,e){"use strict";function n(){this.reinitializeTransaction(),this.reactMountReady=s.getPooled(null)}var r=t("./ExecutionEnvironment"),o=t("./PooledClass"),i=t("./ReactEventEmitter"),a=t("./ReactInputSelection"),s=t("./ReactMountReady"),u=t("./Transaction"),c=t("./mixInto"),l={initialize:a.getSelectionInformation,close:a.restoreSelection},p={initialize:function(){var t=i.isEnabled();return i.setEnabled(!1),t},close:function(t){i.setEnabled(t)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[l,p,d],f={getTransactionWrappers:function(){return r.canUseDOM?h:[]},getReactMountReady:function(){return this.reactMountReady},destructor:function(){s.release(this.reactMountReady),this.reactMountReady=null}};c(n,u.Mixin),c(n,f),o.addPoolingTo(n),e.exports=n},{"./ExecutionEnvironment":20,"./PooledClass":23,"./ReactEventEmitter":42,"./ReactInputSelection":45,"./ReactMountReady":49,"./Transaction":71,"./mixInto":106}],57:[function(t,e){"use strict";function n(t,e){var n=i.createReactRootID(),a=o.getPooled();a.reinitializeTransaction();try{a.perform(function(){var o=t.mountComponent(n,a,0);o=r.addChecksumToMarkup(o),e(o)},null)}finally{o.release(a)}}var r=t("./ReactMarkupChecksum"),o=t("./ReactReconcileTransaction"),i=t("./ReactInstanceHandles");e.exports={renderComponentToString:n}},{"./ReactInstanceHandles":46,"./ReactMarkupChecksum":47,"./ReactReconcileTransaction":56}],58:[function(t,e){"use strict";var n=t("./ReactComponent"),r=t("./ReactMount"),o=t("./escapeTextForBrowser"),i=t("./mixInto"),a=function(t){this.construct({text:t})};i(a,n.Mixin),i(a,{mountComponent:function(t,e,i){return n.Mixin.mountComponent.call(this,t,e,i),"'+o(this.props.text)+""},receiveProps:function(t){t.text!==this.props.text&&(this.props.text=t.text,n.DOMIDOperations.updateTextContentByID(this._rootNodeID,t.text))}}),e.exports=a},{"./ReactComponent":25,"./ReactMount":48,"./escapeTextForBrowser":81,"./mixInto":106}],59:[function(t,e){"use strict";function n(){c(p)}function r(t,e){n(),p.batchedUpdates(t,e)}function o(t,e){return t._mountDepth-e._mountDepth}function i(){l.sort(o);for(var t=0;t":">","<":"<",'"':""","'":"'","/":"/"},i=/[&><"'\/]/g;e.exports=r},{}],82:[function(t,e){var n=function(t){var e=Array.prototype.slice.call(arguments).map(function(t){return String(t)}),r=t.split("%s").length-1;return r!==e.length-1?n("ex args number mismatch: %s",JSON.stringify(e)):n._prefix+JSON.stringify(e)+n._suffix};n._prefix="",e.exports=n},{}],83:[function(t,e){"use strict";function n(t,e,n){for(var r=t.attributes,o=r.length,i=[],a=0;o>a;a++){var s=r.item(a);e.call(n,s)&&i.push(s)}return i}e.exports=n},{}],84:[function(t,e){"use strict";function n(t,e,n){var r=t;o(!r.hasOwnProperty(n)),r[n]=e}function r(t){if(null==t)return t;var e={};return i(t,n,e),e}var o=t("./invariant"),i=t("./traverseAllChildren");e.exports=r},{"./invariant":94,"./traverseAllChildren":112}],85:[function(t,e){"use strict";var n=function(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)};e.exports=n},{}],86:[function(t,e){function n(t,e,n){return"string"!=typeof t?t:e?r(t,e,n):document.getElementById(t)}function r(t,e,n){var i,a,s;if(o(e)==t)return e;if(e.getElementsByTagName){for(a=e.getElementsByTagName(n||"*"),s=0;s":"<"+t+">",a[t]=!i.firstChild),a[t]?p[t]:null}var r=t("./ExecutionEnvironment"),o=t("./invariant"),i=r.canUseDOM?document.createElement("div"):null,a={circle:!0,g:!0,line:!0,path:!0,polyline:!0,rect:!0,text:!0},s=[1,'"],u=[1,"","
    "],c=[3,"","
    "],l=[1,"",""],p={"*":[1,"?
    ","
    "],area:[1,"",""],col:[2,"","
    "],legend:[1,"
    ","
    "],param:[1,"",""],tr:[2,"","
    "],optgroup:s,option:s,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c,circle:l,g:l,line:l,path:l,polyline:l,rect:l,text:l};e.exports=n},{"./ExecutionEnvironment":20,"./invariant":94}],90:[function(t,e){"use strict";function n(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function r(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function o(t,e){for(var o=n(t),i=0,a=0;o;){if(3==o.nodeType){if(a=i+o.textContent.length,e>=i&&a>=e)return{node:o,offset:e-i};i=a}o=n(r(o))}}e.exports=o},{}],91:[function(t,e){"use strict";function n(t){return t&&t.firstChild}e.exports=n},{}],92:[function(t,e){"use strict";function n(){return!o&&r.canUseDOM&&(o="innerText"in document.createElement("div")?"innerText":"textContent"),o}var r=t("./ExecutionEnvironment"),o=null;e.exports=n},{"./ExecutionEnvironment":20}],93:[function(t,e){function n(t){return t.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;e.exports=n},{}],94:[function(t,e){function n(t){if(!t)throw new Error("Invariant Violation")}e.exports=n},{}],95:[function(t,e){"use strict";function n(t,e){if(!r||e&&!r.addEventListener)return!1;var n=document.createElement("div"),i="on"+t,a=i in n;return a||(n.setAttribute(i,"return;"),a="function"==typeof n[i],"undefined"!=typeof n[i]&&(n[i]=void 0),n.removeAttribute(i)),!a&&o&&"wheel"===t&&(a=document.implementation.hasFeature("Events.wheel","3.0")),n=null,a}var r,o,i=t("./ExecutionEnvironment");i.canUseDOM&&(r=document.createElement("div"),o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=n},{"./ExecutionEnvironment":20}],96:[function(t,e){function n(t){return!(!t||!("undefined"!=typeof Node?t instanceof Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}e.exports=n},{}],97:[function(t,e){"use strict";function n(t){return t&&("INPUT"===t.nodeName&&r[t.type]||"TEXTAREA"===t.nodeName)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=n},{}],98:[function(t,e){function n(t){return r(t)&&3==t.nodeType}var r=t("./isNode");e.exports=n},{"./isNode":96}],99:[function(t,e){"use strict";function n(t){t||(t="");var e,n=arguments.length;if(n>1)for(var r=1;n>r;r++)e=arguments[r],e&&(t+=" "+e);return t}e.exports=n},{}],100:[function(t,e){"use strict";var n=t("./invariant"),r=function(t){var e,r={};n(t instanceof Object&&!Array.isArray(t));for(e in t)t.hasOwnProperty(e)&&(r[e]=e);return r};e.exports=r},{"./invariant":94}],101:[function(t,e){var n=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return e;return null};e.exports=n},{}],102:[function(t,e){"use strict";function n(t){var e={};return function(n){return e.hasOwnProperty(n)?e[n]:e[n]=t.call(this,n)}}e.exports=n},{}],103:[function(t,e){"use strict";var n=t("./mergeInto"),r=function(t,e){var r={};return n(r,t),n(r,e),r};e.exports=r},{"./mergeInto":105}],104:[function(t,e){"use strict";var n=t("./invariant"),r=t("./keyMirror"),o=36,i=function(t){return"object"!=typeof t||null===t},a={MAX_MERGE_DEPTH:o,isTerminal:i,normalizeMergeArg:function(t){return void 0===t||null===t?{}:t},checkMergeArrayArgs:function(t,e){n(Array.isArray(t)&&Array.isArray(e))},checkMergeObjectArgs:function(t,e){a.checkMergeObjectArg(t),a.checkMergeObjectArg(e)},checkMergeObjectArg:function(t){n(!i(t)&&!Array.isArray(t))},checkMergeLevel:function(t){n(o>t)},checkArrayStrategy:function(t){n(void 0===t||t in a.ArrayStrategies)},ArrayStrategies:r({Clobber:!0,IndexByIndex:!0})};e.exports=a},{"./invariant":94,"./keyMirror":100}],105:[function(t,e){"use strict";function n(t,e){if(o(t),null!=e){o(e);for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}}var r=t("./mergeHelpers"),o=r.checkMergeObjectArg;e.exports=n},{"./mergeHelpers":104}],106:[function(t,e){"use strict";var n=function(t,e){var n;for(n in e)e.hasOwnProperty(n)&&(t.prototype[n]=e[n])};e.exports=n},{}],107:[function(t,e){"use strict";function n(t,e){i("html"===t.tagName.toLowerCase()),e=e.trim(),i(0===e.toLowerCase().indexOf("")+1,a=e.lastIndexOf("<"),s=e.substring(0,n),u=e.substring(n,a),c=s.indexOf(" ")>-1,l=null;if(c){l=r(s.replace("html ","span ")+"")[0];var p=o(l,function(e){return t.getAttributeNS(e.namespaceURI,e.name)!==e.value});p.forEach(function(e){t.setAttributeNS(e.namespaceURI,e.name,e.value)})}var d=o(t,function(t){return!(l&&l.hasAttributeNS(t.namespaceURI,t.name))});d.forEach(function(e){t.removeAttributeNS(e.namespaceURI,e.name)}),t.innerHTML=u}var r=t("./createNodesFromMarkup"),o=t("./filterAttributes"),i=t("./invariant");e.exports=n},{"./createNodesFromMarkup":77,"./filterAttributes":83,"./invariant":94}],108:[function(t,e){function n(t,e){return t&&e?t===e?!0:r(t)?!1:r(e)?n(t,e.parentNode):t.contains?t.contains(e):t.compareDocumentPosition?!!(16&t.compareDocumentPosition(e)):!1:!1}var r=t("./isTextNode");e.exports=n},{"./isTextNode":98}],109:[function(t,e){"use strict";function n(t,e,n){if(!t)return null;var r=0,o={};for(var i in t)t.hasOwnProperty(i)&&(o[i]=e.call(n,t[i],i,r++));return o}e.exports=n},{}],110:[function(t,e){"use strict";function n(t,e,n){if(!t)return null;var r=0,o={};for(var i in t)t.hasOwnProperty(i)&&(o[i]=e.call(n,i,t[i],r++));return o}e.exports=n},{}],111:[function(t,e){"use strict";function n(t,e){if(t===e)return!0;var n;for(n in t)if(t.hasOwnProperty(n)&&(!e.hasOwnProperty(n)||t[n]!==e[n]))return!1;for(n in e)if(e.hasOwnProperty(n)&&!t.hasOwnProperty(n))return!1;return!0}e.exports=n},{}],112:[function(t,e){"use strict";function n(t,e,n){null!==t&&void 0!==t&&a(t,"",0,e,n)}var r=t("./ReactComponent"),o=t("./ReactTextComponent"),i=t("./invariant"),a=function(t,e,n,s,u){var c=0;if(Array.isArray(t))for(var l=0;l