Keep docs/js/{react,JSXTransformer}.js in repo
This way we don't need to rebuild them each time for the website.
Ben Alpert committed
Mar 28, 2015 at 14:56 UTC
0b6c7c29fe5618246af3ab41c7403628710ca183
6 files changed
+35469
-21
Gruntfile.js
-2
@@ -18,7 +18,6 @@ module.exports = function(grunt) {
18
19
grunt.initConfig({
20
pkg: grunt.file.readJSON('package.json'),
21
- copy: require('./grunt/config/copy'),
21
jsx: require('./grunt/config/jsx'),
22
browserify: require('./grunt/config/browserify'),
23
populist: require('./grunt/config/populist')(grunt),
@@ -236,7 +235,6 @@ module.exports = function(grunt) {
235
'npm-react:pack',
236
'npm-react-tools:release',
237
'npm-react-tools:pack',
239
- 'copy:react_docs',
238
'compare_size'
239
]);
240
docs/js/JSXTransformer.js
new
+15924
@@ -0,0 +1,15924 @@
1
+/**
2
+ * JSXTransformer v0.13.1
3
+ */
4
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5
+/**
6
+ * Copyright 2013-2015, Facebook, Inc.
7
+ * All rights reserved.
8
+ *
9
+ * This source code is licensed under the BSD-style license found in the
10
+ * LICENSE file in the root directory of this source tree. An additional grant
11
+ * of patent rights can be found in the PATENTS file in the same directory.
12
+ */
13
+/* jshint browser: true */
14
+/* jslint evil: true */
15
+/*eslint-disable no-eval */
16
+/*eslint-disable block-scoped-var */
17
+
18
+'use strict';
19
+
20
+var ReactTools = _dereq_('../main');
21
+var inlineSourceMap = _dereq_('./inline-source-map');
22
+
23
+var headEl;
24
+var dummyAnchor;
25
+var inlineScriptCount = 0;
26
+
27
+// The source-map library relies on Object.defineProperty, but IE8 doesn't
28
+// support it fully even with es5-sham. Indeed, es5-sham's defineProperty
29
+// throws when Object.prototype.__defineGetter__ is missing, so we skip building
30
+// the source map in that case.
31
+var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
32
+
33
+/**
34
+ * Run provided code through jstransform.
35
+ *
36
+ * @param {string} source Original source code
37
+ * @param {object?} options Options to pass to jstransform
38
+ * @return {object} object as returned from jstransform
39
+ */
40
+function transformReact(source, options) {
41
+ options = options || {};
42
+
43
+ // Force the sourcemaps option manually. We don't want to use it if it will
44
+ // break (see above note about supportsAccessors). We'll only override the
45
+ // value here if sourceMap was specified and is truthy. This guarantees that
46
+ // we won't override any user intent (since this method is exposed publicly).
47
+ if (options.sourceMap) {
48
+ options.sourceMap = supportsAccessors;
49
+ }
50
+
51
+ // Otherwise just pass all options straight through to react-tools.
52
+ return ReactTools.transformWithDetails(source, options);
53
+}
54
+
55
+/**
56
+ * Eval provided source after transforming it.
57
+ *
58
+ * @param {string} source Original source code
59
+ * @param {object?} options Options to pass to jstransform
60
+ */
61
+function exec(source, options) {
62
+ return eval(transformReact(source, options).code);
63
+}
64
+
65
+/**
66
+ * This method returns a nicely formated line of code pointing to the exact
67
+ * location of the error `e`. The line is limited in size so big lines of code
68
+ * are also shown in a readable way.
69
+ *
70
+ * Example:
71
+ * ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=" ...
72
+ * ^
73
+ *
74
+ * @param {string} code The full string of code
75
+ * @param {Error} e The error being thrown
76
+ * @return {string} formatted message
77
+ * @internal
78
+ */
79
+function createSourceCodeErrorMessage(code, e) {
80
+ var sourceLines = code.split('\n');
81
+ // e.lineNumber is non-standard so we can't depend on its availability. If
82
+ // we're in a browser where it isn't supported, don't even bother trying to
83
+ // format anything. We may also hit a case where the line number is reported
84
+ // incorrectly and is outside the bounds of the actual code. Handle that too.
85
+ if (!e.lineNumber || e.lineNumber > sourceLines.length) {
86
+ return '';
87
+ }
88
+ var erroneousLine = sourceLines[e.lineNumber - 1];
89
+
90
+ // Removes any leading indenting spaces and gets the number of
91
+ // chars indenting the `erroneousLine`
92
+ var indentation = 0;
93
+ erroneousLine = erroneousLine.replace(/^\s+/, function(leadingSpaces) {
94
+ indentation = leadingSpaces.length;
95
+ return '';
96
+ });
97
+
98
+ // Defines the number of characters that are going to show
99
+ // before and after the erroneous code
100
+ var LIMIT = 30;
101
+ var errorColumn = e.column - indentation;
102
+
103
+ if (errorColumn > LIMIT) {
104
+ erroneousLine = '... ' + erroneousLine.slice(errorColumn - LIMIT);
105
+ errorColumn = 4 + LIMIT;
106
+ }
107
+ if (erroneousLine.length - errorColumn > LIMIT) {
108
+ erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + ' ...';
109
+ }
110
+ var message = '\n\n' + erroneousLine + '\n';
111
+ message += new Array(errorColumn - 1).join(' ') + '^';
112
+ return message;
113
+}
114
+
115
+/**
116
+ * Actually transform the code.
117
+ *
118
+ * @param {string} code
119
+ * @param {string?} url
120
+ * @param {object?} options
121
+ * @return {string} The transformed code.
122
+ * @internal
123
+ */
124
+function transformCode(code, url, options) {
125
+ try {
126
+ var transformed = transformReact(code, options);
127
+ } catch(e) {
128
+ e.message += '\n at ';
129
+ if (url) {
130
+ if ('fileName' in e) {
131
+ // We set `fileName` if it's supported by this error object and
132
+ // a `url` was provided.
133
+ // The error will correctly point to `url` in Firefox.
134
+ e.fileName = url;
135
+ }
136
+ e.message += url + ':' + e.lineNumber + ':' + e.columnNumber;
137
+ } else {
138
+ e.message += location.href;
139
+ }
140
+ e.message += createSourceCodeErrorMessage(code, e);
141
+ throw e;
142
+ }
143
+
144
+ if (!transformed.sourceMap) {
145
+ return transformed.code;
146
+ }
147
+
148
+ var source;
149
+ if (url == null) {
150
+ source = 'Inline JSX script';
151
+ inlineScriptCount++;
152
+ if (inlineScriptCount > 1) {
153
+ source += ' (' + inlineScriptCount + ')';
154
+ }
155
+ } else if (dummyAnchor) {
156
+ // Firefox has problems when the sourcemap source is a proper URL with a
157
+ // protocol and hostname, so use the pathname. We could use just the
158
+ // filename, but hopefully using the full path will prevent potential
159
+ // issues where the same filename exists in multiple directories.
160
+ dummyAnchor.href = url;
161
+ source = dummyAnchor.pathname.substr(1);
162
+ }
163
+
164
+ return (
165
+ transformed.code +
166
+ '\n' +
167
+ inlineSourceMap(transformed.sourceMap, code, source)
168
+ );
169
+}
170
+
171
+
172
+/**
173
+ * Appends a script element at the end of the <head> with the content of code,
174
+ * after transforming it.
175
+ *
176
+ * @param {string} code The original source code
177
+ * @param {string?} url Where the code came from. null if inline
178
+ * @param {object?} options Options to pass to jstransform
179
+ * @internal
180
+ */
181
+function run(code, url, options) {
182
+ var scriptEl = document.createElement('script');
183
+ scriptEl.text = transformCode(code, url, options);
184
+ headEl.appendChild(scriptEl);
185
+}
186
+
187
+/**
188
+ * Load script from the provided url and pass the content to the callback.
189
+ *
190
+ * @param {string} url The location of the script src
191
+ * @param {function} callback Function to call with the content of url
192
+ * @internal
193
+ */
194
+function load(url, successCallback, errorCallback) {
195
+ var xhr;
196
+ xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
197
+ : new XMLHttpRequest();
198
+
199
+ // async, however scripts will be executed in the order they are in the
200
+ // DOM to mirror normal script loading.
201
+ xhr.open('GET', url, true);
202
+ if ('overrideMimeType' in xhr) {
203
+ xhr.overrideMimeType('text/plain');
204
+ }
205
+ xhr.onreadystatechange = function() {
206
+ if (xhr.readyState === 4) {
207
+ if (xhr.status === 0 || xhr.status === 200) {
208
+ successCallback(xhr.responseText);
209
+ } else {
210
+ errorCallback();
211
+ throw new Error('Could not load ' + url);
212
+ }
213
+ }
214
+ };
215
+ return xhr.send(null);
216
+}
217
+
218
+/**
219
+ * Loop over provided script tags and get the content, via innerHTML if an
220
+ * inline script, or by using XHR. Transforms are applied if needed. The scripts
221
+ * are executed in the order they are found on the page.
222
+ *
223
+ * @param {array} scripts The <script> elements to load and run.
224
+ * @internal
225
+ */
226
+function loadScripts(scripts) {
227
+ var result = [];
228
+ var count = scripts.length;
229
+
230
+ function check() {
231
+ var script, i;
232
+
233
+ for (i = 0; i < count; i++) {
234
+ script = result[i];
235
+
236
+ if (script.loaded && !script.executed) {
237
+ script.executed = true;
238
+ run(script.content, script.url, script.options);
239
+ } else if (!script.loaded && !script.error && !script.async) {
240
+ break;
241
+ }
242
+ }
243
+ }
244
+
245
+ scripts.forEach(function(script, i) {
246
+ var options = {
247
+ sourceMap: true
248
+ };
249
+ if (/;harmony=true(;|$)/.test(script.type)) {
250
+ options.harmony = true;
251
+ }
252
+ if (/;stripTypes=true(;|$)/.test(script.type)) {
253
+ options.stripTypes = true;
254
+ }
255
+
256
+ // script.async is always true for non-javascript script tags
257
+ var async = script.hasAttribute('async');
258
+
259
+ if (script.src) {
260
+ result[i] = {
261
+ async: async,
262
+ error: false,
263
+ executed: false,
264
+ content: null,
265
+ loaded: false,
266
+ url: script.src,
267
+ options: options
268
+ };
269
+
270
+ load(script.src, function(content) {
271
+ result[i].loaded = true;
272
+ result[i].content = content;
273
+ check();
274
+ }, function() {
275
+ result[i].error = true;
276
+ check();
277
+ });
278
+ } else {
279
+ result[i] = {
280
+ async: async,
281
+ error: false,
282
+ executed: false,
283
+ content: script.innerHTML,
284
+ loaded: true,
285
+ url: null,
286
+ options: options
287
+ };
288
+ }
289
+ });
290
+
291
+ check();
292
+}
293
+
294
+/**
295
+ * Find and run all script tags with type="text/jsx".
296
+ *
297
+ * @internal
298
+ */
299
+function runScripts() {
300
+ var scripts = document.getElementsByTagName('script');
301
+
302
+ // Array.prototype.slice cannot be used on NodeList on IE8
303
+ var jsxScripts = [];
304
+ for (var i = 0; i < scripts.length; i++) {
305
+ if (/^text\/jsx(;|$)/.test(scripts.item(i).type)) {
306
+ jsxScripts.push(scripts.item(i));
307
+ }
308
+ }
309
+
310
+ if (jsxScripts.length < 1) {
311
+ return;
312
+ }
313
+
314
+ console.warn(
315
+ 'You are using the in-browser JSX transformer. Be sure to precompile ' +
316
+ 'your JSX for production - ' +
317
+ 'http://facebook.github.io/react/docs/tooling-integration.html#jsx'
318
+ );
319
+
320
+ loadScripts(jsxScripts);
321
+}
322
+
323
+// Listen for load event if we're in a browser and then kick off finding and
324
+// running of scripts.
325
+if (typeof window !== 'undefined' && window !== null) {
326
+ headEl = document.getElementsByTagName('head')[0];
327
+ dummyAnchor = document.createElement('a');
328
+
329
+ if (window.addEventListener) {
330
+ window.addEventListener('DOMContentLoaded', runScripts, false);
331
+ } else {
332
+ window.attachEvent('onload', runScripts);
333
+ }
334
+}
335
+
336
+module.exports = {
337
+ transform: transformReact,
338
+ exec: exec
339
+};
340
+
341
+},{"../main":2,"./inline-source-map":41}],2:[function(_dereq_,module,exports){
342
+/**
343
+ * Copyright 2013-2015, Facebook, Inc.
344
+ * All rights reserved.
345
+ *
346
+ * This source code is licensed under the BSD-style license found in the
347
+ * LICENSE file in the root directory of this source tree. An additional grant
348
+ * of patent rights can be found in the PATENTS file in the same directory.
349
+ */
350
+
351
+'use strict';
352
+/*eslint-disable no-undef*/
353
+var visitors = _dereq_('./vendor/fbtransform/visitors');
354
+var transform = _dereq_('jstransform').transform;
355
+var typesSyntax = _dereq_('jstransform/visitors/type-syntax');
356
+var inlineSourceMap = _dereq_('./vendor/inline-source-map');
357
+
358
+module.exports = {
359
+ transform: function(input, options) {
360
+ options = processOptions(options);
361
+ var output = innerTransform(input, options);
362
+ var result = output.code;
363
+ if (options.sourceMap) {
364
+ var map = inlineSourceMap(
365
+ output.sourceMap,
366
+ input,
367
+ options.filename
368
+ );
369
+ result += '\n' + map;
370
+ }
371
+ return result;
372
+ },
373
+ transformWithDetails: function(input, options) {
374
+ options = processOptions(options);
375
+ var output = innerTransform(input, options);
376
+ var result = {};
377
+ result.code = output.code;
378
+ if (options.sourceMap) {
379
+ result.sourceMap = output.sourceMap.toJSON();
380
+ }
381
+ if (options.filename) {
382
+ result.sourceMap.sources = [options.filename];
383
+ }
384
+ return result;
385
+ }
386
+};
387
+
388
+/**
389
+ * Only copy the values that we need. We'll do some preprocessing to account for
390
+ * converting command line flags to options that jstransform can actually use.
391
+ */
392
+function processOptions(opts) {
393
+ opts = opts || {};
394
+ var options = {};
395
+
396
+ options.harmony = opts.harmony;
397
+ options.stripTypes = opts.stripTypes;
398
+ options.sourceMap = opts.sourceMap;
399
+ options.filename = opts.sourceFilename;
400
+
401
+ if (opts.es6module) {
402
+ options.sourceType = 'module';
403
+ }
404
+ if (opts.nonStrictEs6module) {
405
+ options.sourceType = 'nonStrictModule';
406
+ }
407
+
408
+ // Instead of doing any fancy validation, only look for 'es3'. If we have
409
+ // that, then use it. Otherwise use 'es5'.
410
+ options.es3 = opts.target === 'es3';
411
+ options.es5 = !options.es3;
412
+
413
+ return options;
414
+}
415
+
416
+function innerTransform(input, options) {
417
+ var visitorSets = ['react'];
418
+ if (options.harmony) {
419
+ visitorSets.push('harmony');
420
+ }
421
+
422
+ if (options.es3) {
423
+ visitorSets.push('es3');
424
+ }
425
+
426
+ if (options.stripTypes) {
427
+ // Stripping types needs to happen before the other transforms
428
+ // unfortunately, due to bad interactions. For example,
429
+ // es6-rest-param-visitors conflict with stripping rest param type
430
+ // annotation
431
+ input = transform(typesSyntax.visitorList, input, options).code;
432
+ }
433
+
434
+ var visitorList = visitors.getVisitorsBySet(visitorSets);
435
+ return transform(visitorList, input, options);
436
+}
437
+
438
+},{"./vendor/fbtransform/visitors":40,"./vendor/inline-source-map":41,"jstransform":22,"jstransform/visitors/type-syntax":36}],3:[function(_dereq_,module,exports){
439
+/*!
440
+ * The buffer module from node.js, for the browser.
441
+ *
442
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
443
+ * @license MIT
444
+ */
445
+
446
+var base64 = _dereq_('base64-js')
447
+var ieee754 = _dereq_('ieee754')
448
+var isArray = _dereq_('is-array')
449
+
450
+exports.Buffer = Buffer
451
+exports.SlowBuffer = SlowBuffer
452
+exports.INSPECT_MAX_BYTES = 50
453
+Buffer.poolSize = 8192 // not used by this implementation
454
+
455
+var kMaxLength = 0x3fffffff
456
+var rootParent = {}
457
+
458
+/**
459
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
460
+ * === true Use Uint8Array implementation (fastest)
461
+ * === false Use Object implementation (most compatible, even IE6)
462
+ *
463
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
464
+ * Opera 11.6+, iOS 4.2+.
465
+ *
466
+ * Note:
467
+ *
468
+ * - Implementation must support adding new properties to `Uint8Array` instances.
469
+ * Firefox 4-29 lacked support, fixed in Firefox 30+.
470
+ * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
471
+ *
472
+ * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
473
+ *
474
+ * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
475
+ * incorrect length in some situations.
476
+ *
477
+ * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will
478
+ * get the Object implementation, which is slower but will work correctly.
479
+ */
480
+Buffer.TYPED_ARRAY_SUPPORT = (function () {
481
+ try {
482
+ var buf = new ArrayBuffer(0)
483
+ var arr = new Uint8Array(buf)
484
+ arr.foo = function () { return 42 }
485
+ return arr.foo() === 42 && // typed array instances can be augmented
486
+ typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
487
+ new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
488
+ } catch (e) {
489
+ return false
490
+ }
491
+})()
492
+
493
+/**
494
+ * Class: Buffer
495
+ * =============
496
+ *
497
+ * The Buffer constructor returns instances of `Uint8Array` that are augmented
498
+ * with function properties for all the node `Buffer` API functions. We use
499
+ * `Uint8Array` so that square bracket notation works as expected -- it returns
500
+ * a single octet.
501
+ *
502
+ * By augmenting the instances, we can avoid modifying the `Uint8Array`
503
+ * prototype.
504
+ */
505
+function Buffer (subject, encoding, noZero) {
506
+ if (!(this instanceof Buffer)) return new Buffer(subject, encoding, noZero)
507
+
508
+ var type = typeof subject
509
+ var length
510
+
511
+ if (type === 'number') {
512
+ length = +subject
513
+ } else if (type === 'string') {
514
+ length = Buffer.byteLength(subject, encoding)
515
+ } else if (type === 'object' && subject !== null) {
516
+ // assume object is array-like
517
+ if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data
518
+ length = +subject.length
519
+ } else {
520
+ throw new TypeError('must start with number, buffer, array or string')
521
+ }
522
+
523
+ if (length > kMaxLength) {
524
+ throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +
525
+ kMaxLength.toString(16) + ' bytes')
526
+ }
527
+
528
+ if (length < 0) length = 0
529
+ else length >>>= 0 // coerce to uint32
530
+
531
+ var self = this
532
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
533
+ // Preferred: Return an augmented `Uint8Array` instance for best performance
534
+ /*eslint-disable consistent-this */
535
+ self = Buffer._augment(new Uint8Array(length))
536
+ /*eslint-enable consistent-this */
537
+ } else {
538
+ // Fallback: Return THIS instance of Buffer (created by `new`)
539
+ self.length = length
540
+ self._isBuffer = true
541
+ }
542
+
543
+ var i
544
+ if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {
545
+ // Speed optimization -- use set if we're copying from a typed array
546
+ self._set(subject)
547
+ } else if (isArrayish(subject)) {
548
+ // Treat array-ish objects as a byte array
549
+ if (Buffer.isBuffer(subject)) {
550
+ for (i = 0; i < length; i++) {
551
+ self[i] = subject.readUInt8(i)
552
+ }
553
+ } else {
554
+ for (i = 0; i < length; i++) {
555
+ self[i] = ((subject[i] % 256) + 256) % 256
556
+ }
557
+ }
558
+ } else if (type === 'string') {
559
+ self.write(subject, 0, encoding)
560
+ } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {
561
+ for (i = 0; i < length; i++) {
562
+ self[i] = 0
563
+ }
564
+ }
565
+
566
+ if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent
567
+
568
+ return self
569
+}
570
+
571
+function SlowBuffer (subject, encoding, noZero) {
572
+ if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding, noZero)
573
+
574
+ var buf = new Buffer(subject, encoding, noZero)
575
+ delete buf.parent
576
+ return buf
577
+}
578
+
579
+Buffer.isBuffer = function isBuffer (b) {
580
+ return !!(b != null && b._isBuffer)
581
+}
582
+
583
+Buffer.compare = function compare (a, b) {
584
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
585
+ throw new TypeError('Arguments must be Buffers')
586
+ }
587
+
588
+ if (a === b) return 0
589
+
590
+ var x = a.length
591
+ var y = b.length
592
+ for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
593
+ if (i !== len) {
594
+ x = a[i]
595
+ y = b[i]
596
+ }
597
+ if (x < y) return -1
598
+ if (y < x) return 1
599
+ return 0
600
+}
601
+
602
+Buffer.isEncoding = function isEncoding (encoding) {
603
+ switch (String(encoding).toLowerCase()) {
604
+ case 'hex':
605
+ case 'utf8':
606
+ case 'utf-8':
607
+ case 'ascii':
608
+ case 'binary':
609
+ case 'base64':
610
+ case 'raw':
611
+ case 'ucs2':
612
+ case 'ucs-2':
613
+ case 'utf16le':
614
+ case 'utf-16le':
615
+ return true
616
+ default:
617
+ return false
618
+ }
619
+}
620
+
621
+Buffer.concat = function concat (list, totalLength) {
622
+ if (!isArray(list)) throw new TypeError('Usage: Buffer.concat(list[, length])')
623
+
624
+ if (list.length === 0) {
625
+ return new Buffer(0)
626
+ } else if (list.length === 1) {
627
+ return list[0]
628
+ }
629
+
630
+ var i
631
+ if (totalLength === undefined) {
632
+ totalLength = 0
633
+ for (i = 0; i < list.length; i++) {
634
+ totalLength += list[i].length
635
+ }
636
+ }
637
+
638
+ var buf = new Buffer(totalLength)
639
+ var pos = 0
640
+ for (i = 0; i < list.length; i++) {
641
+ var item = list[i]
642
+ item.copy(buf, pos)
643
+ pos += item.length
644
+ }
645
+ return buf
646
+}
647
+
648
+Buffer.byteLength = function byteLength (str, encoding) {
649
+ var ret
650
+ str = str + ''
651
+ switch (encoding || 'utf8') {
652
+ case 'ascii':
653
+ case 'binary':
654
+ case 'raw':
655
+ ret = str.length
656
+ break
657
+ case 'ucs2':
658
+ case 'ucs-2':
659
+ case 'utf16le':
660
+ case 'utf-16le':
661
+ ret = str.length * 2
662
+ break
663
+ case 'hex':
664
+ ret = str.length >>> 1
665
+ break
666
+ case 'utf8':
667
+ case 'utf-8':
668
+ ret = utf8ToBytes(str).length
669
+ break
670
+ case 'base64':
671
+ ret = base64ToBytes(str).length
672
+ break
673
+ default:
674
+ ret = str.length
675
+ }
676
+ return ret
677
+}
678
+
679
+// pre-set for values that may exist in the future
680
+Buffer.prototype.length = undefined
681
+Buffer.prototype.parent = undefined
682
+
683
+// toString(encoding, start=0, end=buffer.length)
684
+Buffer.prototype.toString = function toString (encoding, start, end) {
685
+ var loweredCase = false
686
+
687
+ start = start >>> 0
688
+ end = end === undefined || end === Infinity ? this.length : end >>> 0
689
+
690
+ if (!encoding) encoding = 'utf8'
691
+ if (start < 0) start = 0
692
+ if (end > this.length) end = this.length
693
+ if (end <= start) return ''
694
+
695
+ while (true) {
696
+ switch (encoding) {
697
+ case 'hex':
698
+ return hexSlice(this, start, end)
699
+
700
+ case 'utf8':
701
+ case 'utf-8':
702
+ return utf8Slice(this, start, end)
703
+
704
+ case 'ascii':
705
+ return asciiSlice(this, start, end)
706
+
707
+ case 'binary':
708
+ return binarySlice(this, start, end)
709
+
710
+ case 'base64':
711
+ return base64Slice(this, start, end)
712
+
713
+ case 'ucs2':
714
+ case 'ucs-2':
715
+ case 'utf16le':
716
+ case 'utf-16le':
717
+ return utf16leSlice(this, start, end)
718
+
719
+ default:
720
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
721
+ encoding = (encoding + '').toLowerCase()
722
+ loweredCase = true
723
+ }
724
+ }
725
+}
726
+
727
+Buffer.prototype.equals = function equals (b) {
728
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
729
+ if (this === b) return true
730
+ return Buffer.compare(this, b) === 0
731
+}
732
+
733
+Buffer.prototype.inspect = function inspect () {
734
+ var str = ''
735
+ var max = exports.INSPECT_MAX_BYTES
736
+ if (this.length > 0) {
737
+ str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
738
+ if (this.length > max) str += ' ... '
739
+ }
740
+ return '<Buffer ' + str + '>'
741
+}
742
+
743
+Buffer.prototype.compare = function compare (b) {
744
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
745
+ if (this === b) return 0
746
+ return Buffer.compare(this, b)
747
+}
748
+
749
+Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
750
+ if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
751
+ else if (byteOffset < -0x80000000) byteOffset = -0x80000000
752
+ byteOffset >>= 0
753
+
754
+ if (this.length === 0) return -1
755
+ if (byteOffset >= this.length) return -1
756
+
757
+ // Negative offsets start from the end of the buffer
758
+ if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
759
+
760
+ if (typeof val === 'string') {
761
+ if (val.length === 0) return -1 // special case: looking for empty string always fails
762
+ return String.prototype.indexOf.call(this, val, byteOffset)
763
+ }
764
+ if (Buffer.isBuffer(val)) {
765
+ return arrayIndexOf(this, val, byteOffset)
766
+ }
767
+ if (typeof val === 'number') {
768
+ if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
769
+ return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
770
+ }
771
+ return arrayIndexOf(this, [ val ], byteOffset)
772
+ }
773
+
774
+ function arrayIndexOf (arr, val, byteOffset) {
775
+ var foundIndex = -1
776
+ for (var i = 0; byteOffset + i < arr.length; i++) {
777
+ if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
778
+ if (foundIndex === -1) foundIndex = i
779
+ if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
780
+ } else {
781
+ foundIndex = -1
782
+ }
783
+ }
784
+ return -1
785
+ }
786
+
787
+ throw new TypeError('val must be string, number or Buffer')
788
+}
789
+
790
+// `get` will be removed in Node 0.13+
791
+Buffer.prototype.get = function get (offset) {
792
+ console.log('.get() is deprecated. Access using array indexes instead.')
793
+ return this.readUInt8(offset)
794
+}
795
+
796
+// `set` will be removed in Node 0.13+
797
+Buffer.prototype.set = function set (v, offset) {
798
+ console.log('.set() is deprecated. Access using array indexes instead.')
799
+ return this.writeUInt8(v, offset)
800
+}
801
+
802
+function hexWrite (buf, string, offset, length) {
803
+ offset = Number(offset) || 0
804
+ var remaining = buf.length - offset
805
+ if (!length) {
806
+ length = remaining
807
+ } else {
808
+ length = Number(length)
809
+ if (length > remaining) {
810
+ length = remaining
811
+ }
812
+ }
813
+
814
+ // must be an even number of digits
815
+ var strLen = string.length
816
+ if (strLen % 2 !== 0) throw new Error('Invalid hex string')
817
+
818
+ if (length > strLen / 2) {
819
+ length = strLen / 2
820
+ }
821
+ for (var i = 0; i < length; i++) {
822
+ var parsed = parseInt(string.substr(i * 2, 2), 16)
823
+ if (isNaN(parsed)) throw new Error('Invalid hex string')
824
+ buf[offset + i] = parsed
825
+ }
826
+ return i
827
+}
828
+
829
+function utf8Write (buf, string, offset, length) {
830
+ var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
831
+ return charsWritten
832
+}
833
+
834
+function asciiWrite (buf, string, offset, length) {
835
+ var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)
836
+ return charsWritten
837
+}
838
+
839
+function binaryWrite (buf, string, offset, length) {
840
+ return asciiWrite(buf, string, offset, length)
841
+}
842
+
843
+function base64Write (buf, string, offset, length) {
844
+ var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)
845
+ return charsWritten
846
+}
847
+
848
+function utf16leWrite (buf, string, offset, length) {
849
+ var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
850
+ return charsWritten
851
+}
852
+
853
+Buffer.prototype.write = function write (string, offset, length, encoding) {
854
+ // Support both (string, offset, length, encoding)
855
+ // and the legacy (string, encoding, offset, length)
856
+ if (isFinite(offset)) {
857
+ if (!isFinite(length)) {
858
+ encoding = length
859
+ length = undefined
860
+ }
861
+ } else { // legacy
862
+ var swap = encoding
863
+ encoding = offset
864
+ offset = length
865
+ length = swap
866
+ }
867
+
868
+ offset = Number(offset) || 0
869
+
870
+ if (length < 0 || offset < 0 || offset > this.length) {
871
+ throw new RangeError('attempt to write outside buffer bounds')
872
+ }
873
+
874
+ var remaining = this.length - offset
875
+ if (!length) {
876
+ length = remaining
877
+ } else {
878
+ length = Number(length)
879
+ if (length > remaining) {
880
+ length = remaining
881
+ }
882
+ }
883
+ encoding = String(encoding || 'utf8').toLowerCase()
884
+
885
+ var ret
886
+ switch (encoding) {
887
+ case 'hex':
888
+ ret = hexWrite(this, string, offset, length)
889
+ break
890
+ case 'utf8':
891
+ case 'utf-8':
892
+ ret = utf8Write(this, string, offset, length)
893
+ break
894
+ case 'ascii':
895
+ ret = asciiWrite(this, string, offset, length)
896
+ break
897
+ case 'binary':
898
+ ret = binaryWrite(this, string, offset, length)
899
+ break
900
+ case 'base64':
901
+ ret = base64Write(this, string, offset, length)
902
+ break
903
+ case 'ucs2':
904
+ case 'ucs-2':
905
+ case 'utf16le':
906
+ case 'utf-16le':
907
+ ret = utf16leWrite(this, string, offset, length)
908
+ break
909
+ default:
910
+ throw new TypeError('Unknown encoding: ' + encoding)
911
+ }
912
+ return ret
913
+}
914
+
915
+Buffer.prototype.toJSON = function toJSON () {
916
+ return {
917
+ type: 'Buffer',
918
+ data: Array.prototype.slice.call(this._arr || this, 0)
919
+ }
920
+}
921
+
922
+function base64Slice (buf, start, end) {
923
+ if (start === 0 && end === buf.length) {
924
+ return base64.fromByteArray(buf)
925
+ } else {
926
+ return base64.fromByteArray(buf.slice(start, end))
927
+ }
928
+}
929
+
930
+function utf8Slice (buf, start, end) {
931
+ var res = ''
932
+ var tmp = ''
933
+ end = Math.min(buf.length, end)
934
+
935
+ for (var i = start; i < end; i++) {
936
+ if (buf[i] <= 0x7F) {
937
+ res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
938
+ tmp = ''
939
+ } else {
940
+ tmp += '%' + buf[i].toString(16)
941
+ }
942
+ }
943
+
944
+ return res + decodeUtf8Char(tmp)
945
+}
946
+
947
+function asciiSlice (buf, start, end) {
948
+ var ret = ''
949
+ end = Math.min(buf.length, end)
950
+
951
+ for (var i = start; i < end; i++) {
952
+ ret += String.fromCharCode(buf[i] & 0x7F)
953
+ }
954
+ return ret
955
+}
956
+
957
+function binarySlice (buf, start, end) {
958
+ var ret = ''
959
+ end = Math.min(buf.length, end)
960
+
961
+ for (var i = start; i < end; i++) {
962
+ ret += String.fromCharCode(buf[i])
963
+ }
964
+ return ret
965
+}
966
+
967
+function hexSlice (buf, start, end) {
968
+ var len = buf.length
969
+
970
+ if (!start || start < 0) start = 0
971
+ if (!end || end < 0 || end > len) end = len
972
+
973
+ var out = ''
974
+ for (var i = start; i < end; i++) {
975
+ out += toHex(buf[i])
976
+ }
977
+ return out
978
+}
979
+
980
+function utf16leSlice (buf, start, end) {
981
+ var bytes = buf.slice(start, end)
982
+ var res = ''
983
+ for (var i = 0; i < bytes.length; i += 2) {
984
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
985
+ }
986
+ return res
987
+}
988
+
989
+Buffer.prototype.slice = function slice (start, end) {
990
+ var len = this.length
991
+ start = ~~start
992
+ end = end === undefined ? len : ~~end
993
+
994
+ if (start < 0) {
995
+ start += len
996
+ if (start < 0) start = 0
997
+ } else if (start > len) {
998
+ start = len
999
+ }
1000
+
1001
+ if (end < 0) {
1002
+ end += len
1003
+ if (end < 0) end = 0
1004
+ } else if (end > len) {
1005
+ end = len
1006
+ }
1007
+
1008
+ if (end < start) end = start
1009
+
1010
+ var newBuf
1011
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1012
+ newBuf = Buffer._augment(this.subarray(start, end))
1013
+ } else {
1014
+ var sliceLen = end - start
1015
+ newBuf = new Buffer(sliceLen, undefined, true)
1016
+ for (var i = 0; i < sliceLen; i++) {
1017
+ newBuf[i] = this[i + start]
1018
+ }
1019
+ }
1020
+
1021
+ if (newBuf.length) newBuf.parent = this.parent || this
1022
+
1023
+ return newBuf
1024
+}
1025
+
1026
+/*
1027
+ * Need to make sure that buffer isn't trying to write out of bounds.
1028
+ */
1029
+function checkOffset (offset, ext, length) {
1030
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1031
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1032
+}
1033
+
1034
+Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1035
+ offset = offset >>> 0
1036
+ byteLength = byteLength >>> 0
1037
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
1038
+
1039
+ var val = this[offset]
1040
+ var mul = 1
1041
+ var i = 0
1042
+ while (++i < byteLength && (mul *= 0x100)) {
1043
+ val += this[offset + i] * mul
1044
+ }
1045
+
1046
+ return val
1047
+}
1048
+
1049
+Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1050
+ offset = offset >>> 0
1051
+ byteLength = byteLength >>> 0
1052
+ if (!noAssert) {
1053
+ checkOffset(offset, byteLength, this.length)
1054
+ }
1055
+
1056
+ var val = this[offset + --byteLength]
1057
+ var mul = 1
1058
+ while (byteLength > 0 && (mul *= 0x100)) {
1059
+ val += this[offset + --byteLength] * mul
1060
+ }
1061
+
1062
+ return val
1063
+}
1064
+
1065
+Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1066
+ if (!noAssert) checkOffset(offset, 1, this.length)
1067
+ return this[offset]
1068
+}
1069
+
1070
+Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1071
+ if (!noAssert) checkOffset(offset, 2, this.length)
1072
+ return this[offset] | (this[offset + 1] << 8)
1073
+}
1074
+
1075
+Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1076
+ if (!noAssert) checkOffset(offset, 2, this.length)
1077
+ return (this[offset] << 8) | this[offset + 1]
1078
+}
1079
+
1080
+Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1081
+ if (!noAssert) checkOffset(offset, 4, this.length)
1082
+
1083
+ return ((this[offset]) |
1084
+ (this[offset + 1] << 8) |
1085
+ (this[offset + 2] << 16)) +
1086
+ (this[offset + 3] * 0x1000000)
1087
+}
1088
+
1089
+Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1090
+ if (!noAssert) checkOffset(offset, 4, this.length)
1091
+
1092
+ return (this[offset] * 0x1000000) +
1093
+ ((this[offset + 1] << 16) |
1094
+ (this[offset + 2] << 8) |
1095
+ this[offset + 3])
1096
+}
1097
+
1098
+Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1099
+ offset = offset >>> 0
1100
+ byteLength = byteLength >>> 0
1101
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
1102
+
1103
+ var val = this[offset]
1104
+ var mul = 1
1105
+ var i = 0
1106
+ while (++i < byteLength && (mul *= 0x100)) {
1107
+ val += this[offset + i] * mul
1108
+ }
1109
+ mul *= 0x80
1110
+
1111
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1112
+
1113
+ return val
1114
+}
1115
+
1116
+Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1117
+ offset = offset >>> 0
1118
+ byteLength = byteLength >>> 0
1119
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
1120
+
1121
+ var i = byteLength
1122
+ var mul = 1
1123
+ var val = this[offset + --i]
1124
+ while (i > 0 && (mul *= 0x100)) {
1125
+ val += this[offset + --i] * mul
1126
+ }
1127
+ mul *= 0x80
1128
+
1129
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1130
+
1131
+ return val
1132
+}
1133
+
1134
+Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1135
+ if (!noAssert) checkOffset(offset, 1, this.length)
1136
+ if (!(this[offset] & 0x80)) return (this[offset])
1137
+ return ((0xff - this[offset] + 1) * -1)
1138
+}
1139
+
1140
+Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1141
+ if (!noAssert) checkOffset(offset, 2, this.length)
1142
+ var val = this[offset] | (this[offset + 1] << 8)
1143
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1144
+}
1145
+
1146
+Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1147
+ if (!noAssert) checkOffset(offset, 2, this.length)
1148
+ var val = this[offset + 1] | (this[offset] << 8)
1149
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1150
+}
1151
+
1152
+Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1153
+ if (!noAssert) checkOffset(offset, 4, this.length)
1154
+
1155
+ return (this[offset]) |
1156
+ (this[offset + 1] << 8) |
1157
+ (this[offset + 2] << 16) |
1158
+ (this[offset + 3] << 24)
1159
+}
1160
+
1161
+Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1162
+ if (!noAssert) checkOffset(offset, 4, this.length)
1163
+
1164
+ return (this[offset] << 24) |
1165
+ (this[offset + 1] << 16) |
1166
+ (this[offset + 2] << 8) |
1167
+ (this[offset + 3])
1168
+}
1169
+
1170
+Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1171
+ if (!noAssert) checkOffset(offset, 4, this.length)
1172
+ return ieee754.read(this, offset, true, 23, 4)
1173
+}
1174
+
1175
+Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1176
+ if (!noAssert) checkOffset(offset, 4, this.length)
1177
+ return ieee754.read(this, offset, false, 23, 4)
1178
+}
1179
+
1180
+Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1181
+ if (!noAssert) checkOffset(offset, 8, this.length)
1182
+ return ieee754.read(this, offset, true, 52, 8)
1183
+}
1184
+
1185
+Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1186
+ if (!noAssert) checkOffset(offset, 8, this.length)
1187
+ return ieee754.read(this, offset, false, 52, 8)
1188
+}
1189
+
1190
+function checkInt (buf, value, offset, ext, max, min) {
1191
+ if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
1192
+ if (value > max || value < min) throw new RangeError('value is out of bounds')
1193
+ if (offset + ext > buf.length) throw new RangeError('index out of range')
1194
+}
1195
+
1196
+Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1197
+ value = +value
1198
+ offset = offset >>> 0
1199
+ byteLength = byteLength >>> 0
1200
+ if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1201
+
1202
+ var mul = 1
1203
+ var i = 0
1204
+ this[offset] = value & 0xFF
1205
+ while (++i < byteLength && (mul *= 0x100)) {
1206
+ this[offset + i] = (value / mul) >>> 0 & 0xFF
1207
+ }
1208
+
1209
+ return offset + byteLength
1210
+}
1211
+
1212
+Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1213
+ value = +value
1214
+ offset = offset >>> 0
1215
+ byteLength = byteLength >>> 0
1216
+ if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1217
+
1218
+ var i = byteLength - 1
1219
+ var mul = 1
1220
+ this[offset + i] = value & 0xFF
1221
+ while (--i >= 0 && (mul *= 0x100)) {
1222
+ this[offset + i] = (value / mul) >>> 0 & 0xFF
1223
+ }
1224
+
1225
+ return offset + byteLength
1226
+}
1227
+
1228
+Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1229
+ value = +value
1230
+ offset = offset >>> 0
1231
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1232
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1233
+ this[offset] = value
1234
+ return offset + 1
1235
+}
1236
+
1237
+function objectWriteUInt16 (buf, value, offset, littleEndian) {
1238
+ if (value < 0) value = 0xffff + value + 1
1239
+ for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
1240
+ buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1241
+ (littleEndian ? i : 1 - i) * 8
1242
+ }
1243
+}
1244
+
1245
+Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1246
+ value = +value
1247
+ offset = offset >>> 0
1248
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1249
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1250
+ this[offset] = value
1251
+ this[offset + 1] = (value >>> 8)
1252
+ } else {
1253
+ objectWriteUInt16(this, value, offset, true)
1254
+ }
1255
+ return offset + 2
1256
+}
1257
+
1258
+Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1259
+ value = +value
1260
+ offset = offset >>> 0
1261
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1262
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1263
+ this[offset] = (value >>> 8)
1264
+ this[offset + 1] = value
1265
+ } else {
1266
+ objectWriteUInt16(this, value, offset, false)
1267
+ }
1268
+ return offset + 2
1269
+}
1270
+
1271
+function objectWriteUInt32 (buf, value, offset, littleEndian) {
1272
+ if (value < 0) value = 0xffffffff + value + 1
1273
+ for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
1274
+ buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
1275
+ }
1276
+}
1277
+
1278
+Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1279
+ value = +value
1280
+ offset = offset >>> 0
1281
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1282
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1283
+ this[offset + 3] = (value >>> 24)
1284
+ this[offset + 2] = (value >>> 16)
1285
+ this[offset + 1] = (value >>> 8)
1286
+ this[offset] = value
1287
+ } else {
1288
+ objectWriteUInt32(this, value, offset, true)
1289
+ }
1290
+ return offset + 4
1291
+}
1292
+
1293
+Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1294
+ value = +value
1295
+ offset = offset >>> 0
1296
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1297
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1298
+ this[offset] = (value >>> 24)
1299
+ this[offset + 1] = (value >>> 16)
1300
+ this[offset + 2] = (value >>> 8)
1301
+ this[offset + 3] = value
1302
+ } else {
1303
+ objectWriteUInt32(this, value, offset, false)
1304
+ }
1305
+ return offset + 4
1306
+}
1307
+
1308
+Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1309
+ value = +value
1310
+ offset = offset >>> 0
1311
+ if (!noAssert) {
1312
+ checkInt(
1313
+ this, value, offset, byteLength,
1314
+ Math.pow(2, 8 * byteLength - 1) - 1,
1315
+ -Math.pow(2, 8 * byteLength - 1)
1316
+ )
1317
+ }
1318
+
1319
+ var i = 0
1320
+ var mul = 1
1321
+ var sub = value < 0 ? 1 : 0
1322
+ this[offset] = value & 0xFF
1323
+ while (++i < byteLength && (mul *= 0x100)) {
1324
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1325
+ }
1326
+
1327
+ return offset + byteLength
1328
+}
1329
+
1330
+Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1331
+ value = +value
1332
+ offset = offset >>> 0
1333
+ if (!noAssert) {
1334
+ checkInt(
1335
+ this, value, offset, byteLength,
1336
+ Math.pow(2, 8 * byteLength - 1) - 1,
1337
+ -Math.pow(2, 8 * byteLength - 1)
1338
+ )
1339
+ }
1340
+
1341
+ var i = byteLength - 1
1342
+ var mul = 1
1343
+ var sub = value < 0 ? 1 : 0
1344
+ this[offset + i] = value & 0xFF
1345
+ while (--i >= 0 && (mul *= 0x100)) {
1346
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1347
+ }
1348
+
1349
+ return offset + byteLength
1350
+}
1351
+
1352
+Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1353
+ value = +value
1354
+ offset = offset >>> 0
1355
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1356
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1357
+ if (value < 0) value = 0xff + value + 1
1358
+ this[offset] = value
1359
+ return offset + 1
1360
+}
1361
+
1362
+Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1363
+ value = +value
1364
+ offset = offset >>> 0
1365
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1366
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1367
+ this[offset] = value
1368
+ this[offset + 1] = (value >>> 8)
1369
+ } else {
1370
+ objectWriteUInt16(this, value, offset, true)
1371
+ }
1372
+ return offset + 2
1373
+}
1374
+
1375
+Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1376
+ value = +value
1377
+ offset = offset >>> 0
1378
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1379
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1380
+ this[offset] = (value >>> 8)
1381
+ this[offset + 1] = value
1382
+ } else {
1383
+ objectWriteUInt16(this, value, offset, false)
1384
+ }
1385
+ return offset + 2
1386
+}
1387
+
1388
+Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1389
+ value = +value
1390
+ offset = offset >>> 0
1391
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1392
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1393
+ this[offset] = value
1394
+ this[offset + 1] = (value >>> 8)
1395
+ this[offset + 2] = (value >>> 16)
1396
+ this[offset + 3] = (value >>> 24)
1397
+ } else {
1398
+ objectWriteUInt32(this, value, offset, true)
1399
+ }
1400
+ return offset + 4
1401
+}
1402
+
1403
+Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1404
+ value = +value
1405
+ offset = offset >>> 0
1406
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1407
+ if (value < 0) value = 0xffffffff + value + 1
1408
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1409
+ this[offset] = (value >>> 24)
1410
+ this[offset + 1] = (value >>> 16)
1411
+ this[offset + 2] = (value >>> 8)
1412
+ this[offset + 3] = value
1413
+ } else {
1414
+ objectWriteUInt32(this, value, offset, false)
1415
+ }
1416
+ return offset + 4
1417
+}
1418
+
1419
+function checkIEEE754 (buf, value, offset, ext, max, min) {
1420
+ if (value > max || value < min) throw new RangeError('value is out of bounds')
1421
+ if (offset + ext > buf.length) throw new RangeError('index out of range')
1422
+ if (offset < 0) throw new RangeError('index out of range')
1423
+}
1424
+
1425
+function writeFloat (buf, value, offset, littleEndian, noAssert) {
1426
+ if (!noAssert) {
1427
+ checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1428
+ }
1429
+ ieee754.write(buf, value, offset, littleEndian, 23, 4)
1430
+ return offset + 4
1431
+}
1432
+
1433
+Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1434
+ return writeFloat(this, value, offset, true, noAssert)
1435
+}
1436
+
1437
+Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1438
+ return writeFloat(this, value, offset, false, noAssert)
1439
+}
1440
+
1441
+function writeDouble (buf, value, offset, littleEndian, noAssert) {
1442
+ if (!noAssert) {
1443
+ checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1444
+ }
1445
+ ieee754.write(buf, value, offset, littleEndian, 52, 8)
1446
+ return offset + 8
1447
+}
1448
+
1449
+Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1450
+ return writeDouble(this, value, offset, true, noAssert)
1451
+}
1452
+
1453
+Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1454
+ return writeDouble(this, value, offset, false, noAssert)
1455
+}
1456
+
1457
+// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1458
+Buffer.prototype.copy = function copy (target, target_start, start, end) {
1459
+ var self = this // source
1460
+
1461
+ if (!start) start = 0
1462
+ if (!end && end !== 0) end = this.length
1463
+ if (target_start >= target.length) target_start = target.length
1464
+ if (!target_start) target_start = 0
1465
+ if (end > 0 && end < start) end = start
1466
+
1467
+ // Copy 0 bytes; we're done
1468
+ if (end === start) return 0
1469
+ if (target.length === 0 || self.length === 0) return 0
1470
+
1471
+ // Fatal error conditions
1472
+ if (target_start < 0) {
1473
+ throw new RangeError('targetStart out of bounds')
1474
+ }
1475
+ if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds')
1476
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
1477
+
1478
+ // Are we oob?
1479
+ if (end > this.length) end = this.length
1480
+ if (target.length - target_start < end - start) {
1481
+ end = target.length - target_start + start
1482
+ }
1483
+
1484
+ var len = end - start
1485
+
1486
+ if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
1487
+ for (var i = 0; i < len; i++) {
1488
+ target[i + target_start] = this[i + start]
1489
+ }
1490
+ } else {
1491
+ target._set(this.subarray(start, start + len), target_start)
1492
+ }
1493
+
1494
+ return len
1495
+}
1496
+
1497
+// fill(value, start=0, end=buffer.length)
1498
+Buffer.prototype.fill = function fill (value, start, end) {
1499
+ if (!value) value = 0
1500
+ if (!start) start = 0
1501
+ if (!end) end = this.length
1502
+
1503
+ if (end < start) throw new RangeError('end < start')
1504
+
1505
+ // Fill 0 bytes; we're done
1506
+ if (end === start) return
1507
+ if (this.length === 0) return
1508
+
1509
+ if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
1510
+ if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
1511
+
1512
+ var i
1513
+ if (typeof value === 'number') {
1514
+ for (i = start; i < end; i++) {
1515
+ this[i] = value
1516
+ }
1517
+ } else {
1518
+ var bytes = utf8ToBytes(value.toString())
1519
+ var len = bytes.length
1520
+ for (i = start; i < end; i++) {
1521
+ this[i] = bytes[i % len]
1522
+ }
1523
+ }
1524
+
1525
+ return this
1526
+}
1527
+
1528
+/**
1529
+ * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
1530
+ * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
1531
+ */
1532
+Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
1533
+ if (typeof Uint8Array !== 'undefined') {
1534
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
1535
+ return (new Buffer(this)).buffer
1536
+ } else {
1537
+ var buf = new Uint8Array(this.length)
1538
+ for (var i = 0, len = buf.length; i < len; i += 1) {
1539
+ buf[i] = this[i]
1540
+ }
1541
+ return buf.buffer
1542
+ }
1543
+ } else {
1544
+ throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
1545
+ }
1546
+}
1547
+
1548
+// HELPER FUNCTIONS
1549
+// ================
1550
+
1551
+var BP = Buffer.prototype
1552
+
1553
+/**
1554
+ * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
1555
+ */
1556
+Buffer._augment = function _augment (arr) {
1557
+ arr.constructor = Buffer
1558
+ arr._isBuffer = true
1559
+
1560
+ // save reference to original Uint8Array get/set methods before overwriting
1561
+ arr._get = arr.get
1562
+ arr._set = arr.set
1563
+
1564
+ // deprecated, will be removed in node 0.13+
1565
+ arr.get = BP.get
1566
+ arr.set = BP.set
1567
+
1568
+ arr.write = BP.write
1569
+ arr.toString = BP.toString
1570
+ arr.toLocaleString = BP.toString
1571
+ arr.toJSON = BP.toJSON
1572
+ arr.equals = BP.equals
1573
+ arr.compare = BP.compare
1574
+ arr.indexOf = BP.indexOf
1575
+ arr.copy = BP.copy
1576
+ arr.slice = BP.slice
1577
+ arr.readUIntLE = BP.readUIntLE
1578
+ arr.readUIntBE = BP.readUIntBE
1579
+ arr.readUInt8 = BP.readUInt8
1580
+ arr.readUInt16LE = BP.readUInt16LE
1581
+ arr.readUInt16BE = BP.readUInt16BE
1582
+ arr.readUInt32LE = BP.readUInt32LE
1583
+ arr.readUInt32BE = BP.readUInt32BE
1584
+ arr.readIntLE = BP.readIntLE
1585
+ arr.readIntBE = BP.readIntBE
1586
+ arr.readInt8 = BP.readInt8
1587
+ arr.readInt16LE = BP.readInt16LE
1588
+ arr.readInt16BE = BP.readInt16BE
1589
+ arr.readInt32LE = BP.readInt32LE
1590
+ arr.readInt32BE = BP.readInt32BE
1591
+ arr.readFloatLE = BP.readFloatLE
1592
+ arr.readFloatBE = BP.readFloatBE
1593
+ arr.readDoubleLE = BP.readDoubleLE
1594
+ arr.readDoubleBE = BP.readDoubleBE
1595
+ arr.writeUInt8 = BP.writeUInt8
1596
+ arr.writeUIntLE = BP.writeUIntLE
1597
+ arr.writeUIntBE = BP.writeUIntBE
1598
+ arr.writeUInt16LE = BP.writeUInt16LE
1599
+ arr.writeUInt16BE = BP.writeUInt16BE
1600
+ arr.writeUInt32LE = BP.writeUInt32LE
1601
+ arr.writeUInt32BE = BP.writeUInt32BE
1602
+ arr.writeIntLE = BP.writeIntLE
1603
+ arr.writeIntBE = BP.writeIntBE
1604
+ arr.writeInt8 = BP.writeInt8
1605
+ arr.writeInt16LE = BP.writeInt16LE
1606
+ arr.writeInt16BE = BP.writeInt16BE
1607
+ arr.writeInt32LE = BP.writeInt32LE
1608
+ arr.writeInt32BE = BP.writeInt32BE
1609
+ arr.writeFloatLE = BP.writeFloatLE
1610
+ arr.writeFloatBE = BP.writeFloatBE
1611
+ arr.writeDoubleLE = BP.writeDoubleLE
1612
+ arr.writeDoubleBE = BP.writeDoubleBE
1613
+ arr.fill = BP.fill
1614
+ arr.inspect = BP.inspect
1615
+ arr.toArrayBuffer = BP.toArrayBuffer
1616
+
1617
+ return arr
1618
+}
1619
+
1620
+var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
1621
+
1622
+function base64clean (str) {
1623
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
1624
+ str = stringtrim(str).replace(INVALID_BASE64_RE, '')
1625
+ // Node converts strings with length < 2 to ''
1626
+ if (str.length < 2) return ''
1627
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1628
+ while (str.length % 4 !== 0) {
1629
+ str = str + '='
1630
+ }
1631
+ return str
1632
+}
1633
+
1634
+function stringtrim (str) {
1635
+ if (str.trim) return str.trim()
1636
+ return str.replace(/^\s+|\s+$/g, '')
1637
+}
1638
+
1639
+function isArrayish (subject) {
1640
+ return isArray(subject) || Buffer.isBuffer(subject) ||
1641
+ subject && typeof subject === 'object' &&
1642
+ typeof subject.length === 'number'
1643
+}
1644
+
1645
+function toHex (n) {
1646
+ if (n < 16) return '0' + n.toString(16)
1647
+ return n.toString(16)
1648
+}
1649
+
1650
+function utf8ToBytes (string, units) {
1651
+ units = units || Infinity
1652
+ var codePoint
1653
+ var length = string.length
1654
+ var leadSurrogate = null
1655
+ var bytes = []
1656
+ var i = 0
1657
+
1658
+ for (; i < length; i++) {
1659
+ codePoint = string.charCodeAt(i)
1660
+
1661
+ // is surrogate component
1662
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
1663
+ // last char was a lead
1664
+ if (leadSurrogate) {
1665
+ // 2 leads in a row
1666
+ if (codePoint < 0xDC00) {
1667
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1668
+ leadSurrogate = codePoint
1669
+ continue
1670
+ } else {
1671
+ // valid surrogate pair
1672
+ codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
1673
+ leadSurrogate = null
1674
+ }
1675
+ } else {
1676
+ // no lead yet
1677
+
1678
+ if (codePoint > 0xDBFF) {
1679
+ // unexpected trail
1680
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1681
+ continue
1682
+ } else if (i + 1 === length) {
1683
+ // unpaired lead
1684
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1685
+ continue
1686
+ } else {
1687
+ // valid lead
1688
+ leadSurrogate = codePoint
1689
+ continue
1690
+ }
1691
+ }
1692
+ } else if (leadSurrogate) {
1693
+ // valid bmp char, but last char was a lead
1694
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1695
+ leadSurrogate = null
1696
+ }
1697
+
1698
+ // encode utf8
1699
+ if (codePoint < 0x80) {
1700
+ if ((units -= 1) < 0) break
1701
+ bytes.push(codePoint)
1702
+ } else if (codePoint < 0x800) {
1703
+ if ((units -= 2) < 0) break
1704
+ bytes.push(
1705
+ codePoint >> 0x6 | 0xC0,
1706
+ codePoint & 0x3F | 0x80
1707
+ )
1708
+ } else if (codePoint < 0x10000) {
1709
+ if ((units -= 3) < 0) break
1710
+ bytes.push(
1711
+ codePoint >> 0xC | 0xE0,
1712
+ codePoint >> 0x6 & 0x3F | 0x80,
1713
+ codePoint & 0x3F | 0x80
1714
+ )
1715
+ } else if (codePoint < 0x200000) {
1716
+ if ((units -= 4) < 0) break
1717
+ bytes.push(
1718
+ codePoint >> 0x12 | 0xF0,
1719
+ codePoint >> 0xC & 0x3F | 0x80,
1720
+ codePoint >> 0x6 & 0x3F | 0x80,
1721
+ codePoint & 0x3F | 0x80
1722
+ )
1723
+ } else {
1724
+ throw new Error('Invalid code point')
1725
+ }
1726
+ }
1727
+
1728
+ return bytes
1729
+}
1730
+
1731
+function asciiToBytes (str) {
1732
+ var byteArray = []
1733
+ for (var i = 0; i < str.length; i++) {
1734
+ // Node's code seems to be doing this and not & 0x7F..
1735
+ byteArray.push(str.charCodeAt(i) & 0xFF)
1736
+ }
1737
+ return byteArray
1738
+}
1739
+
1740
+function utf16leToBytes (str, units) {
1741
+ var c, hi, lo
1742
+ var byteArray = []
1743
+ for (var i = 0; i < str.length; i++) {
1744
+ if ((units -= 2) < 0) break
1745
+
1746
+ c = str.charCodeAt(i)
1747
+ hi = c >> 8
1748
+ lo = c % 256
1749
+ byteArray.push(lo)
1750
+ byteArray.push(hi)
1751
+ }
1752
+
1753
+ return byteArray
1754
+}
1755
+
1756
+function base64ToBytes (str) {
1757
+ return base64.toByteArray(base64clean(str))
1758
+}
1759
+
1760
+function blitBuffer (src, dst, offset, length) {
1761
+ for (var i = 0; i < length; i++) {
1762
+ if ((i + offset >= dst.length) || (i >= src.length)) break
1763
+ dst[i + offset] = src[i]
1764
+ }
1765
+ return i
1766
+}
1767
+
1768
+function decodeUtf8Char (str) {
1769
+ try {
1770
+ return decodeURIComponent(str)
1771
+ } catch (err) {
1772
+ return String.fromCharCode(0xFFFD) // UTF 8 invalid char
1773
+ }
1774
+}
1775
+
1776
+},{"base64-js":4,"ieee754":5,"is-array":6}],4:[function(_dereq_,module,exports){
1777
+var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1778
+
1779
+;(function (exports) {
1780
+ 'use strict';
1781
+
1782
+ var Arr = (typeof Uint8Array !== 'undefined')
1783
+ ? Uint8Array
1784
+ : Array
1785
+
1786
+ var PLUS = '+'.charCodeAt(0)
1787
+ var SLASH = '/'.charCodeAt(0)
1788
+ var NUMBER = '0'.charCodeAt(0)
1789
+ var LOWER = 'a'.charCodeAt(0)
1790
+ var UPPER = 'A'.charCodeAt(0)
1791
+ var PLUS_URL_SAFE = '-'.charCodeAt(0)
1792
+ var SLASH_URL_SAFE = '_'.charCodeAt(0)
1793
+
1794
+ function decode (elt) {
1795
+ var code = elt.charCodeAt(0)
1796
+ if (code === PLUS ||
1797
+ code === PLUS_URL_SAFE)
1798
+ return 62 // '+'
1799
+ if (code === SLASH ||
1800
+ code === SLASH_URL_SAFE)
1801
+ return 63 // '/'
1802
+ if (code < NUMBER)
1803
+ return -1 //no match
1804
+ if (code < NUMBER + 10)
1805
+ return code - NUMBER + 26 + 26
1806
+ if (code < UPPER + 26)
1807
+ return code - UPPER
1808
+ if (code < LOWER + 26)
1809
+ return code - LOWER + 26
1810
+ }
1811
+
1812
+ function b64ToByteArray (b64) {
1813
+ var i, j, l, tmp, placeHolders, arr
1814
+
1815
+ if (b64.length % 4 > 0) {
1816
+ throw new Error('Invalid string. Length must be a multiple of 4')
1817
+ }
1818
+
1819
+ // the number of equal signs (place holders)
1820
+ // if there are two placeholders, than the two characters before it
1821
+ // represent one byte
1822
+ // if there is only one, then the three characters before it represent 2 bytes
1823
+ // this is just a cheap hack to not do indexOf twice
1824
+ var len = b64.length
1825
+ placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
1826
+
1827
+ // base64 is 4/3 + up to two characters of the original data
1828
+ arr = new Arr(b64.length * 3 / 4 - placeHolders)
1829
+
1830
+ // if there are placeholders, only get up to the last complete 4 chars
1831
+ l = placeHolders > 0 ? b64.length - 4 : b64.length
1832
+
1833
+ var L = 0
1834
+
1835
+ function push (v) {
1836
+ arr[L++] = v
1837
+ }
1838
+
1839
+ for (i = 0, j = 0; i < l; i += 4, j += 3) {
1840
+ tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
1841
+ push((tmp & 0xFF0000) >> 16)
1842
+ push((tmp & 0xFF00) >> 8)
1843
+ push(tmp & 0xFF)
1844
+ }
1845
+
1846
+ if (placeHolders === 2) {
1847
+ tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
1848
+ push(tmp & 0xFF)
1849
+ } else if (placeHolders === 1) {
1850
+ tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
1851
+ push((tmp >> 8) & 0xFF)
1852
+ push(tmp & 0xFF)
1853
+ }
1854
+
1855
+ return arr
1856
+ }
1857
+
1858
+ function uint8ToBase64 (uint8) {
1859
+ var i,
1860
+ extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
1861
+ output = "",
1862
+ temp, length
1863
+
1864
+ function encode (num) {
1865
+ return lookup.charAt(num)
1866
+ }
1867
+
1868
+ function tripletToBase64 (num) {
1869
+ return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
1870
+ }
1871
+
1872
+ // go through the array every three bytes, we'll deal with trailing stuff later
1873
+ for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
1874
+ temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
1875
+ output += tripletToBase64(temp)
1876
+ }
1877
+
1878
+ // pad the end with zeros, but make sure to not forget the extra bytes
1879
+ switch (extraBytes) {
1880
+ case 1:
1881
+ temp = uint8[uint8.length - 1]
1882
+ output += encode(temp >> 2)
1883
+ output += encode((temp << 4) & 0x3F)
1884
+ output += '=='
1885
+ break
1886
+ case 2:
1887
+ temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
1888
+ output += encode(temp >> 10)
1889
+ output += encode((temp >> 4) & 0x3F)
1890
+ output += encode((temp << 2) & 0x3F)
1891
+ output += '='
1892
+ break
1893
+ }
1894
+
1895
+ return output
1896
+ }
1897
+
1898
+ exports.toByteArray = b64ToByteArray
1899
+ exports.fromByteArray = uint8ToBase64
1900
+}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
1901
+
1902
+},{}],5:[function(_dereq_,module,exports){
1903
+exports.read = function(buffer, offset, isLE, mLen, nBytes) {
1904
+ var e, m,
1905
+ eLen = nBytes * 8 - mLen - 1,
1906
+ eMax = (1 << eLen) - 1,
1907
+ eBias = eMax >> 1,
1908
+ nBits = -7,
1909
+ i = isLE ? (nBytes - 1) : 0,
1910
+ d = isLE ? -1 : 1,
1911
+ s = buffer[offset + i];
1912
+
1913
+ i += d;
1914
+
1915
+ e = s & ((1 << (-nBits)) - 1);
1916
+ s >>= (-nBits);
1917
+ nBits += eLen;
1918
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
1919
+
1920
+ m = e & ((1 << (-nBits)) - 1);
1921
+ e >>= (-nBits);
1922
+ nBits += mLen;
1923
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
1924
+
1925
+ if (e === 0) {
1926
+ e = 1 - eBias;
1927
+ } else if (e === eMax) {
1928
+ return m ? NaN : ((s ? -1 : 1) * Infinity);
1929
+ } else {
1930
+ m = m + Math.pow(2, mLen);
1931
+ e = e - eBias;
1932
+ }
1933
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
1934
+};
1935
+
1936
+exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
1937
+ var e, m, c,
1938
+ eLen = nBytes * 8 - mLen - 1,
1939
+ eMax = (1 << eLen) - 1,
1940
+ eBias = eMax >> 1,
1941
+ rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
1942
+ i = isLE ? 0 : (nBytes - 1),
1943
+ d = isLE ? 1 : -1,
1944
+ s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
1945
+
1946
+ value = Math.abs(value);
1947
+
1948
+ if (isNaN(value) || value === Infinity) {
1949
+ m = isNaN(value) ? 1 : 0;
1950
+ e = eMax;
1951
+ } else {
1952
+ e = Math.floor(Math.log(value) / Math.LN2);
1953
+ if (value * (c = Math.pow(2, -e)) < 1) {
1954
+ e--;
1955
+ c *= 2;
1956
+ }
1957
+ if (e + eBias >= 1) {
1958
+ value += rt / c;
1959
+ } else {
1960
+ value += rt * Math.pow(2, 1 - eBias);
1961
+ }
1962
+ if (value * c >= 2) {
1963
+ e++;
1964
+ c /= 2;
1965
+ }
1966
+
1967
+ if (e + eBias >= eMax) {
1968
+ m = 0;
1969
+ e = eMax;
1970
+ } else if (e + eBias >= 1) {
1971
+ m = (value * c - 1) * Math.pow(2, mLen);
1972
+ e = e + eBias;
1973
+ } else {
1974
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
1975
+ e = 0;
1976
+ }
1977
+ }
1978
+
1979
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);
1980
+
1981
+ e = (e << mLen) | m;
1982
+ eLen += mLen;
1983
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
1984
+
1985
+ buffer[offset + i - d] |= s * 128;
1986
+};
1987
+
1988
+},{}],6:[function(_dereq_,module,exports){
1989
+
1990
+/**
1991
+ * isArray
1992
+ */
1993
+
1994
+var isArray = Array.isArray;
1995
+
1996
+/**
1997
+ * toString
1998
+ */
1999
+
2000
+var str = Object.prototype.toString;
2001
+
2002
+/**
2003
+ * Whether or not the given `val`
2004
+ * is an array.
2005
+ *
2006
+ * example:
2007
+ *
2008
+ * isArray([]);
2009
+ * // > true
2010
+ * isArray(arguments);
2011
+ * // > false
2012
+ * isArray('');
2013
+ * // > false
2014
+ *
2015
+ * @param {mixed} val
2016
+ * @return {bool}
2017
+ */
2018
+
2019
+module.exports = isArray || function (val) {
2020
+ return !! val && '[object Array]' == str.call(val);
2021
+};
2022
+
2023
+},{}],7:[function(_dereq_,module,exports){
2024
+(function (process){
2025
+// Copyright Joyent, Inc. and other Node contributors.
2026
+//
2027
+// Permission is hereby granted, free of charge, to any person obtaining a
2028
+// copy of this software and associated documentation files (the
2029
+// "Software"), to deal in the Software without restriction, including
2030
+// without limitation the rights to use, copy, modify, merge, publish,
2031
+// distribute, sublicense, and/or sell copies of the Software, and to permit
2032
+// persons to whom the Software is furnished to do so, subject to the
2033
+// following conditions:
2034
+//
2035
+// The above copyright notice and this permission notice shall be included
2036
+// in all copies or substantial portions of the Software.
2037
+//
2038
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2039
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2040
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2041
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2042
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2043
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2044
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
2045
+
2046
+// resolves . and .. elements in a path array with directory names there
2047
+// must be no slashes, empty elements, or device names (c:\) in the array
2048
+// (so also no leading and trailing slashes - it does not distinguish
2049
+// relative and absolute paths)
2050
+function normalizeArray(parts, allowAboveRoot) {
2051
+ // if the path tries to go above the root, `up` ends up > 0
2052
+ var up = 0;
2053
+ for (var i = parts.length - 1; i >= 0; i--) {
2054
+ var last = parts[i];
2055
+ if (last === '.') {
2056
+ parts.splice(i, 1);
2057
+ } else if (last === '..') {
2058
+ parts.splice(i, 1);
2059
+ up++;
2060
+ } else if (up) {
2061
+ parts.splice(i, 1);
2062
+ up--;
2063
+ }
2064
+ }
2065
+
2066
+ // if the path is allowed to go above the root, restore leading ..s
2067
+ if (allowAboveRoot) {
2068
+ for (; up--; up) {
2069
+ parts.unshift('..');
2070
+ }
2071
+ }
2072
+
2073
+ return parts;
2074
+}
2075
+
2076
+// Split a filename into [root, dir, basename, ext], unix version
2077
+// 'root' is just a slash, or nothing.
2078
+var splitPathRe =
2079
+ /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
2080
+var splitPath = function(filename) {
2081
+ return splitPathRe.exec(filename).slice(1);
2082
+};
2083
+
2084
+// path.resolve([from ...], to)
2085
+// posix version
2086
+exports.resolve = function() {
2087
+ var resolvedPath = '',
2088
+ resolvedAbsolute = false;
2089
+
2090
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
2091
+ var path = (i >= 0) ? arguments[i] : process.cwd();
2092
+
2093
+ // Skip empty and invalid entries
2094
+ if (typeof path !== 'string') {
2095
+ throw new TypeError('Arguments to path.resolve must be strings');
2096
+ } else if (!path) {
2097
+ continue;
2098
+ }
2099
+
2100
+ resolvedPath = path + '/' + resolvedPath;
2101
+ resolvedAbsolute = path.charAt(0) === '/';
2102
+ }
2103
+
2104
+ // At this point the path should be resolved to a full absolute path, but
2105
+ // handle relative paths to be safe (might happen when process.cwd() fails)
2106
+
2107
+ // Normalize the path
2108
+ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
2109
+ return !!p;
2110
+ }), !resolvedAbsolute).join('/');
2111
+
2112
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
2113
+};
2114
+
2115
+// path.normalize(path)
2116
+// posix version
2117
+exports.normalize = function(path) {
2118
+ var isAbsolute = exports.isAbsolute(path),
2119
+ trailingSlash = substr(path, -1) === '/';
2120
+
2121
+ // Normalize the path
2122
+ path = normalizeArray(filter(path.split('/'), function(p) {
2123
+ return !!p;
2124
+ }), !isAbsolute).join('/');
2125
+
2126
+ if (!path && !isAbsolute) {
2127
+ path = '.';
2128
+ }
2129
+ if (path && trailingSlash) {
2130
+ path += '/';
2131
+ }
2132
+
2133
+ return (isAbsolute ? '/' : '') + path;
2134
+};
2135
+
2136
+// posix version
2137
+exports.isAbsolute = function(path) {
2138
+ return path.charAt(0) === '/';
2139
+};
2140
+
2141
+// posix version
2142
+exports.join = function() {
2143
+ var paths = Array.prototype.slice.call(arguments, 0);
2144
+ return exports.normalize(filter(paths, function(p, index) {
2145
+ if (typeof p !== 'string') {
2146
+ throw new TypeError('Arguments to path.join must be strings');
2147
+ }
2148
+ return p;
2149
+ }).join('/'));
2150
+};
2151
+
2152
+
2153
+// path.relative(from, to)
2154
+// posix version
2155
+exports.relative = function(from, to) {
2156
+ from = exports.resolve(from).substr(1);
2157
+ to = exports.resolve(to).substr(1);
2158
+
2159
+ function trim(arr) {
2160
+ var start = 0;
2161
+ for (; start < arr.length; start++) {
2162
+ if (arr[start] !== '') break;
2163
+ }
2164
+
2165
+ var end = arr.length - 1;
2166
+ for (; end >= 0; end--) {
2167
+ if (arr[end] !== '') break;
2168
+ }
2169
+
2170
+ if (start > end) return [];
2171
+ return arr.slice(start, end - start + 1);
2172
+ }
2173
+
2174
+ var fromParts = trim(from.split('/'));
2175
+ var toParts = trim(to.split('/'));
2176
+
2177
+ var length = Math.min(fromParts.length, toParts.length);
2178
+ var samePartsLength = length;
2179
+ for (var i = 0; i < length; i++) {
2180
+ if (fromParts[i] !== toParts[i]) {
2181
+ samePartsLength = i;
2182
+ break;
2183
+ }
2184
+ }
2185
+
2186
+ var outputParts = [];
2187
+ for (var i = samePartsLength; i < fromParts.length; i++) {
2188
+ outputParts.push('..');
2189
+ }
2190
+
2191
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
2192
+
2193
+ return outputParts.join('/');
2194
+};
2195
+
2196
+exports.sep = '/';
2197
+exports.delimiter = ':';
2198
+
2199
+exports.dirname = function(path) {
2200
+ var result = splitPath(path),
2201
+ root = result[0],
2202
+ dir = result[1];
2203
+
2204
+ if (!root && !dir) {
2205
+ // No dirname whatsoever
2206
+ return '.';
2207
+ }
2208
+
2209
+ if (dir) {
2210
+ // It has a dirname, strip trailing slash
2211
+ dir = dir.substr(0, dir.length - 1);
2212
+ }
2213
+
2214
+ return root + dir;
2215
+};
2216
+
2217
+
2218
+exports.basename = function(path, ext) {
2219
+ var f = splitPath(path)[2];
2220
+ // TODO: make this comparison case-insensitive on windows?
2221
+ if (ext && f.substr(-1 * ext.length) === ext) {
2222
+ f = f.substr(0, f.length - ext.length);
2223
+ }
2224
+ return f;
2225
+};
2226
+
2227
+
2228
+exports.extname = function(path) {
2229
+ return splitPath(path)[3];
2230
+};
2231
+
2232
+function filter (xs, f) {
2233
+ if (xs.filter) return xs.filter(f);
2234
+ var res = [];
2235
+ for (var i = 0; i < xs.length; i++) {
2236
+ if (f(xs[i], i, xs)) res.push(xs[i]);
2237
+ }
2238
+ return res;
2239
+}
2240
+
2241
+// String.prototype.substr - negative index don't work in IE8
2242
+var substr = 'ab'.substr(-1) === 'b'
2243
+ ? function (str, start, len) { return str.substr(start, len) }
2244
+ : function (str, start, len) {
2245
+ if (start < 0) start = str.length + start;
2246
+ return str.substr(start, len);
2247
+ }
2248
+;
2249
+
2250
+}).call(this,_dereq_('_process'))
2251
+},{"_process":8}],8:[function(_dereq_,module,exports){
2252
+// shim for using process in browser
2253
+
2254
+var process = module.exports = {};
2255
+var queue = [];
2256
+var draining = false;
2257
+
2258
+function drainQueue() {
2259
+ if (draining) {
2260
+ return;
2261
+ }
2262
+ draining = true;
2263
+ var currentQueue;
2264
+ var len = queue.length;
2265
+ while(len) {
2266
+ currentQueue = queue;
2267
+ queue = [];
2268
+ var i = -1;
2269
+ while (++i < len) {
2270
+ currentQueue[i]();
2271
+ }
2272
+ len = queue.length;
2273
+ }
2274
+ draining = false;
2275
+}
2276
+process.nextTick = function (fun) {
2277
+ queue.push(fun);
2278
+ if (!draining) {
2279
+ setTimeout(drainQueue, 0);
2280
+ }
2281
+};
2282
+
2283
+process.title = 'browser';
2284
+process.browser = true;
2285
+process.env = {};
2286
+process.argv = [];
2287
+process.version = ''; // empty string to avoid regexp issues
2288
+process.versions = {};
2289
+
2290
+function noop() {}
2291
+
2292
+process.on = noop;
2293
+process.addListener = noop;
2294
+process.once = noop;
2295
+process.off = noop;
2296
+process.removeListener = noop;
2297
+process.removeAllListeners = noop;
2298
+process.emit = noop;
2299
+
2300
+process.binding = function (name) {
2301
+ throw new Error('process.binding is not supported');
2302
+};
2303
+
2304
+// TODO(shtylman)
2305
+process.cwd = function () { return '/' };
2306
+process.chdir = function (dir) {
2307
+ throw new Error('process.chdir is not supported');
2308
+};
2309
+process.umask = function() { return 0; };
2310
+
2311
+},{}],9:[function(_dereq_,module,exports){
2312
+/*
2313
+ Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
2314
+ Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
2315
+ Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
2316
+ Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
2317
+ Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
2318
+ Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
2319
+ Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
2320
+ Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
2321
+ Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
2322
+
2323
+ Redistribution and use in source and binary forms, with or without
2324
+ modification, are permitted provided that the following conditions are met:
2325
+
2326
+ * Redistributions of source code must retain the above copyright
2327
+ notice, this list of conditions and the following disclaimer.
2328
+ * Redistributions in binary form must reproduce the above copyright
2329
+ notice, this list of conditions and the following disclaimer in the
2330
+ documentation and/or other materials provided with the distribution.
2331
+
2332
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2333
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2334
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2335
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
2336
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2337
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2338
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2339
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2340
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2341
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2342
+*/
2343
+
2344
+(function (root, factory) {
2345
+ 'use strict';
2346
+
2347
+ // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
2348
+ // Rhino, and plain browser loading.
2349
+
2350
+ /* istanbul ignore next */
2351
+ if (typeof define === 'function' && define.amd) {
2352
+ define(['exports'], factory);
2353
+ } else if (typeof exports !== 'undefined') {
2354
+ factory(exports);
2355
+ } else {
2356
+ factory((root.esprima = {}));
2357
+ }
2358
+}(this, function (exports) {
2359
+ 'use strict';
2360
+
2361
+ var Token,
2362
+ TokenName,
2363
+ FnExprTokens,
2364
+ Syntax,
2365
+ PropertyKind,
2366
+ Messages,
2367
+ Regex,
2368
+ SyntaxTreeDelegate,
2369
+ XHTMLEntities,
2370
+ ClassPropertyType,
2371
+ source,
2372
+ strict,
2373
+ index,
2374
+ lineNumber,
2375
+ lineStart,
2376
+ length,
2377
+ delegate,
2378
+ lookahead,
2379
+ state,
2380
+ extra;
2381
+
2382
+ Token = {
2383
+ BooleanLiteral: 1,
2384
+ EOF: 2,
2385
+ Identifier: 3,
2386
+ Keyword: 4,
2387
+ NullLiteral: 5,
2388
+ NumericLiteral: 6,
2389
+ Punctuator: 7,
2390
+ StringLiteral: 8,
2391
+ RegularExpression: 9,
2392
+ Template: 10,
2393
+ JSXIdentifier: 11,
2394
+ JSXText: 12
2395
+ };
2396
+
2397
+ TokenName = {};
2398
+ TokenName[Token.BooleanLiteral] = 'Boolean';
2399
+ TokenName[Token.EOF] = '<end>';
2400
+ TokenName[Token.Identifier] = 'Identifier';
2401
+ TokenName[Token.Keyword] = 'Keyword';
2402
+ TokenName[Token.NullLiteral] = 'Null';
2403
+ TokenName[Token.NumericLiteral] = 'Numeric';
2404
+ TokenName[Token.Punctuator] = 'Punctuator';
2405
+ TokenName[Token.StringLiteral] = 'String';
2406
+ TokenName[Token.JSXIdentifier] = 'JSXIdentifier';
2407
+ TokenName[Token.JSXText] = 'JSXText';
2408
+ TokenName[Token.RegularExpression] = 'RegularExpression';
2409
+
2410
+ // A function following one of those tokens is an expression.
2411
+ FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
2412
+ 'return', 'case', 'delete', 'throw', 'void',
2413
+ // assignment operators
2414
+ '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
2415
+ '&=', '|=', '^=', ',',
2416
+ // binary/unary operators
2417
+ '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
2418
+ '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
2419
+ '<=', '<', '>', '!=', '!=='];
2420
+
2421
+ Syntax = {
2422
+ AnyTypeAnnotation: 'AnyTypeAnnotation',
2423
+ ArrayExpression: 'ArrayExpression',
2424
+ ArrayPattern: 'ArrayPattern',
2425
+ ArrayTypeAnnotation: 'ArrayTypeAnnotation',
2426
+ ArrowFunctionExpression: 'ArrowFunctionExpression',
2427
+ AssignmentExpression: 'AssignmentExpression',
2428
+ BinaryExpression: 'BinaryExpression',
2429
+ BlockStatement: 'BlockStatement',
2430
+ BooleanTypeAnnotation: 'BooleanTypeAnnotation',
2431
+ BreakStatement: 'BreakStatement',
2432
+ CallExpression: 'CallExpression',
2433
+ CatchClause: 'CatchClause',
2434
+ ClassBody: 'ClassBody',
2435
+ ClassDeclaration: 'ClassDeclaration',
2436
+ ClassExpression: 'ClassExpression',
2437
+ ClassImplements: 'ClassImplements',
2438
+ ClassProperty: 'ClassProperty',
2439
+ ComprehensionBlock: 'ComprehensionBlock',
2440
+ ComprehensionExpression: 'ComprehensionExpression',
2441
+ ConditionalExpression: 'ConditionalExpression',
2442
+ ContinueStatement: 'ContinueStatement',
2443
+ DebuggerStatement: 'DebuggerStatement',
2444
+ DeclareClass: 'DeclareClass',
2445
+ DeclareFunction: 'DeclareFunction',
2446
+ DeclareModule: 'DeclareModule',
2447
+ DeclareVariable: 'DeclareVariable',
2448
+ DoWhileStatement: 'DoWhileStatement',
2449
+ EmptyStatement: 'EmptyStatement',
2450
+ ExportDeclaration: 'ExportDeclaration',
2451
+ ExportBatchSpecifier: 'ExportBatchSpecifier',
2452
+ ExportSpecifier: 'ExportSpecifier',
2453
+ ExpressionStatement: 'ExpressionStatement',
2454
+ ForInStatement: 'ForInStatement',
2455
+ ForOfStatement: 'ForOfStatement',
2456
+ ForStatement: 'ForStatement',
2457
+ FunctionDeclaration: 'FunctionDeclaration',
2458
+ FunctionExpression: 'FunctionExpression',
2459
+ FunctionTypeAnnotation: 'FunctionTypeAnnotation',
2460
+ FunctionTypeParam: 'FunctionTypeParam',
2461
+ GenericTypeAnnotation: 'GenericTypeAnnotation',
2462
+ Identifier: 'Identifier',
2463
+ IfStatement: 'IfStatement',
2464
+ ImportDeclaration: 'ImportDeclaration',
2465
+ ImportDefaultSpecifier: 'ImportDefaultSpecifier',
2466
+ ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
2467
+ ImportSpecifier: 'ImportSpecifier',
2468
+ InterfaceDeclaration: 'InterfaceDeclaration',
2469
+ InterfaceExtends: 'InterfaceExtends',
2470
+ IntersectionTypeAnnotation: 'IntersectionTypeAnnotation',
2471
+ LabeledStatement: 'LabeledStatement',
2472
+ Literal: 'Literal',
2473
+ LogicalExpression: 'LogicalExpression',
2474
+ MemberExpression: 'MemberExpression',
2475
+ MethodDefinition: 'MethodDefinition',
2476
+ ModuleSpecifier: 'ModuleSpecifier',
2477
+ NewExpression: 'NewExpression',
2478
+ NullableTypeAnnotation: 'NullableTypeAnnotation',
2479
+ NumberTypeAnnotation: 'NumberTypeAnnotation',
2480
+ ObjectExpression: 'ObjectExpression',
2481
+ ObjectPattern: 'ObjectPattern',
2482
+ ObjectTypeAnnotation: 'ObjectTypeAnnotation',
2483
+ ObjectTypeCallProperty: 'ObjectTypeCallProperty',
2484
+ ObjectTypeIndexer: 'ObjectTypeIndexer',
2485
+ ObjectTypeProperty: 'ObjectTypeProperty',
2486
+ Program: 'Program',
2487
+ Property: 'Property',
2488
+ QualifiedTypeIdentifier: 'QualifiedTypeIdentifier',
2489
+ ReturnStatement: 'ReturnStatement',
2490
+ SequenceExpression: 'SequenceExpression',
2491
+ SpreadElement: 'SpreadElement',
2492
+ SpreadProperty: 'SpreadProperty',
2493
+ StringLiteralTypeAnnotation: 'StringLiteralTypeAnnotation',
2494
+ StringTypeAnnotation: 'StringTypeAnnotation',
2495
+ SwitchCase: 'SwitchCase',
2496
+ SwitchStatement: 'SwitchStatement',
2497
+ TaggedTemplateExpression: 'TaggedTemplateExpression',
2498
+ TemplateElement: 'TemplateElement',
2499
+ TemplateLiteral: 'TemplateLiteral',
2500
+ ThisExpression: 'ThisExpression',
2501
+ ThrowStatement: 'ThrowStatement',
2502
+ TupleTypeAnnotation: 'TupleTypeAnnotation',
2503
+ TryStatement: 'TryStatement',
2504
+ TypeAlias: 'TypeAlias',
2505
+ TypeAnnotation: 'TypeAnnotation',
2506
+ TypeCastExpression: 'TypeCastExpression',
2507
+ TypeofTypeAnnotation: 'TypeofTypeAnnotation',
2508
+ TypeParameterDeclaration: 'TypeParameterDeclaration',
2509
+ TypeParameterInstantiation: 'TypeParameterInstantiation',
2510
+ UnaryExpression: 'UnaryExpression',
2511
+ UnionTypeAnnotation: 'UnionTypeAnnotation',
2512
+ UpdateExpression: 'UpdateExpression',
2513
+ VariableDeclaration: 'VariableDeclaration',
2514
+ VariableDeclarator: 'VariableDeclarator',
2515
+ VoidTypeAnnotation: 'VoidTypeAnnotation',
2516
+ WhileStatement: 'WhileStatement',
2517
+ WithStatement: 'WithStatement',
2518
+ JSXIdentifier: 'JSXIdentifier',
2519
+ JSXNamespacedName: 'JSXNamespacedName',
2520
+ JSXMemberExpression: 'JSXMemberExpression',
2521
+ JSXEmptyExpression: 'JSXEmptyExpression',
2522
+ JSXExpressionContainer: 'JSXExpressionContainer',
2523
+ JSXElement: 'JSXElement',
2524
+ JSXClosingElement: 'JSXClosingElement',
2525
+ JSXOpeningElement: 'JSXOpeningElement',
2526
+ JSXAttribute: 'JSXAttribute',
2527
+ JSXSpreadAttribute: 'JSXSpreadAttribute',
2528
+ JSXText: 'JSXText',
2529
+ YieldExpression: 'YieldExpression',
2530
+ AwaitExpression: 'AwaitExpression'
2531
+ };
2532
+
2533
+ PropertyKind = {
2534
+ Data: 1,
2535
+ Get: 2,
2536
+ Set: 4
2537
+ };
2538
+
2539
+ ClassPropertyType = {
2540
+ 'static': 'static',
2541
+ prototype: 'prototype'
2542
+ };
2543
+
2544
+ // Error messages should be identical to V8.
2545
+ Messages = {
2546
+ UnexpectedToken: 'Unexpected token %0',
2547
+ UnexpectedNumber: 'Unexpected number',
2548
+ UnexpectedString: 'Unexpected string',
2549
+ UnexpectedIdentifier: 'Unexpected identifier',
2550
+ UnexpectedReserved: 'Unexpected reserved word',
2551
+ UnexpectedTemplate: 'Unexpected quasi %0',
2552
+ UnexpectedEOS: 'Unexpected end of input',
2553
+ NewlineAfterThrow: 'Illegal newline after throw',
2554
+ InvalidRegExp: 'Invalid regular expression',
2555
+ UnterminatedRegExp: 'Invalid regular expression: missing /',
2556
+ InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
2557
+ InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',
2558
+ InvalidLHSInForIn: 'Invalid left-hand side in for-in',
2559
+ MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
2560
+ NoCatchOrFinally: 'Missing catch or finally after try',
2561
+ UnknownLabel: 'Undefined label \'%0\'',
2562
+ Redeclaration: '%0 \'%1\' has already been declared',
2563
+ IllegalContinue: 'Illegal continue statement',
2564
+ IllegalBreak: 'Illegal break statement',
2565
+ IllegalDuplicateClassProperty: 'Illegal duplicate property in class definition',
2566
+ IllegalClassConstructorProperty: 'Illegal constructor property in class definition',
2567
+ IllegalReturn: 'Illegal return statement',
2568
+ IllegalSpread: 'Illegal spread element',
2569
+ StrictModeWith: 'Strict mode code may not include a with statement',
2570
+ StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
2571
+ StrictVarName: 'Variable name may not be eval or arguments in strict mode',
2572
+ StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
2573
+ StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
2574
+ ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list',
2575
+ DefaultRestParameter: 'Rest parameter can not have a default value',
2576
+ ElementAfterSpreadElement: 'Spread must be the final element of an element list',
2577
+ PropertyAfterSpreadProperty: 'A rest property must be the final property of an object literal',
2578
+ ObjectPatternAsRestParameter: 'Invalid rest parameter',
2579
+ ObjectPatternAsSpread: 'Invalid spread argument',
2580
+ StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
2581
+ StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
2582
+ StrictDelete: 'Delete of an unqualified identifier in strict mode.',
2583
+ StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
2584
+ AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
2585
+ AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
2586
+ StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
2587
+ StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
2588
+ StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
2589
+ StrictReservedWord: 'Use of future reserved word in strict mode',
2590
+ MissingFromClause: 'Missing from clause',
2591
+ NoAsAfterImportNamespace: 'Missing as after import *',
2592
+ InvalidModuleSpecifier: 'Invalid module specifier',
2593
+ IllegalImportDeclaration: 'Illegal import declaration',
2594
+ IllegalExportDeclaration: 'Illegal export declaration',
2595
+ NoUninitializedConst: 'Const must be initialized',
2596
+ ComprehensionRequiresBlock: 'Comprehension must have at least one block',
2597
+ ComprehensionError: 'Comprehension Error',
2598
+ EachNotAllowed: 'Each is not supported',
2599
+ InvalidJSXAttributeValue: 'JSX value should be either an expression or a quoted JSX text',
2600
+ ExpectedJSXClosingTag: 'Expected corresponding JSX closing tag for %0',
2601
+ AdjacentJSXElements: 'Adjacent JSX elements must be wrapped in an enclosing tag',
2602
+ ConfusedAboutFunctionType: 'Unexpected token =>. It looks like ' +
2603
+ 'you are trying to write a function type, but you ended up ' +
2604
+ 'writing a grouped type followed by an =>, which is a syntax ' +
2605
+ 'error. Remember, function type parameters are named so function ' +
2606
+ 'types look like (name1: type1, name2: type2) => returnType. You ' +
2607
+ 'probably wrote (type1) => returnType'
2608
+ };
2609
+
2610
+ // See also tools/generate-unicode-regex.py.
2611
+ Regex = {
2612
+ NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
2613
+ NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
2614
+ LeadingZeros: new RegExp('^0+(?!$)')
2615
+ };
2616
+
2617
+ // Ensure the condition is true, otherwise throw an error.
2618
+ // This is only to have a better contract semantic, i.e. another safety net
2619
+ // to catch a logic error. The condition shall be fulfilled in normal case.
2620
+ // Do NOT use this to enforce a certain condition on any user input.
2621
+
2622
+ function assert(condition, message) {
2623
+ /* istanbul ignore if */
2624
+ if (!condition) {
2625
+ throw new Error('ASSERT: ' + message);
2626
+ }
2627
+ }
2628
+
2629
+ function StringMap() {
2630
+ this.$data = {};
2631
+ }
2632
+
2633
+ StringMap.prototype.get = function (key) {
2634
+ key = '$' + key;
2635
+ return this.$data[key];
2636
+ };
2637
+
2638
+ StringMap.prototype.set = function (key, value) {
2639
+ key = '$' + key;
2640
+ this.$data[key] = value;
2641
+ return this;
2642
+ };
2643
+
2644
+ StringMap.prototype.has = function (key) {
2645
+ key = '$' + key;
2646
+ return Object.prototype.hasOwnProperty.call(this.$data, key);
2647
+ };
2648
+
2649
+ StringMap.prototype["delete"] = function (key) {
2650
+ key = '$' + key;
2651
+ return delete this.$data[key];
2652
+ };
2653
+
2654
+ function isDecimalDigit(ch) {
2655
+ return (ch >= 48 && ch <= 57); // 0..9
2656
+ }
2657
+
2658
+ function isHexDigit(ch) {
2659
+ return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
2660
+ }
2661
+
2662
+ function isOctalDigit(ch) {
2663
+ return '01234567'.indexOf(ch) >= 0;
2664
+ }
2665
+
2666
+
2667
+ // 7.2 White Space
2668
+
2669
+ function isWhiteSpace(ch) {
2670
+ return (ch === 32) || // space
2671
+ (ch === 9) || // tab
2672
+ (ch === 0xB) ||
2673
+ (ch === 0xC) ||
2674
+ (ch === 0xA0) ||
2675
+ (ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
2676
+ }
2677
+
2678
+ // 7.3 Line Terminators
2679
+
2680
+ function isLineTerminator(ch) {
2681
+ return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
2682
+ }
2683
+
2684
+ // 7.6 Identifier Names and Identifiers
2685
+
2686
+ function isIdentifierStart(ch) {
2687
+ return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
2688
+ (ch >= 65 && ch <= 90) || // A..Z
2689
+ (ch >= 97 && ch <= 122) || // a..z
2690
+ (ch === 92) || // \ (backslash)
2691
+ ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
2692
+ }
2693
+
2694
+ function isIdentifierPart(ch) {
2695
+ return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
2696
+ (ch >= 65 && ch <= 90) || // A..Z
2697
+ (ch >= 97 && ch <= 122) || // a..z
2698
+ (ch >= 48 && ch <= 57) || // 0..9
2699
+ (ch === 92) || // \ (backslash)
2700
+ ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
2701
+ }
2702
+
2703
+ // 7.6.1.2 Future Reserved Words
2704
+
2705
+ function isFutureReservedWord(id) {
2706
+ switch (id) {
2707
+ case 'class':
2708
+ case 'enum':
2709
+ case 'export':
2710
+ case 'extends':
2711
+ case 'import':
2712
+ case 'super':
2713
+ return true;
2714
+ default:
2715
+ return false;
2716
+ }
2717
+ }
2718
+
2719
+ function isStrictModeReservedWord(id) {
2720
+ switch (id) {
2721
+ case 'implements':
2722
+ case 'interface':
2723
+ case 'package':
2724
+ case 'private':
2725
+ case 'protected':
2726
+ case 'public':
2727
+ case 'static':
2728
+ case 'yield':
2729
+ case 'let':
2730
+ return true;
2731
+ default:
2732
+ return false;
2733
+ }
2734
+ }
2735
+
2736
+ function isRestrictedWord(id) {
2737
+ return id === 'eval' || id === 'arguments';
2738
+ }
2739
+
2740
+ // 7.6.1.1 Keywords
2741
+
2742
+ function isKeyword(id) {
2743
+ if (strict && isStrictModeReservedWord(id)) {
2744
+ return true;
2745
+ }
2746
+
2747
+ // 'const' is specialized as Keyword in V8.
2748
+ // 'yield' is only treated as a keyword in strict mode.
2749
+ // 'let' is for compatiblity with SpiderMonkey and ES.next.
2750
+ // Some others are from future reserved words.
2751
+
2752
+ switch (id.length) {
2753
+ case 2:
2754
+ return (id === 'if') || (id === 'in') || (id === 'do');
2755
+ case 3:
2756
+ return (id === 'var') || (id === 'for') || (id === 'new') ||
2757
+ (id === 'try') || (id === 'let');
2758
+ case 4:
2759
+ return (id === 'this') || (id === 'else') || (id === 'case') ||
2760
+ (id === 'void') || (id === 'with') || (id === 'enum');
2761
+ case 5:
2762
+ return (id === 'while') || (id === 'break') || (id === 'catch') ||
2763
+ (id === 'throw') || (id === 'const') ||
2764
+ (id === 'class') || (id === 'super');
2765
+ case 6:
2766
+ return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
2767
+ (id === 'switch') || (id === 'export') || (id === 'import');
2768
+ case 7:
2769
+ return (id === 'default') || (id === 'finally') || (id === 'extends');
2770
+ case 8:
2771
+ return (id === 'function') || (id === 'continue') || (id === 'debugger');
2772
+ case 10:
2773
+ return (id === 'instanceof');
2774
+ default:
2775
+ return false;
2776
+ }
2777
+ }
2778
+
2779
+ // 7.4 Comments
2780
+
2781
+ function addComment(type, value, start, end, loc) {
2782
+ var comment;
2783
+ assert(typeof start === 'number', 'Comment must have valid position');
2784
+
2785
+ // Because the way the actual token is scanned, often the comments
2786
+ // (if any) are skipped twice during the lexical analysis.
2787
+ // Thus, we need to skip adding a comment if the comment array already
2788
+ // handled it.
2789
+ if (state.lastCommentStart >= start) {
2790
+ return;
2791
+ }
2792
+ state.lastCommentStart = start;
2793
+
2794
+ comment = {
2795
+ type: type,
2796
+ value: value
2797
+ };
2798
+ if (extra.range) {
2799
+ comment.range = [start, end];
2800
+ }
2801
+ if (extra.loc) {
2802
+ comment.loc = loc;
2803
+ }
2804
+ extra.comments.push(comment);
2805
+ if (extra.attachComment) {
2806
+ extra.leadingComments.push(comment);
2807
+ extra.trailingComments.push(comment);
2808
+ }
2809
+ }
2810
+
2811
+ function skipSingleLineComment() {
2812
+ var start, loc, ch, comment;
2813
+
2814
+ start = index - 2;
2815
+ loc = {
2816
+ start: {
2817
+ line: lineNumber,
2818
+ column: index - lineStart - 2
2819
+ }
2820
+ };
2821
+
2822
+ while (index < length) {
2823
+ ch = source.charCodeAt(index);
2824
+ ++index;
2825
+ if (isLineTerminator(ch)) {
2826
+ if (extra.comments) {
2827
+ comment = source.slice(start + 2, index - 1);
2828
+ loc.end = {
2829
+ line: lineNumber,
2830
+ column: index - lineStart - 1
2831
+ };
2832
+ addComment('Line', comment, start, index - 1, loc);
2833
+ }
2834
+ if (ch === 13 && source.charCodeAt(index) === 10) {
2835
+ ++index;
2836
+ }
2837
+ ++lineNumber;
2838
+ lineStart = index;
2839
+ return;
2840
+ }
2841
+ }
2842
+
2843
+ if (extra.comments) {
2844
+ comment = source.slice(start + 2, index);
2845
+ loc.end = {
2846
+ line: lineNumber,
2847
+ column: index - lineStart
2848
+ };
2849
+ addComment('Line', comment, start, index, loc);
2850
+ }
2851
+ }
2852
+
2853
+ function skipMultiLineComment() {
2854
+ var start, loc, ch, comment;
2855
+
2856
+ if (extra.comments) {
2857
+ start = index - 2;
2858
+ loc = {
2859
+ start: {
2860
+ line: lineNumber,
2861
+ column: index - lineStart - 2
2862
+ }
2863
+ };
2864
+ }
2865
+
2866
+ while (index < length) {
2867
+ ch = source.charCodeAt(index);
2868
+ if (isLineTerminator(ch)) {
2869
+ if (ch === 13 && source.charCodeAt(index + 1) === 10) {
2870
+ ++index;
2871
+ }
2872
+ ++lineNumber;
2873
+ ++index;
2874
+ lineStart = index;
2875
+ if (index >= length) {
2876
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2877
+ }
2878
+ } else if (ch === 42) {
2879
+ // Block comment ends with '*/' (char #42, char #47).
2880
+ if (source.charCodeAt(index + 1) === 47) {
2881
+ ++index;
2882
+ ++index;
2883
+ if (extra.comments) {
2884
+ comment = source.slice(start + 2, index - 2);
2885
+ loc.end = {
2886
+ line: lineNumber,
2887
+ column: index - lineStart
2888
+ };
2889
+ addComment('Block', comment, start, index, loc);
2890
+ }
2891
+ return;
2892
+ }
2893
+ ++index;
2894
+ } else {
2895
+ ++index;
2896
+ }
2897
+ }
2898
+
2899
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2900
+ }
2901
+
2902
+ function skipComment() {
2903
+ var ch;
2904
+
2905
+ while (index < length) {
2906
+ ch = source.charCodeAt(index);
2907
+
2908
+ if (isWhiteSpace(ch)) {
2909
+ ++index;
2910
+ } else if (isLineTerminator(ch)) {
2911
+ ++index;
2912
+ if (ch === 13 && source.charCodeAt(index) === 10) {
2913
+ ++index;
2914
+ }
2915
+ ++lineNumber;
2916
+ lineStart = index;
2917
+ } else if (ch === 47) { // 47 is '/'
2918
+ ch = source.charCodeAt(index + 1);
2919
+ if (ch === 47) {
2920
+ ++index;
2921
+ ++index;
2922
+ skipSingleLineComment();
2923
+ } else if (ch === 42) { // 42 is '*'
2924
+ ++index;
2925
+ ++index;
2926
+ skipMultiLineComment();
2927
+ } else {
2928
+ break;
2929
+ }
2930
+ } else {
2931
+ break;
2932
+ }
2933
+ }
2934
+ }
2935
+
2936
+ function scanHexEscape(prefix) {
2937
+ var i, len, ch, code = 0;
2938
+
2939
+ len = (prefix === 'u') ? 4 : 2;
2940
+ for (i = 0; i < len; ++i) {
2941
+ if (index < length && isHexDigit(source[index])) {
2942
+ ch = source[index++];
2943
+ code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
2944
+ } else {
2945
+ return '';
2946
+ }
2947
+ }
2948
+ return String.fromCharCode(code);
2949
+ }
2950
+
2951
+ function scanUnicodeCodePointEscape() {
2952
+ var ch, code, cu1, cu2;
2953
+
2954
+ ch = source[index];
2955
+ code = 0;
2956
+
2957
+ // At least, one hex digit is required.
2958
+ if (ch === '}') {
2959
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2960
+ }
2961
+
2962
+ while (index < length) {
2963
+ ch = source[index++];
2964
+ if (!isHexDigit(ch)) {
2965
+ break;
2966
+ }
2967
+ code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
2968
+ }
2969
+
2970
+ if (code > 0x10FFFF || ch !== '}') {
2971
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2972
+ }
2973
+
2974
+ // UTF-16 Encoding
2975
+ if (code <= 0xFFFF) {
2976
+ return String.fromCharCode(code);
2977
+ }
2978
+ cu1 = ((code - 0x10000) >> 10) + 0xD800;
2979
+ cu2 = ((code - 0x10000) & 1023) + 0xDC00;
2980
+ return String.fromCharCode(cu1, cu2);
2981
+ }
2982
+
2983
+ function getEscapedIdentifier() {
2984
+ var ch, id;
2985
+
2986
+ ch = source.charCodeAt(index++);
2987
+ id = String.fromCharCode(ch);
2988
+
2989
+ // '\u' (char #92, char #117) denotes an escaped character.
2990
+ if (ch === 92) {
2991
+ if (source.charCodeAt(index) !== 117) {
2992
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2993
+ }
2994
+ ++index;
2995
+ ch = scanHexEscape('u');
2996
+ if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
2997
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2998
+ }
2999
+ id = ch;
3000
+ }
3001
+
3002
+ while (index < length) {
3003
+ ch = source.charCodeAt(index);
3004
+ if (!isIdentifierPart(ch)) {
3005
+ break;
3006
+ }
3007
+ ++index;
3008
+ id += String.fromCharCode(ch);
3009
+
3010
+ // '\u' (char #92, char #117) denotes an escaped character.
3011
+ if (ch === 92) {
3012
+ id = id.substr(0, id.length - 1);
3013
+ if (source.charCodeAt(index) !== 117) {
3014
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3015
+ }
3016
+ ++index;
3017
+ ch = scanHexEscape('u');
3018
+ if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
3019
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3020
+ }
3021
+ id += ch;
3022
+ }
3023
+ }
3024
+
3025
+ return id;
3026
+ }
3027
+
3028
+ function getIdentifier() {
3029
+ var start, ch;
3030
+
3031
+ start = index++;
3032
+ while (index < length) {
3033
+ ch = source.charCodeAt(index);
3034
+ if (ch === 92) {
3035
+ // Blackslash (char #92) marks Unicode escape sequence.
3036
+ index = start;
3037
+ return getEscapedIdentifier();
3038
+ }
3039
+ if (isIdentifierPart(ch)) {
3040
+ ++index;
3041
+ } else {
3042
+ break;
3043
+ }
3044
+ }
3045
+
3046
+ return source.slice(start, index);
3047
+ }
3048
+
3049
+ function scanIdentifier() {
3050
+ var start, id, type;
3051
+
3052
+ start = index;
3053
+
3054
+ // Backslash (char #92) starts an escaped character.
3055
+ id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
3056
+
3057
+ // There is no keyword or literal with only one character.
3058
+ // Thus, it must be an identifier.
3059
+ if (id.length === 1) {
3060
+ type = Token.Identifier;
3061
+ } else if (isKeyword(id)) {
3062
+ type = Token.Keyword;
3063
+ } else if (id === 'null') {
3064
+ type = Token.NullLiteral;
3065
+ } else if (id === 'true' || id === 'false') {
3066
+ type = Token.BooleanLiteral;
3067
+ } else {
3068
+ type = Token.Identifier;
3069
+ }
3070
+
3071
+ return {
3072
+ type: type,
3073
+ value: id,
3074
+ lineNumber: lineNumber,
3075
+ lineStart: lineStart,
3076
+ range: [start, index]
3077
+ };
3078
+ }
3079
+
3080
+
3081
+ // 7.7 Punctuators
3082
+
3083
+ function scanPunctuator() {
3084
+ var start = index,
3085
+ code = source.charCodeAt(index),
3086
+ code2,
3087
+ ch1 = source[index],
3088
+ ch2,
3089
+ ch3,
3090
+ ch4;
3091
+
3092
+ if (state.inJSXTag || state.inJSXChild) {
3093
+ // Don't need to check for '{' and '}' as it's already handled
3094
+ // correctly by default.
3095
+ switch (code) {
3096
+ case 60: // <
3097
+ case 62: // >
3098
+ ++index;
3099
+ return {
3100
+ type: Token.Punctuator,
3101
+ value: String.fromCharCode(code),
3102
+ lineNumber: lineNumber,
3103
+ lineStart: lineStart,
3104
+ range: [start, index]
3105
+ };
3106
+ }
3107
+ }
3108
+
3109
+ switch (code) {
3110
+ // Check for most common single-character punctuators.
3111
+ case 40: // ( open bracket
3112
+ case 41: // ) close bracket
3113
+ case 59: // ; semicolon
3114
+ case 44: // , comma
3115
+ case 123: // { open curly brace
3116
+ case 125: // } close curly brace
3117
+ case 91: // [
3118
+ case 93: // ]
3119
+ case 58: // :
3120
+ case 63: // ?
3121
+ case 126: // ~
3122
+ ++index;
3123
+ if (extra.tokenize) {
3124
+ if (code === 40) {
3125
+ extra.openParenToken = extra.tokens.length;
3126
+ } else if (code === 123) {
3127
+ extra.openCurlyToken = extra.tokens.length;
3128
+ }
3129
+ }
3130
+ return {
3131
+ type: Token.Punctuator,
3132
+ value: String.fromCharCode(code),
3133
+ lineNumber: lineNumber,
3134
+ lineStart: lineStart,
3135
+ range: [start, index]
3136
+ };
3137
+
3138
+ default:
3139
+ code2 = source.charCodeAt(index + 1);
3140
+
3141
+ // '=' (char #61) marks an assignment or comparison operator.
3142
+ if (code2 === 61) {
3143
+ switch (code) {
3144
+ case 37: // %
3145
+ case 38: // &
3146
+ case 42: // *:
3147
+ case 43: // +
3148
+ case 45: // -
3149
+ case 47: // /
3150
+ case 60: // <
3151
+ case 62: // >
3152
+ case 94: // ^
3153
+ case 124: // |
3154
+ index += 2;
3155
+ return {
3156
+ type: Token.Punctuator,
3157
+ value: String.fromCharCode(code) + String.fromCharCode(code2),
3158
+ lineNumber: lineNumber,
3159
+ lineStart: lineStart,
3160
+ range: [start, index]
3161
+ };
3162
+
3163
+ case 33: // !
3164
+ case 61: // =
3165
+ index += 2;
3166
+
3167
+ // !== and ===
3168
+ if (source.charCodeAt(index) === 61) {
3169
+ ++index;
3170
+ }
3171
+ return {
3172
+ type: Token.Punctuator,
3173
+ value: source.slice(start, index),
3174
+ lineNumber: lineNumber,
3175
+ lineStart: lineStart,
3176
+ range: [start, index]
3177
+ };
3178
+ default:
3179
+ break;
3180
+ }
3181
+ }
3182
+ break;
3183
+ }
3184
+
3185
+ // Peek more characters.
3186
+
3187
+ ch2 = source[index + 1];
3188
+ ch3 = source[index + 2];
3189
+ ch4 = source[index + 3];
3190
+
3191
+ // 4-character punctuator: >>>=
3192
+
3193
+ if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
3194
+ if (ch4 === '=') {
3195
+ index += 4;
3196
+ return {
3197
+ type: Token.Punctuator,
3198
+ value: '>>>=',
3199
+ lineNumber: lineNumber,
3200
+ lineStart: lineStart,
3201
+ range: [start, index]
3202
+ };
3203
+ }
3204
+ }
3205
+
3206
+ // 3-character punctuators: === !== >>> <<= >>=
3207
+
3208
+ if (ch1 === '>' && ch2 === '>' && ch3 === '>' && !state.inType) {
3209
+ index += 3;
3210
+ return {
3211
+ type: Token.Punctuator,
3212
+ value: '>>>',
3213
+ lineNumber: lineNumber,
3214
+ lineStart: lineStart,
3215
+ range: [start, index]
3216
+ };
3217
+ }
3218
+
3219
+ if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
3220
+ index += 3;
3221
+ return {
3222
+ type: Token.Punctuator,
3223
+ value: '<<=',
3224
+ lineNumber: lineNumber,
3225
+ lineStart: lineStart,
3226
+ range: [start, index]
3227
+ };
3228
+ }
3229
+
3230
+ if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
3231
+ index += 3;
3232
+ return {
3233
+ type: Token.Punctuator,
3234
+ value: '>>=',
3235
+ lineNumber: lineNumber,
3236
+ lineStart: lineStart,
3237
+ range: [start, index]
3238
+ };
3239
+ }
3240
+
3241
+ if (ch1 === '.' && ch2 === '.' && ch3 === '.') {
3242
+ index += 3;
3243
+ return {
3244
+ type: Token.Punctuator,
3245
+ value: '...',
3246
+ lineNumber: lineNumber,
3247
+ lineStart: lineStart,
3248
+ range: [start, index]
3249
+ };
3250
+ }
3251
+
3252
+ // Other 2-character punctuators: ++ -- << >> && ||
3253
+
3254
+ // Don't match these tokens if we're in a type, since they never can
3255
+ // occur and can mess up types like Map<string, Array<string>>
3256
+ if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0) && !state.inType) {
3257
+ index += 2;
3258
+ return {
3259
+ type: Token.Punctuator,
3260
+ value: ch1 + ch2,
3261
+ lineNumber: lineNumber,
3262
+ lineStart: lineStart,
3263
+ range: [start, index]
3264
+ };
3265
+ }
3266
+
3267
+ if (ch1 === '=' && ch2 === '>') {
3268
+ index += 2;
3269
+ return {
3270
+ type: Token.Punctuator,
3271
+ value: '=>',
3272
+ lineNumber: lineNumber,
3273
+ lineStart: lineStart,
3274
+ range: [start, index]
3275
+ };
3276
+ }
3277
+
3278
+ if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
3279
+ ++index;
3280
+ return {
3281
+ type: Token.Punctuator,
3282
+ value: ch1,
3283
+ lineNumber: lineNumber,
3284
+ lineStart: lineStart,
3285
+ range: [start, index]
3286
+ };
3287
+ }
3288
+
3289
+ if (ch1 === '.') {
3290
+ ++index;
3291
+ return {
3292
+ type: Token.Punctuator,
3293
+ value: ch1,
3294
+ lineNumber: lineNumber,
3295
+ lineStart: lineStart,
3296
+ range: [start, index]
3297
+ };
3298
+ }
3299
+
3300
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3301
+ }
3302
+
3303
+ // 7.8.3 Numeric Literals
3304
+
3305
+ function scanHexLiteral(start) {
3306
+ var number = '';
3307
+
3308
+ while (index < length) {
3309
+ if (!isHexDigit(source[index])) {
3310
+ break;
3311
+ }
3312
+ number += source[index++];
3313
+ }
3314
+
3315
+ if (number.length === 0) {
3316
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3317
+ }
3318
+
3319
+ if (isIdentifierStart(source.charCodeAt(index))) {
3320
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3321
+ }
3322
+
3323
+ return {
3324
+ type: Token.NumericLiteral,
3325
+ value: parseInt('0x' + number, 16),
3326
+ lineNumber: lineNumber,
3327
+ lineStart: lineStart,
3328
+ range: [start, index]
3329
+ };
3330
+ }
3331
+
3332
+ function scanBinaryLiteral(start) {
3333
+ var ch, number;
3334
+
3335
+ number = '';
3336
+
3337
+ while (index < length) {
3338
+ ch = source[index];
3339
+ if (ch !== '0' && ch !== '1') {
3340
+ break;
3341
+ }
3342
+ number += source[index++];
3343
+ }
3344
+
3345
+ if (number.length === 0) {
3346
+ // only 0b or 0B
3347
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3348
+ }
3349
+
3350
+ if (index < length) {
3351
+ ch = source.charCodeAt(index);
3352
+ /* istanbul ignore else */
3353
+ if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
3354
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3355
+ }
3356
+ }
3357
+
3358
+ return {
3359
+ type: Token.NumericLiteral,
3360
+ value: parseInt(number, 2),
3361
+ lineNumber: lineNumber,
3362
+ lineStart: lineStart,
3363
+ range: [start, index]
3364
+ };
3365
+ }
3366
+
3367
+ function scanOctalLiteral(prefix, start) {
3368
+ var number, octal;
3369
+
3370
+ if (isOctalDigit(prefix)) {
3371
+ octal = true;
3372
+ number = '0' + source[index++];
3373
+ } else {
3374
+ octal = false;
3375
+ ++index;
3376
+ number = '';
3377
+ }
3378
+
3379
+ while (index < length) {
3380
+ if (!isOctalDigit(source[index])) {
3381
+ break;
3382
+ }
3383
+ number += source[index++];
3384
+ }
3385
+
3386
+ if (!octal && number.length === 0) {
3387
+ // only 0o or 0O
3388
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3389
+ }
3390
+
3391
+ if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
3392
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3393
+ }
3394
+
3395
+ return {
3396
+ type: Token.NumericLiteral,
3397
+ value: parseInt(number, 8),
3398
+ octal: octal,
3399
+ lineNumber: lineNumber,
3400
+ lineStart: lineStart,
3401
+ range: [start, index]
3402
+ };
3403
+ }
3404
+
3405
+ function scanNumericLiteral() {
3406
+ var number, start, ch;
3407
+
3408
+ ch = source[index];
3409
+ assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
3410
+ 'Numeric literal must start with a decimal digit or a decimal point');
3411
+
3412
+ start = index;
3413
+ number = '';
3414
+ if (ch !== '.') {
3415
+ number = source[index++];
3416
+ ch = source[index];
3417
+
3418
+ // Hex number starts with '0x'.
3419
+ // Octal number starts with '0'.
3420
+ // Octal number in ES6 starts with '0o'.
3421
+ // Binary number in ES6 starts with '0b'.
3422
+ if (number === '0') {
3423
+ if (ch === 'x' || ch === 'X') {
3424
+ ++index;
3425
+ return scanHexLiteral(start);
3426
+ }
3427
+ if (ch === 'b' || ch === 'B') {
3428
+ ++index;
3429
+ return scanBinaryLiteral(start);
3430
+ }
3431
+ if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {
3432
+ return scanOctalLiteral(ch, start);
3433
+ }
3434
+ // decimal number starts with '0' such as '09' is illegal.
3435
+ if (ch && isDecimalDigit(ch.charCodeAt(0))) {
3436
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3437
+ }
3438
+ }
3439
+
3440
+ while (isDecimalDigit(source.charCodeAt(index))) {
3441
+ number += source[index++];
3442
+ }
3443
+ ch = source[index];
3444
+ }
3445
+
3446
+ if (ch === '.') {
3447
+ number += source[index++];
3448
+ while (isDecimalDigit(source.charCodeAt(index))) {
3449
+ number += source[index++];
3450
+ }
3451
+ ch = source[index];
3452
+ }
3453
+
3454
+ if (ch === 'e' || ch === 'E') {
3455
+ number += source[index++];
3456
+
3457
+ ch = source[index];
3458
+ if (ch === '+' || ch === '-') {
3459
+ number += source[index++];
3460
+ }
3461
+ if (isDecimalDigit(source.charCodeAt(index))) {
3462
+ while (isDecimalDigit(source.charCodeAt(index))) {
3463
+ number += source[index++];
3464
+ }
3465
+ } else {
3466
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3467
+ }
3468
+ }
3469
+
3470
+ if (isIdentifierStart(source.charCodeAt(index))) {
3471
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3472
+ }
3473
+
3474
+ return {
3475
+ type: Token.NumericLiteral,
3476
+ value: parseFloat(number),
3477
+ lineNumber: lineNumber,
3478
+ lineStart: lineStart,
3479
+ range: [start, index]
3480
+ };
3481
+ }
3482
+
3483
+ // 7.8.4 String Literals
3484
+
3485
+ function scanStringLiteral() {
3486
+ var str = '', quote, start, ch, code, unescaped, restore, octal = false;
3487
+
3488
+ quote = source[index];
3489
+ assert((quote === '\'' || quote === '"'),
3490
+ 'String literal must starts with a quote');
3491
+
3492
+ start = index;
3493
+ ++index;
3494
+
3495
+ while (index < length) {
3496
+ ch = source[index++];
3497
+
3498
+ if (ch === quote) {
3499
+ quote = '';
3500
+ break;
3501
+ } else if (ch === '\\') {
3502
+ ch = source[index++];
3503
+ if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
3504
+ switch (ch) {
3505
+ case 'n':
3506
+ str += '\n';
3507
+ break;
3508
+ case 'r':
3509
+ str += '\r';
3510
+ break;
3511
+ case 't':
3512
+ str += '\t';
3513
+ break;
3514
+ case 'u':
3515
+ case 'x':
3516
+ if (source[index] === '{') {
3517
+ ++index;
3518
+ str += scanUnicodeCodePointEscape();
3519
+ } else {
3520
+ restore = index;
3521
+ unescaped = scanHexEscape(ch);
3522
+ if (unescaped) {
3523
+ str += unescaped;
3524
+ } else {
3525
+ index = restore;
3526
+ str += ch;
3527
+ }
3528
+ }
3529
+ break;
3530
+ case 'b':
3531
+ str += '\b';
3532
+ break;
3533
+ case 'f':
3534
+ str += '\f';
3535
+ break;
3536
+ case 'v':
3537
+ str += '\x0B';
3538
+ break;
3539
+
3540
+ default:
3541
+ if (isOctalDigit(ch)) {
3542
+ code = '01234567'.indexOf(ch);
3543
+
3544
+ // \0 is not octal escape sequence
3545
+ if (code !== 0) {
3546
+ octal = true;
3547
+ }
3548
+
3549
+ /* istanbul ignore else */
3550
+ if (index < length && isOctalDigit(source[index])) {
3551
+ octal = true;
3552
+ code = code * 8 + '01234567'.indexOf(source[index++]);
3553
+
3554
+ // 3 digits are only allowed when string starts
3555
+ // with 0, 1, 2, 3
3556
+ if ('0123'.indexOf(ch) >= 0 &&
3557
+ index < length &&
3558
+ isOctalDigit(source[index])) {
3559
+ code = code * 8 + '01234567'.indexOf(source[index++]);
3560
+ }
3561
+ }
3562
+ str += String.fromCharCode(code);
3563
+ } else {
3564
+ str += ch;
3565
+ }
3566
+ break;
3567
+ }
3568
+ } else {
3569
+ ++lineNumber;
3570
+ if (ch === '\r' && source[index] === '\n') {
3571
+ ++index;
3572
+ }
3573
+ lineStart = index;
3574
+ }
3575
+ } else if (isLineTerminator(ch.charCodeAt(0))) {
3576
+ break;
3577
+ } else {
3578
+ str += ch;
3579
+ }
3580
+ }
3581
+
3582
+ if (quote !== '') {
3583
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3584
+ }
3585
+
3586
+ return {
3587
+ type: Token.StringLiteral,
3588
+ value: str,
3589
+ octal: octal,
3590
+ lineNumber: lineNumber,
3591
+ lineStart: lineStart,
3592
+ range: [start, index]
3593
+ };
3594
+ }
3595
+
3596
+ function scanTemplate() {
3597
+ var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;
3598
+
3599
+ terminated = false;
3600
+ tail = false;
3601
+ start = index;
3602
+
3603
+ ++index;
3604
+
3605
+ while (index < length) {
3606
+ ch = source[index++];
3607
+ if (ch === '`') {
3608
+ tail = true;
3609
+ terminated = true;
3610
+ break;
3611
+ } else if (ch === '$') {
3612
+ if (source[index] === '{') {
3613
+ ++index;
3614
+ terminated = true;
3615
+ break;
3616
+ }
3617
+ cooked += ch;
3618
+ } else if (ch === '\\') {
3619
+ ch = source[index++];
3620
+ if (!isLineTerminator(ch.charCodeAt(0))) {
3621
+ switch (ch) {
3622
+ case 'n':
3623
+ cooked += '\n';
3624
+ break;
3625
+ case 'r':
3626
+ cooked += '\r';
3627
+ break;
3628
+ case 't':
3629
+ cooked += '\t';
3630
+ break;
3631
+ case 'u':
3632
+ case 'x':
3633
+ if (source[index] === '{') {
3634
+ ++index;
3635
+ cooked += scanUnicodeCodePointEscape();
3636
+ } else {
3637
+ restore = index;
3638
+ unescaped = scanHexEscape(ch);
3639
+ if (unescaped) {
3640
+ cooked += unescaped;
3641
+ } else {
3642
+ index = restore;
3643
+ cooked += ch;
3644
+ }
3645
+ }
3646
+ break;
3647
+ case 'b':
3648
+ cooked += '\b';
3649
+ break;
3650
+ case 'f':
3651
+ cooked += '\f';
3652
+ break;
3653
+ case 'v':
3654
+ cooked += '\v';
3655
+ break;
3656
+
3657
+ default:
3658
+ if (isOctalDigit(ch)) {
3659
+ code = '01234567'.indexOf(ch);
3660
+
3661
+ // \0 is not octal escape sequence
3662
+ if (code !== 0) {
3663
+ octal = true;
3664
+ }
3665
+
3666
+ /* istanbul ignore else */
3667
+ if (index < length && isOctalDigit(source[index])) {
3668
+ octal = true;
3669
+ code = code * 8 + '01234567'.indexOf(source[index++]);
3670
+
3671
+ // 3 digits are only allowed when string starts
3672
+ // with 0, 1, 2, 3
3673
+ if ('0123'.indexOf(ch) >= 0 &&
3674
+ index < length &&
3675
+ isOctalDigit(source[index])) {
3676
+ code = code * 8 + '01234567'.indexOf(source[index++]);
3677
+ }
3678
+ }
3679
+ cooked += String.fromCharCode(code);
3680
+ } else {
3681
+ cooked += ch;
3682
+ }
3683
+ break;
3684
+ }
3685
+ } else {
3686
+ ++lineNumber;
3687
+ if (ch === '\r' && source[index] === '\n') {
3688
+ ++index;
3689
+ }
3690
+ lineStart = index;
3691
+ }
3692
+ } else if (isLineTerminator(ch.charCodeAt(0))) {
3693
+ ++lineNumber;
3694
+ if (ch === '\r' && source[index] === '\n') {
3695
+ ++index;
3696
+ }
3697
+ lineStart = index;
3698
+ cooked += '\n';
3699
+ } else {
3700
+ cooked += ch;
3701
+ }
3702
+ }
3703
+
3704
+ if (!terminated) {
3705
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3706
+ }
3707
+
3708
+ return {
3709
+ type: Token.Template,
3710
+ value: {
3711
+ cooked: cooked,
3712
+ raw: source.slice(start + 1, index - ((tail) ? 1 : 2))
3713
+ },
3714
+ tail: tail,
3715
+ octal: octal,
3716
+ lineNumber: lineNumber,
3717
+ lineStart: lineStart,
3718
+ range: [start, index]
3719
+ };
3720
+ }
3721
+
3722
+ function scanTemplateElement(option) {
3723
+ var startsWith, template;
3724
+
3725
+ lookahead = null;
3726
+ skipComment();
3727
+
3728
+ startsWith = (option.head) ? '`' : '}';
3729
+
3730
+ if (source[index] !== startsWith) {
3731
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3732
+ }
3733
+
3734
+ template = scanTemplate();
3735
+
3736
+ peek();
3737
+
3738
+ return template;
3739
+ }
3740
+
3741
+ function testRegExp(pattern, flags) {
3742
+ var tmp = pattern,
3743
+ value;
3744
+
3745
+ if (flags.indexOf('u') >= 0) {
3746
+ // Replace each astral symbol and every Unicode code point
3747
+ // escape sequence with a single ASCII symbol to avoid throwing on
3748
+ // regular expressions that are only valid in combination with the
3749
+ // `/u` flag.
3750
+ // Note: replacing with the ASCII symbol `x` might cause false
3751
+ // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
3752
+ // perfectly valid pattern that is equivalent to `[a-b]`, but it
3753
+ // would be replaced by `[x-b]` which throws an error.
3754
+ tmp = tmp
3755
+ .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
3756
+ if (parseInt($1, 16) <= 0x10FFFF) {
3757
+ return 'x';
3758
+ }
3759
+ throwError({}, Messages.InvalidRegExp);
3760
+ })
3761
+ .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
3762
+ }
3763
+
3764
+ // First, detect invalid regular expressions.
3765
+ try {
3766
+ value = new RegExp(tmp);
3767
+ } catch (e) {
3768
+ throwError({}, Messages.InvalidRegExp);
3769
+ }
3770
+
3771
+ // Return a regular expression object for this pattern-flag pair, or
3772
+ // `null` in case the current environment doesn't support the flags it
3773
+ // uses.
3774
+ try {
3775
+ return new RegExp(pattern, flags);
3776
+ } catch (exception) {
3777
+ return null;
3778
+ }
3779
+ }
3780
+
3781
+ function scanRegExpBody() {
3782
+ var ch, str, classMarker, terminated, body;
3783
+
3784
+ ch = source[index];
3785
+ assert(ch === '/', 'Regular expression literal must start with a slash');
3786
+ str = source[index++];
3787
+
3788
+ classMarker = false;
3789
+ terminated = false;
3790
+ while (index < length) {
3791
+ ch = source[index++];
3792
+ str += ch;
3793
+ if (ch === '\\') {
3794
+ ch = source[index++];
3795
+ // ECMA-262 7.8.5
3796
+ if (isLineTerminator(ch.charCodeAt(0))) {
3797
+ throwError({}, Messages.UnterminatedRegExp);
3798
+ }
3799
+ str += ch;
3800
+ } else if (isLineTerminator(ch.charCodeAt(0))) {
3801
+ throwError({}, Messages.UnterminatedRegExp);
3802
+ } else if (classMarker) {
3803
+ if (ch === ']') {
3804
+ classMarker = false;
3805
+ }
3806
+ } else {
3807
+ if (ch === '/') {
3808
+ terminated = true;
3809
+ break;
3810
+ } else if (ch === '[') {
3811
+ classMarker = true;
3812
+ }
3813
+ }
3814
+ }
3815
+
3816
+ if (!terminated) {
3817
+ throwError({}, Messages.UnterminatedRegExp);
3818
+ }
3819
+
3820
+ // Exclude leading and trailing slash.
3821
+ body = str.substr(1, str.length - 2);
3822
+ return {
3823
+ value: body,
3824
+ literal: str
3825
+ };
3826
+ }
3827
+
3828
+ function scanRegExpFlags() {
3829
+ var ch, str, flags, restore;
3830
+
3831
+ str = '';
3832
+ flags = '';
3833
+ while (index < length) {
3834
+ ch = source[index];
3835
+ if (!isIdentifierPart(ch.charCodeAt(0))) {
3836
+ break;
3837
+ }
3838
+
3839
+ ++index;
3840
+ if (ch === '\\' && index < length) {
3841
+ ch = source[index];
3842
+ if (ch === 'u') {
3843
+ ++index;
3844
+ restore = index;
3845
+ ch = scanHexEscape('u');
3846
+ if (ch) {
3847
+ flags += ch;
3848
+ for (str += '\\u'; restore < index; ++restore) {
3849
+ str += source[restore];
3850
+ }
3851
+ } else {
3852
+ index = restore;
3853
+ flags += 'u';
3854
+ str += '\\u';
3855
+ }
3856
+ throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3857
+ } else {
3858
+ str += '\\';
3859
+ throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3860
+ }
3861
+ } else {
3862
+ flags += ch;
3863
+ str += ch;
3864
+ }
3865
+ }
3866
+
3867
+ return {
3868
+ value: flags,
3869
+ literal: str
3870
+ };
3871
+ }
3872
+
3873
+ function scanRegExp() {
3874
+ var start, body, flags, value;
3875
+
3876
+ lookahead = null;
3877
+ skipComment();
3878
+ start = index;
3879
+
3880
+ body = scanRegExpBody();
3881
+ flags = scanRegExpFlags();
3882
+ value = testRegExp(body.value, flags.value);
3883
+
3884
+ if (extra.tokenize) {
3885
+ return {
3886
+ type: Token.RegularExpression,
3887
+ value: value,
3888
+ regex: {
3889
+ pattern: body.value,
3890
+ flags: flags.value
3891
+ },
3892
+ lineNumber: lineNumber,
3893
+ lineStart: lineStart,
3894
+ range: [start, index]
3895
+ };
3896
+ }
3897
+
3898
+ return {
3899
+ literal: body.literal + flags.literal,
3900
+ value: value,
3901
+ regex: {
3902
+ pattern: body.value,
3903
+ flags: flags.value
3904
+ },
3905
+ range: [start, index]
3906
+ };
3907
+ }
3908
+
3909
+ function isIdentifierName(token) {
3910
+ return token.type === Token.Identifier ||
3911
+ token.type === Token.Keyword ||
3912
+ token.type === Token.BooleanLiteral ||
3913
+ token.type === Token.NullLiteral;
3914
+ }
3915
+
3916
+ function advanceSlash() {
3917
+ var prevToken,
3918
+ checkToken;
3919
+ // Using the following algorithm:
3920
+ // https://github.com/mozilla/sweet.js/wiki/design
3921
+ prevToken = extra.tokens[extra.tokens.length - 1];
3922
+ if (!prevToken) {
3923
+ // Nothing before that: it cannot be a division.
3924
+ return scanRegExp();
3925
+ }
3926
+ if (prevToken.type === 'Punctuator') {
3927
+ if (prevToken.value === ')') {
3928
+ checkToken = extra.tokens[extra.openParenToken - 1];
3929
+ if (checkToken &&
3930
+ checkToken.type === 'Keyword' &&
3931
+ (checkToken.value === 'if' ||
3932
+ checkToken.value === 'while' ||
3933
+ checkToken.value === 'for' ||
3934
+ checkToken.value === 'with')) {
3935
+ return scanRegExp();
3936
+ }
3937
+ return scanPunctuator();
3938
+ }
3939
+ if (prevToken.value === '}') {
3940
+ // Dividing a function by anything makes little sense,
3941
+ // but we have to check for that.
3942
+ if (extra.tokens[extra.openCurlyToken - 3] &&
3943
+ extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
3944
+ // Anonymous function.
3945
+ checkToken = extra.tokens[extra.openCurlyToken - 4];
3946
+ if (!checkToken) {
3947
+ return scanPunctuator();
3948
+ }
3949
+ } else if (extra.tokens[extra.openCurlyToken - 4] &&
3950
+ extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
3951
+ // Named function.
3952
+ checkToken = extra.tokens[extra.openCurlyToken - 5];
3953
+ if (!checkToken) {
3954
+ return scanRegExp();
3955
+ }
3956
+ } else {
3957
+ return scanPunctuator();
3958
+ }
3959
+ // checkToken determines whether the function is
3960
+ // a declaration or an expression.
3961
+ if (FnExprTokens.indexOf(checkToken.value) >= 0) {
3962
+ // It is an expression.
3963
+ return scanPunctuator();
3964
+ }
3965
+ // It is a declaration.
3966
+ return scanRegExp();
3967
+ }
3968
+ return scanRegExp();
3969
+ }
3970
+ if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
3971
+ return scanRegExp();
3972
+ }
3973
+ return scanPunctuator();
3974
+ }
3975
+
3976
+ function advance() {
3977
+ var ch;
3978
+
3979
+ if (!state.inJSXChild) {
3980
+ skipComment();
3981
+ }
3982
+
3983
+ if (index >= length) {
3984
+ return {
3985
+ type: Token.EOF,
3986
+ lineNumber: lineNumber,
3987
+ lineStart: lineStart,
3988
+ range: [index, index]
3989
+ };
3990
+ }
3991
+
3992
+ if (state.inJSXChild) {
3993
+ return advanceJSXChild();
3994
+ }
3995
+
3996
+ ch = source.charCodeAt(index);
3997
+
3998
+ // Very common: ( and ) and ;
3999
+ if (ch === 40 || ch === 41 || ch === 58) {
4000
+ return scanPunctuator();
4001
+ }
4002
+
4003
+ // String literal starts with single quote (#39) or double quote (#34).
4004
+ if (ch === 39 || ch === 34) {
4005
+ if (state.inJSXTag) {
4006
+ return scanJSXStringLiteral();
4007
+ }
4008
+ return scanStringLiteral();
4009
+ }
4010
+
4011
+ if (state.inJSXTag && isJSXIdentifierStart(ch)) {
4012
+ return scanJSXIdentifier();
4013
+ }
4014
+
4015
+ if (ch === 96) {
4016
+ return scanTemplate();
4017
+ }
4018
+ if (isIdentifierStart(ch)) {
4019
+ return scanIdentifier();
4020
+ }
4021
+
4022
+ // Dot (.) char #46 can also start a floating-point number, hence the need
4023
+ // to check the next character.
4024
+ if (ch === 46) {
4025
+ if (isDecimalDigit(source.charCodeAt(index + 1))) {
4026
+ return scanNumericLiteral();
4027
+ }
4028
+ return scanPunctuator();
4029
+ }
4030
+
4031
+ if (isDecimalDigit(ch)) {
4032
+ return scanNumericLiteral();
4033
+ }
4034
+
4035
+ // Slash (/) char #47 can also start a regex.
4036
+ if (extra.tokenize && ch === 47) {
4037
+ return advanceSlash();
4038
+ }
4039
+
4040
+ return scanPunctuator();
4041
+ }
4042
+
4043
+ function lex() {
4044
+ var token;
4045
+
4046
+ token = lookahead;
4047
+ index = token.range[1];
4048
+ lineNumber = token.lineNumber;
4049
+ lineStart = token.lineStart;
4050
+
4051
+ lookahead = advance();
4052
+
4053
+ index = token.range[1];
4054
+ lineNumber = token.lineNumber;
4055
+ lineStart = token.lineStart;
4056
+
4057
+ return token;
4058
+ }
4059
+
4060
+ function peek() {
4061
+ var pos, line, start;
4062
+
4063
+ pos = index;
4064
+ line = lineNumber;
4065
+ start = lineStart;
4066
+ lookahead = advance();
4067
+ index = pos;
4068
+ lineNumber = line;
4069
+ lineStart = start;
4070
+ }
4071
+
4072
+ function lookahead2() {
4073
+ var adv, pos, line, start, result;
4074
+
4075
+ // If we are collecting the tokens, don't grab the next one yet.
4076
+ /* istanbul ignore next */
4077
+ adv = (typeof extra.advance === 'function') ? extra.advance : advance;
4078
+
4079
+ pos = index;
4080
+ line = lineNumber;
4081
+ start = lineStart;
4082
+
4083
+ // Scan for the next immediate token.
4084
+ /* istanbul ignore if */
4085
+ if (lookahead === null) {
4086
+ lookahead = adv();
4087
+ }
4088
+ index = lookahead.range[1];
4089
+ lineNumber = lookahead.lineNumber;
4090
+ lineStart = lookahead.lineStart;
4091
+
4092
+ // Grab the token right after.
4093
+ result = adv();
4094
+ index = pos;
4095
+ lineNumber = line;
4096
+ lineStart = start;
4097
+
4098
+ return result;
4099
+ }
4100
+
4101
+ function rewind(token) {
4102
+ index = token.range[0];
4103
+ lineNumber = token.lineNumber;
4104
+ lineStart = token.lineStart;
4105
+ lookahead = token;
4106
+ }
4107
+
4108
+ function markerCreate() {
4109
+ if (!extra.loc && !extra.range) {
4110
+ return undefined;
4111
+ }
4112
+ skipComment();
4113
+ return {offset: index, line: lineNumber, col: index - lineStart};
4114
+ }
4115
+
4116
+ function markerCreatePreserveWhitespace() {
4117
+ if (!extra.loc && !extra.range) {
4118
+ return undefined;
4119
+ }
4120
+ return {offset: index, line: lineNumber, col: index - lineStart};
4121
+ }
4122
+
4123
+ function processComment(node) {
4124
+ var lastChild,
4125
+ trailingComments,
4126
+ bottomRight = extra.bottomRightStack,
4127
+ last = bottomRight[bottomRight.length - 1];
4128
+
4129
+ if (node.type === Syntax.Program) {
4130
+ /* istanbul ignore else */
4131
+ if (node.body.length > 0) {
4132
+ return;
4133
+ }
4134
+ }
4135
+
4136
+ if (extra.trailingComments.length > 0) {
4137
+ if (extra.trailingComments[0].range[0] >= node.range[1]) {
4138
+ trailingComments = extra.trailingComments;
4139
+ extra.trailingComments = [];
4140
+ } else {
4141
+ extra.trailingComments.length = 0;
4142
+ }
4143
+ } else {
4144
+ if (last && last.trailingComments && last.trailingComments[0].range[0] >= node.range[1]) {
4145
+ trailingComments = last.trailingComments;
4146
+ delete last.trailingComments;
4147
+ }
4148
+ }
4149
+
4150
+ // Eating the stack.
4151
+ if (last) {
4152
+ while (last && last.range[0] >= node.range[0]) {
4153
+ lastChild = last;
4154
+ last = bottomRight.pop();
4155
+ }
4156
+ }
4157
+
4158
+ if (lastChild) {
4159
+ if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) {
4160
+ node.leadingComments = lastChild.leadingComments;
4161
+ delete lastChild.leadingComments;
4162
+ }
4163
+ } else if (extra.leadingComments.length > 0 && extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) {
4164
+ node.leadingComments = extra.leadingComments;
4165
+ extra.leadingComments = [];
4166
+ }
4167
+
4168
+ if (trailingComments) {
4169
+ node.trailingComments = trailingComments;
4170
+ }
4171
+
4172
+ bottomRight.push(node);
4173
+ }
4174
+
4175
+ function markerApply(marker, node) {
4176
+ if (extra.range) {
4177
+ node.range = [marker.offset, index];
4178
+ }
4179
+ if (extra.loc) {
4180
+ node.loc = {
4181
+ start: {
4182
+ line: marker.line,
4183
+ column: marker.col
4184
+ },
4185
+ end: {
4186
+ line: lineNumber,
4187
+ column: index - lineStart
4188
+ }
4189
+ };
4190
+ node = delegate.postProcess(node);
4191
+ }
4192
+ if (extra.attachComment) {
4193
+ processComment(node);
4194
+ }
4195
+ return node;
4196
+ }
4197
+
4198
+ SyntaxTreeDelegate = {
4199
+
4200
+ name: 'SyntaxTree',
4201
+
4202
+ postProcess: function (node) {
4203
+ return node;
4204
+ },
4205
+
4206
+ createArrayExpression: function (elements) {
4207
+ return {
4208
+ type: Syntax.ArrayExpression,
4209
+ elements: elements
4210
+ };
4211
+ },
4212
+
4213
+ createAssignmentExpression: function (operator, left, right) {
4214
+ return {
4215
+ type: Syntax.AssignmentExpression,
4216
+ operator: operator,
4217
+ left: left,
4218
+ right: right
4219
+ };
4220
+ },
4221
+
4222
+ createBinaryExpression: function (operator, left, right) {
4223
+ var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :
4224
+ Syntax.BinaryExpression;
4225
+ return {
4226
+ type: type,
4227
+ operator: operator,
4228
+ left: left,
4229
+ right: right
4230
+ };
4231
+ },
4232
+
4233
+ createBlockStatement: function (body) {
4234
+ return {
4235
+ type: Syntax.BlockStatement,
4236
+ body: body
4237
+ };
4238
+ },
4239
+
4240
+ createBreakStatement: function (label) {
4241
+ return {
4242
+ type: Syntax.BreakStatement,
4243
+ label: label
4244
+ };
4245
+ },
4246
+
4247
+ createCallExpression: function (callee, args) {
4248
+ return {
4249
+ type: Syntax.CallExpression,
4250
+ callee: callee,
4251
+ 'arguments': args
4252
+ };
4253
+ },
4254
+
4255
+ createCatchClause: function (param, body) {
4256
+ return {
4257
+ type: Syntax.CatchClause,
4258
+ param: param,
4259
+ body: body
4260
+ };
4261
+ },
4262
+
4263
+ createConditionalExpression: function (test, consequent, alternate) {
4264
+ return {
4265
+ type: Syntax.ConditionalExpression,
4266
+ test: test,
4267
+ consequent: consequent,
4268
+ alternate: alternate
4269
+ };
4270
+ },
4271
+
4272
+ createContinueStatement: function (label) {
4273
+ return {
4274
+ type: Syntax.ContinueStatement,
4275
+ label: label
4276
+ };
4277
+ },
4278
+
4279
+ createDebuggerStatement: function () {
4280
+ return {
4281
+ type: Syntax.DebuggerStatement
4282
+ };
4283
+ },
4284
+
4285
+ createDoWhileStatement: function (body, test) {
4286
+ return {
4287
+ type: Syntax.DoWhileStatement,
4288
+ body: body,
4289
+ test: test
4290
+ };
4291
+ },
4292
+
4293
+ createEmptyStatement: function () {
4294
+ return {
4295
+ type: Syntax.EmptyStatement
4296
+ };
4297
+ },
4298
+
4299
+ createExpressionStatement: function (expression) {
4300
+ return {
4301
+ type: Syntax.ExpressionStatement,
4302
+ expression: expression
4303
+ };
4304
+ },
4305
+
4306
+ createForStatement: function (init, test, update, body) {
4307
+ return {
4308
+ type: Syntax.ForStatement,
4309
+ init: init,
4310
+ test: test,
4311
+ update: update,
4312
+ body: body
4313
+ };
4314
+ },
4315
+
4316
+ createForInStatement: function (left, right, body) {
4317
+ return {
4318
+ type: Syntax.ForInStatement,
4319
+ left: left,
4320
+ right: right,
4321
+ body: body,
4322
+ each: false
4323
+ };
4324
+ },
4325
+
4326
+ createForOfStatement: function (left, right, body) {
4327
+ return {
4328
+ type: Syntax.ForOfStatement,
4329
+ left: left,
4330
+ right: right,
4331
+ body: body
4332
+ };
4333
+ },
4334
+
4335
+ createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,
4336
+ isAsync, returnType, typeParameters) {
4337
+ var funDecl = {
4338
+ type: Syntax.FunctionDeclaration,
4339
+ id: id,
4340
+ params: params,
4341
+ defaults: defaults,
4342
+ body: body,
4343
+ rest: rest,
4344
+ generator: generator,
4345
+ expression: expression,
4346
+ returnType: returnType,
4347
+ typeParameters: typeParameters
4348
+ };
4349
+
4350
+ if (isAsync) {
4351
+ funDecl.async = true;
4352
+ }
4353
+
4354
+ return funDecl;
4355
+ },
4356
+
4357
+ createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,
4358
+ isAsync, returnType, typeParameters) {
4359
+ var funExpr = {
4360
+ type: Syntax.FunctionExpression,
4361
+ id: id,
4362
+ params: params,
4363
+ defaults: defaults,
4364
+ body: body,
4365
+ rest: rest,
4366
+ generator: generator,
4367
+ expression: expression,
4368
+ returnType: returnType,
4369
+ typeParameters: typeParameters
4370
+ };
4371
+
4372
+ if (isAsync) {
4373
+ funExpr.async = true;
4374
+ }
4375
+
4376
+ return funExpr;
4377
+ },
4378
+
4379
+ createIdentifier: function (name) {
4380
+ return {
4381
+ type: Syntax.Identifier,
4382
+ name: name,
4383
+ // Only here to initialize the shape of the object to ensure
4384
+ // that the 'typeAnnotation' key is ordered before others that
4385
+ // are added later (like 'loc' and 'range'). This just helps
4386
+ // keep the shape of Identifier nodes consistent with everything
4387
+ // else.
4388
+ typeAnnotation: undefined,
4389
+ optional: undefined
4390
+ };
4391
+ },
4392
+
4393
+ createTypeAnnotation: function (typeAnnotation) {
4394
+ return {
4395
+ type: Syntax.TypeAnnotation,
4396
+ typeAnnotation: typeAnnotation
4397
+ };
4398
+ },
4399
+
4400
+ createTypeCast: function (expression, typeAnnotation) {
4401
+ return {
4402
+ type: Syntax.TypeCastExpression,
4403
+ expression: expression,
4404
+ typeAnnotation: typeAnnotation
4405
+ };
4406
+ },
4407
+
4408
+ createFunctionTypeAnnotation: function (params, returnType, rest, typeParameters) {
4409
+ return {
4410
+ type: Syntax.FunctionTypeAnnotation,
4411
+ params: params,
4412
+ returnType: returnType,
4413
+ rest: rest,
4414
+ typeParameters: typeParameters
4415
+ };
4416
+ },
4417
+
4418
+ createFunctionTypeParam: function (name, typeAnnotation, optional) {
4419
+ return {
4420
+ type: Syntax.FunctionTypeParam,
4421
+ name: name,
4422
+ typeAnnotation: typeAnnotation,
4423
+ optional: optional
4424
+ };
4425
+ },
4426
+
4427
+ createNullableTypeAnnotation: function (typeAnnotation) {
4428
+ return {
4429
+ type: Syntax.NullableTypeAnnotation,
4430
+ typeAnnotation: typeAnnotation
4431
+ };
4432
+ },
4433
+
4434
+ createArrayTypeAnnotation: function (elementType) {
4435
+ return {
4436
+ type: Syntax.ArrayTypeAnnotation,
4437
+ elementType: elementType
4438
+ };
4439
+ },
4440
+
4441
+ createGenericTypeAnnotation: function (id, typeParameters) {
4442
+ return {
4443
+ type: Syntax.GenericTypeAnnotation,
4444
+ id: id,
4445
+ typeParameters: typeParameters
4446
+ };
4447
+ },
4448
+
4449
+ createQualifiedTypeIdentifier: function (qualification, id) {
4450
+ return {
4451
+ type: Syntax.QualifiedTypeIdentifier,
4452
+ qualification: qualification,
4453
+ id: id
4454
+ };
4455
+ },
4456
+
4457
+ createTypeParameterDeclaration: function (params) {
4458
+ return {
4459
+ type: Syntax.TypeParameterDeclaration,
4460
+ params: params
4461
+ };
4462
+ },
4463
+
4464
+ createTypeParameterInstantiation: function (params) {
4465
+ return {
4466
+ type: Syntax.TypeParameterInstantiation,
4467
+ params: params
4468
+ };
4469
+ },
4470
+
4471
+ createAnyTypeAnnotation: function () {
4472
+ return {
4473
+ type: Syntax.AnyTypeAnnotation
4474
+ };
4475
+ },
4476
+
4477
+ createBooleanTypeAnnotation: function () {
4478
+ return {
4479
+ type: Syntax.BooleanTypeAnnotation
4480
+ };
4481
+ },
4482
+
4483
+ createNumberTypeAnnotation: function () {
4484
+ return {
4485
+ type: Syntax.NumberTypeAnnotation
4486
+ };
4487
+ },
4488
+
4489
+ createStringTypeAnnotation: function () {
4490
+ return {
4491
+ type: Syntax.StringTypeAnnotation
4492
+ };
4493
+ },
4494
+
4495
+ createStringLiteralTypeAnnotation: function (token) {
4496
+ return {
4497
+ type: Syntax.StringLiteralTypeAnnotation,
4498
+ value: token.value,
4499
+ raw: source.slice(token.range[0], token.range[1])
4500
+ };
4501
+ },
4502
+
4503
+ createVoidTypeAnnotation: function () {
4504
+ return {
4505
+ type: Syntax.VoidTypeAnnotation
4506
+ };
4507
+ },
4508
+
4509
+ createTypeofTypeAnnotation: function (argument) {
4510
+ return {
4511
+ type: Syntax.TypeofTypeAnnotation,
4512
+ argument: argument
4513
+ };
4514
+ },
4515
+
4516
+ createTupleTypeAnnotation: function (types) {
4517
+ return {
4518
+ type: Syntax.TupleTypeAnnotation,
4519
+ types: types
4520
+ };
4521
+ },
4522
+
4523
+ createObjectTypeAnnotation: function (properties, indexers, callProperties) {
4524
+ return {
4525
+ type: Syntax.ObjectTypeAnnotation,
4526
+ properties: properties,
4527
+ indexers: indexers,
4528
+ callProperties: callProperties
4529
+ };
4530
+ },
4531
+
4532
+ createObjectTypeIndexer: function (id, key, value, isStatic) {
4533
+ return {
4534
+ type: Syntax.ObjectTypeIndexer,
4535
+ id: id,
4536
+ key: key,
4537
+ value: value,
4538
+ "static": isStatic
4539
+ };
4540
+ },
4541
+
4542
+ createObjectTypeCallProperty: function (value, isStatic) {
4543
+ return {
4544
+ type: Syntax.ObjectTypeCallProperty,
4545
+ value: value,
4546
+ "static": isStatic
4547
+ };
4548
+ },
4549
+
4550
+ createObjectTypeProperty: function (key, value, optional, isStatic) {
4551
+ return {
4552
+ type: Syntax.ObjectTypeProperty,
4553
+ key: key,
4554
+ value: value,
4555
+ optional: optional,
4556
+ "static": isStatic
4557
+ };
4558
+ },
4559
+
4560
+ createUnionTypeAnnotation: function (types) {
4561
+ return {
4562
+ type: Syntax.UnionTypeAnnotation,
4563
+ types: types
4564
+ };
4565
+ },
4566
+
4567
+ createIntersectionTypeAnnotation: function (types) {
4568
+ return {
4569
+ type: Syntax.IntersectionTypeAnnotation,
4570
+ types: types
4571
+ };
4572
+ },
4573
+
4574
+ createTypeAlias: function (id, typeParameters, right) {
4575
+ return {
4576
+ type: Syntax.TypeAlias,
4577
+ id: id,
4578
+ typeParameters: typeParameters,
4579
+ right: right
4580
+ };
4581
+ },
4582
+
4583
+ createInterface: function (id, typeParameters, body, extended) {
4584
+ return {
4585
+ type: Syntax.InterfaceDeclaration,
4586
+ id: id,
4587
+ typeParameters: typeParameters,
4588
+ body: body,
4589
+ "extends": extended
4590
+ };
4591
+ },
4592
+
4593
+ createInterfaceExtends: function (id, typeParameters) {
4594
+ return {
4595
+ type: Syntax.InterfaceExtends,
4596
+ id: id,
4597
+ typeParameters: typeParameters
4598
+ };
4599
+ },
4600
+
4601
+ createDeclareFunction: function (id) {
4602
+ return {
4603
+ type: Syntax.DeclareFunction,
4604
+ id: id
4605
+ };
4606
+ },
4607
+
4608
+ createDeclareVariable: function (id) {
4609
+ return {
4610
+ type: Syntax.DeclareVariable,
4611
+ id: id
4612
+ };
4613
+ },
4614
+
4615
+ createDeclareModule: function (id, body) {
4616
+ return {
4617
+ type: Syntax.DeclareModule,
4618
+ id: id,
4619
+ body: body
4620
+ };
4621
+ },
4622
+
4623
+ createJSXAttribute: function (name, value) {
4624
+ return {
4625
+ type: Syntax.JSXAttribute,
4626
+ name: name,
4627
+ value: value || null
4628
+ };
4629
+ },
4630
+
4631
+ createJSXSpreadAttribute: function (argument) {
4632
+ return {
4633
+ type: Syntax.JSXSpreadAttribute,
4634
+ argument: argument
4635
+ };
4636
+ },
4637
+
4638
+ createJSXIdentifier: function (name) {
4639
+ return {
4640
+ type: Syntax.JSXIdentifier,
4641
+ name: name
4642
+ };
4643
+ },
4644
+
4645
+ createJSXNamespacedName: function (namespace, name) {
4646
+ return {
4647
+ type: Syntax.JSXNamespacedName,
4648
+ namespace: namespace,
4649
+ name: name
4650
+ };
4651
+ },
4652
+
4653
+ createJSXMemberExpression: function (object, property) {
4654
+ return {
4655
+ type: Syntax.JSXMemberExpression,
4656
+ object: object,
4657
+ property: property
4658
+ };
4659
+ },
4660
+
4661
+ createJSXElement: function (openingElement, closingElement, children) {
4662
+ return {
4663
+ type: Syntax.JSXElement,
4664
+ openingElement: openingElement,
4665
+ closingElement: closingElement,
4666
+ children: children
4667
+ };
4668
+ },
4669
+
4670
+ createJSXEmptyExpression: function () {
4671
+ return {
4672
+ type: Syntax.JSXEmptyExpression
4673
+ };
4674
+ },
4675
+
4676
+ createJSXExpressionContainer: function (expression) {
4677
+ return {
4678
+ type: Syntax.JSXExpressionContainer,
4679
+ expression: expression
4680
+ };
4681
+ },
4682
+
4683
+ createJSXOpeningElement: function (name, attributes, selfClosing) {
4684
+ return {
4685
+ type: Syntax.JSXOpeningElement,
4686
+ name: name,
4687
+ selfClosing: selfClosing,
4688
+ attributes: attributes
4689
+ };
4690
+ },
4691
+
4692
+ createJSXClosingElement: function (name) {
4693
+ return {
4694
+ type: Syntax.JSXClosingElement,
4695
+ name: name
4696
+ };
4697
+ },
4698
+
4699
+ createIfStatement: function (test, consequent, alternate) {
4700
+ return {
4701
+ type: Syntax.IfStatement,
4702
+ test: test,
4703
+ consequent: consequent,
4704
+ alternate: alternate
4705
+ };
4706
+ },
4707
+
4708
+ createLabeledStatement: function (label, body) {
4709
+ return {
4710
+ type: Syntax.LabeledStatement,
4711
+ label: label,
4712
+ body: body
4713
+ };
4714
+ },
4715
+
4716
+ createLiteral: function (token) {
4717
+ var object = {
4718
+ type: Syntax.Literal,
4719
+ value: token.value,
4720
+ raw: source.slice(token.range[0], token.range[1])
4721
+ };
4722
+ if (token.regex) {
4723
+ object.regex = token.regex;
4724
+ }
4725
+ return object;
4726
+ },
4727
+
4728
+ createMemberExpression: function (accessor, object, property) {
4729
+ return {
4730
+ type: Syntax.MemberExpression,
4731
+ computed: accessor === '[',
4732
+ object: object,
4733
+ property: property
4734
+ };
4735
+ },
4736
+
4737
+ createNewExpression: function (callee, args) {
4738
+ return {
4739
+ type: Syntax.NewExpression,
4740
+ callee: callee,
4741
+ 'arguments': args
4742
+ };
4743
+ },
4744
+
4745
+ createObjectExpression: function (properties) {
4746
+ return {
4747
+ type: Syntax.ObjectExpression,
4748
+ properties: properties
4749
+ };
4750
+ },
4751
+
4752
+ createPostfixExpression: function (operator, argument) {
4753
+ return {
4754
+ type: Syntax.UpdateExpression,
4755
+ operator: operator,
4756
+ argument: argument,
4757
+ prefix: false
4758
+ };
4759
+ },
4760
+
4761
+ createProgram: function (body) {
4762
+ return {
4763
+ type: Syntax.Program,
4764
+ body: body
4765
+ };
4766
+ },
4767
+
4768
+ createProperty: function (kind, key, value, method, shorthand, computed) {
4769
+ return {
4770
+ type: Syntax.Property,
4771
+ key: key,
4772
+ value: value,
4773
+ kind: kind,
4774
+ method: method,
4775
+ shorthand: shorthand,
4776
+ computed: computed
4777
+ };
4778
+ },
4779
+
4780
+ createReturnStatement: function (argument) {
4781
+ return {
4782
+ type: Syntax.ReturnStatement,
4783
+ argument: argument
4784
+ };
4785
+ },
4786
+
4787
+ createSequenceExpression: function (expressions) {
4788
+ return {
4789
+ type: Syntax.SequenceExpression,
4790
+ expressions: expressions
4791
+ };
4792
+ },
4793
+
4794
+ createSwitchCase: function (test, consequent) {
4795
+ return {
4796
+ type: Syntax.SwitchCase,
4797
+ test: test,
4798
+ consequent: consequent
4799
+ };
4800
+ },
4801
+
4802
+ createSwitchStatement: function (discriminant, cases) {
4803
+ return {
4804
+ type: Syntax.SwitchStatement,
4805
+ discriminant: discriminant,
4806
+ cases: cases
4807
+ };
4808
+ },
4809
+
4810
+ createThisExpression: function () {
4811
+ return {
4812
+ type: Syntax.ThisExpression
4813
+ };
4814
+ },
4815
+
4816
+ createThrowStatement: function (argument) {
4817
+ return {
4818
+ type: Syntax.ThrowStatement,
4819
+ argument: argument
4820
+ };
4821
+ },
4822
+
4823
+ createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
4824
+ return {
4825
+ type: Syntax.TryStatement,
4826
+ block: block,
4827
+ guardedHandlers: guardedHandlers,
4828
+ handlers: handlers,
4829
+ finalizer: finalizer
4830
+ };
4831
+ },
4832
+
4833
+ createUnaryExpression: function (operator, argument) {
4834
+ if (operator === '++' || operator === '--') {
4835
+ return {
4836
+ type: Syntax.UpdateExpression,
4837
+ operator: operator,
4838
+ argument: argument,
4839
+ prefix: true
4840
+ };
4841
+ }
4842
+ return {
4843
+ type: Syntax.UnaryExpression,
4844
+ operator: operator,
4845
+ argument: argument,
4846
+ prefix: true
4847
+ };
4848
+ },
4849
+
4850
+ createVariableDeclaration: function (declarations, kind) {
4851
+ return {
4852
+ type: Syntax.VariableDeclaration,
4853
+ declarations: declarations,
4854
+ kind: kind
4855
+ };
4856
+ },
4857
+
4858
+ createVariableDeclarator: function (id, init) {
4859
+ return {
4860
+ type: Syntax.VariableDeclarator,
4861
+ id: id,
4862
+ init: init
4863
+ };
4864
+ },
4865
+
4866
+ createWhileStatement: function (test, body) {
4867
+ return {
4868
+ type: Syntax.WhileStatement,
4869
+ test: test,
4870
+ body: body
4871
+ };
4872
+ },
4873
+
4874
+ createWithStatement: function (object, body) {
4875
+ return {
4876
+ type: Syntax.WithStatement,
4877
+ object: object,
4878
+ body: body
4879
+ };
4880
+ },
4881
+
4882
+ createTemplateElement: function (value, tail) {
4883
+ return {
4884
+ type: Syntax.TemplateElement,
4885
+ value: value,
4886
+ tail: tail
4887
+ };
4888
+ },
4889
+
4890
+ createTemplateLiteral: function (quasis, expressions) {
4891
+ return {
4892
+ type: Syntax.TemplateLiteral,
4893
+ quasis: quasis,
4894
+ expressions: expressions
4895
+ };
4896
+ },
4897
+
4898
+ createSpreadElement: function (argument) {
4899
+ return {
4900
+ type: Syntax.SpreadElement,
4901
+ argument: argument
4902
+ };
4903
+ },
4904
+
4905
+ createSpreadProperty: function (argument) {
4906
+ return {
4907
+ type: Syntax.SpreadProperty,
4908
+ argument: argument
4909
+ };
4910
+ },
4911
+
4912
+ createTaggedTemplateExpression: function (tag, quasi) {
4913
+ return {
4914
+ type: Syntax.TaggedTemplateExpression,
4915
+ tag: tag,
4916
+ quasi: quasi
4917
+ };
4918
+ },
4919
+
4920
+ createArrowFunctionExpression: function (params, defaults, body, rest, expression, isAsync) {
4921
+ var arrowExpr = {
4922
+ type: Syntax.ArrowFunctionExpression,
4923
+ id: null,
4924
+ params: params,
4925
+ defaults: defaults,
4926
+ body: body,
4927
+ rest: rest,
4928
+ generator: false,
4929
+ expression: expression
4930
+ };
4931
+
4932
+ if (isAsync) {
4933
+ arrowExpr.async = true;
4934
+ }
4935
+
4936
+ return arrowExpr;
4937
+ },
4938
+
4939
+ createMethodDefinition: function (propertyType, kind, key, value, computed) {
4940
+ return {
4941
+ type: Syntax.MethodDefinition,
4942
+ key: key,
4943
+ value: value,
4944
+ kind: kind,
4945
+ 'static': propertyType === ClassPropertyType["static"],
4946
+ computed: computed
4947
+ };
4948
+ },
4949
+
4950
+ createClassProperty: function (key, typeAnnotation, computed, isStatic) {
4951
+ return {
4952
+ type: Syntax.ClassProperty,
4953
+ key: key,
4954
+ typeAnnotation: typeAnnotation,
4955
+ computed: computed,
4956
+ "static": isStatic
4957
+ };
4958
+ },
4959
+
4960
+ createClassBody: function (body) {
4961
+ return {
4962
+ type: Syntax.ClassBody,
4963
+ body: body
4964
+ };
4965
+ },
4966
+
4967
+ createClassImplements: function (id, typeParameters) {
4968
+ return {
4969
+ type: Syntax.ClassImplements,
4970
+ id: id,
4971
+ typeParameters: typeParameters
4972
+ };
4973
+ },
4974
+
4975
+ createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
4976
+ return {
4977
+ type: Syntax.ClassExpression,
4978
+ id: id,
4979
+ superClass: superClass,
4980
+ body: body,
4981
+ typeParameters: typeParameters,
4982
+ superTypeParameters: superTypeParameters,
4983
+ "implements": implemented
4984
+ };
4985
+ },
4986
+
4987
+ createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
4988
+ return {
4989
+ type: Syntax.ClassDeclaration,
4990
+ id: id,
4991
+ superClass: superClass,
4992
+ body: body,
4993
+ typeParameters: typeParameters,
4994
+ superTypeParameters: superTypeParameters,
4995
+ "implements": implemented
4996
+ };
4997
+ },
4998
+
4999
+ createModuleSpecifier: function (token) {
This file is too large to show in full.
docs/js/react.js
new
+19541
@@ -0,0 +1,19541 @@
1
+/**
2
+ * React v0.13.1
3
+ */
4
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5
+/**
6
+ * Copyright 2013-2015, Facebook, Inc.
7
+ * All rights reserved.
8
+ *
9
+ * This source code is licensed under the BSD-style license found in the
10
+ * LICENSE file in the root directory of this source tree. An additional grant
11
+ * of patent rights can be found in the PATENTS file in the same directory.
12
+ *
13
+ * @providesModule React
14
+ */
15
+
16
+/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
17
+
18
+'use strict';
19
+
20
+var EventPluginUtils = _dereq_(19);
21
+var ReactChildren = _dereq_(32);
22
+var ReactComponent = _dereq_(34);
23
+var ReactClass = _dereq_(33);
24
+var ReactContext = _dereq_(38);
25
+var ReactCurrentOwner = _dereq_(39);
26
+var ReactElement = _dereq_(57);
27
+var ReactElementValidator = _dereq_(58);
28
+var ReactDOM = _dereq_(40);
29
+var ReactDOMTextComponent = _dereq_(51);
30
+var ReactDefaultInjection = _dereq_(54);
31
+var ReactInstanceHandles = _dereq_(66);
32
+var ReactMount = _dereq_(70);
33
+var ReactPerf = _dereq_(75);
34
+var ReactPropTypes = _dereq_(78);
35
+var ReactReconciler = _dereq_(81);
36
+var ReactServerRendering = _dereq_(84);
37
+
38
+var assign = _dereq_(27);
39
+var findDOMNode = _dereq_(117);
40
+var onlyChild = _dereq_(144);
41
+
42
+ReactDefaultInjection.inject();
43
+
44
+var createElement = ReactElement.createElement;
45
+var createFactory = ReactElement.createFactory;
46
+var cloneElement = ReactElement.cloneElement;
47
+
48
+if ("production" !== "development") {
49
+ createElement = ReactElementValidator.createElement;
50
+ createFactory = ReactElementValidator.createFactory;
51
+ cloneElement = ReactElementValidator.cloneElement;
52
+}
53
+
54
+var render = ReactPerf.measure('React', 'render', ReactMount.render);
55
+
56
+var React = {
57
+ Children: {
58
+ map: ReactChildren.map,
59
+ forEach: ReactChildren.forEach,
60
+ count: ReactChildren.count,
61
+ only: onlyChild
62
+ },
63
+ Component: ReactComponent,
64
+ DOM: ReactDOM,
65
+ PropTypes: ReactPropTypes,
66
+ initializeTouchEvents: function(shouldUseTouch) {
67
+ EventPluginUtils.useTouchEvents = shouldUseTouch;
68
+ },
69
+ createClass: ReactClass.createClass,
70
+ createElement: createElement,
71
+ cloneElement: cloneElement,
72
+ createFactory: createFactory,
73
+ createMixin: function(mixin) {
74
+ // Currently a noop. Will be used to validate and trace mixins.
75
+ return mixin;
76
+ },
77
+ constructAndRenderComponent: ReactMount.constructAndRenderComponent,
78
+ constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
79
+ findDOMNode: findDOMNode,
80
+ render: render,
81
+ renderToString: ReactServerRendering.renderToString,
82
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
83
+ unmountComponentAtNode: ReactMount.unmountComponentAtNode,
84
+ isValidElement: ReactElement.isValidElement,
85
+ withContext: ReactContext.withContext,
86
+
87
+ // Hook for JSX spread, don't use this for anything else.
88
+ __spread: assign
89
+};
90
+
91
+// Inject the runtime into a devtools global hook regardless of browser.
92
+// Allows for debugging when the hook is injected on the page.
93
+if (
94
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
95
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
96
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
97
+ CurrentOwner: ReactCurrentOwner,
98
+ InstanceHandles: ReactInstanceHandles,
99
+ Mount: ReactMount,
100
+ Reconciler: ReactReconciler,
101
+ TextComponent: ReactDOMTextComponent
102
+ });
103
+}
104
+
105
+if ("production" !== "development") {
106
+ var ExecutionEnvironment = _dereq_(21);
107
+ if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
108
+
109
+ // If we're in Chrome, look for the devtools marker and provide a download
110
+ // link if not installed.
111
+ if (navigator.userAgent.indexOf('Chrome') > -1) {
112
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
113
+ console.debug(
114
+ 'Download the React DevTools for a better development experience: ' +
115
+ 'http://fb.me/react-devtools'
116
+ );
117
+ }
118
+ }
119
+
120
+ var expectedFeatures = [
121
+ // shims
122
+ Array.isArray,
123
+ Array.prototype.every,
124
+ Array.prototype.forEach,
125
+ Array.prototype.indexOf,
126
+ Array.prototype.map,
127
+ Date.now,
128
+ Function.prototype.bind,
129
+ Object.keys,
130
+ String.prototype.split,
131
+ String.prototype.trim,
132
+
133
+ // shams
134
+ Object.create,
135
+ Object.freeze
136
+ ];
137
+
138
+ for (var i = 0; i < expectedFeatures.length; i++) {
139
+ if (!expectedFeatures[i]) {
140
+ console.error(
141
+ 'One or more ES5 shim/shams expected by React are not available: ' +
142
+ 'http://fb.me/react-warning-polyfills'
143
+ );
144
+ break;
145
+ }
146
+ }
147
+ }
148
+}
149
+
150
+React.version = '0.13.1';
151
+
152
+module.exports = React;
153
+
154
+},{"117":117,"144":144,"19":19,"21":21,"27":27,"32":32,"33":33,"34":34,"38":38,"39":39,"40":40,"51":51,"54":54,"57":57,"58":58,"66":66,"70":70,"75":75,"78":78,"81":81,"84":84}],2:[function(_dereq_,module,exports){
155
+/**
156
+ * Copyright 2013-2015, Facebook, Inc.
157
+ * All rights reserved.
158
+ *
159
+ * This source code is licensed under the BSD-style license found in the
160
+ * LICENSE file in the root directory of this source tree. An additional grant
161
+ * of patent rights can be found in the PATENTS file in the same directory.
162
+ *
163
+ * @providesModule AutoFocusMixin
164
+ * @typechecks static-only
165
+ */
166
+
167
+'use strict';
168
+
169
+var focusNode = _dereq_(119);
170
+
171
+var AutoFocusMixin = {
172
+ componentDidMount: function() {
173
+ if (this.props.autoFocus) {
174
+ focusNode(this.getDOMNode());
175
+ }
176
+ }
177
+};
178
+
179
+module.exports = AutoFocusMixin;
180
+
181
+},{"119":119}],3:[function(_dereq_,module,exports){
182
+/**
183
+ * Copyright 2013-2015 Facebook, Inc.
184
+ * All rights reserved.
185
+ *
186
+ * This source code is licensed under the BSD-style license found in the
187
+ * LICENSE file in the root directory of this source tree. An additional grant
188
+ * of patent rights can be found in the PATENTS file in the same directory.
189
+ *
190
+ * @providesModule BeforeInputEventPlugin
191
+ * @typechecks static-only
192
+ */
193
+
194
+'use strict';
195
+
196
+var EventConstants = _dereq_(15);
197
+var EventPropagators = _dereq_(20);
198
+var ExecutionEnvironment = _dereq_(21);
199
+var FallbackCompositionState = _dereq_(22);
200
+var SyntheticCompositionEvent = _dereq_(93);
201
+var SyntheticInputEvent = _dereq_(97);
202
+
203
+var keyOf = _dereq_(141);
204
+
205
+var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
206
+var START_KEYCODE = 229;
207
+
208
+var canUseCompositionEvent = (
209
+ ExecutionEnvironment.canUseDOM &&
210
+ 'CompositionEvent' in window
211
+);
212
+
213
+var documentMode = null;
214
+if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
215
+ documentMode = document.documentMode;
216
+}
217
+
218
+// Webkit offers a very useful `textInput` event that can be used to
219
+// directly represent `beforeInput`. The IE `textinput` event is not as
220
+// useful, so we don't use it.
221
+var canUseTextInputEvent = (
222
+ ExecutionEnvironment.canUseDOM &&
223
+ 'TextEvent' in window &&
224
+ !documentMode &&
225
+ !isPresto()
226
+);
227
+
228
+// In IE9+, we have access to composition events, but the data supplied
229
+// by the native compositionend event may be incorrect. Japanese ideographic
230
+// spaces, for instance (\u3000) are not recorded correctly.
231
+var useFallbackCompositionData = (
232
+ ExecutionEnvironment.canUseDOM &&
233
+ (
234
+ (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
235
+ )
236
+);
237
+
238
+/**
239
+ * Opera <= 12 includes TextEvent in window, but does not fire
240
+ * text input events. Rely on keypress instead.
241
+ */
242
+function isPresto() {
243
+ var opera = window.opera;
244
+ return (
245
+ typeof opera === 'object' &&
246
+ typeof opera.version === 'function' &&
247
+ parseInt(opera.version(), 10) <= 12
248
+ );
249
+}
250
+
251
+var SPACEBAR_CODE = 32;
252
+var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
253
+
254
+var topLevelTypes = EventConstants.topLevelTypes;
255
+
256
+// Events and their corresponding property names.
257
+var eventTypes = {
258
+ beforeInput: {
259
+ phasedRegistrationNames: {
260
+ bubbled: keyOf({onBeforeInput: null}),
261
+ captured: keyOf({onBeforeInputCapture: null})
262
+ },
263
+ dependencies: [
264
+ topLevelTypes.topCompositionEnd,
265
+ topLevelTypes.topKeyPress,
266
+ topLevelTypes.topTextInput,
267
+ topLevelTypes.topPaste
268
+ ]
269
+ },
270
+ compositionEnd: {
271
+ phasedRegistrationNames: {
272
+ bubbled: keyOf({onCompositionEnd: null}),
273
+ captured: keyOf({onCompositionEndCapture: null})
274
+ },
275
+ dependencies: [
276
+ topLevelTypes.topBlur,
277
+ topLevelTypes.topCompositionEnd,
278
+ topLevelTypes.topKeyDown,
279
+ topLevelTypes.topKeyPress,
280
+ topLevelTypes.topKeyUp,
281
+ topLevelTypes.topMouseDown
282
+ ]
283
+ },
284
+ compositionStart: {
285
+ phasedRegistrationNames: {
286
+ bubbled: keyOf({onCompositionStart: null}),
287
+ captured: keyOf({onCompositionStartCapture: null})
288
+ },
289
+ dependencies: [
290
+ topLevelTypes.topBlur,
291
+ topLevelTypes.topCompositionStart,
292
+ topLevelTypes.topKeyDown,
293
+ topLevelTypes.topKeyPress,
294
+ topLevelTypes.topKeyUp,
295
+ topLevelTypes.topMouseDown
296
+ ]
297
+ },
298
+ compositionUpdate: {
299
+ phasedRegistrationNames: {
300
+ bubbled: keyOf({onCompositionUpdate: null}),
301
+ captured: keyOf({onCompositionUpdateCapture: null})
302
+ },
303
+ dependencies: [
304
+ topLevelTypes.topBlur,
305
+ topLevelTypes.topCompositionUpdate,
306
+ topLevelTypes.topKeyDown,
307
+ topLevelTypes.topKeyPress,
308
+ topLevelTypes.topKeyUp,
309
+ topLevelTypes.topMouseDown
310
+ ]
311
+ }
312
+};
313
+
314
+// Track whether we've ever handled a keypress on the space key.
315
+var hasSpaceKeypress = false;
316
+
317
+/**
318
+ * Return whether a native keypress event is assumed to be a command.
319
+ * This is required because Firefox fires `keypress` events for key commands
320
+ * (cut, copy, select-all, etc.) even though no character is inserted.
321
+ */
322
+function isKeypressCommand(nativeEvent) {
323
+ return (
324
+ (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
325
+ // ctrlKey && altKey is equivalent to AltGr, and is not a command.
326
+ !(nativeEvent.ctrlKey && nativeEvent.altKey)
327
+ );
328
+}
329
+
330
+
331
+/**
332
+ * Translate native top level events into event types.
333
+ *
334
+ * @param {string} topLevelType
335
+ * @return {object}
336
+ */
337
+function getCompositionEventType(topLevelType) {
338
+ switch (topLevelType) {
339
+ case topLevelTypes.topCompositionStart:
340
+ return eventTypes.compositionStart;
341
+ case topLevelTypes.topCompositionEnd:
342
+ return eventTypes.compositionEnd;
343
+ case topLevelTypes.topCompositionUpdate:
344
+ return eventTypes.compositionUpdate;
345
+ }
346
+}
347
+
348
+/**
349
+ * Does our fallback best-guess model think this event signifies that
350
+ * composition has begun?
351
+ *
352
+ * @param {string} topLevelType
353
+ * @param {object} nativeEvent
354
+ * @return {boolean}
355
+ */
356
+function isFallbackCompositionStart(topLevelType, nativeEvent) {
357
+ return (
358
+ topLevelType === topLevelTypes.topKeyDown &&
359
+ nativeEvent.keyCode === START_KEYCODE
360
+ );
361
+}
362
+
363
+/**
364
+ * Does our fallback mode think that this event is the end of composition?
365
+ *
366
+ * @param {string} topLevelType
367
+ * @param {object} nativeEvent
368
+ * @return {boolean}
369
+ */
370
+function isFallbackCompositionEnd(topLevelType, nativeEvent) {
371
+ switch (topLevelType) {
372
+ case topLevelTypes.topKeyUp:
373
+ // Command keys insert or clear IME input.
374
+ return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
375
+ case topLevelTypes.topKeyDown:
376
+ // Expect IME keyCode on each keydown. If we get any other
377
+ // code we must have exited earlier.
378
+ return (nativeEvent.keyCode !== START_KEYCODE);
379
+ case topLevelTypes.topKeyPress:
380
+ case topLevelTypes.topMouseDown:
381
+ case topLevelTypes.topBlur:
382
+ // Events are not possible without cancelling IME.
383
+ return true;
384
+ default:
385
+ return false;
386
+ }
387
+}
388
+
389
+/**
390
+ * Google Input Tools provides composition data via a CustomEvent,
391
+ * with the `data` property populated in the `detail` object. If this
392
+ * is available on the event object, use it. If not, this is a plain
393
+ * composition event and we have nothing special to extract.
394
+ *
395
+ * @param {object} nativeEvent
396
+ * @return {?string}
397
+ */
398
+function getDataFromCustomEvent(nativeEvent) {
399
+ var detail = nativeEvent.detail;
400
+ if (typeof detail === 'object' && 'data' in detail) {
401
+ return detail.data;
402
+ }
403
+ return null;
404
+}
405
+
406
+// Track the current IME composition fallback object, if any.
407
+var currentComposition = null;
408
+
409
+/**
410
+ * @param {string} topLevelType Record from `EventConstants`.
411
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
412
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
413
+ * @param {object} nativeEvent Native browser event.
414
+ * @return {?object} A SyntheticCompositionEvent.
415
+ */
416
+function extractCompositionEvent(
417
+ topLevelType,
418
+ topLevelTarget,
419
+ topLevelTargetID,
420
+ nativeEvent
421
+) {
422
+ var eventType;
423
+ var fallbackData;
424
+
425
+ if (canUseCompositionEvent) {
426
+ eventType = getCompositionEventType(topLevelType);
427
+ } else if (!currentComposition) {
428
+ if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
429
+ eventType = eventTypes.compositionStart;
430
+ }
431
+ } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
432
+ eventType = eventTypes.compositionEnd;
433
+ }
434
+
435
+ if (!eventType) {
436
+ return null;
437
+ }
438
+
439
+ if (useFallbackCompositionData) {
440
+ // The current composition is stored statically and must not be
441
+ // overwritten while composition continues.
442
+ if (!currentComposition && eventType === eventTypes.compositionStart) {
443
+ currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
444
+ } else if (eventType === eventTypes.compositionEnd) {
445
+ if (currentComposition) {
446
+ fallbackData = currentComposition.getData();
447
+ }
448
+ }
449
+ }
450
+
451
+ var event = SyntheticCompositionEvent.getPooled(
452
+ eventType,
453
+ topLevelTargetID,
454
+ nativeEvent
455
+ );
456
+
457
+ if (fallbackData) {
458
+ // Inject data generated from fallback path into the synthetic event.
459
+ // This matches the property of native CompositionEventInterface.
460
+ event.data = fallbackData;
461
+ } else {
462
+ var customData = getDataFromCustomEvent(nativeEvent);
463
+ if (customData !== null) {
464
+ event.data = customData;
465
+ }
466
+ }
467
+
468
+ EventPropagators.accumulateTwoPhaseDispatches(event);
469
+ return event;
470
+}
471
+
472
+/**
473
+ * @param {string} topLevelType Record from `EventConstants`.
474
+ * @param {object} nativeEvent Native browser event.
475
+ * @return {?string} The string corresponding to this `beforeInput` event.
476
+ */
477
+function getNativeBeforeInputChars(topLevelType, nativeEvent) {
478
+ switch (topLevelType) {
479
+ case topLevelTypes.topCompositionEnd:
480
+ return getDataFromCustomEvent(nativeEvent);
481
+ case topLevelTypes.topKeyPress:
482
+ /**
483
+ * If native `textInput` events are available, our goal is to make
484
+ * use of them. However, there is a special case: the spacebar key.
485
+ * In Webkit, preventing default on a spacebar `textInput` event
486
+ * cancels character insertion, but it *also* causes the browser
487
+ * to fall back to its default spacebar behavior of scrolling the
488
+ * page.
489
+ *
490
+ * Tracking at:
491
+ * https://code.google.com/p/chromium/issues/detail?id=355103
492
+ *
493
+ * To avoid this issue, use the keypress event as if no `textInput`
494
+ * event is available.
495
+ */
496
+ var which = nativeEvent.which;
497
+ if (which !== SPACEBAR_CODE) {
498
+ return null;
499
+ }
500
+
501
+ hasSpaceKeypress = true;
502
+ return SPACEBAR_CHAR;
503
+
504
+ case topLevelTypes.topTextInput:
505
+ // Record the characters to be added to the DOM.
506
+ var chars = nativeEvent.data;
507
+
508
+ // If it's a spacebar character, assume that we have already handled
509
+ // it at the keypress level and bail immediately. Android Chrome
510
+ // doesn't give us keycodes, so we need to blacklist it.
511
+ if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
512
+ return null;
513
+ }
514
+
515
+ return chars;
516
+
517
+ default:
518
+ // For other native event types, do nothing.
519
+ return null;
520
+ }
521
+}
522
+
523
+/**
524
+ * For browsers that do not provide the `textInput` event, extract the
525
+ * appropriate string to use for SyntheticInputEvent.
526
+ *
527
+ * @param {string} topLevelType Record from `EventConstants`.
528
+ * @param {object} nativeEvent Native browser event.
529
+ * @return {?string} The fallback string for this `beforeInput` event.
530
+ */
531
+function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
532
+ // If we are currently composing (IME) and using a fallback to do so,
533
+ // try to extract the composed characters from the fallback object.
534
+ if (currentComposition) {
535
+ if (
536
+ topLevelType === topLevelTypes.topCompositionEnd ||
537
+ isFallbackCompositionEnd(topLevelType, nativeEvent)
538
+ ) {
539
+ var chars = currentComposition.getData();
540
+ FallbackCompositionState.release(currentComposition);
541
+ currentComposition = null;
542
+ return chars;
543
+ }
544
+ return null;
545
+ }
546
+
547
+ switch (topLevelType) {
548
+ case topLevelTypes.topPaste:
549
+ // If a paste event occurs after a keypress, throw out the input
550
+ // chars. Paste events should not lead to BeforeInput events.
551
+ return null;
552
+ case topLevelTypes.topKeyPress:
553
+ /**
554
+ * As of v27, Firefox may fire keypress events even when no character
555
+ * will be inserted. A few possibilities:
556
+ *
557
+ * - `which` is `0`. Arrow keys, Esc key, etc.
558
+ *
559
+ * - `which` is the pressed key code, but no char is available.
560
+ * Ex: 'AltGr + d` in Polish. There is no modified character for
561
+ * this key combination and no character is inserted into the
562
+ * document, but FF fires the keypress for char code `100` anyway.
563
+ * No `input` event will occur.
564
+ *
565
+ * - `which` is the pressed key code, but a command combination is
566
+ * being used. Ex: `Cmd+C`. No character is inserted, and no
567
+ * `input` event will occur.
568
+ */
569
+ if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
570
+ return String.fromCharCode(nativeEvent.which);
571
+ }
572
+ return null;
573
+ case topLevelTypes.topCompositionEnd:
574
+ return useFallbackCompositionData ? null : nativeEvent.data;
575
+ default:
576
+ return null;
577
+ }
578
+}
579
+
580
+/**
581
+ * Extract a SyntheticInputEvent for `beforeInput`, based on either native
582
+ * `textInput` or fallback behavior.
583
+ *
584
+ * @param {string} topLevelType Record from `EventConstants`.
585
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
586
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
587
+ * @param {object} nativeEvent Native browser event.
588
+ * @return {?object} A SyntheticInputEvent.
589
+ */
590
+function extractBeforeInputEvent(
591
+ topLevelType,
592
+ topLevelTarget,
593
+ topLevelTargetID,
594
+ nativeEvent
595
+) {
596
+ var chars;
597
+
598
+ if (canUseTextInputEvent) {
599
+ chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
600
+ } else {
601
+ chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
602
+ }
603
+
604
+ // If no characters are being inserted, no BeforeInput event should
605
+ // be fired.
606
+ if (!chars) {
607
+ return null;
608
+ }
609
+
610
+ var event = SyntheticInputEvent.getPooled(
611
+ eventTypes.beforeInput,
612
+ topLevelTargetID,
613
+ nativeEvent
614
+ );
615
+
616
+ event.data = chars;
617
+ EventPropagators.accumulateTwoPhaseDispatches(event);
618
+ return event;
619
+}
620
+
621
+/**
622
+ * Create an `onBeforeInput` event to match
623
+ * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
624
+ *
625
+ * This event plugin is based on the native `textInput` event
626
+ * available in Chrome, Safari, Opera, and IE. This event fires after
627
+ * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
628
+ *
629
+ * `beforeInput` is spec'd but not implemented in any browsers, and
630
+ * the `input` event does not provide any useful information about what has
631
+ * actually been added, contrary to the spec. Thus, `textInput` is the best
632
+ * available event to identify the characters that have actually been inserted
633
+ * into the target node.
634
+ *
635
+ * This plugin is also responsible for emitting `composition` events, thus
636
+ * allowing us to share composition fallback code for both `beforeInput` and
637
+ * `composition` event types.
638
+ */
639
+var BeforeInputEventPlugin = {
640
+
641
+ eventTypes: eventTypes,
642
+
643
+ /**
644
+ * @param {string} topLevelType Record from `EventConstants`.
645
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
646
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
647
+ * @param {object} nativeEvent Native browser event.
648
+ * @return {*} An accumulation of synthetic events.
649
+ * @see {EventPluginHub.extractEvents}
650
+ */
651
+ extractEvents: function(
652
+ topLevelType,
653
+ topLevelTarget,
654
+ topLevelTargetID,
655
+ nativeEvent
656
+ ) {
657
+ return [
658
+ extractCompositionEvent(
659
+ topLevelType,
660
+ topLevelTarget,
661
+ topLevelTargetID,
662
+ nativeEvent
663
+ ),
664
+ extractBeforeInputEvent(
665
+ topLevelType,
666
+ topLevelTarget,
667
+ topLevelTargetID,
668
+ nativeEvent
669
+ )
670
+ ];
671
+ }
672
+};
673
+
674
+module.exports = BeforeInputEventPlugin;
675
+
676
+},{"141":141,"15":15,"20":20,"21":21,"22":22,"93":93,"97":97}],4:[function(_dereq_,module,exports){
677
+/**
678
+ * Copyright 2013-2015, Facebook, Inc.
679
+ * All rights reserved.
680
+ *
681
+ * This source code is licensed under the BSD-style license found in the
682
+ * LICENSE file in the root directory of this source tree. An additional grant
683
+ * of patent rights can be found in the PATENTS file in the same directory.
684
+ *
685
+ * @providesModule CSSProperty
686
+ */
687
+
688
+'use strict';
689
+
690
+/**
691
+ * CSS properties which accept numbers but are not in units of "px".
692
+ */
693
+var isUnitlessNumber = {
694
+ boxFlex: true,
695
+ boxFlexGroup: true,
696
+ columnCount: true,
697
+ flex: true,
698
+ flexGrow: true,
699
+ flexShrink: true,
700
+ fontWeight: true,
701
+ lineClamp: true,
702
+ lineHeight: true,
703
+ opacity: true,
704
+ order: true,
705
+ orphans: true,
706
+ widows: true,
707
+ zIndex: true,
708
+ zoom: true,
709
+
710
+ // SVG-related properties
711
+ fillOpacity: true,
712
+ strokeOpacity: true
713
+};
714
+
715
+/**
716
+ * @param {string} prefix vendor-specific prefix, eg: Webkit
717
+ * @param {string} key style name, eg: transitionDuration
718
+ * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
719
+ * WebkitTransitionDuration
720
+ */
721
+function prefixKey(prefix, key) {
722
+ return prefix + key.charAt(0).toUpperCase() + key.substring(1);
723
+}
724
+
725
+/**
726
+ * Support style names that may come passed in prefixed by adding permutations
727
+ * of vendor prefixes.
728
+ */
729
+var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
730
+
731
+// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
732
+// infinite loop, because it iterates over the newly added props too.
733
+Object.keys(isUnitlessNumber).forEach(function(prop) {
734
+ prefixes.forEach(function(prefix) {
735
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
736
+ });
737
+});
738
+
739
+/**
740
+ * Most style properties can be unset by doing .style[prop] = '' but IE8
741
+ * doesn't like doing that with shorthand properties so for the properties that
742
+ * IE8 breaks on, which are listed here, we instead unset each of the
743
+ * individual properties. See http://bugs.jquery.com/ticket/12385.
744
+ * The 4-value 'clock' properties like margin, padding, border-width seem to
745
+ * behave without any problems. Curiously, list-style works too without any
746
+ * special prodding.
747
+ */
748
+var shorthandPropertyExpansions = {
749
+ background: {
750
+ backgroundImage: true,
751
+ backgroundPosition: true,
752
+ backgroundRepeat: true,
753
+ backgroundColor: true
754
+ },
755
+ border: {
756
+ borderWidth: true,
757
+ borderStyle: true,
758
+ borderColor: true
759
+ },
760
+ borderBottom: {
761
+ borderBottomWidth: true,
762
+ borderBottomStyle: true,
763
+ borderBottomColor: true
764
+ },
765
+ borderLeft: {
766
+ borderLeftWidth: true,
767
+ borderLeftStyle: true,
768
+ borderLeftColor: true
769
+ },
770
+ borderRight: {
771
+ borderRightWidth: true,
772
+ borderRightStyle: true,
773
+ borderRightColor: true
774
+ },
775
+ borderTop: {
776
+ borderTopWidth: true,
777
+ borderTopStyle: true,
778
+ borderTopColor: true
779
+ },
780
+ font: {
781
+ fontStyle: true,
782
+ fontVariant: true,
783
+ fontWeight: true,
784
+ fontSize: true,
785
+ lineHeight: true,
786
+ fontFamily: true
787
+ }
788
+};
789
+
790
+var CSSProperty = {
791
+ isUnitlessNumber: isUnitlessNumber,
792
+ shorthandPropertyExpansions: shorthandPropertyExpansions
793
+};
794
+
795
+module.exports = CSSProperty;
796
+
797
+},{}],5:[function(_dereq_,module,exports){
798
+/**
799
+ * Copyright 2013-2015, Facebook, Inc.
800
+ * All rights reserved.
801
+ *
802
+ * This source code is licensed under the BSD-style license found in the
803
+ * LICENSE file in the root directory of this source tree. An additional grant
804
+ * of patent rights can be found in the PATENTS file in the same directory.
805
+ *
806
+ * @providesModule CSSPropertyOperations
807
+ * @typechecks static-only
808
+ */
809
+
810
+'use strict';
811
+
812
+var CSSProperty = _dereq_(4);
813
+var ExecutionEnvironment = _dereq_(21);
814
+
815
+var camelizeStyleName = _dereq_(108);
816
+var dangerousStyleValue = _dereq_(113);
817
+var hyphenateStyleName = _dereq_(133);
818
+var memoizeStringOnly = _dereq_(143);
819
+var warning = _dereq_(154);
820
+
821
+var processStyleName = memoizeStringOnly(function(styleName) {
822
+ return hyphenateStyleName(styleName);
823
+});
824
+
825
+var styleFloatAccessor = 'cssFloat';
826
+if (ExecutionEnvironment.canUseDOM) {
827
+ // IE8 only supports accessing cssFloat (standard) as styleFloat
828
+ if (document.documentElement.style.cssFloat === undefined) {
829
+ styleFloatAccessor = 'styleFloat';
830
+ }
831
+}
832
+
833
+if ("production" !== "development") {
834
+ // 'msTransform' is correct, but the other prefixes should be capitalized
835
+ var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
836
+
837
+ // style values shouldn't contain a semicolon
838
+ var badStyleValueWithSemicolonPattern = /;\s*$/;
839
+
840
+ var warnedStyleNames = {};
841
+ var warnedStyleValues = {};
842
+
843
+ var warnHyphenatedStyleName = function(name) {
844
+ if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
845
+ return;
846
+ }
847
+
848
+ warnedStyleNames[name] = true;
849
+ ("production" !== "development" ? warning(
850
+ false,
851
+ 'Unsupported style property %s. Did you mean %s?',
852
+ name,
853
+ camelizeStyleName(name)
854
+ ) : null);
855
+ };
856
+
857
+ var warnBadVendoredStyleName = function(name) {
858
+ if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
859
+ return;
860
+ }
861
+
862
+ warnedStyleNames[name] = true;
863
+ ("production" !== "development" ? warning(
864
+ false,
865
+ 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
866
+ name,
867
+ name.charAt(0).toUpperCase() + name.slice(1)
868
+ ) : null);
869
+ };
870
+
871
+ var warnStyleValueWithSemicolon = function(name, value) {
872
+ if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
873
+ return;
874
+ }
875
+
876
+ warnedStyleValues[value] = true;
877
+ ("production" !== "development" ? warning(
878
+ false,
879
+ 'Style property values shouldn\'t contain a semicolon. ' +
880
+ 'Try "%s: %s" instead.',
881
+ name,
882
+ value.replace(badStyleValueWithSemicolonPattern, '')
883
+ ) : null);
884
+ };
885
+
886
+ /**
887
+ * @param {string} name
888
+ * @param {*} value
889
+ */
890
+ var warnValidStyle = function(name, value) {
891
+ if (name.indexOf('-') > -1) {
892
+ warnHyphenatedStyleName(name);
893
+ } else if (badVendoredStyleNamePattern.test(name)) {
894
+ warnBadVendoredStyleName(name);
895
+ } else if (badStyleValueWithSemicolonPattern.test(value)) {
896
+ warnStyleValueWithSemicolon(name, value);
897
+ }
898
+ };
899
+}
900
+
901
+/**
902
+ * Operations for dealing with CSS properties.
903
+ */
904
+var CSSPropertyOperations = {
905
+
906
+ /**
907
+ * Serializes a mapping of style properties for use as inline styles:
908
+ *
909
+ * > createMarkupForStyles({width: '200px', height: 0})
910
+ * "width:200px;height:0;"
911
+ *
912
+ * Undefined values are ignored so that declarative programming is easier.
913
+ * The result should be HTML-escaped before insertion into the DOM.
914
+ *
915
+ * @param {object} styles
916
+ * @return {?string}
917
+ */
918
+ createMarkupForStyles: function(styles) {
919
+ var serialized = '';
920
+ for (var styleName in styles) {
921
+ if (!styles.hasOwnProperty(styleName)) {
922
+ continue;
923
+ }
924
+ var styleValue = styles[styleName];
925
+ if ("production" !== "development") {
926
+ warnValidStyle(styleName, styleValue);
927
+ }
928
+ if (styleValue != null) {
929
+ serialized += processStyleName(styleName) + ':';
930
+ serialized += dangerousStyleValue(styleName, styleValue) + ';';
931
+ }
932
+ }
933
+ return serialized || null;
934
+ },
935
+
936
+ /**
937
+ * Sets the value for multiple styles on a node. If a value is specified as
938
+ * '' (empty string), the corresponding style property will be unset.
939
+ *
940
+ * @param {DOMElement} node
941
+ * @param {object} styles
942
+ */
943
+ setValueForStyles: function(node, styles) {
944
+ var style = node.style;
945
+ for (var styleName in styles) {
946
+ if (!styles.hasOwnProperty(styleName)) {
947
+ continue;
948
+ }
949
+ if ("production" !== "development") {
950
+ warnValidStyle(styleName, styles[styleName]);
951
+ }
952
+ var styleValue = dangerousStyleValue(styleName, styles[styleName]);
953
+ if (styleName === 'float') {
954
+ styleName = styleFloatAccessor;
955
+ }
956
+ if (styleValue) {
957
+ style[styleName] = styleValue;
958
+ } else {
959
+ var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
960
+ if (expansion) {
961
+ // Shorthand property that IE8 won't like unsetting, so unset each
962
+ // component to placate it
963
+ for (var individualStyleName in expansion) {
964
+ style[individualStyleName] = '';
965
+ }
966
+ } else {
967
+ style[styleName] = '';
968
+ }
969
+ }
970
+ }
971
+ }
972
+
973
+};
974
+
975
+module.exports = CSSPropertyOperations;
976
+
977
+},{"108":108,"113":113,"133":133,"143":143,"154":154,"21":21,"4":4}],6:[function(_dereq_,module,exports){
978
+/**
979
+ * Copyright 2013-2015, Facebook, Inc.
980
+ * All rights reserved.
981
+ *
982
+ * This source code is licensed under the BSD-style license found in the
983
+ * LICENSE file in the root directory of this source tree. An additional grant
984
+ * of patent rights can be found in the PATENTS file in the same directory.
985
+ *
986
+ * @providesModule CallbackQueue
987
+ */
988
+
989
+'use strict';
990
+
991
+var PooledClass = _dereq_(28);
992
+
993
+var assign = _dereq_(27);
994
+var invariant = _dereq_(135);
995
+
996
+/**
997
+ * A specialized pseudo-event module to help keep track of components waiting to
998
+ * be notified when their DOM representations are available for use.
999
+ *
1000
+ * This implements `PooledClass`, so you should never need to instantiate this.
1001
+ * Instead, use `CallbackQueue.getPooled()`.
1002
+ *
1003
+ * @class ReactMountReady
1004
+ * @implements PooledClass
1005
+ * @internal
1006
+ */
1007
+function CallbackQueue() {
1008
+ this._callbacks = null;
1009
+ this._contexts = null;
1010
+}
1011
+
1012
+assign(CallbackQueue.prototype, {
1013
+
1014
+ /**
1015
+ * Enqueues a callback to be invoked when `notifyAll` is invoked.
1016
+ *
1017
+ * @param {function} callback Invoked when `notifyAll` is invoked.
1018
+ * @param {?object} context Context to call `callback` with.
1019
+ * @internal
1020
+ */
1021
+ enqueue: function(callback, context) {
1022
+ this._callbacks = this._callbacks || [];
1023
+ this._contexts = this._contexts || [];
1024
+ this._callbacks.push(callback);
1025
+ this._contexts.push(context);
1026
+ },
1027
+
1028
+ /**
1029
+ * Invokes all enqueued callbacks and clears the queue. This is invoked after
1030
+ * the DOM representation of a component has been created or updated.
1031
+ *
1032
+ * @internal
1033
+ */
1034
+ notifyAll: function() {
1035
+ var callbacks = this._callbacks;
1036
+ var contexts = this._contexts;
1037
+ if (callbacks) {
1038
+ ("production" !== "development" ? invariant(
1039
+ callbacks.length === contexts.length,
1040
+ 'Mismatched list of contexts in callback queue'
1041
+ ) : invariant(callbacks.length === contexts.length));
1042
+ this._callbacks = null;
1043
+ this._contexts = null;
1044
+ for (var i = 0, l = callbacks.length; i < l; i++) {
1045
+ callbacks[i].call(contexts[i]);
1046
+ }
1047
+ callbacks.length = 0;
1048
+ contexts.length = 0;
1049
+ }
1050
+ },
1051
+
1052
+ /**
1053
+ * Resets the internal queue.
1054
+ *
1055
+ * @internal
1056
+ */
1057
+ reset: function() {
1058
+ this._callbacks = null;
1059
+ this._contexts = null;
1060
+ },
1061
+
1062
+ /**
1063
+ * `PooledClass` looks for this.
1064
+ */
1065
+ destructor: function() {
1066
+ this.reset();
1067
+ }
1068
+
1069
+});
1070
+
1071
+PooledClass.addPoolingTo(CallbackQueue);
1072
+
1073
+module.exports = CallbackQueue;
1074
+
1075
+},{"135":135,"27":27,"28":28}],7:[function(_dereq_,module,exports){
1076
+/**
1077
+ * Copyright 2013-2015, Facebook, Inc.
1078
+ * All rights reserved.
1079
+ *
1080
+ * This source code is licensed under the BSD-style license found in the
1081
+ * LICENSE file in the root directory of this source tree. An additional grant
1082
+ * of patent rights can be found in the PATENTS file in the same directory.
1083
+ *
1084
+ * @providesModule ChangeEventPlugin
1085
+ */
1086
+
1087
+'use strict';
1088
+
1089
+var EventConstants = _dereq_(15);
1090
+var EventPluginHub = _dereq_(17);
1091
+var EventPropagators = _dereq_(20);
1092
+var ExecutionEnvironment = _dereq_(21);
1093
+var ReactUpdates = _dereq_(87);
1094
+var SyntheticEvent = _dereq_(95);
1095
+
1096
+var isEventSupported = _dereq_(136);
1097
+var isTextInputElement = _dereq_(138);
1098
+var keyOf = _dereq_(141);
1099
+
1100
+var topLevelTypes = EventConstants.topLevelTypes;
1101
+
1102
+var eventTypes = {
1103
+ change: {
1104
+ phasedRegistrationNames: {
1105
+ bubbled: keyOf({onChange: null}),
1106
+ captured: keyOf({onChangeCapture: null})
1107
+ },
1108
+ dependencies: [
1109
+ topLevelTypes.topBlur,
1110
+ topLevelTypes.topChange,
1111
+ topLevelTypes.topClick,
1112
+ topLevelTypes.topFocus,
1113
+ topLevelTypes.topInput,
1114
+ topLevelTypes.topKeyDown,
1115
+ topLevelTypes.topKeyUp,
1116
+ topLevelTypes.topSelectionChange
1117
+ ]
1118
+ }
1119
+};
1120
+
1121
+/**
1122
+ * For IE shims
1123
+ */
1124
+var activeElement = null;
1125
+var activeElementID = null;
1126
+var activeElementValue = null;
1127
+var activeElementValueProp = null;
1128
+
1129
+/**
1130
+ * SECTION: handle `change` event
1131
+ */
1132
+function shouldUseChangeEvent(elem) {
1133
+ return (
1134
+ elem.nodeName === 'SELECT' ||
1135
+ (elem.nodeName === 'INPUT' && elem.type === 'file')
1136
+ );
1137
+}
1138
+
1139
+var doesChangeEventBubble = false;
1140
+if (ExecutionEnvironment.canUseDOM) {
1141
+ // See `handleChange` comment below
1142
+ doesChangeEventBubble = isEventSupported('change') && (
1143
+ (!('documentMode' in document) || document.documentMode > 8)
1144
+ );
1145
+}
1146
+
1147
+function manualDispatchChangeEvent(nativeEvent) {
1148
+ var event = SyntheticEvent.getPooled(
1149
+ eventTypes.change,
1150
+ activeElementID,
1151
+ nativeEvent
1152
+ );
1153
+ EventPropagators.accumulateTwoPhaseDispatches(event);
1154
+
1155
+ // If change and propertychange bubbled, we'd just bind to it like all the
1156
+ // other events and have it go through ReactBrowserEventEmitter. Since it
1157
+ // doesn't, we manually listen for the events and so we have to enqueue and
1158
+ // process the abstract event manually.
1159
+ //
1160
+ // Batching is necessary here in order to ensure that all event handlers run
1161
+ // before the next rerender (including event handlers attached to ancestor
1162
+ // elements instead of directly on the input). Without this, controlled
1163
+ // components don't work properly in conjunction with event bubbling because
1164
+ // the component is rerendered and the value reverted before all the event
1165
+ // handlers can run. See https://github.com/facebook/react/issues/708.
1166
+ ReactUpdates.batchedUpdates(runEventInBatch, event);
1167
+}
1168
+
1169
+function runEventInBatch(event) {
1170
+ EventPluginHub.enqueueEvents(event);
1171
+ EventPluginHub.processEventQueue();
1172
+}
1173
+
1174
+function startWatchingForChangeEventIE8(target, targetID) {
1175
+ activeElement = target;
1176
+ activeElementID = targetID;
1177
+ activeElement.attachEvent('onchange', manualDispatchChangeEvent);
1178
+}
1179
+
1180
+function stopWatchingForChangeEventIE8() {
1181
+ if (!activeElement) {
1182
+ return;
1183
+ }
1184
+ activeElement.detachEvent('onchange', manualDispatchChangeEvent);
1185
+ activeElement = null;
1186
+ activeElementID = null;
1187
+}
1188
+
1189
+function getTargetIDForChangeEvent(
1190
+ topLevelType,
1191
+ topLevelTarget,
1192
+ topLevelTargetID) {
1193
+ if (topLevelType === topLevelTypes.topChange) {
1194
+ return topLevelTargetID;
1195
+ }
1196
+}
1197
+function handleEventsForChangeEventIE8(
1198
+ topLevelType,
1199
+ topLevelTarget,
1200
+ topLevelTargetID) {
1201
+ if (topLevelType === topLevelTypes.topFocus) {
1202
+ // stopWatching() should be a noop here but we call it just in case we
1203
+ // missed a blur event somehow.
1204
+ stopWatchingForChangeEventIE8();
1205
+ startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
1206
+ } else if (topLevelType === topLevelTypes.topBlur) {
1207
+ stopWatchingForChangeEventIE8();
1208
+ }
1209
+}
1210
+
1211
+
1212
+/**
1213
+ * SECTION: handle `input` event
1214
+ */
1215
+var isInputEventSupported = false;
1216
+if (ExecutionEnvironment.canUseDOM) {
1217
+ // IE9 claims to support the input event but fails to trigger it when
1218
+ // deleting text, so we ignore its input events
1219
+ isInputEventSupported = isEventSupported('input') && (
1220
+ (!('documentMode' in document) || document.documentMode > 9)
1221
+ );
1222
+}
1223
+
1224
+/**
1225
+ * (For old IE.) Replacement getter/setter for the `value` property that gets
1226
+ * set on the active element.
1227
+ */
1228
+var newValueProp = {
1229
+ get: function() {
1230
+ return activeElementValueProp.get.call(this);
1231
+ },
1232
+ set: function(val) {
1233
+ // Cast to a string so we can do equality checks.
1234
+ activeElementValue = '' + val;
1235
+ activeElementValueProp.set.call(this, val);
1236
+ }
1237
+};
1238
+
1239
+/**
1240
+ * (For old IE.) Starts tracking propertychange events on the passed-in element
1241
+ * and override the value property so that we can distinguish user events from
1242
+ * value changes in JS.
1243
+ */
1244
+function startWatchingForValueChange(target, targetID) {
1245
+ activeElement = target;
1246
+ activeElementID = targetID;
1247
+ activeElementValue = target.value;
1248
+ activeElementValueProp = Object.getOwnPropertyDescriptor(
1249
+ target.constructor.prototype,
1250
+ 'value'
1251
+ );
1252
+
1253
+ Object.defineProperty(activeElement, 'value', newValueProp);
1254
+ activeElement.attachEvent('onpropertychange', handlePropertyChange);
1255
+}
1256
+
1257
+/**
1258
+ * (For old IE.) Removes the event listeners from the currently-tracked element,
1259
+ * if any exists.
1260
+ */
1261
+function stopWatchingForValueChange() {
1262
+ if (!activeElement) {
1263
+ return;
1264
+ }
1265
+
1266
+ // delete restores the original property definition
1267
+ delete activeElement.value;
1268
+ activeElement.detachEvent('onpropertychange', handlePropertyChange);
1269
+
1270
+ activeElement = null;
1271
+ activeElementID = null;
1272
+ activeElementValue = null;
1273
+ activeElementValueProp = null;
1274
+}
1275
+
1276
+/**
1277
+ * (For old IE.) Handles a propertychange event, sending a `change` event if
1278
+ * the value of the active element has changed.
1279
+ */
1280
+function handlePropertyChange(nativeEvent) {
1281
+ if (nativeEvent.propertyName !== 'value') {
1282
+ return;
1283
+ }
1284
+ var value = nativeEvent.srcElement.value;
1285
+ if (value === activeElementValue) {
1286
+ return;
1287
+ }
1288
+ activeElementValue = value;
1289
+
1290
+ manualDispatchChangeEvent(nativeEvent);
1291
+}
1292
+
1293
+/**
1294
+ * If a `change` event should be fired, returns the target's ID.
1295
+ */
1296
+function getTargetIDForInputEvent(
1297
+ topLevelType,
1298
+ topLevelTarget,
1299
+ topLevelTargetID) {
1300
+ if (topLevelType === topLevelTypes.topInput) {
1301
+ // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
1302
+ // what we want so fall through here and trigger an abstract event
1303
+ return topLevelTargetID;
1304
+ }
1305
+}
1306
+
1307
+// For IE8 and IE9.
1308
+function handleEventsForInputEventIE(
1309
+ topLevelType,
1310
+ topLevelTarget,
1311
+ topLevelTargetID) {
1312
+ if (topLevelType === topLevelTypes.topFocus) {
1313
+ // In IE8, we can capture almost all .value changes by adding a
1314
+ // propertychange handler and looking for events with propertyName
1315
+ // equal to 'value'
1316
+ // In IE9, propertychange fires for most input events but is buggy and
1317
+ // doesn't fire when text is deleted, but conveniently, selectionchange
1318
+ // appears to fire in all of the remaining cases so we catch those and
1319
+ // forward the event if the value has changed
1320
+ // In either case, we don't want to call the event handler if the value
1321
+ // is changed from JS so we redefine a setter for `.value` that updates
1322
+ // our activeElementValue variable, allowing us to ignore those changes
1323
+ //
1324
+ // stopWatching() should be a noop here but we call it just in case we
1325
+ // missed a blur event somehow.
1326
+ stopWatchingForValueChange();
1327
+ startWatchingForValueChange(topLevelTarget, topLevelTargetID);
1328
+ } else if (topLevelType === topLevelTypes.topBlur) {
1329
+ stopWatchingForValueChange();
1330
+ }
1331
+}
1332
+
1333
+// For IE8 and IE9.
1334
+function getTargetIDForInputEventIE(
1335
+ topLevelType,
1336
+ topLevelTarget,
1337
+ topLevelTargetID) {
1338
+ if (topLevelType === topLevelTypes.topSelectionChange ||
1339
+ topLevelType === topLevelTypes.topKeyUp ||
1340
+ topLevelType === topLevelTypes.topKeyDown) {
1341
+ // On the selectionchange event, the target is just document which isn't
1342
+ // helpful for us so just check activeElement instead.
1343
+ //
1344
+ // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
1345
+ // propertychange on the first input event after setting `value` from a
1346
+ // script and fires only keydown, keypress, keyup. Catching keyup usually
1347
+ // gets it and catching keydown lets us fire an event for the first
1348
+ // keystroke if user does a key repeat (it'll be a little delayed: right
1349
+ // before the second keystroke). Other input methods (e.g., paste) seem to
1350
+ // fire selectionchange normally.
1351
+ if (activeElement && activeElement.value !== activeElementValue) {
1352
+ activeElementValue = activeElement.value;
1353
+ return activeElementID;
1354
+ }
1355
+ }
1356
+}
1357
+
1358
+
1359
+/**
1360
+ * SECTION: handle `click` event
1361
+ */
1362
+function shouldUseClickEvent(elem) {
1363
+ // Use the `click` event to detect changes to checkbox and radio inputs.
1364
+ // This approach works across all browsers, whereas `change` does not fire
1365
+ // until `blur` in IE8.
1366
+ return (
1367
+ elem.nodeName === 'INPUT' &&
1368
+ (elem.type === 'checkbox' || elem.type === 'radio')
1369
+ );
1370
+}
1371
+
1372
+function getTargetIDForClickEvent(
1373
+ topLevelType,
1374
+ topLevelTarget,
1375
+ topLevelTargetID) {
1376
+ if (topLevelType === topLevelTypes.topClick) {
1377
+ return topLevelTargetID;
1378
+ }
1379
+}
1380
+
1381
+/**
1382
+ * This plugin creates an `onChange` event that normalizes change events
1383
+ * across form elements. This event fires at a time when it's possible to
1384
+ * change the element's value without seeing a flicker.
1385
+ *
1386
+ * Supported elements are:
1387
+ * - input (see `isTextInputElement`)
1388
+ * - textarea
1389
+ * - select
1390
+ */
1391
+var ChangeEventPlugin = {
1392
+
1393
+ eventTypes: eventTypes,
1394
+
1395
+ /**
1396
+ * @param {string} topLevelType Record from `EventConstants`.
1397
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
1398
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
1399
+ * @param {object} nativeEvent Native browser event.
1400
+ * @return {*} An accumulation of synthetic events.
1401
+ * @see {EventPluginHub.extractEvents}
1402
+ */
1403
+ extractEvents: function(
1404
+ topLevelType,
1405
+ topLevelTarget,
1406
+ topLevelTargetID,
1407
+ nativeEvent) {
1408
+
1409
+ var getTargetIDFunc, handleEventFunc;
1410
+ if (shouldUseChangeEvent(topLevelTarget)) {
1411
+ if (doesChangeEventBubble) {
1412
+ getTargetIDFunc = getTargetIDForChangeEvent;
1413
+ } else {
1414
+ handleEventFunc = handleEventsForChangeEventIE8;
1415
+ }
1416
+ } else if (isTextInputElement(topLevelTarget)) {
1417
+ if (isInputEventSupported) {
1418
+ getTargetIDFunc = getTargetIDForInputEvent;
1419
+ } else {
1420
+ getTargetIDFunc = getTargetIDForInputEventIE;
1421
+ handleEventFunc = handleEventsForInputEventIE;
1422
+ }
1423
+ } else if (shouldUseClickEvent(topLevelTarget)) {
1424
+ getTargetIDFunc = getTargetIDForClickEvent;
1425
+ }
1426
+
1427
+ if (getTargetIDFunc) {
1428
+ var targetID = getTargetIDFunc(
1429
+ topLevelType,
1430
+ topLevelTarget,
1431
+ topLevelTargetID
1432
+ );
1433
+ if (targetID) {
1434
+ var event = SyntheticEvent.getPooled(
1435
+ eventTypes.change,
1436
+ targetID,
1437
+ nativeEvent
1438
+ );
1439
+ EventPropagators.accumulateTwoPhaseDispatches(event);
1440
+ return event;
1441
+ }
1442
+ }
1443
+
1444
+ if (handleEventFunc) {
1445
+ handleEventFunc(
1446
+ topLevelType,
1447
+ topLevelTarget,
1448
+ topLevelTargetID
1449
+ );
1450
+ }
1451
+ }
1452
+
1453
+};
1454
+
1455
+module.exports = ChangeEventPlugin;
1456
+
1457
+},{"136":136,"138":138,"141":141,"15":15,"17":17,"20":20,"21":21,"87":87,"95":95}],8:[function(_dereq_,module,exports){
1458
+/**
1459
+ * Copyright 2013-2015, Facebook, Inc.
1460
+ * All rights reserved.
1461
+ *
1462
+ * This source code is licensed under the BSD-style license found in the
1463
+ * LICENSE file in the root directory of this source tree. An additional grant
1464
+ * of patent rights can be found in the PATENTS file in the same directory.
1465
+ *
1466
+ * @providesModule ClientReactRootIndex
1467
+ * @typechecks
1468
+ */
1469
+
1470
+'use strict';
1471
+
1472
+var nextReactRootIndex = 0;
1473
+
1474
+var ClientReactRootIndex = {
1475
+ createReactRootIndex: function() {
1476
+ return nextReactRootIndex++;
1477
+ }
1478
+};
1479
+
1480
+module.exports = ClientReactRootIndex;
1481
+
1482
+},{}],9:[function(_dereq_,module,exports){
1483
+/**
1484
+ * Copyright 2013-2015, Facebook, Inc.
1485
+ * All rights reserved.
1486
+ *
1487
+ * This source code is licensed under the BSD-style license found in the
1488
+ * LICENSE file in the root directory of this source tree. An additional grant
1489
+ * of patent rights can be found in the PATENTS file in the same directory.
1490
+ *
1491
+ * @providesModule DOMChildrenOperations
1492
+ * @typechecks static-only
1493
+ */
1494
+
1495
+'use strict';
1496
+
1497
+var Danger = _dereq_(12);
1498
+var ReactMultiChildUpdateTypes = _dereq_(72);
1499
+
1500
+var setTextContent = _dereq_(149);
1501
+var invariant = _dereq_(135);
1502
+
1503
+/**
1504
+ * Inserts `childNode` as a child of `parentNode` at the `index`.
1505
+ *
1506
+ * @param {DOMElement} parentNode Parent node in which to insert.
1507
+ * @param {DOMElement} childNode Child node to insert.
1508
+ * @param {number} index Index at which to insert the child.
1509
+ * @internal
1510
+ */
1511
+function insertChildAt(parentNode, childNode, index) {
1512
+ // By exploiting arrays returning `undefined` for an undefined index, we can
1513
+ // rely exclusively on `insertBefore(node, null)` instead of also using
1514
+ // `appendChild(node)`. However, using `undefined` is not allowed by all
1515
+ // browsers so we must replace it with `null`.
1516
+ parentNode.insertBefore(
1517
+ childNode,
1518
+ parentNode.childNodes[index] || null
1519
+ );
1520
+}
1521
+
1522
+/**
1523
+ * Operations for updating with DOM children.
1524
+ */
1525
+var DOMChildrenOperations = {
1526
+
1527
+ dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
1528
+
1529
+ updateTextContent: setTextContent,
1530
+
1531
+ /**
1532
+ * Updates a component's children by processing a series of updates. The
1533
+ * update configurations are each expected to have a `parentNode` property.
1534
+ *
1535
+ * @param {array<object>} updates List of update configurations.
1536
+ * @param {array<string>} markupList List of markup strings.
1537
+ * @internal
1538
+ */
1539
+ processUpdates: function(updates, markupList) {
1540
+ var update;
1541
+ // Mapping from parent IDs to initial child orderings.
1542
+ var initialChildren = null;
1543
+ // List of children that will be moved or removed.
1544
+ var updatedChildren = null;
1545
+
1546
+ for (var i = 0; i < updates.length; i++) {
1547
+ update = updates[i];
1548
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
1549
+ update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
1550
+ var updatedIndex = update.fromIndex;
1551
+ var updatedChild = update.parentNode.childNodes[updatedIndex];
1552
+ var parentID = update.parentID;
1553
+
1554
+ ("production" !== "development" ? invariant(
1555
+ updatedChild,
1556
+ 'processUpdates(): Unable to find child %s of element. This ' +
1557
+ 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
1558
+ 'browser), usually due to forgetting a <tbody> when using tables, ' +
1559
+ 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
1560
+ 'in an <svg> parent. Try inspecting the child nodes of the element ' +
1561
+ 'with React ID `%s`.',
1562
+ updatedIndex,
1563
+ parentID
1564
+ ) : invariant(updatedChild));
1565
+
1566
+ initialChildren = initialChildren || {};
1567
+ initialChildren[parentID] = initialChildren[parentID] || [];
1568
+ initialChildren[parentID][updatedIndex] = updatedChild;
1569
+
1570
+ updatedChildren = updatedChildren || [];
1571
+ updatedChildren.push(updatedChild);
1572
+ }
1573
+ }
1574
+
1575
+ var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
1576
+
1577
+ // Remove updated children first so that `toIndex` is consistent.
1578
+ if (updatedChildren) {
1579
+ for (var j = 0; j < updatedChildren.length; j++) {
1580
+ updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
1581
+ }
1582
+ }
1583
+
1584
+ for (var k = 0; k < updates.length; k++) {
1585
+ update = updates[k];
1586
+ switch (update.type) {
1587
+ case ReactMultiChildUpdateTypes.INSERT_MARKUP:
1588
+ insertChildAt(
1589
+ update.parentNode,
1590
+ renderedMarkup[update.markupIndex],
1591
+ update.toIndex
1592
+ );
1593
+ break;
1594
+ case ReactMultiChildUpdateTypes.MOVE_EXISTING:
1595
+ insertChildAt(
1596
+ update.parentNode,
1597
+ initialChildren[update.parentID][update.fromIndex],
1598
+ update.toIndex
1599
+ );
1600
+ break;
1601
+ case ReactMultiChildUpdateTypes.TEXT_CONTENT:
1602
+ setTextContent(
1603
+ update.parentNode,
1604
+ update.textContent
1605
+ );
1606
+ break;
1607
+ case ReactMultiChildUpdateTypes.REMOVE_NODE:
1608
+ // Already removed by the for-loop above.
1609
+ break;
1610
+ }
1611
+ }
1612
+ }
1613
+
1614
+};
1615
+
1616
+module.exports = DOMChildrenOperations;
1617
+
1618
+},{"12":12,"135":135,"149":149,"72":72}],10:[function(_dereq_,module,exports){
1619
+/**
1620
+ * Copyright 2013-2015, Facebook, Inc.
1621
+ * All rights reserved.
1622
+ *
1623
+ * This source code is licensed under the BSD-style license found in the
1624
+ * LICENSE file in the root directory of this source tree. An additional grant
1625
+ * of patent rights can be found in the PATENTS file in the same directory.
1626
+ *
1627
+ * @providesModule DOMProperty
1628
+ * @typechecks static-only
1629
+ */
1630
+
1631
+/*jslint bitwise: true */
1632
+
1633
+'use strict';
1634
+
1635
+var invariant = _dereq_(135);
1636
+
1637
+function checkMask(value, bitmask) {
1638
+ return (value & bitmask) === bitmask;
1639
+}
1640
+
1641
+var DOMPropertyInjection = {
1642
+ /**
1643
+ * Mapping from normalized, camelcased property names to a configuration that
1644
+ * specifies how the associated DOM property should be accessed or rendered.
1645
+ */
1646
+ MUST_USE_ATTRIBUTE: 0x1,
1647
+ MUST_USE_PROPERTY: 0x2,
1648
+ HAS_SIDE_EFFECTS: 0x4,
1649
+ HAS_BOOLEAN_VALUE: 0x8,
1650
+ HAS_NUMERIC_VALUE: 0x10,
1651
+ HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
1652
+ HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
1653
+
1654
+ /**
1655
+ * Inject some specialized knowledge about the DOM. This takes a config object
1656
+ * with the following properties:
1657
+ *
1658
+ * isCustomAttribute: function that given an attribute name will return true
1659
+ * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
1660
+ * attributes where it's impossible to enumerate all of the possible
1661
+ * attribute names,
1662
+ *
1663
+ * Properties: object mapping DOM property name to one of the
1664
+ * DOMPropertyInjection constants or null. If your attribute isn't in here,
1665
+ * it won't get written to the DOM.
1666
+ *
1667
+ * DOMAttributeNames: object mapping React attribute name to the DOM
1668
+ * attribute name. Attribute names not specified use the **lowercase**
1669
+ * normalized name.
1670
+ *
1671
+ * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
1672
+ * Property names not specified use the normalized name.
1673
+ *
1674
+ * DOMMutationMethods: Properties that require special mutation methods. If
1675
+ * `value` is undefined, the mutation method should unset the property.
1676
+ *
1677
+ * @param {object} domPropertyConfig the config as described above.
1678
+ */
1679
+ injectDOMPropertyConfig: function(domPropertyConfig) {
1680
+ var Properties = domPropertyConfig.Properties || {};
1681
+ var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
1682
+ var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
1683
+ var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
1684
+
1685
+ if (domPropertyConfig.isCustomAttribute) {
1686
+ DOMProperty._isCustomAttributeFunctions.push(
1687
+ domPropertyConfig.isCustomAttribute
1688
+ );
1689
+ }
1690
+
1691
+ for (var propName in Properties) {
1692
+ ("production" !== "development" ? invariant(
1693
+ !DOMProperty.isStandardName.hasOwnProperty(propName),
1694
+ 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
1695
+ '\'%s\' which has already been injected. You may be accidentally ' +
1696
+ 'injecting the same DOM property config twice, or you may be ' +
1697
+ 'injecting two configs that have conflicting property names.',
1698
+ propName
1699
+ ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
1700
+
1701
+ DOMProperty.isStandardName[propName] = true;
1702
+
1703
+ var lowerCased = propName.toLowerCase();
1704
+ DOMProperty.getPossibleStandardName[lowerCased] = propName;
1705
+
1706
+ if (DOMAttributeNames.hasOwnProperty(propName)) {
1707
+ var attributeName = DOMAttributeNames[propName];
1708
+ DOMProperty.getPossibleStandardName[attributeName] = propName;
1709
+ DOMProperty.getAttributeName[propName] = attributeName;
1710
+ } else {
1711
+ DOMProperty.getAttributeName[propName] = lowerCased;
1712
+ }
1713
+
1714
+ DOMProperty.getPropertyName[propName] =
1715
+ DOMPropertyNames.hasOwnProperty(propName) ?
1716
+ DOMPropertyNames[propName] :
1717
+ propName;
1718
+
1719
+ if (DOMMutationMethods.hasOwnProperty(propName)) {
1720
+ DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
1721
+ } else {
1722
+ DOMProperty.getMutationMethod[propName] = null;
1723
+ }
1724
+
1725
+ var propConfig = Properties[propName];
1726
+ DOMProperty.mustUseAttribute[propName] =
1727
+ checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
1728
+ DOMProperty.mustUseProperty[propName] =
1729
+ checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
1730
+ DOMProperty.hasSideEffects[propName] =
1731
+ checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
1732
+ DOMProperty.hasBooleanValue[propName] =
1733
+ checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
1734
+ DOMProperty.hasNumericValue[propName] =
1735
+ checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
1736
+ DOMProperty.hasPositiveNumericValue[propName] =
1737
+ checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
1738
+ DOMProperty.hasOverloadedBooleanValue[propName] =
1739
+ checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
1740
+
1741
+ ("production" !== "development" ? invariant(
1742
+ !DOMProperty.mustUseAttribute[propName] ||
1743
+ !DOMProperty.mustUseProperty[propName],
1744
+ 'DOMProperty: Cannot require using both attribute and property: %s',
1745
+ propName
1746
+ ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
1747
+ !DOMProperty.mustUseProperty[propName]));
1748
+ ("production" !== "development" ? invariant(
1749
+ DOMProperty.mustUseProperty[propName] ||
1750
+ !DOMProperty.hasSideEffects[propName],
1751
+ 'DOMProperty: Properties that have side effects must use property: %s',
1752
+ propName
1753
+ ) : invariant(DOMProperty.mustUseProperty[propName] ||
1754
+ !DOMProperty.hasSideEffects[propName]));
1755
+ ("production" !== "development" ? invariant(
1756
+ !!DOMProperty.hasBooleanValue[propName] +
1757
+ !!DOMProperty.hasNumericValue[propName] +
1758
+ !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
1759
+ 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
1760
+ 'numeric value, but not a combination: %s',
1761
+ propName
1762
+ ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
1763
+ !!DOMProperty.hasNumericValue[propName] +
1764
+ !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
1765
+ }
1766
+ }
1767
+};
1768
+var defaultValueCache = {};
1769
+
1770
+/**
1771
+ * DOMProperty exports lookup objects that can be used like functions:
1772
+ *
1773
+ * > DOMProperty.isValid['id']
1774
+ * true
1775
+ * > DOMProperty.isValid['foobar']
1776
+ * undefined
1777
+ *
1778
+ * Although this may be confusing, it performs better in general.
1779
+ *
1780
+ * @see http://jsperf.com/key-exists
1781
+ * @see http://jsperf.com/key-missing
1782
+ */
1783
+var DOMProperty = {
1784
+
1785
+ ID_ATTRIBUTE_NAME: 'data-reactid',
1786
+
1787
+ /**
1788
+ * Checks whether a property name is a standard property.
1789
+ * @type {Object}
1790
+ */
1791
+ isStandardName: {},
1792
+
1793
+ /**
1794
+ * Mapping from lowercase property names to the properly cased version, used
1795
+ * to warn in the case of missing properties.
1796
+ * @type {Object}
1797
+ */
1798
+ getPossibleStandardName: {},
1799
+
1800
+ /**
1801
+ * Mapping from normalized names to attribute names that differ. Attribute
1802
+ * names are used when rendering markup or with `*Attribute()`.
1803
+ * @type {Object}
1804
+ */
1805
+ getAttributeName: {},
1806
+
1807
+ /**
1808
+ * Mapping from normalized names to properties on DOM node instances.
1809
+ * (This includes properties that mutate due to external factors.)
1810
+ * @type {Object}
1811
+ */
1812
+ getPropertyName: {},
1813
+
1814
+ /**
1815
+ * Mapping from normalized names to mutation methods. This will only exist if
1816
+ * mutation cannot be set simply by the property or `setAttribute()`.
1817
+ * @type {Object}
1818
+ */
1819
+ getMutationMethod: {},
1820
+
1821
+ /**
1822
+ * Whether the property must be accessed and mutated as an object property.
1823
+ * @type {Object}
1824
+ */
1825
+ mustUseAttribute: {},
1826
+
1827
+ /**
1828
+ * Whether the property must be accessed and mutated using `*Attribute()`.
1829
+ * (This includes anything that fails `<propName> in <element>`.)
1830
+ * @type {Object}
1831
+ */
1832
+ mustUseProperty: {},
1833
+
1834
+ /**
1835
+ * Whether or not setting a value causes side effects such as triggering
1836
+ * resources to be loaded or text selection changes. We must ensure that
1837
+ * the value is only set if it has changed.
1838
+ * @type {Object}
1839
+ */
1840
+ hasSideEffects: {},
1841
+
1842
+ /**
1843
+ * Whether the property should be removed when set to a falsey value.
1844
+ * @type {Object}
1845
+ */
1846
+ hasBooleanValue: {},
1847
+
1848
+ /**
1849
+ * Whether the property must be numeric or parse as a
1850
+ * numeric and should be removed when set to a falsey value.
1851
+ * @type {Object}
1852
+ */
1853
+ hasNumericValue: {},
1854
+
1855
+ /**
1856
+ * Whether the property must be positive numeric or parse as a positive
1857
+ * numeric and should be removed when set to a falsey value.
1858
+ * @type {Object}
1859
+ */
1860
+ hasPositiveNumericValue: {},
1861
+
1862
+ /**
1863
+ * Whether the property can be used as a flag as well as with a value. Removed
1864
+ * when strictly equal to false; present without a value when strictly equal
1865
+ * to true; present with a value otherwise.
1866
+ * @type {Object}
1867
+ */
1868
+ hasOverloadedBooleanValue: {},
1869
+
1870
+ /**
1871
+ * All of the isCustomAttribute() functions that have been injected.
1872
+ */
1873
+ _isCustomAttributeFunctions: [],
1874
+
1875
+ /**
1876
+ * Checks whether a property name is a custom attribute.
1877
+ * @method
1878
+ */
1879
+ isCustomAttribute: function(attributeName) {
1880
+ for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
1881
+ var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
1882
+ if (isCustomAttributeFn(attributeName)) {
1883
+ return true;
1884
+ }
1885
+ }
1886
+ return false;
1887
+ },
1888
+
1889
+ /**
1890
+ * Returns the default property value for a DOM property (i.e., not an
1891
+ * attribute). Most default values are '' or false, but not all. Worse yet,
1892
+ * some (in particular, `type`) vary depending on the type of element.
1893
+ *
1894
+ * TODO: Is it better to grab all the possible properties when creating an
1895
+ * element to avoid having to create the same element twice?
1896
+ */
1897
+ getDefaultValueForProperty: function(nodeName, prop) {
1898
+ var nodeDefaults = defaultValueCache[nodeName];
1899
+ var testElement;
1900
+ if (!nodeDefaults) {
1901
+ defaultValueCache[nodeName] = nodeDefaults = {};
1902
+ }
1903
+ if (!(prop in nodeDefaults)) {
1904
+ testElement = document.createElement(nodeName);
1905
+ nodeDefaults[prop] = testElement[prop];
1906
+ }
1907
+ return nodeDefaults[prop];
1908
+ },
1909
+
1910
+ injection: DOMPropertyInjection
1911
+};
1912
+
1913
+module.exports = DOMProperty;
1914
+
1915
+},{"135":135}],11:[function(_dereq_,module,exports){
1916
+/**
1917
+ * Copyright 2013-2015, Facebook, Inc.
1918
+ * All rights reserved.
1919
+ *
1920
+ * This source code is licensed under the BSD-style license found in the
1921
+ * LICENSE file in the root directory of this source tree. An additional grant
1922
+ * of patent rights can be found in the PATENTS file in the same directory.
1923
+ *
1924
+ * @providesModule DOMPropertyOperations
1925
+ * @typechecks static-only
1926
+ */
1927
+
1928
+'use strict';
1929
+
1930
+var DOMProperty = _dereq_(10);
1931
+
1932
+var quoteAttributeValueForBrowser = _dereq_(147);
1933
+var warning = _dereq_(154);
1934
+
1935
+function shouldIgnoreValue(name, value) {
1936
+ return value == null ||
1937
+ (DOMProperty.hasBooleanValue[name] && !value) ||
1938
+ (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
1939
+ (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
1940
+ (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
1941
+}
1942
+
1943
+if ("production" !== "development") {
1944
+ var reactProps = {
1945
+ children: true,
1946
+ dangerouslySetInnerHTML: true,
1947
+ key: true,
1948
+ ref: true
1949
+ };
1950
+ var warnedProperties = {};
1951
+
1952
+ var warnUnknownProperty = function(name) {
1953
+ if (reactProps.hasOwnProperty(name) && reactProps[name] ||
1954
+ warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
1955
+ return;
1956
+ }
1957
+
1958
+ warnedProperties[name] = true;
1959
+ var lowerCasedName = name.toLowerCase();
1960
+
1961
+ // data-* attributes should be lowercase; suggest the lowercase version
1962
+ var standardName = (
1963
+ DOMProperty.isCustomAttribute(lowerCasedName) ?
1964
+ lowerCasedName :
1965
+ DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
1966
+ DOMProperty.getPossibleStandardName[lowerCasedName] :
1967
+ null
1968
+ );
1969
+
1970
+ // For now, only warn when we have a suggested correction. This prevents
1971
+ // logging too much when using transferPropsTo.
1972
+ ("production" !== "development" ? warning(
1973
+ standardName == null,
1974
+ 'Unknown DOM property %s. Did you mean %s?',
1975
+ name,
1976
+ standardName
1977
+ ) : null);
1978
+
1979
+ };
1980
+}
1981
+
1982
+/**
1983
+ * Operations for dealing with DOM properties.
1984
+ */
1985
+var DOMPropertyOperations = {
1986
+
1987
+ /**
1988
+ * Creates markup for the ID property.
1989
+ *
1990
+ * @param {string} id Unescaped ID.
1991
+ * @return {string} Markup string.
1992
+ */
1993
+ createMarkupForID: function(id) {
1994
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
1995
+ quoteAttributeValueForBrowser(id);
1996
+ },
1997
+
1998
+ /**
1999
+ * Creates markup for a property.
2000
+ *
2001
+ * @param {string} name
2002
+ * @param {*} value
2003
+ * @return {?string} Markup string, or null if the property was invalid.
2004
+ */
2005
+ createMarkupForProperty: function(name, value) {
2006
+ if (DOMProperty.isStandardName.hasOwnProperty(name) &&
2007
+ DOMProperty.isStandardName[name]) {
2008
+ if (shouldIgnoreValue(name, value)) {
2009
+ return '';
2010
+ }
2011
+ var attributeName = DOMProperty.getAttributeName[name];
2012
+ if (DOMProperty.hasBooleanValue[name] ||
2013
+ (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
2014
+ return attributeName;
2015
+ }
2016
+ return attributeName + '=' + quoteAttributeValueForBrowser(value);
2017
+ } else if (DOMProperty.isCustomAttribute(name)) {
2018
+ if (value == null) {
2019
+ return '';
2020
+ }
2021
+ return name + '=' + quoteAttributeValueForBrowser(value);
2022
+ } else if ("production" !== "development") {
2023
+ warnUnknownProperty(name);
2024
+ }
2025
+ return null;
2026
+ },
2027
+
2028
+ /**
2029
+ * Sets the value for a property on a node.
2030
+ *
2031
+ * @param {DOMElement} node
2032
+ * @param {string} name
2033
+ * @param {*} value
2034
+ */
2035
+ setValueForProperty: function(node, name, value) {
2036
+ if (DOMProperty.isStandardName.hasOwnProperty(name) &&
2037
+ DOMProperty.isStandardName[name]) {
2038
+ var mutationMethod = DOMProperty.getMutationMethod[name];
2039
+ if (mutationMethod) {
2040
+ mutationMethod(node, value);
2041
+ } else if (shouldIgnoreValue(name, value)) {
2042
+ this.deleteValueForProperty(node, name);
2043
+ } else if (DOMProperty.mustUseAttribute[name]) {
2044
+ // `setAttribute` with objects becomes only `[object]` in IE8/9,
2045
+ // ('' + value) makes it output the correct toString()-value.
2046
+ node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
2047
+ } else {
2048
+ var propName = DOMProperty.getPropertyName[name];
2049
+ // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
2050
+ // property type before comparing; only `value` does and is string.
2051
+ if (!DOMProperty.hasSideEffects[name] ||
2052
+ ('' + node[propName]) !== ('' + value)) {
2053
+ // Contrary to `setAttribute`, object properties are properly
2054
+ // `toString`ed by IE8/9.
2055
+ node[propName] = value;
2056
+ }
2057
+ }
2058
+ } else if (DOMProperty.isCustomAttribute(name)) {
2059
+ if (value == null) {
2060
+ node.removeAttribute(name);
2061
+ } else {
2062
+ node.setAttribute(name, '' + value);
2063
+ }
2064
+ } else if ("production" !== "development") {
2065
+ warnUnknownProperty(name);
2066
+ }
2067
+ },
2068
+
2069
+ /**
2070
+ * Deletes the value for a property on a node.
2071
+ *
2072
+ * @param {DOMElement} node
2073
+ * @param {string} name
2074
+ */
2075
+ deleteValueForProperty: function(node, name) {
2076
+ if (DOMProperty.isStandardName.hasOwnProperty(name) &&
2077
+ DOMProperty.isStandardName[name]) {
2078
+ var mutationMethod = DOMProperty.getMutationMethod[name];
2079
+ if (mutationMethod) {
2080
+ mutationMethod(node, undefined);
2081
+ } else if (DOMProperty.mustUseAttribute[name]) {
2082
+ node.removeAttribute(DOMProperty.getAttributeName[name]);
2083
+ } else {
2084
+ var propName = DOMProperty.getPropertyName[name];
2085
+ var defaultValue = DOMProperty.getDefaultValueForProperty(
2086
+ node.nodeName,
2087
+ propName
2088
+ );
2089
+ if (!DOMProperty.hasSideEffects[name] ||
2090
+ ('' + node[propName]) !== defaultValue) {
2091
+ node[propName] = defaultValue;
2092
+ }
2093
+ }
2094
+ } else if (DOMProperty.isCustomAttribute(name)) {
2095
+ node.removeAttribute(name);
2096
+ } else if ("production" !== "development") {
2097
+ warnUnknownProperty(name);
2098
+ }
2099
+ }
2100
+
2101
+};
2102
+
2103
+module.exports = DOMPropertyOperations;
2104
+
2105
+},{"10":10,"147":147,"154":154}],12:[function(_dereq_,module,exports){
2106
+/**
2107
+ * Copyright 2013-2015, Facebook, Inc.
2108
+ * All rights reserved.
2109
+ *
2110
+ * This source code is licensed under the BSD-style license found in the
2111
+ * LICENSE file in the root directory of this source tree. An additional grant
2112
+ * of patent rights can be found in the PATENTS file in the same directory.
2113
+ *
2114
+ * @providesModule Danger
2115
+ * @typechecks static-only
2116
+ */
2117
+
2118
+/*jslint evil: true, sub: true */
2119
+
2120
+'use strict';
2121
+
2122
+var ExecutionEnvironment = _dereq_(21);
2123
+
2124
+var createNodesFromMarkup = _dereq_(112);
2125
+var emptyFunction = _dereq_(114);
2126
+var getMarkupWrap = _dereq_(127);
2127
+var invariant = _dereq_(135);
2128
+
2129
+var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
2130
+var RESULT_INDEX_ATTR = 'data-danger-index';
2131
+
2132
+/**
2133
+ * Extracts the `nodeName` from a string of markup.
2134
+ *
2135
+ * NOTE: Extracting the `nodeName` does not require a regular expression match
2136
+ * because we make assumptions about React-generated markup (i.e. there are no
2137
+ * spaces surrounding the opening tag and there is at least one attribute).
2138
+ *
2139
+ * @param {string} markup String of markup.
2140
+ * @return {string} Node name of the supplied markup.
2141
+ * @see http://jsperf.com/extract-nodename
2142
+ */
2143
+function getNodeName(markup) {
2144
+ return markup.substring(1, markup.indexOf(' '));
2145
+}
2146
+
2147
+var Danger = {
2148
+
2149
+ /**
2150
+ * Renders markup into an array of nodes. The markup is expected to render
2151
+ * into a list of root nodes. Also, the length of `resultList` and
2152
+ * `markupList` should be the same.
2153
+ *
2154
+ * @param {array<string>} markupList List of markup strings to render.
2155
+ * @return {array<DOMElement>} List of rendered nodes.
2156
+ * @internal
2157
+ */
2158
+ dangerouslyRenderMarkup: function(markupList) {
2159
+ ("production" !== "development" ? invariant(
2160
+ ExecutionEnvironment.canUseDOM,
2161
+ 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
2162
+ 'thread. Make sure `window` and `document` are available globally ' +
2163
+ 'before requiring React when unit testing or use ' +
2164
+ 'React.renderToString for server rendering.'
2165
+ ) : invariant(ExecutionEnvironment.canUseDOM));
2166
+ var nodeName;
2167
+ var markupByNodeName = {};
2168
+ // Group markup by `nodeName` if a wrap is necessary, else by '*'.
2169
+ for (var i = 0; i < markupList.length; i++) {
2170
+ ("production" !== "development" ? invariant(
2171
+ markupList[i],
2172
+ 'dangerouslyRenderMarkup(...): Missing markup.'
2173
+ ) : invariant(markupList[i]));
2174
+ nodeName = getNodeName(markupList[i]);
2175
+ nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
2176
+ markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
2177
+ markupByNodeName[nodeName][i] = markupList[i];
2178
+ }
2179
+ var resultList = [];
2180
+ var resultListAssignmentCount = 0;
2181
+ for (nodeName in markupByNodeName) {
2182
+ if (!markupByNodeName.hasOwnProperty(nodeName)) {
2183
+ continue;
2184
+ }
2185
+ var markupListByNodeName = markupByNodeName[nodeName];
2186
+
2187
+ // This for-in loop skips the holes of the sparse array. The order of
2188
+ // iteration should follow the order of assignment, which happens to match
2189
+ // numerical index order, but we don't rely on that.
2190
+ var resultIndex;
2191
+ for (resultIndex in markupListByNodeName) {
2192
+ if (markupListByNodeName.hasOwnProperty(resultIndex)) {
2193
+ var markup = markupListByNodeName[resultIndex];
2194
+
2195
+ // Push the requested markup with an additional RESULT_INDEX_ATTR
2196
+ // attribute. If the markup does not start with a < character, it
2197
+ // will be discarded below (with an appropriate console.error).
2198
+ markupListByNodeName[resultIndex] = markup.replace(
2199
+ OPEN_TAG_NAME_EXP,
2200
+ // This index will be parsed back out below.
2201
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
2202
+ );
2203
+ }
2204
+ }
2205
+
2206
+ // Render each group of markup with similar wrapping `nodeName`.
2207
+ var renderNodes = createNodesFromMarkup(
2208
+ markupListByNodeName.join(''),
2209
+ emptyFunction // Do nothing special with <script> tags.
2210
+ );
2211
+
2212
+ for (var j = 0; j < renderNodes.length; ++j) {
2213
+ var renderNode = renderNodes[j];
2214
+ if (renderNode.hasAttribute &&
2215
+ renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
2216
+
2217
+ resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
2218
+ renderNode.removeAttribute(RESULT_INDEX_ATTR);
2219
+
2220
+ ("production" !== "development" ? invariant(
2221
+ !resultList.hasOwnProperty(resultIndex),
2222
+ 'Danger: Assigning to an already-occupied result index.'
2223
+ ) : invariant(!resultList.hasOwnProperty(resultIndex)));
2224
+
2225
+ resultList[resultIndex] = renderNode;
2226
+
2227
+ // This should match resultList.length and markupList.length when
2228
+ // we're done.
2229
+ resultListAssignmentCount += 1;
2230
+
2231
+ } else if ("production" !== "development") {
2232
+ console.error(
2233
+ 'Danger: Discarding unexpected node:',
2234
+ renderNode
2235
+ );
2236
+ }
2237
+ }
2238
+ }
2239
+
2240
+ // Although resultList was populated out of order, it should now be a dense
2241
+ // array.
2242
+ ("production" !== "development" ? invariant(
2243
+ resultListAssignmentCount === resultList.length,
2244
+ 'Danger: Did not assign to every index of resultList.'
2245
+ ) : invariant(resultListAssignmentCount === resultList.length));
2246
+
2247
+ ("production" !== "development" ? invariant(
2248
+ resultList.length === markupList.length,
2249
+ 'Danger: Expected markup to render %s nodes, but rendered %s.',
2250
+ markupList.length,
2251
+ resultList.length
2252
+ ) : invariant(resultList.length === markupList.length));
2253
+
2254
+ return resultList;
2255
+ },
2256
+
2257
+ /**
2258
+ * Replaces a node with a string of markup at its current position within its
2259
+ * parent. The markup must render into a single root node.
2260
+ *
2261
+ * @param {DOMElement} oldChild Child node to replace.
2262
+ * @param {string} markup Markup to render in place of the child node.
2263
+ * @internal
2264
+ */
2265
+ dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
2266
+ ("production" !== "development" ? invariant(
2267
+ ExecutionEnvironment.canUseDOM,
2268
+ 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
2269
+ 'worker thread. Make sure `window` and `document` are available ' +
2270
+ 'globally before requiring React when unit testing or use ' +
2271
+ 'React.renderToString for server rendering.'
2272
+ ) : invariant(ExecutionEnvironment.canUseDOM));
2273
+ ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
2274
+ ("production" !== "development" ? invariant(
2275
+ oldChild.tagName.toLowerCase() !== 'html',
2276
+ 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
2277
+ '<html> node. This is because browser quirks make this unreliable ' +
2278
+ 'and/or slow. If you want to render to the root you must use ' +
2279
+ 'server rendering. See React.renderToString().'
2280
+ ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
2281
+
2282
+ var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
2283
+ oldChild.parentNode.replaceChild(newChild, oldChild);
2284
+ }
2285
+
2286
+};
2287
+
2288
+module.exports = Danger;
2289
+
2290
+},{"112":112,"114":114,"127":127,"135":135,"21":21}],13:[function(_dereq_,module,exports){
2291
+/**
2292
+ * Copyright 2013-2015, Facebook, Inc.
2293
+ * All rights reserved.
2294
+ *
2295
+ * This source code is licensed under the BSD-style license found in the
2296
+ * LICENSE file in the root directory of this source tree. An additional grant
2297
+ * of patent rights can be found in the PATENTS file in the same directory.
2298
+ *
2299
+ * @providesModule DefaultEventPluginOrder
2300
+ */
2301
+
2302
+'use strict';
2303
+
2304
+var keyOf = _dereq_(141);
2305
+
2306
+/**
2307
+ * Module that is injectable into `EventPluginHub`, that specifies a
2308
+ * deterministic ordering of `EventPlugin`s. A convenient way to reason about
2309
+ * plugins, without having to package every one of them. This is better than
2310
+ * having plugins be ordered in the same order that they are injected because
2311
+ * that ordering would be influenced by the packaging order.
2312
+ * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
2313
+ * preventing default on events is convenient in `SimpleEventPlugin` handlers.
2314
+ */
2315
+var DefaultEventPluginOrder = [
2316
+ keyOf({ResponderEventPlugin: null}),
2317
+ keyOf({SimpleEventPlugin: null}),
2318
+ keyOf({TapEventPlugin: null}),
2319
+ keyOf({EnterLeaveEventPlugin: null}),
2320
+ keyOf({ChangeEventPlugin: null}),
2321
+ keyOf({SelectEventPlugin: null}),
2322
+ keyOf({BeforeInputEventPlugin: null}),
2323
+ keyOf({AnalyticsEventPlugin: null}),
2324
+ keyOf({MobileSafariClickEventPlugin: null})
2325
+];
2326
+
2327
+module.exports = DefaultEventPluginOrder;
2328
+
2329
+},{"141":141}],14:[function(_dereq_,module,exports){
2330
+/**
2331
+ * Copyright 2013-2015, Facebook, Inc.
2332
+ * All rights reserved.
2333
+ *
2334
+ * This source code is licensed under the BSD-style license found in the
2335
+ * LICENSE file in the root directory of this source tree. An additional grant
2336
+ * of patent rights can be found in the PATENTS file in the same directory.
2337
+ *
2338
+ * @providesModule EnterLeaveEventPlugin
2339
+ * @typechecks static-only
2340
+ */
2341
+
2342
+'use strict';
2343
+
2344
+var EventConstants = _dereq_(15);
2345
+var EventPropagators = _dereq_(20);
2346
+var SyntheticMouseEvent = _dereq_(99);
2347
+
2348
+var ReactMount = _dereq_(70);
2349
+var keyOf = _dereq_(141);
2350
+
2351
+var topLevelTypes = EventConstants.topLevelTypes;
2352
+var getFirstReactDOM = ReactMount.getFirstReactDOM;
2353
+
2354
+var eventTypes = {
2355
+ mouseEnter: {
2356
+ registrationName: keyOf({onMouseEnter: null}),
2357
+ dependencies: [
2358
+ topLevelTypes.topMouseOut,
2359
+ topLevelTypes.topMouseOver
2360
+ ]
2361
+ },
2362
+ mouseLeave: {
2363
+ registrationName: keyOf({onMouseLeave: null}),
2364
+ dependencies: [
2365
+ topLevelTypes.topMouseOut,
2366
+ topLevelTypes.topMouseOver
2367
+ ]
2368
+ }
2369
+};
2370
+
2371
+var extractedEvents = [null, null];
2372
+
2373
+var EnterLeaveEventPlugin = {
2374
+
2375
+ eventTypes: eventTypes,
2376
+
2377
+ /**
2378
+ * For almost every interaction we care about, there will be both a top-level
2379
+ * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
2380
+ * we do not extract duplicate events. However, moving the mouse into the
2381
+ * browser from outside will not fire a `mouseout` event. In this case, we use
2382
+ * the `mouseover` top-level event.
2383
+ *
2384
+ * @param {string} topLevelType Record from `EventConstants`.
2385
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
2386
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
2387
+ * @param {object} nativeEvent Native browser event.
2388
+ * @return {*} An accumulation of synthetic events.
2389
+ * @see {EventPluginHub.extractEvents}
2390
+ */
2391
+ extractEvents: function(
2392
+ topLevelType,
2393
+ topLevelTarget,
2394
+ topLevelTargetID,
2395
+ nativeEvent) {
2396
+ if (topLevelType === topLevelTypes.topMouseOver &&
2397
+ (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
2398
+ return null;
2399
+ }
2400
+ if (topLevelType !== topLevelTypes.topMouseOut &&
2401
+ topLevelType !== topLevelTypes.topMouseOver) {
2402
+ // Must not be a mouse in or mouse out - ignoring.
2403
+ return null;
2404
+ }
2405
+
2406
+ var win;
2407
+ if (topLevelTarget.window === topLevelTarget) {
2408
+ // `topLevelTarget` is probably a window object.
2409
+ win = topLevelTarget;
2410
+ } else {
2411
+ // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
2412
+ var doc = topLevelTarget.ownerDocument;
2413
+ if (doc) {
2414
+ win = doc.defaultView || doc.parentWindow;
2415
+ } else {
2416
+ win = window;
2417
+ }
2418
+ }
2419
+
2420
+ var from, to;
2421
+ if (topLevelType === topLevelTypes.topMouseOut) {
2422
+ from = topLevelTarget;
2423
+ to =
2424
+ getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
2425
+ win;
2426
+ } else {
2427
+ from = win;
2428
+ to = topLevelTarget;
2429
+ }
2430
+
2431
+ if (from === to) {
2432
+ // Nothing pertains to our managed components.
2433
+ return null;
2434
+ }
2435
+
2436
+ var fromID = from ? ReactMount.getID(from) : '';
2437
+ var toID = to ? ReactMount.getID(to) : '';
2438
+
2439
+ var leave = SyntheticMouseEvent.getPooled(
2440
+ eventTypes.mouseLeave,
2441
+ fromID,
2442
+ nativeEvent
2443
+ );
2444
+ leave.type = 'mouseleave';
2445
+ leave.target = from;
2446
+ leave.relatedTarget = to;
2447
+
2448
+ var enter = SyntheticMouseEvent.getPooled(
2449
+ eventTypes.mouseEnter,
2450
+ toID,
2451
+ nativeEvent
2452
+ );
2453
+ enter.type = 'mouseenter';
2454
+ enter.target = to;
2455
+ enter.relatedTarget = from;
2456
+
2457
+ EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
2458
+
2459
+ extractedEvents[0] = leave;
2460
+ extractedEvents[1] = enter;
2461
+
2462
+ return extractedEvents;
2463
+ }
2464
+
2465
+};
2466
+
2467
+module.exports = EnterLeaveEventPlugin;
2468
+
2469
+},{"141":141,"15":15,"20":20,"70":70,"99":99}],15:[function(_dereq_,module,exports){
2470
+/**
2471
+ * Copyright 2013-2015, Facebook, Inc.
2472
+ * All rights reserved.
2473
+ *
2474
+ * This source code is licensed under the BSD-style license found in the
2475
+ * LICENSE file in the root directory of this source tree. An additional grant
2476
+ * of patent rights can be found in the PATENTS file in the same directory.
2477
+ *
2478
+ * @providesModule EventConstants
2479
+ */
2480
+
2481
+'use strict';
2482
+
2483
+var keyMirror = _dereq_(140);
2484
+
2485
+var PropagationPhases = keyMirror({bubbled: null, captured: null});
2486
+
2487
+/**
2488
+ * Types of raw signals from the browser caught at the top level.
2489
+ */
2490
+var topLevelTypes = keyMirror({
2491
+ topBlur: null,
2492
+ topChange: null,
2493
+ topClick: null,
2494
+ topCompositionEnd: null,
2495
+ topCompositionStart: null,
2496
+ topCompositionUpdate: null,
2497
+ topContextMenu: null,
2498
+ topCopy: null,
2499
+ topCut: null,
2500
+ topDoubleClick: null,
2501
+ topDrag: null,
2502
+ topDragEnd: null,
2503
+ topDragEnter: null,
2504
+ topDragExit: null,
2505
+ topDragLeave: null,
2506
+ topDragOver: null,
2507
+ topDragStart: null,
2508
+ topDrop: null,
2509
+ topError: null,
2510
+ topFocus: null,
2511
+ topInput: null,
2512
+ topKeyDown: null,
2513
+ topKeyPress: null,
2514
+ topKeyUp: null,
2515
+ topLoad: null,
2516
+ topMouseDown: null,
2517
+ topMouseMove: null,
2518
+ topMouseOut: null,
2519
+ topMouseOver: null,
2520
+ topMouseUp: null,
2521
+ topPaste: null,
2522
+ topReset: null,
2523
+ topScroll: null,
2524
+ topSelectionChange: null,
2525
+ topSubmit: null,
2526
+ topTextInput: null,
2527
+ topTouchCancel: null,
2528
+ topTouchEnd: null,
2529
+ topTouchMove: null,
2530
+ topTouchStart: null,
2531
+ topWheel: null
2532
+});
2533
+
2534
+var EventConstants = {
2535
+ topLevelTypes: topLevelTypes,
2536
+ PropagationPhases: PropagationPhases
2537
+};
2538
+
2539
+module.exports = EventConstants;
2540
+
2541
+},{"140":140}],16:[function(_dereq_,module,exports){
2542
+/**
2543
+ * Copyright 2013-2015, Facebook, Inc.
2544
+ *
2545
+ * Licensed under the Apache License, Version 2.0 (the "License");
2546
+ * you may not use this file except in compliance with the License.
2547
+ * You may obtain a copy of the License at
2548
+ *
2549
+ * http://www.apache.org/licenses/LICENSE-2.0
2550
+ *
2551
+ * Unless required by applicable law or agreed to in writing, software
2552
+ * distributed under the License is distributed on an "AS IS" BASIS,
2553
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554
+ * See the License for the specific language governing permissions and
2555
+ * limitations under the License.
2556
+ *
2557
+ * @providesModule EventListener
2558
+ * @typechecks
2559
+ */
2560
+
2561
+var emptyFunction = _dereq_(114);
2562
+
2563
+/**
2564
+ * Upstream version of event listener. Does not take into account specific
2565
+ * nature of platform.
2566
+ */
2567
+var EventListener = {
2568
+ /**
2569
+ * Listen to DOM events during the bubble phase.
2570
+ *
2571
+ * @param {DOMEventTarget} target DOM element to register listener on.
2572
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
2573
+ * @param {function} callback Callback function.
2574
+ * @return {object} Object with a `remove` method.
2575
+ */
2576
+ listen: function(target, eventType, callback) {
2577
+ if (target.addEventListener) {
2578
+ target.addEventListener(eventType, callback, false);
2579
+ return {
2580
+ remove: function() {
2581
+ target.removeEventListener(eventType, callback, false);
2582
+ }
2583
+ };
2584
+ } else if (target.attachEvent) {
2585
+ target.attachEvent('on' + eventType, callback);
2586
+ return {
2587
+ remove: function() {
2588
+ target.detachEvent('on' + eventType, callback);
2589
+ }
2590
+ };
2591
+ }
2592
+ },
2593
+
2594
+ /**
2595
+ * Listen to DOM events during the capture phase.
2596
+ *
2597
+ * @param {DOMEventTarget} target DOM element to register listener on.
2598
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
2599
+ * @param {function} callback Callback function.
2600
+ * @return {object} Object with a `remove` method.
2601
+ */
2602
+ capture: function(target, eventType, callback) {
2603
+ if (!target.addEventListener) {
2604
+ if ("production" !== "development") {
2605
+ console.error(
2606
+ 'Attempted to listen to events during the capture phase on a ' +
2607
+ 'browser that does not support the capture phase. Your application ' +
2608
+ 'will not receive some events.'
2609
+ );
2610
+ }
2611
+ return {
2612
+ remove: emptyFunction
2613
+ };
2614
+ } else {
2615
+ target.addEventListener(eventType, callback, true);
2616
+ return {
2617
+ remove: function() {
2618
+ target.removeEventListener(eventType, callback, true);
2619
+ }
2620
+ };
2621
+ }
2622
+ },
2623
+
2624
+ registerDefault: function() {}
2625
+};
2626
+
2627
+module.exports = EventListener;
2628
+
2629
+},{"114":114}],17:[function(_dereq_,module,exports){
2630
+/**
2631
+ * Copyright 2013-2015, Facebook, Inc.
2632
+ * All rights reserved.
2633
+ *
2634
+ * This source code is licensed under the BSD-style license found in the
2635
+ * LICENSE file in the root directory of this source tree. An additional grant
2636
+ * of patent rights can be found in the PATENTS file in the same directory.
2637
+ *
2638
+ * @providesModule EventPluginHub
2639
+ */
2640
+
2641
+'use strict';
2642
+
2643
+var EventPluginRegistry = _dereq_(18);
2644
+var EventPluginUtils = _dereq_(19);
2645
+
2646
+var accumulateInto = _dereq_(105);
2647
+var forEachAccumulated = _dereq_(120);
2648
+var invariant = _dereq_(135);
2649
+
2650
+/**
2651
+ * Internal store for event listeners
2652
+ */
2653
+var listenerBank = {};
2654
+
2655
+/**
2656
+ * Internal queue of events that have accumulated their dispatches and are
2657
+ * waiting to have their dispatches executed.
2658
+ */
2659
+var eventQueue = null;
2660
+
2661
+/**
2662
+ * Dispatches an event and releases it back into the pool, unless persistent.
2663
+ *
2664
+ * @param {?object} event Synthetic event to be dispatched.
2665
+ * @private
2666
+ */
2667
+var executeDispatchesAndRelease = function(event) {
2668
+ if (event) {
2669
+ var executeDispatch = EventPluginUtils.executeDispatch;
2670
+ // Plugins can provide custom behavior when dispatching events.
2671
+ var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
2672
+ if (PluginModule && PluginModule.executeDispatch) {
2673
+ executeDispatch = PluginModule.executeDispatch;
2674
+ }
2675
+ EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
2676
+
2677
+ if (!event.isPersistent()) {
2678
+ event.constructor.release(event);
2679
+ }
2680
+ }
2681
+};
2682
+
2683
+/**
2684
+ * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
2685
+ * hierarchy given ids of the logical DOM elements involved.
2686
+ */
2687
+var InstanceHandle = null;
2688
+
2689
+function validateInstanceHandle() {
2690
+ var valid =
2691
+ InstanceHandle &&
2692
+ InstanceHandle.traverseTwoPhase &&
2693
+ InstanceHandle.traverseEnterLeave;
2694
+ ("production" !== "development" ? invariant(
2695
+ valid,
2696
+ 'InstanceHandle not injected before use!'
2697
+ ) : invariant(valid));
2698
+}
2699
+
2700
+/**
2701
+ * This is a unified interface for event plugins to be installed and configured.
2702
+ *
2703
+ * Event plugins can implement the following properties:
2704
+ *
2705
+ * `extractEvents` {function(string, DOMEventTarget, string, object): *}
2706
+ * Required. When a top-level event is fired, this method is expected to
2707
+ * extract synthetic events that will in turn be queued and dispatched.
2708
+ *
2709
+ * `eventTypes` {object}
2710
+ * Optional, plugins that fire events must publish a mapping of registration
2711
+ * names that are used to register listeners. Values of this mapping must
2712
+ * be objects that contain `registrationName` or `phasedRegistrationNames`.
2713
+ *
2714
+ * `executeDispatch` {function(object, function, string)}
2715
+ * Optional, allows plugins to override how an event gets dispatched. By
2716
+ * default, the listener is simply invoked.
2717
+ *
2718
+ * Each plugin that is injected into `EventsPluginHub` is immediately operable.
2719
+ *
2720
+ * @public
2721
+ */
2722
+var EventPluginHub = {
2723
+
2724
+ /**
2725
+ * Methods for injecting dependencies.
2726
+ */
2727
+ injection: {
2728
+
2729
+ /**
2730
+ * @param {object} InjectedMount
2731
+ * @public
2732
+ */
2733
+ injectMount: EventPluginUtils.injection.injectMount,
2734
+
2735
+ /**
2736
+ * @param {object} InjectedInstanceHandle
2737
+ * @public
2738
+ */
2739
+ injectInstanceHandle: function(InjectedInstanceHandle) {
2740
+ InstanceHandle = InjectedInstanceHandle;
2741
+ if ("production" !== "development") {
2742
+ validateInstanceHandle();
2743
+ }
2744
+ },
2745
+
2746
+ getInstanceHandle: function() {
2747
+ if ("production" !== "development") {
2748
+ validateInstanceHandle();
2749
+ }
2750
+ return InstanceHandle;
2751
+ },
2752
+
2753
+ /**
2754
+ * @param {array} InjectedEventPluginOrder
2755
+ * @public
2756
+ */
2757
+ injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
2758
+
2759
+ /**
2760
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2761
+ */
2762
+ injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
2763
+
2764
+ },
2765
+
2766
+ eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
2767
+
2768
+ registrationNameModules: EventPluginRegistry.registrationNameModules,
2769
+
2770
+ /**
2771
+ * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
2772
+ *
2773
+ * @param {string} id ID of the DOM element.
2774
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
2775
+ * @param {?function} listener The callback to store.
2776
+ */
2777
+ putListener: function(id, registrationName, listener) {
2778
+ ("production" !== "development" ? invariant(
2779
+ !listener || typeof listener === 'function',
2780
+ 'Expected %s listener to be a function, instead got type %s',
2781
+ registrationName, typeof listener
2782
+ ) : invariant(!listener || typeof listener === 'function'));
2783
+
2784
+ var bankForRegistrationName =
2785
+ listenerBank[registrationName] || (listenerBank[registrationName] = {});
2786
+ bankForRegistrationName[id] = listener;
2787
+ },
2788
+
2789
+ /**
2790
+ * @param {string} id ID of the DOM element.
2791
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
2792
+ * @return {?function} The stored callback.
2793
+ */
2794
+ getListener: function(id, registrationName) {
2795
+ var bankForRegistrationName = listenerBank[registrationName];
2796
+ return bankForRegistrationName && bankForRegistrationName[id];
2797
+ },
2798
+
2799
+ /**
2800
+ * Deletes a listener from the registration bank.
2801
+ *
2802
+ * @param {string} id ID of the DOM element.
2803
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
2804
+ */
2805
+ deleteListener: function(id, registrationName) {
2806
+ var bankForRegistrationName = listenerBank[registrationName];
2807
+ if (bankForRegistrationName) {
2808
+ delete bankForRegistrationName[id];
2809
+ }
2810
+ },
2811
+
2812
+ /**
2813
+ * Deletes all listeners for the DOM element with the supplied ID.
2814
+ *
2815
+ * @param {string} id ID of the DOM element.
2816
+ */
2817
+ deleteAllListeners: function(id) {
2818
+ for (var registrationName in listenerBank) {
2819
+ delete listenerBank[registrationName][id];
2820
+ }
2821
+ },
2822
+
2823
+ /**
2824
+ * Allows registered plugins an opportunity to extract events from top-level
2825
+ * native browser events.
2826
+ *
2827
+ * @param {string} topLevelType Record from `EventConstants`.
2828
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
2829
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
2830
+ * @param {object} nativeEvent Native browser event.
2831
+ * @return {*} An accumulation of synthetic events.
2832
+ * @internal
2833
+ */
2834
+ extractEvents: function(
2835
+ topLevelType,
2836
+ topLevelTarget,
2837
+ topLevelTargetID,
2838
+ nativeEvent) {
2839
+ var events;
2840
+ var plugins = EventPluginRegistry.plugins;
2841
+ for (var i = 0, l = plugins.length; i < l; i++) {
2842
+ // Not every plugin in the ordering may be loaded at runtime.
2843
+ var possiblePlugin = plugins[i];
2844
+ if (possiblePlugin) {
2845
+ var extractedEvents = possiblePlugin.extractEvents(
2846
+ topLevelType,
2847
+ topLevelTarget,
2848
+ topLevelTargetID,
2849
+ nativeEvent
2850
+ );
2851
+ if (extractedEvents) {
2852
+ events = accumulateInto(events, extractedEvents);
2853
+ }
2854
+ }
2855
+ }
2856
+ return events;
2857
+ },
2858
+
2859
+ /**
2860
+ * Enqueues a synthetic event that should be dispatched when
2861
+ * `processEventQueue` is invoked.
2862
+ *
2863
+ * @param {*} events An accumulation of synthetic events.
2864
+ * @internal
2865
+ */
2866
+ enqueueEvents: function(events) {
2867
+ if (events) {
2868
+ eventQueue = accumulateInto(eventQueue, events);
2869
+ }
2870
+ },
2871
+
2872
+ /**
2873
+ * Dispatches all synthetic events on the event queue.
2874
+ *
2875
+ * @internal
2876
+ */
2877
+ processEventQueue: function() {
2878
+ // Set `eventQueue` to null before processing it so that we can tell if more
2879
+ // events get enqueued while processing.
2880
+ var processingEventQueue = eventQueue;
2881
+ eventQueue = null;
2882
+ forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
2883
+ ("production" !== "development" ? invariant(
2884
+ !eventQueue,
2885
+ 'processEventQueue(): Additional events were enqueued while processing ' +
2886
+ 'an event queue. Support for this has not yet been implemented.'
2887
+ ) : invariant(!eventQueue));
2888
+ },
2889
+
2890
+ /**
2891
+ * These are needed for tests only. Do not use!
2892
+ */
2893
+ __purge: function() {
2894
+ listenerBank = {};
2895
+ },
2896
+
2897
+ __getListenerBank: function() {
2898
+ return listenerBank;
2899
+ }
2900
+
2901
+};
2902
+
2903
+module.exports = EventPluginHub;
2904
+
2905
+},{"105":105,"120":120,"135":135,"18":18,"19":19}],18:[function(_dereq_,module,exports){
2906
+/**
2907
+ * Copyright 2013-2015, Facebook, Inc.
2908
+ * All rights reserved.
2909
+ *
2910
+ * This source code is licensed under the BSD-style license found in the
2911
+ * LICENSE file in the root directory of this source tree. An additional grant
2912
+ * of patent rights can be found in the PATENTS file in the same directory.
2913
+ *
2914
+ * @providesModule EventPluginRegistry
2915
+ * @typechecks static-only
2916
+ */
2917
+
2918
+'use strict';
2919
+
2920
+var invariant = _dereq_(135);
2921
+
2922
+/**
2923
+ * Injectable ordering of event plugins.
2924
+ */
2925
+var EventPluginOrder = null;
2926
+
2927
+/**
2928
+ * Injectable mapping from names to event plugin modules.
2929
+ */
2930
+var namesToPlugins = {};
2931
+
2932
+/**
2933
+ * Recomputes the plugin list using the injected plugins and plugin ordering.
2934
+ *
2935
+ * @private
2936
+ */
2937
+function recomputePluginOrdering() {
2938
+ if (!EventPluginOrder) {
2939
+ // Wait until an `EventPluginOrder` is injected.
2940
+ return;
2941
+ }
2942
+ for (var pluginName in namesToPlugins) {
2943
+ var PluginModule = namesToPlugins[pluginName];
2944
+ var pluginIndex = EventPluginOrder.indexOf(pluginName);
2945
+ ("production" !== "development" ? invariant(
2946
+ pluginIndex > -1,
2947
+ 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
2948
+ 'the plugin ordering, `%s`.',
2949
+ pluginName
2950
+ ) : invariant(pluginIndex > -1));
2951
+ if (EventPluginRegistry.plugins[pluginIndex]) {
2952
+ continue;
2953
+ }
2954
+ ("production" !== "development" ? invariant(
2955
+ PluginModule.extractEvents,
2956
+ 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
2957
+ 'method, but `%s` does not.',
2958
+ pluginName
2959
+ ) : invariant(PluginModule.extractEvents));
2960
+ EventPluginRegistry.plugins[pluginIndex] = PluginModule;
2961
+ var publishedEvents = PluginModule.eventTypes;
2962
+ for (var eventName in publishedEvents) {
2963
+ ("production" !== "development" ? invariant(
2964
+ publishEventForPlugin(
2965
+ publishedEvents[eventName],
2966
+ PluginModule,
2967
+ eventName
2968
+ ),
2969
+ 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
2970
+ eventName,
2971
+ pluginName
2972
+ ) : invariant(publishEventForPlugin(
2973
+ publishedEvents[eventName],
2974
+ PluginModule,
2975
+ eventName
2976
+ )));
2977
+ }
2978
+ }
2979
+}
2980
+
2981
+/**
2982
+ * Publishes an event so that it can be dispatched by the supplied plugin.
2983
+ *
2984
+ * @param {object} dispatchConfig Dispatch configuration for the event.
2985
+ * @param {object} PluginModule Plugin publishing the event.
2986
+ * @return {boolean} True if the event was successfully published.
2987
+ * @private
2988
+ */
2989
+function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
2990
+ ("production" !== "development" ? invariant(
2991
+ !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
2992
+ 'EventPluginHub: More than one plugin attempted to publish the same ' +
2993
+ 'event name, `%s`.',
2994
+ eventName
2995
+ ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
2996
+ EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
2997
+
2998
+ var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2999
+ if (phasedRegistrationNames) {
3000
+ for (var phaseName in phasedRegistrationNames) {
3001
+ if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
3002
+ var phasedRegistrationName = phasedRegistrationNames[phaseName];
3003
+ publishRegistrationName(
3004
+ phasedRegistrationName,
3005
+ PluginModule,
3006
+ eventName
3007
+ );
3008
+ }
3009
+ }
3010
+ return true;
3011
+ } else if (dispatchConfig.registrationName) {
3012
+ publishRegistrationName(
3013
+ dispatchConfig.registrationName,
3014
+ PluginModule,
3015
+ eventName
3016
+ );
3017
+ return true;
3018
+ }
3019
+ return false;
3020
+}
3021
+
3022
+/**
3023
+ * Publishes a registration name that is used to identify dispatched events and
3024
+ * can be used with `EventPluginHub.putListener` to register listeners.
3025
+ *
3026
+ * @param {string} registrationName Registration name to add.
3027
+ * @param {object} PluginModule Plugin publishing the event.
3028
+ * @private
3029
+ */
3030
+function publishRegistrationName(registrationName, PluginModule, eventName) {
3031
+ ("production" !== "development" ? invariant(
3032
+ !EventPluginRegistry.registrationNameModules[registrationName],
3033
+ 'EventPluginHub: More than one plugin attempted to publish the same ' +
3034
+ 'registration name, `%s`.',
3035
+ registrationName
3036
+ ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
3037
+ EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
3038
+ EventPluginRegistry.registrationNameDependencies[registrationName] =
3039
+ PluginModule.eventTypes[eventName].dependencies;
3040
+}
3041
+
3042
+/**
3043
+ * Registers plugins so that they can extract and dispatch events.
3044
+ *
3045
+ * @see {EventPluginHub}
3046
+ */
3047
+var EventPluginRegistry = {
3048
+
3049
+ /**
3050
+ * Ordered list of injected plugins.
3051
+ */
3052
+ plugins: [],
3053
+
3054
+ /**
3055
+ * Mapping from event name to dispatch config
3056
+ */
3057
+ eventNameDispatchConfigs: {},
3058
+
3059
+ /**
3060
+ * Mapping from registration name to plugin module
3061
+ */
3062
+ registrationNameModules: {},
3063
+
3064
+ /**
3065
+ * Mapping from registration name to event name
3066
+ */
3067
+ registrationNameDependencies: {},
3068
+
3069
+ /**
3070
+ * Injects an ordering of plugins (by plugin name). This allows the ordering
3071
+ * to be decoupled from injection of the actual plugins so that ordering is
3072
+ * always deterministic regardless of packaging, on-the-fly injection, etc.
3073
+ *
3074
+ * @param {array} InjectedEventPluginOrder
3075
+ * @internal
3076
+ * @see {EventPluginHub.injection.injectEventPluginOrder}
3077
+ */
3078
+ injectEventPluginOrder: function(InjectedEventPluginOrder) {
3079
+ ("production" !== "development" ? invariant(
3080
+ !EventPluginOrder,
3081
+ 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
3082
+ 'once. You are likely trying to load more than one copy of React.'
3083
+ ) : invariant(!EventPluginOrder));
3084
+ // Clone the ordering so it cannot be dynamically mutated.
3085
+ EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
3086
+ recomputePluginOrdering();
3087
+ },
3088
+
3089
+ /**
3090
+ * Injects plugins to be used by `EventPluginHub`. The plugin names must be
3091
+ * in the ordering injected by `injectEventPluginOrder`.
3092
+ *
3093
+ * Plugins can be injected as part of page initialization or on-the-fly.
3094
+ *
3095
+ * @param {object} injectedNamesToPlugins Map from names to plugin modules.
3096
+ * @internal
3097
+ * @see {EventPluginHub.injection.injectEventPluginsByName}
3098
+ */
3099
+ injectEventPluginsByName: function(injectedNamesToPlugins) {
3100
+ var isOrderingDirty = false;
3101
+ for (var pluginName in injectedNamesToPlugins) {
3102
+ if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
3103
+ continue;
3104
+ }
3105
+ var PluginModule = injectedNamesToPlugins[pluginName];
3106
+ if (!namesToPlugins.hasOwnProperty(pluginName) ||
3107
+ namesToPlugins[pluginName] !== PluginModule) {
3108
+ ("production" !== "development" ? invariant(
3109
+ !namesToPlugins[pluginName],
3110
+ 'EventPluginRegistry: Cannot inject two different event plugins ' +
3111
+ 'using the same name, `%s`.',
3112
+ pluginName
3113
+ ) : invariant(!namesToPlugins[pluginName]));
3114
+ namesToPlugins[pluginName] = PluginModule;
3115
+ isOrderingDirty = true;
3116
+ }
3117
+ }
3118
+ if (isOrderingDirty) {
3119
+ recomputePluginOrdering();
3120
+ }
3121
+ },
3122
+
3123
+ /**
3124
+ * Looks up the plugin for the supplied event.
3125
+ *
3126
+ * @param {object} event A synthetic event.
3127
+ * @return {?object} The plugin that created the supplied event.
3128
+ * @internal
3129
+ */
3130
+ getPluginModuleForEvent: function(event) {
3131
+ var dispatchConfig = event.dispatchConfig;
3132
+ if (dispatchConfig.registrationName) {
3133
+ return EventPluginRegistry.registrationNameModules[
3134
+ dispatchConfig.registrationName
3135
+ ] || null;
3136
+ }
3137
+ for (var phase in dispatchConfig.phasedRegistrationNames) {
3138
+ if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
3139
+ continue;
3140
+ }
3141
+ var PluginModule = EventPluginRegistry.registrationNameModules[
3142
+ dispatchConfig.phasedRegistrationNames[phase]
3143
+ ];
3144
+ if (PluginModule) {
3145
+ return PluginModule;
3146
+ }
3147
+ }
3148
+ return null;
3149
+ },
3150
+
3151
+ /**
3152
+ * Exposed for unit testing.
3153
+ * @private
3154
+ */
3155
+ _resetEventPlugins: function() {
3156
+ EventPluginOrder = null;
3157
+ for (var pluginName in namesToPlugins) {
3158
+ if (namesToPlugins.hasOwnProperty(pluginName)) {
3159
+ delete namesToPlugins[pluginName];
3160
+ }
3161
+ }
3162
+ EventPluginRegistry.plugins.length = 0;
3163
+
3164
+ var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
3165
+ for (var eventName in eventNameDispatchConfigs) {
3166
+ if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
3167
+ delete eventNameDispatchConfigs[eventName];
3168
+ }
3169
+ }
3170
+
3171
+ var registrationNameModules = EventPluginRegistry.registrationNameModules;
3172
+ for (var registrationName in registrationNameModules) {
3173
+ if (registrationNameModules.hasOwnProperty(registrationName)) {
3174
+ delete registrationNameModules[registrationName];
3175
+ }
3176
+ }
3177
+ }
3178
+
3179
+};
3180
+
3181
+module.exports = EventPluginRegistry;
3182
+
3183
+},{"135":135}],19:[function(_dereq_,module,exports){
3184
+/**
3185
+ * Copyright 2013-2015, Facebook, Inc.
3186
+ * All rights reserved.
3187
+ *
3188
+ * This source code is licensed under the BSD-style license found in the
3189
+ * LICENSE file in the root directory of this source tree. An additional grant
3190
+ * of patent rights can be found in the PATENTS file in the same directory.
3191
+ *
3192
+ * @providesModule EventPluginUtils
3193
+ */
3194
+
3195
+'use strict';
3196
+
3197
+var EventConstants = _dereq_(15);
3198
+
3199
+var invariant = _dereq_(135);
3200
+
3201
+/**
3202
+ * Injected dependencies:
3203
+ */
3204
+
3205
+/**
3206
+ * - `Mount`: [required] Module that can convert between React dom IDs and
3207
+ * actual node references.
3208
+ */
3209
+var injection = {
3210
+ Mount: null,
3211
+ injectMount: function(InjectedMount) {
3212
+ injection.Mount = InjectedMount;
3213
+ if ("production" !== "development") {
3214
+ ("production" !== "development" ? invariant(
3215
+ InjectedMount && InjectedMount.getNode,
3216
+ 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
3217
+ 'is missing getNode.'
3218
+ ) : invariant(InjectedMount && InjectedMount.getNode));
3219
+ }
3220
+ }
3221
+};
3222
+
3223
+var topLevelTypes = EventConstants.topLevelTypes;
3224
+
3225
+function isEndish(topLevelType) {
3226
+ return topLevelType === topLevelTypes.topMouseUp ||
3227
+ topLevelType === topLevelTypes.topTouchEnd ||
3228
+ topLevelType === topLevelTypes.topTouchCancel;
3229
+}
3230
+
3231
+function isMoveish(topLevelType) {
3232
+ return topLevelType === topLevelTypes.topMouseMove ||
3233
+ topLevelType === topLevelTypes.topTouchMove;
3234
+}
3235
+function isStartish(topLevelType) {
3236
+ return topLevelType === topLevelTypes.topMouseDown ||
3237
+ topLevelType === topLevelTypes.topTouchStart;
3238
+}
3239
+
3240
+
3241
+var validateEventDispatches;
3242
+if ("production" !== "development") {
3243
+ validateEventDispatches = function(event) {
3244
+ var dispatchListeners = event._dispatchListeners;
3245
+ var dispatchIDs = event._dispatchIDs;
3246
+
3247
+ var listenersIsArr = Array.isArray(dispatchListeners);
3248
+ var idsIsArr = Array.isArray(dispatchIDs);
3249
+ var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
3250
+ var listenersLen = listenersIsArr ?
3251
+ dispatchListeners.length :
3252
+ dispatchListeners ? 1 : 0;
3253
+
3254
+ ("production" !== "development" ? invariant(
3255
+ idsIsArr === listenersIsArr && IDsLen === listenersLen,
3256
+ 'EventPluginUtils: Invalid `event`.'
3257
+ ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
3258
+ };
3259
+}
3260
+
3261
+/**
3262
+ * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
3263
+ * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
3264
+ * kept separate to conserve memory.
3265
+ */
3266
+function forEachEventDispatch(event, cb) {
3267
+ var dispatchListeners = event._dispatchListeners;
3268
+ var dispatchIDs = event._dispatchIDs;
3269
+ if ("production" !== "development") {
3270
+ validateEventDispatches(event);
3271
+ }
3272
+ if (Array.isArray(dispatchListeners)) {
3273
+ for (var i = 0; i < dispatchListeners.length; i++) {
3274
+ if (event.isPropagationStopped()) {
3275
+ break;
3276
+ }
3277
+ // Listeners and IDs are two parallel arrays that are always in sync.
3278
+ cb(event, dispatchListeners[i], dispatchIDs[i]);
3279
+ }
3280
+ } else if (dispatchListeners) {
3281
+ cb(event, dispatchListeners, dispatchIDs);
3282
+ }
3283
+}
3284
+
3285
+/**
3286
+ * Default implementation of PluginModule.executeDispatch().
3287
+ * @param {SyntheticEvent} SyntheticEvent to handle
3288
+ * @param {function} Application-level callback
3289
+ * @param {string} domID DOM id to pass to the callback.
3290
+ */
3291
+function executeDispatch(event, listener, domID) {
3292
+ event.currentTarget = injection.Mount.getNode(domID);
3293
+ var returnValue = listener(event, domID);
3294
+ event.currentTarget = null;
3295
+ return returnValue;
3296
+}
3297
+
3298
+/**
3299
+ * Standard/simple iteration through an event's collected dispatches.
3300
+ */
3301
+function executeDispatchesInOrder(event, cb) {
3302
+ forEachEventDispatch(event, cb);
3303
+ event._dispatchListeners = null;
3304
+ event._dispatchIDs = null;
3305
+}
3306
+
3307
+/**
3308
+ * Standard/simple iteration through an event's collected dispatches, but stops
3309
+ * at the first dispatch execution returning true, and returns that id.
3310
+ *
3311
+ * @return id of the first dispatch execution who's listener returns true, or
3312
+ * null if no listener returned true.
3313
+ */
3314
+function executeDispatchesInOrderStopAtTrueImpl(event) {
3315
+ var dispatchListeners = event._dispatchListeners;
3316
+ var dispatchIDs = event._dispatchIDs;
3317
+ if ("production" !== "development") {
3318
+ validateEventDispatches(event);
3319
+ }
3320
+ if (Array.isArray(dispatchListeners)) {
3321
+ for (var i = 0; i < dispatchListeners.length; i++) {
3322
+ if (event.isPropagationStopped()) {
3323
+ break;
3324
+ }
3325
+ // Listeners and IDs are two parallel arrays that are always in sync.
3326
+ if (dispatchListeners[i](event, dispatchIDs[i])) {
3327
+ return dispatchIDs[i];
3328
+ }
3329
+ }
3330
+ } else if (dispatchListeners) {
3331
+ if (dispatchListeners(event, dispatchIDs)) {
3332
+ return dispatchIDs;
3333
+ }
3334
+ }
3335
+ return null;
3336
+}
3337
+
3338
+/**
3339
+ * @see executeDispatchesInOrderStopAtTrueImpl
3340
+ */
3341
+function executeDispatchesInOrderStopAtTrue(event) {
3342
+ var ret = executeDispatchesInOrderStopAtTrueImpl(event);
3343
+ event._dispatchIDs = null;
3344
+ event._dispatchListeners = null;
3345
+ return ret;
3346
+}
3347
+
3348
+/**
3349
+ * Execution of a "direct" dispatch - there must be at most one dispatch
3350
+ * accumulated on the event or it is considered an error. It doesn't really make
3351
+ * sense for an event with multiple dispatches (bubbled) to keep track of the
3352
+ * return values at each dispatch execution, but it does tend to make sense when
3353
+ * dealing with "direct" dispatches.
3354
+ *
3355
+ * @return The return value of executing the single dispatch.
3356
+ */
3357
+function executeDirectDispatch(event) {
3358
+ if ("production" !== "development") {
3359
+ validateEventDispatches(event);
3360
+ }
3361
+ var dispatchListener = event._dispatchListeners;
3362
+ var dispatchID = event._dispatchIDs;
3363
+ ("production" !== "development" ? invariant(
3364
+ !Array.isArray(dispatchListener),
3365
+ 'executeDirectDispatch(...): Invalid `event`.'
3366
+ ) : invariant(!Array.isArray(dispatchListener)));
3367
+ var res = dispatchListener ?
3368
+ dispatchListener(event, dispatchID) :
3369
+ null;
3370
+ event._dispatchListeners = null;
3371
+ event._dispatchIDs = null;
3372
+ return res;
3373
+}
3374
+
3375
+/**
3376
+ * @param {SyntheticEvent} event
3377
+ * @return {bool} True iff number of dispatches accumulated is greater than 0.
3378
+ */
3379
+function hasDispatches(event) {
3380
+ return !!event._dispatchListeners;
3381
+}
3382
+
3383
+/**
3384
+ * General utilities that are useful in creating custom Event Plugins.
3385
+ */
3386
+var EventPluginUtils = {
3387
+ isEndish: isEndish,
3388
+ isMoveish: isMoveish,
3389
+ isStartish: isStartish,
3390
+
3391
+ executeDirectDispatch: executeDirectDispatch,
3392
+ executeDispatch: executeDispatch,
3393
+ executeDispatchesInOrder: executeDispatchesInOrder,
3394
+ executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
3395
+ hasDispatches: hasDispatches,
3396
+ injection: injection,
3397
+ useTouchEvents: false
3398
+};
3399
+
3400
+module.exports = EventPluginUtils;
3401
+
3402
+},{"135":135,"15":15}],20:[function(_dereq_,module,exports){
3403
+/**
3404
+ * Copyright 2013-2015, Facebook, Inc.
3405
+ * All rights reserved.
3406
+ *
3407
+ * This source code is licensed under the BSD-style license found in the
3408
+ * LICENSE file in the root directory of this source tree. An additional grant
3409
+ * of patent rights can be found in the PATENTS file in the same directory.
3410
+ *
3411
+ * @providesModule EventPropagators
3412
+ */
3413
+
3414
+'use strict';
3415
+
3416
+var EventConstants = _dereq_(15);
3417
+var EventPluginHub = _dereq_(17);
3418
+
3419
+var accumulateInto = _dereq_(105);
3420
+var forEachAccumulated = _dereq_(120);
3421
+
3422
+var PropagationPhases = EventConstants.PropagationPhases;
3423
+var getListener = EventPluginHub.getListener;
3424
+
3425
+/**
3426
+ * Some event types have a notion of different registration names for different
3427
+ * "phases" of propagation. This finds listeners by a given phase.
3428
+ */
3429
+function listenerAtPhase(id, event, propagationPhase) {
3430
+ var registrationName =
3431
+ event.dispatchConfig.phasedRegistrationNames[propagationPhase];
3432
+ return getListener(id, registrationName);
3433
+}
3434
+
3435
+/**
3436
+ * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
3437
+ * here, allows us to not have to bind or create functions for each event.
3438
+ * Mutating the event's members allows us to not have to create a wrapping
3439
+ * "dispatch" object that pairs the event with the listener.
3440
+ */
3441
+function accumulateDirectionalDispatches(domID, upwards, event) {
3442
+ if ("production" !== "development") {
3443
+ if (!domID) {
3444
+ throw new Error('Dispatching id must not be null');
3445
+ }
3446
+ }
3447
+ var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
3448
+ var listener = listenerAtPhase(domID, event, phase);
3449
+ if (listener) {
3450
+ event._dispatchListeners =
3451
+ accumulateInto(event._dispatchListeners, listener);
3452
+ event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
3453
+ }
3454
+}
3455
+
3456
+/**
3457
+ * Collect dispatches (must be entirely collected before dispatching - see unit
3458
+ * tests). Lazily allocate the array to conserve memory. We must loop through
3459
+ * each event and perform the traversal for each one. We can not perform a
3460
+ * single traversal for the entire collection of events because each event may
3461
+ * have a different target.
3462
+ */
3463
+function accumulateTwoPhaseDispatchesSingle(event) {
3464
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
3465
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
3466
+ event.dispatchMarker,
3467
+ accumulateDirectionalDispatches,
3468
+ event
3469
+ );
3470
+ }
3471
+}
3472
+
3473
+
3474
+/**
3475
+ * Accumulates without regard to direction, does not look for phased
3476
+ * registration names. Same as `accumulateDirectDispatchesSingle` but without
3477
+ * requiring that the `dispatchMarker` be the same as the dispatched ID.
3478
+ */
3479
+function accumulateDispatches(id, ignoredDirection, event) {
3480
+ if (event && event.dispatchConfig.registrationName) {
3481
+ var registrationName = event.dispatchConfig.registrationName;
3482
+ var listener = getListener(id, registrationName);
3483
+ if (listener) {
3484
+ event._dispatchListeners =
3485
+ accumulateInto(event._dispatchListeners, listener);
3486
+ event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
3487
+ }
3488
+ }
3489
+}
3490
+
3491
+/**
3492
+ * Accumulates dispatches on an `SyntheticEvent`, but only for the
3493
+ * `dispatchMarker`.
3494
+ * @param {SyntheticEvent} event
3495
+ */
3496
+function accumulateDirectDispatchesSingle(event) {
3497
+ if (event && event.dispatchConfig.registrationName) {
3498
+ accumulateDispatches(event.dispatchMarker, null, event);
3499
+ }
3500
+}
3501
+
3502
+function accumulateTwoPhaseDispatches(events) {
3503
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
3504
+}
3505
+
3506
+function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
3507
+ EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
3508
+ fromID,
3509
+ toID,
3510
+ accumulateDispatches,
3511
+ leave,
3512
+ enter
3513
+ );
3514
+}
3515
+
3516
+
3517
+function accumulateDirectDispatches(events) {
3518
+ forEachAccumulated(events, accumulateDirectDispatchesSingle);
3519
+}
3520
+
3521
+
3522
+
3523
+/**
3524
+ * A small set of propagation patterns, each of which will accept a small amount
3525
+ * of information, and generate a set of "dispatch ready event objects" - which
3526
+ * are sets of events that have already been annotated with a set of dispatched
3527
+ * listener functions/ids. The API is designed this way to discourage these
3528
+ * propagation strategies from actually executing the dispatches, since we
3529
+ * always want to collect the entire set of dispatches before executing event a
3530
+ * single one.
3531
+ *
3532
+ * @constructor EventPropagators
3533
+ */
3534
+var EventPropagators = {
3535
+ accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
3536
+ accumulateDirectDispatches: accumulateDirectDispatches,
3537
+ accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
3538
+};
3539
+
3540
+module.exports = EventPropagators;
3541
+
3542
+},{"105":105,"120":120,"15":15,"17":17}],21:[function(_dereq_,module,exports){
3543
+/**
3544
+ * Copyright 2013-2015, Facebook, Inc.
3545
+ * All rights reserved.
3546
+ *
3547
+ * This source code is licensed under the BSD-style license found in the
3548
+ * LICENSE file in the root directory of this source tree. An additional grant
3549
+ * of patent rights can be found in the PATENTS file in the same directory.
3550
+ *
3551
+ * @providesModule ExecutionEnvironment
3552
+ */
3553
+
3554
+/*jslint evil: true */
3555
+
3556
+"use strict";
3557
+
3558
+var canUseDOM = !!(
3559
+ (typeof window !== 'undefined' &&
3560
+ window.document && window.document.createElement)
3561
+);
3562
+
3563
+/**
3564
+ * Simple, lightweight module assisting with the detection and context of
3565
+ * Worker. Helps avoid circular dependencies and allows code to reason about
3566
+ * whether or not they are in a Worker, even if they never include the main
3567
+ * `ReactWorker` dependency.
3568
+ */
3569
+var ExecutionEnvironment = {
3570
+
3571
+ canUseDOM: canUseDOM,
3572
+
3573
+ canUseWorkers: typeof Worker !== 'undefined',
3574
+
3575
+ canUseEventListeners:
3576
+ canUseDOM && !!(window.addEventListener || window.attachEvent),
3577
+
3578
+ canUseViewport: canUseDOM && !!window.screen,
3579
+
3580
+ isInWorker: !canUseDOM // For now, this is true - might change in the future.
3581
+
3582
+};
3583
+
3584
+module.exports = ExecutionEnvironment;
3585
+
3586
+},{}],22:[function(_dereq_,module,exports){
3587
+/**
3588
+ * Copyright 2013-2015, Facebook, Inc.
3589
+ * All rights reserved.
3590
+ *
3591
+ * This source code is licensed under the BSD-style license found in the
3592
+ * LICENSE file in the root directory of this source tree. An additional grant
3593
+ * of patent rights can be found in the PATENTS file in the same directory.
3594
+ *
3595
+ * @providesModule FallbackCompositionState
3596
+ * @typechecks static-only
3597
+ */
3598
+
3599
+'use strict';
3600
+
3601
+var PooledClass = _dereq_(28);
3602
+
3603
+var assign = _dereq_(27);
3604
+var getTextContentAccessor = _dereq_(130);
3605
+
3606
+/**
3607
+ * This helper class stores information about text content of a target node,
3608
+ * allowing comparison of content before and after a given event.
3609
+ *
3610
+ * Identify the node where selection currently begins, then observe
3611
+ * both its text content and its current position in the DOM. Since the
3612
+ * browser may natively replace the target node during composition, we can
3613
+ * use its position to find its replacement.
3614
+ *
3615
+ * @param {DOMEventTarget} root
3616
+ */
3617
+function FallbackCompositionState(root) {
3618
+ this._root = root;
3619
+ this._startText = this.getText();
3620
+ this._fallbackText = null;
3621
+}
3622
+
3623
+assign(FallbackCompositionState.prototype, {
3624
+ /**
3625
+ * Get current text of input.
3626
+ *
3627
+ * @return {string}
3628
+ */
3629
+ getText: function() {
3630
+ if ('value' in this._root) {
3631
+ return this._root.value;
3632
+ }
3633
+ return this._root[getTextContentAccessor()];
3634
+ },
3635
+
3636
+ /**
3637
+ * Determine the differing substring between the initially stored
3638
+ * text content and the current content.
3639
+ *
3640
+ * @return {string}
3641
+ */
3642
+ getData: function() {
3643
+ if (this._fallbackText) {
3644
+ return this._fallbackText;
3645
+ }
3646
+
3647
+ var start;
3648
+ var startValue = this._startText;
3649
+ var startLength = startValue.length;
3650
+ var end;
3651
+ var endValue = this.getText();
3652
+ var endLength = endValue.length;
3653
+
3654
+ for (start = 0; start < startLength; start++) {
3655
+ if (startValue[start] !== endValue[start]) {
3656
+ break;
3657
+ }
3658
+ }
3659
+
3660
+ var minEnd = startLength - start;
3661
+ for (end = 1; end <= minEnd; end++) {
3662
+ if (startValue[startLength - end] !== endValue[endLength - end]) {
3663
+ break;
3664
+ }
3665
+ }
3666
+
3667
+ var sliceTail = end > 1 ? 1 - end : undefined;
3668
+ this._fallbackText = endValue.slice(start, sliceTail);
3669
+ return this._fallbackText;
3670
+ }
3671
+});
3672
+
3673
+PooledClass.addPoolingTo(FallbackCompositionState);
3674
+
3675
+module.exports = FallbackCompositionState;
3676
+
3677
+},{"130":130,"27":27,"28":28}],23:[function(_dereq_,module,exports){
3678
+/**
3679
+ * Copyright 2013-2015, Facebook, Inc.
3680
+ * All rights reserved.
3681
+ *
3682
+ * This source code is licensed under the BSD-style license found in the
3683
+ * LICENSE file in the root directory of this source tree. An additional grant
3684
+ * of patent rights can be found in the PATENTS file in the same directory.
3685
+ *
3686
+ * @providesModule HTMLDOMPropertyConfig
3687
+ */
3688
+
3689
+/*jslint bitwise: true*/
3690
+
3691
+'use strict';
3692
+
3693
+var DOMProperty = _dereq_(10);
3694
+var ExecutionEnvironment = _dereq_(21);
3695
+
3696
+var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
3697
+var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
3698
+var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
3699
+var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
3700
+var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
3701
+var HAS_POSITIVE_NUMERIC_VALUE =
3702
+ DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
3703
+var HAS_OVERLOADED_BOOLEAN_VALUE =
3704
+ DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
3705
+
3706
+var hasSVG;
3707
+if (ExecutionEnvironment.canUseDOM) {
3708
+ var implementation = document.implementation;
3709
+ hasSVG = (
3710
+ implementation &&
3711
+ implementation.hasFeature &&
3712
+ implementation.hasFeature(
3713
+ 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
3714
+ '1.1'
3715
+ )
3716
+ );
3717
+}
3718
+
3719
+
3720
+var HTMLDOMPropertyConfig = {
3721
+ isCustomAttribute: RegExp.prototype.test.bind(
3722
+ /^(data|aria)-[a-z_][a-z\d_.\-]*$/
3723
+ ),
3724
+ Properties: {
3725
+ /**
3726
+ * Standard Properties
3727
+ */
3728
+ accept: null,
3729
+ acceptCharset: null,
3730
+ accessKey: null,
3731
+ action: null,
3732
+ allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3733
+ allowTransparency: MUST_USE_ATTRIBUTE,
3734
+ alt: null,
3735
+ async: HAS_BOOLEAN_VALUE,
3736
+ autoComplete: null,
3737
+ // autoFocus is polyfilled/normalized by AutoFocusMixin
3738
+ // autoFocus: HAS_BOOLEAN_VALUE,
3739
+ autoPlay: HAS_BOOLEAN_VALUE,
3740
+ cellPadding: null,
3741
+ cellSpacing: null,
3742
+ charSet: MUST_USE_ATTRIBUTE,
3743
+ checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3744
+ classID: MUST_USE_ATTRIBUTE,
3745
+ // To set className on SVG elements, it's necessary to use .setAttribute;
3746
+ // this works on HTML elements too in all browsers except IE8. Conveniently,
3747
+ // IE8 doesn't support SVG and so we can simply use the attribute in
3748
+ // browsers that support SVG and the property in browsers that don't,
3749
+ // regardless of whether the element is HTML or SVG.
3750
+ className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
3751
+ cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3752
+ colSpan: null,
3753
+ content: null,
3754
+ contentEditable: null,
3755
+ contextMenu: MUST_USE_ATTRIBUTE,
3756
+ controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3757
+ coords: null,
3758
+ crossOrigin: null,
3759
+ data: null, // For `<object />` acts as `src`.
3760
+ dateTime: MUST_USE_ATTRIBUTE,
3761
+ defer: HAS_BOOLEAN_VALUE,
3762
+ dir: null,
3763
+ disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3764
+ download: HAS_OVERLOADED_BOOLEAN_VALUE,
3765
+ draggable: null,
3766
+ encType: null,
3767
+ form: MUST_USE_ATTRIBUTE,
3768
+ formAction: MUST_USE_ATTRIBUTE,
3769
+ formEncType: MUST_USE_ATTRIBUTE,
3770
+ formMethod: MUST_USE_ATTRIBUTE,
3771
+ formNoValidate: HAS_BOOLEAN_VALUE,
3772
+ formTarget: MUST_USE_ATTRIBUTE,
3773
+ frameBorder: MUST_USE_ATTRIBUTE,
3774
+ headers: null,
3775
+ height: MUST_USE_ATTRIBUTE,
3776
+ hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3777
+ href: null,
3778
+ hrefLang: null,
3779
+ htmlFor: null,
3780
+ httpEquiv: null,
3781
+ icon: null,
3782
+ id: MUST_USE_PROPERTY,
3783
+ label: null,
3784
+ lang: null,
3785
+ list: MUST_USE_ATTRIBUTE,
3786
+ loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3787
+ manifest: MUST_USE_ATTRIBUTE,
3788
+ marginHeight: null,
3789
+ marginWidth: null,
3790
+ max: null,
3791
+ maxLength: MUST_USE_ATTRIBUTE,
3792
+ media: MUST_USE_ATTRIBUTE,
3793
+ mediaGroup: null,
3794
+ method: null,
3795
+ min: null,
3796
+ multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3797
+ muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3798
+ name: null,
3799
+ noValidate: HAS_BOOLEAN_VALUE,
3800
+ open: HAS_BOOLEAN_VALUE,
3801
+ pattern: null,
3802
+ placeholder: null,
3803
+ poster: null,
3804
+ preload: null,
3805
+ radioGroup: null,
3806
+ readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3807
+ rel: null,
3808
+ required: HAS_BOOLEAN_VALUE,
3809
+ role: MUST_USE_ATTRIBUTE,
3810
+ rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3811
+ rowSpan: null,
3812
+ sandbox: null,
3813
+ scope: null,
3814
+ scrolling: null,
3815
+ seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3816
+ selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3817
+ shape: null,
3818
+ size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3819
+ sizes: MUST_USE_ATTRIBUTE,
3820
+ span: HAS_POSITIVE_NUMERIC_VALUE,
3821
+ spellCheck: null,
3822
+ src: null,
3823
+ srcDoc: MUST_USE_PROPERTY,
3824
+ srcSet: MUST_USE_ATTRIBUTE,
3825
+ start: HAS_NUMERIC_VALUE,
3826
+ step: null,
3827
+ style: null,
3828
+ tabIndex: null,
3829
+ target: null,
3830
+ title: null,
3831
+ type: null,
3832
+ useMap: null,
3833
+ value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
3834
+ width: MUST_USE_ATTRIBUTE,
3835
+ wmode: MUST_USE_ATTRIBUTE,
3836
+
3837
+ /**
3838
+ * Non-standard Properties
3839
+ */
3840
+ // autoCapitalize and autoCorrect are supported in Mobile Safari for
3841
+ // keyboard hints.
3842
+ autoCapitalize: null,
3843
+ autoCorrect: null,
3844
+ // itemProp, itemScope, itemType are for
3845
+ // Microdata support. See http://schema.org/docs/gs.html
3846
+ itemProp: MUST_USE_ATTRIBUTE,
3847
+ itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3848
+ itemType: MUST_USE_ATTRIBUTE,
3849
+ // itemID and itemRef are for Microdata support as well but
3850
+ // only specified in the the WHATWG spec document. See
3851
+ // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
3852
+ itemID: MUST_USE_ATTRIBUTE,
3853
+ itemRef: MUST_USE_ATTRIBUTE,
3854
+ // property is supported for OpenGraph in meta tags.
3855
+ property: null
3856
+ },
3857
+ DOMAttributeNames: {
3858
+ acceptCharset: 'accept-charset',
3859
+ className: 'class',
3860
+ htmlFor: 'for',
3861
+ httpEquiv: 'http-equiv'
3862
+ },
3863
+ DOMPropertyNames: {
3864
+ autoCapitalize: 'autocapitalize',
3865
+ autoComplete: 'autocomplete',
3866
+ autoCorrect: 'autocorrect',
3867
+ autoFocus: 'autofocus',
3868
+ autoPlay: 'autoplay',
3869
+ // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
3870
+ // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
3871
+ encType: 'encoding',
3872
+ hrefLang: 'hreflang',
3873
+ radioGroup: 'radiogroup',
3874
+ spellCheck: 'spellcheck',
3875
+ srcDoc: 'srcdoc',
3876
+ srcSet: 'srcset'
3877
+ }
3878
+};
3879
+
3880
+module.exports = HTMLDOMPropertyConfig;
3881
+
3882
+},{"10":10,"21":21}],24:[function(_dereq_,module,exports){
3883
+/**
3884
+ * Copyright 2013-2015, Facebook, Inc.
3885
+ * All rights reserved.
3886
+ *
3887
+ * This source code is licensed under the BSD-style license found in the
3888
+ * LICENSE file in the root directory of this source tree. An additional grant
3889
+ * of patent rights can be found in the PATENTS file in the same directory.
3890
+ *
3891
+ * @providesModule LinkedValueUtils
3892
+ * @typechecks static-only
3893
+ */
3894
+
3895
+'use strict';
3896
+
3897
+var ReactPropTypes = _dereq_(78);
3898
+
3899
+var invariant = _dereq_(135);
3900
+
3901
+var hasReadOnlyValue = {
3902
+ 'button': true,
3903
+ 'checkbox': true,
3904
+ 'image': true,
3905
+ 'hidden': true,
3906
+ 'radio': true,
3907
+ 'reset': true,
3908
+ 'submit': true
3909
+};
3910
+
3911
+function _assertSingleLink(input) {
3912
+ ("production" !== "development" ? invariant(
3913
+ input.props.checkedLink == null || input.props.valueLink == null,
3914
+ 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
3915
+ 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
3916
+ ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
3917
+}
3918
+function _assertValueLink(input) {
3919
+ _assertSingleLink(input);
3920
+ ("production" !== "development" ? invariant(
3921
+ input.props.value == null && input.props.onChange == null,
3922
+ 'Cannot provide a valueLink and a value or onChange event. If you want ' +
3923
+ 'to use value or onChange, you probably don\'t want to use valueLink.'
3924
+ ) : invariant(input.props.value == null && input.props.onChange == null));
3925
+}
3926
+
3927
+function _assertCheckedLink(input) {
3928
+ _assertSingleLink(input);
3929
+ ("production" !== "development" ? invariant(
3930
+ input.props.checked == null && input.props.onChange == null,
3931
+ 'Cannot provide a checkedLink and a checked property or onChange event. ' +
3932
+ 'If you want to use checked or onChange, you probably don\'t want to ' +
3933
+ 'use checkedLink'
3934
+ ) : invariant(input.props.checked == null && input.props.onChange == null));
3935
+}
3936
+
3937
+/**
3938
+ * @param {SyntheticEvent} e change event to handle
3939
+ */
3940
+function _handleLinkedValueChange(e) {
3941
+ /*jshint validthis:true */
3942
+ this.props.valueLink.requestChange(e.target.value);
3943
+}
3944
+
3945
+/**
3946
+ * @param {SyntheticEvent} e change event to handle
3947
+ */
3948
+function _handleLinkedCheckChange(e) {
3949
+ /*jshint validthis:true */
3950
+ this.props.checkedLink.requestChange(e.target.checked);
3951
+}
3952
+
3953
+/**
3954
+ * Provide a linked `value` attribute for controlled forms. You should not use
3955
+ * this outside of the ReactDOM controlled form components.
3956
+ */
3957
+var LinkedValueUtils = {
3958
+ Mixin: {
3959
+ propTypes: {
3960
+ value: function(props, propName, componentName) {
3961
+ if (!props[propName] ||
3962
+ hasReadOnlyValue[props.type] ||
3963
+ props.onChange ||
3964
+ props.readOnly ||
3965
+ props.disabled) {
3966
+ return null;
3967
+ }
3968
+ return new Error(
3969
+ 'You provided a `value` prop to a form field without an ' +
3970
+ '`onChange` handler. This will render a read-only field. If ' +
3971
+ 'the field should be mutable use `defaultValue`. Otherwise, ' +
3972
+ 'set either `onChange` or `readOnly`.'
3973
+ );
3974
+ },
3975
+ checked: function(props, propName, componentName) {
3976
+ if (!props[propName] ||
3977
+ props.onChange ||
3978
+ props.readOnly ||
3979
+ props.disabled) {
3980
+ return null;
3981
+ }
3982
+ return new Error(
3983
+ 'You provided a `checked` prop to a form field without an ' +
3984
+ '`onChange` handler. This will render a read-only field. If ' +
3985
+ 'the field should be mutable use `defaultChecked`. Otherwise, ' +
3986
+ 'set either `onChange` or `readOnly`.'
3987
+ );
3988
+ },
3989
+ onChange: ReactPropTypes.func
3990
+ }
3991
+ },
3992
+
3993
+ /**
3994
+ * @param {ReactComponent} input Form component
3995
+ * @return {*} current value of the input either from value prop or link.
3996
+ */
3997
+ getValue: function(input) {
3998
+ if (input.props.valueLink) {
3999
+ _assertValueLink(input);
4000
+ return input.props.valueLink.value;
4001
+ }
4002
+ return input.props.value;
4003
+ },
4004
+
4005
+ /**
4006
+ * @param {ReactComponent} input Form component
4007
+ * @return {*} current checked status of the input either from checked prop
4008
+ * or link.
4009
+ */
4010
+ getChecked: function(input) {
4011
+ if (input.props.checkedLink) {
4012
+ _assertCheckedLink(input);
4013
+ return input.props.checkedLink.value;
4014
+ }
4015
+ return input.props.checked;
4016
+ },
4017
+
4018
+ /**
4019
+ * @param {ReactComponent} input Form component
4020
+ * @return {function} change callback either from onChange prop or link.
4021
+ */
4022
+ getOnChange: function(input) {
4023
+ if (input.props.valueLink) {
4024
+ _assertValueLink(input);
4025
+ return _handleLinkedValueChange;
4026
+ } else if (input.props.checkedLink) {
4027
+ _assertCheckedLink(input);
4028
+ return _handleLinkedCheckChange;
4029
+ }
4030
+ return input.props.onChange;
4031
+ }
4032
+};
4033
+
4034
+module.exports = LinkedValueUtils;
4035
+
4036
+},{"135":135,"78":78}],25:[function(_dereq_,module,exports){
4037
+/**
4038
+ * Copyright 2014-2015, Facebook, Inc.
4039
+ * All rights reserved.
4040
+ *
4041
+ * This source code is licensed under the BSD-style license found in the
4042
+ * LICENSE file in the root directory of this source tree. An additional grant
4043
+ * of patent rights can be found in the PATENTS file in the same directory.
4044
+ *
4045
+ * @providesModule LocalEventTrapMixin
4046
+ */
4047
+
4048
+'use strict';
4049
+
4050
+var ReactBrowserEventEmitter = _dereq_(30);
4051
+
4052
+var accumulateInto = _dereq_(105);
4053
+var forEachAccumulated = _dereq_(120);
4054
+var invariant = _dereq_(135);
4055
+
4056
+function remove(event) {
4057
+ event.remove();
4058
+}
4059
+
4060
+var LocalEventTrapMixin = {
4061
+ trapBubbledEvent:function(topLevelType, handlerBaseName) {
4062
+ ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
4063
+ // If a component renders to null or if another component fatals and causes
4064
+ // the state of the tree to be corrupted, `node` here can be null.
4065
+ var node = this.getDOMNode();
4066
+ ("production" !== "development" ? invariant(
4067
+ node,
4068
+ 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
4069
+ ) : invariant(node));
4070
+ var listener = ReactBrowserEventEmitter.trapBubbledEvent(
4071
+ topLevelType,
4072
+ handlerBaseName,
4073
+ node
4074
+ );
4075
+ this._localEventListeners =
4076
+ accumulateInto(this._localEventListeners, listener);
4077
+ },
4078
+
4079
+ // trapCapturedEvent would look nearly identical. We don't implement that
4080
+ // method because it isn't currently needed.
4081
+
4082
+ componentWillUnmount:function() {
4083
+ if (this._localEventListeners) {
4084
+ forEachAccumulated(this._localEventListeners, remove);
4085
+ }
4086
+ }
4087
+};
4088
+
4089
+module.exports = LocalEventTrapMixin;
4090
+
4091
+},{"105":105,"120":120,"135":135,"30":30}],26:[function(_dereq_,module,exports){
4092
+/**
4093
+ * Copyright 2013-2015, Facebook, Inc.
4094
+ * All rights reserved.
4095
+ *
4096
+ * This source code is licensed under the BSD-style license found in the
4097
+ * LICENSE file in the root directory of this source tree. An additional grant
4098
+ * of patent rights can be found in the PATENTS file in the same directory.
4099
+ *
4100
+ * @providesModule MobileSafariClickEventPlugin
4101
+ * @typechecks static-only
4102
+ */
4103
+
4104
+'use strict';
4105
+
4106
+var EventConstants = _dereq_(15);
4107
+
4108
+var emptyFunction = _dereq_(114);
4109
+
4110
+var topLevelTypes = EventConstants.topLevelTypes;
4111
+
4112
+/**
4113
+ * Mobile Safari does not fire properly bubble click events on non-interactive
4114
+ * elements, which means delegated click listeners do not fire. The workaround
4115
+ * for this bug involves attaching an empty click listener on the target node.
4116
+ *
4117
+ * This particular plugin works around the bug by attaching an empty click
4118
+ * listener on `touchstart` (which does fire on every element).
4119
+ */
4120
+var MobileSafariClickEventPlugin = {
4121
+
4122
+ eventTypes: null,
4123
+
4124
+ /**
4125
+ * @param {string} topLevelType Record from `EventConstants`.
4126
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
4127
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
4128
+ * @param {object} nativeEvent Native browser event.
4129
+ * @return {*} An accumulation of synthetic events.
4130
+ * @see {EventPluginHub.extractEvents}
4131
+ */
4132
+ extractEvents: function(
4133
+ topLevelType,
4134
+ topLevelTarget,
4135
+ topLevelTargetID,
4136
+ nativeEvent) {
4137
+ if (topLevelType === topLevelTypes.topTouchStart) {
4138
+ var target = nativeEvent.target;
4139
+ if (target && !target.onclick) {
4140
+ target.onclick = emptyFunction;
4141
+ }
4142
+ }
4143
+ }
4144
+
4145
+};
4146
+
4147
+module.exports = MobileSafariClickEventPlugin;
4148
+
4149
+},{"114":114,"15":15}],27:[function(_dereq_,module,exports){
4150
+/**
4151
+ * Copyright 2014-2015, Facebook, Inc.
4152
+ * All rights reserved.
4153
+ *
4154
+ * This source code is licensed under the BSD-style license found in the
4155
+ * LICENSE file in the root directory of this source tree. An additional grant
4156
+ * of patent rights can be found in the PATENTS file in the same directory.
4157
+ *
4158
+ * @providesModule Object.assign
4159
+ */
4160
+
4161
+// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
4162
+
4163
+'use strict';
4164
+
4165
+function assign(target, sources) {
4166
+ if (target == null) {
4167
+ throw new TypeError('Object.assign target cannot be null or undefined');
4168
+ }
4169
+
4170
+ var to = Object(target);
4171
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
4172
+
4173
+ for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
4174
+ var nextSource = arguments[nextIndex];
4175
+ if (nextSource == null) {
4176
+ continue;
4177
+ }
4178
+
4179
+ var from = Object(nextSource);
4180
+
4181
+ // We don't currently support accessors nor proxies. Therefore this
4182
+ // copy cannot throw. If we ever supported this then we must handle
4183
+ // exceptions and side-effects. We don't support symbols so they won't
4184
+ // be transferred.
4185
+
4186
+ for (var key in from) {
4187
+ if (hasOwnProperty.call(from, key)) {
4188
+ to[key] = from[key];
4189
+ }
4190
+ }
4191
+ }
4192
+
4193
+ return to;
4194
+}
4195
+
4196
+module.exports = assign;
4197
+
4198
+},{}],28:[function(_dereq_,module,exports){
4199
+/**
4200
+ * Copyright 2013-2015, Facebook, Inc.
4201
+ * All rights reserved.
4202
+ *
4203
+ * This source code is licensed under the BSD-style license found in the
4204
+ * LICENSE file in the root directory of this source tree. An additional grant
4205
+ * of patent rights can be found in the PATENTS file in the same directory.
4206
+ *
4207
+ * @providesModule PooledClass
4208
+ */
4209
+
4210
+'use strict';
4211
+
4212
+var invariant = _dereq_(135);
4213
+
4214
+/**
4215
+ * Static poolers. Several custom versions for each potential number of
4216
+ * arguments. A completely generic pooler is easy to implement, but would
4217
+ * require accessing the `arguments` object. In each of these, `this` refers to
4218
+ * the Class itself, not an instance. If any others are needed, simply add them
4219
+ * here, or in their own files.
4220
+ */
4221
+var oneArgumentPooler = function(copyFieldsFrom) {
4222
+ var Klass = this;
4223
+ if (Klass.instancePool.length) {
4224
+ var instance = Klass.instancePool.pop();
4225
+ Klass.call(instance, copyFieldsFrom);
4226
+ return instance;
4227
+ } else {
4228
+ return new Klass(copyFieldsFrom);
4229
+ }
4230
+};
4231
+
4232
+var twoArgumentPooler = function(a1, a2) {
4233
+ var Klass = this;
4234
+ if (Klass.instancePool.length) {
4235
+ var instance = Klass.instancePool.pop();
4236
+ Klass.call(instance, a1, a2);
4237
+ return instance;
4238
+ } else {
4239
+ return new Klass(a1, a2);
4240
+ }
4241
+};
4242
+
4243
+var threeArgumentPooler = function(a1, a2, a3) {
4244
+ var Klass = this;
4245
+ if (Klass.instancePool.length) {
4246
+ var instance = Klass.instancePool.pop();
4247
+ Klass.call(instance, a1, a2, a3);
4248
+ return instance;
4249
+ } else {
4250
+ return new Klass(a1, a2, a3);
4251
+ }
4252
+};
4253
+
4254
+var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
4255
+ var Klass = this;
4256
+ if (Klass.instancePool.length) {
4257
+ var instance = Klass.instancePool.pop();
4258
+ Klass.call(instance, a1, a2, a3, a4, a5);
4259
+ return instance;
4260
+ } else {
4261
+ return new Klass(a1, a2, a3, a4, a5);
4262
+ }
4263
+};
4264
+
4265
+var standardReleaser = function(instance) {
4266
+ var Klass = this;
4267
+ ("production" !== "development" ? invariant(
4268
+ instance instanceof Klass,
4269
+ 'Trying to release an instance into a pool of a different type.'
4270
+ ) : invariant(instance instanceof Klass));
4271
+ if (instance.destructor) {
4272
+ instance.destructor();
4273
+ }
4274
+ if (Klass.instancePool.length < Klass.poolSize) {
4275
+ Klass.instancePool.push(instance);
4276
+ }
4277
+};
4278
+
4279
+var DEFAULT_POOL_SIZE = 10;
4280
+var DEFAULT_POOLER = oneArgumentPooler;
4281
+
4282
+/**
4283
+ * Augments `CopyConstructor` to be a poolable class, augmenting only the class
4284
+ * itself (statically) not adding any prototypical fields. Any CopyConstructor
4285
+ * you give this may have a `poolSize` property, and will look for a
4286
+ * prototypical `destructor` on instances (optional).
4287
+ *
4288
+ * @param {Function} CopyConstructor Constructor that can be used to reset.
4289
+ * @param {Function} pooler Customizable pooler.
4290
+ */
4291
+var addPoolingTo = function(CopyConstructor, pooler) {
4292
+ var NewKlass = CopyConstructor;
4293
+ NewKlass.instancePool = [];
4294
+ NewKlass.getPooled = pooler || DEFAULT_POOLER;
4295
+ if (!NewKlass.poolSize) {
4296
+ NewKlass.poolSize = DEFAULT_POOL_SIZE;
4297
+ }
4298
+ NewKlass.release = standardReleaser;
4299
+ return NewKlass;
4300
+};
4301
+
4302
+var PooledClass = {
4303
+ addPoolingTo: addPoolingTo,
4304
+ oneArgumentPooler: oneArgumentPooler,
4305
+ twoArgumentPooler: twoArgumentPooler,
4306
+ threeArgumentPooler: threeArgumentPooler,
4307
+ fiveArgumentPooler: fiveArgumentPooler
4308
+};
4309
+
4310
+module.exports = PooledClass;
4311
+
4312
+},{"135":135}],29:[function(_dereq_,module,exports){
4313
+/**
4314
+ * Copyright 2013-2015, Facebook, Inc.
4315
+ * All rights reserved.
4316
+ *
4317
+ * This source code is licensed under the BSD-style license found in the
4318
+ * LICENSE file in the root directory of this source tree. An additional grant
4319
+ * of patent rights can be found in the PATENTS file in the same directory.
4320
+ *
4321
+ * @providesModule ReactBrowserComponentMixin
4322
+ */
4323
+
4324
+'use strict';
4325
+
4326
+var findDOMNode = _dereq_(117);
4327
+
4328
+var ReactBrowserComponentMixin = {
4329
+ /**
4330
+ * Returns the DOM node rendered by this component.
4331
+ *
4332
+ * @return {DOMElement} The root node of this component.
4333
+ * @final
4334
+ * @protected
4335
+ */
4336
+ getDOMNode: function() {
4337
+ return findDOMNode(this);
4338
+ }
4339
+};
4340
+
4341
+module.exports = ReactBrowserComponentMixin;
4342
+
4343
+},{"117":117}],30:[function(_dereq_,module,exports){
4344
+/**
4345
+ * Copyright 2013-2015, Facebook, Inc.
4346
+ * All rights reserved.
4347
+ *
4348
+ * This source code is licensed under the BSD-style license found in the
4349
+ * LICENSE file in the root directory of this source tree. An additional grant
4350
+ * of patent rights can be found in the PATENTS file in the same directory.
4351
+ *
4352
+ * @providesModule ReactBrowserEventEmitter
4353
+ * @typechecks static-only
4354
+ */
4355
+
4356
+'use strict';
4357
+
4358
+var EventConstants = _dereq_(15);
4359
+var EventPluginHub = _dereq_(17);
4360
+var EventPluginRegistry = _dereq_(18);
4361
+var ReactEventEmitterMixin = _dereq_(61);
4362
+var ViewportMetrics = _dereq_(104);
4363
+
4364
+var assign = _dereq_(27);
4365
+var isEventSupported = _dereq_(136);
4366
+
4367
+/**
4368
+ * Summary of `ReactBrowserEventEmitter` event handling:
4369
+ *
4370
+ * - Top-level delegation is used to trap most native browser events. This
4371
+ * may only occur in the main thread and is the responsibility of
4372
+ * ReactEventListener, which is injected and can therefore support pluggable
4373
+ * event sources. This is the only work that occurs in the main thread.
4374
+ *
4375
+ * - We normalize and de-duplicate events to account for browser quirks. This
4376
+ * may be done in the worker thread.
4377
+ *
4378
+ * - Forward these native events (with the associated top-level type used to
4379
+ * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
4380
+ * to extract any synthetic events.
4381
+ *
4382
+ * - The `EventPluginHub` will then process each event by annotating them with
4383
+ * "dispatches", a sequence of listeners and IDs that care about that event.
4384
+ *
4385
+ * - The `EventPluginHub` then dispatches the events.
4386
+ *
4387
+ * Overview of React and the event system:
4388
+ *
4389
+ * +------------+ .
4390
+ * | DOM | .
4391
+ * +------------+ .
4392
+ * | .
4393
+ * v .
4394
+ * +------------+ .
4395
+ * | ReactEvent | .
4396
+ * | Listener | .
4397
+ * +------------+ . +-----------+
4398
+ * | . +--------+|SimpleEvent|
4399
+ * | . | |Plugin |
4400
+ * +-----|------+ . v +-----------+
4401
+ * | | | . +--------------+ +------------+
4402
+ * | +-----------.--->|EventPluginHub| | Event |
4403
+ * | | . | | +-----------+ | Propagators|
4404
+ * | ReactEvent | . | | |TapEvent | |------------|
4405
+ * | Emitter | . | |<---+|Plugin | |other plugin|
4406
+ * | | . | | +-----------+ | utilities |
4407
+ * | +-----------.--->| | +------------+
4408
+ * | | | . +--------------+
4409
+ * +-----|------+ . ^ +-----------+
4410
+ * | . | |Enter/Leave|
4411
+ * + . +-------+|Plugin |
4412
+ * +-------------+ . +-----------+
4413
+ * | application | .
4414
+ * |-------------| .
4415
+ * | | .
4416
+ * | | .
4417
+ * +-------------+ .
4418
+ * .
4419
+ * React Core . General Purpose Event Plugin System
4420
+ */
4421
+
4422
+var alreadyListeningTo = {};
4423
+var isMonitoringScrollValue = false;
4424
+var reactTopListenersCounter = 0;
4425
+
4426
+// For events like 'submit' which don't consistently bubble (which we trap at a
4427
+// lower node than `document`), binding at `document` would cause duplicate
4428
+// events so we don't include them here
4429
+var topEventMapping = {
4430
+ topBlur: 'blur',
4431
+ topChange: 'change',
4432
+ topClick: 'click',
4433
+ topCompositionEnd: 'compositionend',
4434
+ topCompositionStart: 'compositionstart',
4435
+ topCompositionUpdate: 'compositionupdate',
4436
+ topContextMenu: 'contextmenu',
4437
+ topCopy: 'copy',
4438
+ topCut: 'cut',
4439
+ topDoubleClick: 'dblclick',
4440
+ topDrag: 'drag',
4441
+ topDragEnd: 'dragend',
4442
+ topDragEnter: 'dragenter',
4443
+ topDragExit: 'dragexit',
4444
+ topDragLeave: 'dragleave',
4445
+ topDragOver: 'dragover',
4446
+ topDragStart: 'dragstart',
4447
+ topDrop: 'drop',
4448
+ topFocus: 'focus',
4449
+ topInput: 'input',
4450
+ topKeyDown: 'keydown',
4451
+ topKeyPress: 'keypress',
4452
+ topKeyUp: 'keyup',
4453
+ topMouseDown: 'mousedown',
4454
+ topMouseMove: 'mousemove',
4455
+ topMouseOut: 'mouseout',
4456
+ topMouseOver: 'mouseover',
4457
+ topMouseUp: 'mouseup',
4458
+ topPaste: 'paste',
4459
+ topScroll: 'scroll',
4460
+ topSelectionChange: 'selectionchange',
4461
+ topTextInput: 'textInput',
4462
+ topTouchCancel: 'touchcancel',
4463
+ topTouchEnd: 'touchend',
4464
+ topTouchMove: 'touchmove',
4465
+ topTouchStart: 'touchstart',
4466
+ topWheel: 'wheel'
4467
+};
4468
+
4469
+/**
4470
+ * To ensure no conflicts with other potential React instances on the page
4471
+ */
4472
+var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
4473
+
4474
+function getListeningForDocument(mountAt) {
4475
+ // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
4476
+ // directly.
4477
+ if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
4478
+ mountAt[topListenersIDKey] = reactTopListenersCounter++;
4479
+ alreadyListeningTo[mountAt[topListenersIDKey]] = {};
4480
+ }
4481
+ return alreadyListeningTo[mountAt[topListenersIDKey]];
4482
+}
4483
+
4484
+/**
4485
+ * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
4486
+ * example:
4487
+ *
4488
+ * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
4489
+ *
4490
+ * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
4491
+ *
4492
+ * @internal
4493
+ */
4494
+var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
4495
+
4496
+ /**
4497
+ * Injectable event backend
4498
+ */
4499
+ ReactEventListener: null,
4500
+
4501
+ injection: {
4502
+ /**
4503
+ * @param {object} ReactEventListener
4504
+ */
4505
+ injectReactEventListener: function(ReactEventListener) {
4506
+ ReactEventListener.setHandleTopLevel(
4507
+ ReactBrowserEventEmitter.handleTopLevel
4508
+ );
4509
+ ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
4510
+ }
4511
+ },
4512
+
4513
+ /**
4514
+ * Sets whether or not any created callbacks should be enabled.
4515
+ *
4516
+ * @param {boolean} enabled True if callbacks should be enabled.
4517
+ */
4518
+ setEnabled: function(enabled) {
4519
+ if (ReactBrowserEventEmitter.ReactEventListener) {
4520
+ ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
4521
+ }
4522
+ },
4523
+
4524
+ /**
4525
+ * @return {boolean} True if callbacks are enabled.
4526
+ */
4527
+ isEnabled: function() {
4528
+ return !!(
4529
+ (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
4530
+ );
4531
+ },
4532
+
4533
+ /**
4534
+ * We listen for bubbled touch events on the document object.
4535
+ *
4536
+ * Firefox v8.01 (and possibly others) exhibited strange behavior when
4537
+ * mounting `onmousemove` events at some node that was not the document
4538
+ * element. The symptoms were that if your mouse is not moving over something
4539
+ * contained within that mount point (for example on the background) the
4540
+ * top-level listeners for `onmousemove` won't be called. However, if you
4541
+ * register the `mousemove` on the document object, then it will of course
4542
+ * catch all `mousemove`s. This along with iOS quirks, justifies restricting
4543
+ * top-level listeners to the document object only, at least for these
4544
+ * movement types of events and possibly all events.
4545
+ *
4546
+ * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
4547
+ *
4548
+ * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
4549
+ * they bubble to document.
4550
+ *
4551
+ * @param {string} registrationName Name of listener (e.g. `onClick`).
4552
+ * @param {object} contentDocumentHandle Document which owns the container
4553
+ */
4554
+ listenTo: function(registrationName, contentDocumentHandle) {
4555
+ var mountAt = contentDocumentHandle;
4556
+ var isListening = getListeningForDocument(mountAt);
4557
+ var dependencies = EventPluginRegistry.
4558
+ registrationNameDependencies[registrationName];
4559
+
4560
+ var topLevelTypes = EventConstants.topLevelTypes;
4561
+ for (var i = 0, l = dependencies.length; i < l; i++) {
4562
+ var dependency = dependencies[i];
4563
+ if (!(
4564
+ (isListening.hasOwnProperty(dependency) && isListening[dependency])
4565
+ )) {
4566
+ if (dependency === topLevelTypes.topWheel) {
4567
+ if (isEventSupported('wheel')) {
4568
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4569
+ topLevelTypes.topWheel,
4570
+ 'wheel',
4571
+ mountAt
4572
+ );
4573
+ } else if (isEventSupported('mousewheel')) {
4574
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4575
+ topLevelTypes.topWheel,
4576
+ 'mousewheel',
4577
+ mountAt
4578
+ );
4579
+ } else {
4580
+ // Firefox needs to capture a different mouse scroll event.
4581
+ // @see http://www.quirksmode.org/dom/events/tests/scroll.html
4582
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4583
+ topLevelTypes.topWheel,
4584
+ 'DOMMouseScroll',
4585
+ mountAt
4586
+ );
4587
+ }
4588
+ } else if (dependency === topLevelTypes.topScroll) {
4589
+
4590
+ if (isEventSupported('scroll', true)) {
4591
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4592
+ topLevelTypes.topScroll,
4593
+ 'scroll',
4594
+ mountAt
4595
+ );
4596
+ } else {
4597
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4598
+ topLevelTypes.topScroll,
4599
+ 'scroll',
4600
+ ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
4601
+ );
4602
+ }
4603
+ } else if (dependency === topLevelTypes.topFocus ||
4604
+ dependency === topLevelTypes.topBlur) {
4605
+
4606
+ if (isEventSupported('focus', true)) {
4607
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4608
+ topLevelTypes.topFocus,
4609
+ 'focus',
4610
+ mountAt
4611
+ );
4612
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4613
+ topLevelTypes.topBlur,
4614
+ 'blur',
4615
+ mountAt
4616
+ );
4617
+ } else if (isEventSupported('focusin')) {
4618
+ // IE has `focusin` and `focusout` events which bubble.
4619
+ // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
4620
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4621
+ topLevelTypes.topFocus,
4622
+ 'focusin',
4623
+ mountAt
4624
+ );
4625
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4626
+ topLevelTypes.topBlur,
4627
+ 'focusout',
4628
+ mountAt
4629
+ );
4630
+ }
4631
+
4632
+ // to make sure blur and focus event listeners are only attached once
4633
+ isListening[topLevelTypes.topBlur] = true;
4634
+ isListening[topLevelTypes.topFocus] = true;
4635
+ } else if (topEventMapping.hasOwnProperty(dependency)) {
4636
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4637
+ dependency,
4638
+ topEventMapping[dependency],
4639
+ mountAt
4640
+ );
4641
+ }
4642
+
4643
+ isListening[dependency] = true;
4644
+ }
4645
+ }
4646
+ },
4647
+
4648
+ trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
4649
+ return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4650
+ topLevelType,
4651
+ handlerBaseName,
4652
+ handle
4653
+ );
4654
+ },
4655
+
4656
+ trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
4657
+ return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4658
+ topLevelType,
4659
+ handlerBaseName,
4660
+ handle
4661
+ );
4662
+ },
4663
+
4664
+ /**
4665
+ * Listens to window scroll and resize events. We cache scroll values so that
4666
+ * application code can access them without triggering reflows.
4667
+ *
4668
+ * NOTE: Scroll events do not bubble.
4669
+ *
4670
+ * @see http://www.quirksmode.org/dom/events/scroll.html
4671
+ */
4672
+ ensureScrollValueMonitoring: function() {
4673
+ if (!isMonitoringScrollValue) {
4674
+ var refresh = ViewportMetrics.refreshScrollValues;
4675
+ ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
4676
+ isMonitoringScrollValue = true;
4677
+ }
4678
+ },
4679
+
4680
+ eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
4681
+
4682
+ registrationNameModules: EventPluginHub.registrationNameModules,
4683
+
4684
+ putListener: EventPluginHub.putListener,
4685
+
4686
+ getListener: EventPluginHub.getListener,
4687
+
4688
+ deleteListener: EventPluginHub.deleteListener,
4689
+
4690
+ deleteAllListeners: EventPluginHub.deleteAllListeners
4691
+
4692
+});
4693
+
4694
+module.exports = ReactBrowserEventEmitter;
4695
+
4696
+},{"104":104,"136":136,"15":15,"17":17,"18":18,"27":27,"61":61}],31:[function(_dereq_,module,exports){
4697
+/**
4698
+ * Copyright 2014-2015, Facebook, Inc.
4699
+ * All rights reserved.
4700
+ *
4701
+ * This source code is licensed under the BSD-style license found in the
4702
+ * LICENSE file in the root directory of this source tree. An additional grant
4703
+ * of patent rights can be found in the PATENTS file in the same directory.
4704
+ *
4705
+ * @providesModule ReactChildReconciler
4706
+ * @typechecks static-only
4707
+ */
4708
+
4709
+'use strict';
4710
+
4711
+var ReactReconciler = _dereq_(81);
4712
+
4713
+var flattenChildren = _dereq_(118);
4714
+var instantiateReactComponent = _dereq_(134);
4715
+var shouldUpdateReactComponent = _dereq_(151);
4716
+
4717
+/**
4718
+ * ReactChildReconciler provides helpers for initializing or updating a set of
4719
+ * children. Its output is suitable for passing it onto ReactMultiChild which
4720
+ * does diffed reordering and insertion.
4721
+ */
4722
+var ReactChildReconciler = {
4723
+
4724
+ /**
4725
+ * Generates a "mount image" for each of the supplied children. In the case
4726
+ * of `ReactDOMComponent`, a mount image is a string of markup.
4727
+ *
4728
+ * @param {?object} nestedChildNodes Nested child maps.
4729
+ * @return {?object} A set of child instances.
4730
+ * @internal
4731
+ */
4732
+ instantiateChildren: function(nestedChildNodes, transaction, context) {
4733
+ var children = flattenChildren(nestedChildNodes);
4734
+ for (var name in children) {
4735
+ if (children.hasOwnProperty(name)) {
4736
+ var child = children[name];
4737
+ // The rendered children must be turned into instances as they're
4738
+ // mounted.
4739
+ var childInstance = instantiateReactComponent(child, null);
4740
+ children[name] = childInstance;
4741
+ }
4742
+ }
4743
+ return children;
4744
+ },
4745
+
4746
+ /**
4747
+ * Updates the rendered children and returns a new set of children.
4748
+ *
4749
+ * @param {?object} prevChildren Previously initialized set of children.
4750
+ * @param {?object} nextNestedChildNodes Nested child maps.
4751
+ * @param {ReactReconcileTransaction} transaction
4752
+ * @param {object} context
4753
+ * @return {?object} A new set of child instances.
4754
+ * @internal
4755
+ */
4756
+ updateChildren: function(
4757
+ prevChildren,
4758
+ nextNestedChildNodes,
4759
+ transaction,
4760
+ context) {
4761
+ // We currently don't have a way to track moves here but if we use iterators
4762
+ // instead of for..in we can zip the iterators and check if an item has
4763
+ // moved.
4764
+ // TODO: If nothing has changed, return the prevChildren object so that we
4765
+ // can quickly bailout if nothing has changed.
4766
+ var nextChildren = flattenChildren(nextNestedChildNodes);
4767
+ if (!nextChildren && !prevChildren) {
4768
+ return null;
4769
+ }
4770
+ var name;
4771
+ for (name in nextChildren) {
4772
+ if (!nextChildren.hasOwnProperty(name)) {
4773
+ continue;
4774
+ }
4775
+ var prevChild = prevChildren && prevChildren[name];
4776
+ var prevElement = prevChild && prevChild._currentElement;
4777
+ var nextElement = nextChildren[name];
4778
+ if (shouldUpdateReactComponent(prevElement, nextElement)) {
4779
+ ReactReconciler.receiveComponent(
4780
+ prevChild, nextElement, transaction, context
4781
+ );
4782
+ nextChildren[name] = prevChild;
4783
+ } else {
4784
+ if (prevChild) {
4785
+ ReactReconciler.unmountComponent(prevChild, name);
4786
+ }
4787
+ // The child must be instantiated before it's mounted.
4788
+ var nextChildInstance = instantiateReactComponent(
4789
+ nextElement,
4790
+ null
4791
+ );
4792
+ nextChildren[name] = nextChildInstance;
4793
+ }
4794
+ }
4795
+ // Unmount children that are no longer present.
4796
+ for (name in prevChildren) {
4797
+ if (prevChildren.hasOwnProperty(name) &&
4798
+ !(nextChildren && nextChildren.hasOwnProperty(name))) {
4799
+ ReactReconciler.unmountComponent(prevChildren[name]);
4800
+ }
4801
+ }
4802
+ return nextChildren;
4803
+ },
4804
+
4805
+ /**
4806
+ * Unmounts all rendered children. This should be used to clean up children
4807
+ * when this component is unmounted.
4808
+ *
4809
+ * @param {?object} renderedChildren Previously initialized set of children.
4810
+ * @internal
4811
+ */
4812
+ unmountChildren: function(renderedChildren) {
4813
+ for (var name in renderedChildren) {
4814
+ var renderedChild = renderedChildren[name];
4815
+ ReactReconciler.unmountComponent(renderedChild);
4816
+ }
4817
+ }
4818
+
4819
+};
4820
+
4821
+module.exports = ReactChildReconciler;
4822
+
4823
+},{"118":118,"134":134,"151":151,"81":81}],32:[function(_dereq_,module,exports){
4824
+/**
4825
+ * Copyright 2013-2015, Facebook, Inc.
4826
+ * All rights reserved.
4827
+ *
4828
+ * This source code is licensed under the BSD-style license found in the
4829
+ * LICENSE file in the root directory of this source tree. An additional grant
4830
+ * of patent rights can be found in the PATENTS file in the same directory.
4831
+ *
4832
+ * @providesModule ReactChildren
4833
+ */
4834
+
4835
+'use strict';
4836
+
4837
+var PooledClass = _dereq_(28);
4838
+var ReactFragment = _dereq_(63);
4839
+
4840
+var traverseAllChildren = _dereq_(153);
4841
+var warning = _dereq_(154);
4842
+
4843
+var twoArgumentPooler = PooledClass.twoArgumentPooler;
4844
+var threeArgumentPooler = PooledClass.threeArgumentPooler;
4845
+
4846
+/**
4847
+ * PooledClass representing the bookkeeping associated with performing a child
4848
+ * traversal. Allows avoiding binding callbacks.
4849
+ *
4850
+ * @constructor ForEachBookKeeping
4851
+ * @param {!function} forEachFunction Function to perform traversal with.
4852
+ * @param {?*} forEachContext Context to perform context with.
4853
+ */
4854
+function ForEachBookKeeping(forEachFunction, forEachContext) {
4855
+ this.forEachFunction = forEachFunction;
4856
+ this.forEachContext = forEachContext;
4857
+}
4858
+PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
4859
+
4860
+function forEachSingleChild(traverseContext, child, name, i) {
4861
+ var forEachBookKeeping = traverseContext;
4862
+ forEachBookKeeping.forEachFunction.call(
4863
+ forEachBookKeeping.forEachContext, child, i);
4864
+}
4865
+
4866
+/**
4867
+ * Iterates through children that are typically specified as `props.children`.
4868
+ *
4869
+ * The provided forEachFunc(child, index) will be called for each
4870
+ * leaf child.
4871
+ *
4872
+ * @param {?*} children Children tree container.
4873
+ * @param {function(*, int)} forEachFunc.
4874
+ * @param {*} forEachContext Context for forEachContext.
4875
+ */
4876
+function forEachChildren(children, forEachFunc, forEachContext) {
4877
+ if (children == null) {
4878
+ return children;
4879
+ }
4880
+
4881
+ var traverseContext =
4882
+ ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
4883
+ traverseAllChildren(children, forEachSingleChild, traverseContext);
4884
+ ForEachBookKeeping.release(traverseContext);
4885
+}
4886
+
4887
+/**
4888
+ * PooledClass representing the bookkeeping associated with performing a child
4889
+ * mapping. Allows avoiding binding callbacks.
4890
+ *
4891
+ * @constructor MapBookKeeping
4892
+ * @param {!*} mapResult Object containing the ordered map of results.
4893
+ * @param {!function} mapFunction Function to perform mapping with.
4894
+ * @param {?*} mapContext Context to perform mapping with.
4895
+ */
4896
+function MapBookKeeping(mapResult, mapFunction, mapContext) {
4897
+ this.mapResult = mapResult;
4898
+ this.mapFunction = mapFunction;
4899
+ this.mapContext = mapContext;
4900
+}
4901
+PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
4902
+
4903
+function mapSingleChildIntoContext(traverseContext, child, name, i) {
4904
+ var mapBookKeeping = traverseContext;
4905
+ var mapResult = mapBookKeeping.mapResult;
4906
+
4907
+ var keyUnique = !mapResult.hasOwnProperty(name);
4908
+ if ("production" !== "development") {
4909
+ ("production" !== "development" ? warning(
4910
+ keyUnique,
4911
+ 'ReactChildren.map(...): Encountered two children with the same key, ' +
4912
+ '`%s`. Child keys must be unique; when two children share a key, only ' +
4913
+ 'the first child will be used.',
4914
+ name
4915
+ ) : null);
4916
+ }
4917
+
4918
+ if (keyUnique) {
4919
+ var mappedChild =
4920
+ mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
4921
+ mapResult[name] = mappedChild;
4922
+ }
4923
+}
4924
+
4925
+/**
4926
+ * Maps children that are typically specified as `props.children`.
4927
+ *
4928
+ * The provided mapFunction(child, key, index) will be called for each
4929
+ * leaf child.
4930
+ *
4931
+ * TODO: This may likely break any calls to `ReactChildren.map` that were
4932
+ * previously relying on the fact that we guarded against null children.
4933
+ *
4934
+ * @param {?*} children Children tree container.
4935
+ * @param {function(*, int)} mapFunction.
4936
+ * @param {*} mapContext Context for mapFunction.
4937
+ * @return {object} Object containing the ordered map of results.
4938
+ */
4939
+function mapChildren(children, func, context) {
4940
+ if (children == null) {
4941
+ return children;
4942
+ }
4943
+
4944
+ var mapResult = {};
4945
+ var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
4946
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
4947
+ MapBookKeeping.release(traverseContext);
4948
+ return ReactFragment.create(mapResult);
4949
+}
4950
+
4951
+function forEachSingleChildDummy(traverseContext, child, name, i) {
4952
+ return null;
4953
+}
4954
+
4955
+/**
4956
+ * Count the number of children that are typically specified as
4957
+ * `props.children`.
4958
+ *
4959
+ * @param {?*} children Children tree container.
4960
+ * @return {number} The number of children.
4961
+ */
4962
+function countChildren(children, context) {
4963
+ return traverseAllChildren(children, forEachSingleChildDummy, null);
4964
+}
4965
+
4966
+var ReactChildren = {
4967
+ forEach: forEachChildren,
4968
+ map: mapChildren,
4969
+ count: countChildren
4970
+};
4971
+
4972
+module.exports = ReactChildren;
4973
+
4974
+},{"153":153,"154":154,"28":28,"63":63}],33:[function(_dereq_,module,exports){
4975
+/**
4976
+ * Copyright 2013-2015, Facebook, Inc.
4977
+ * All rights reserved.
4978
+ *
4979
+ * This source code is licensed under the BSD-style license found in the
4980
+ * LICENSE file in the root directory of this source tree. An additional grant
4981
+ * of patent rights can be found in the PATENTS file in the same directory.
4982
+ *
4983
+ * @providesModule ReactClass
4984
+ */
4985
+
4986
+'use strict';
4987
+
4988
+var ReactComponent = _dereq_(34);
4989
+var ReactCurrentOwner = _dereq_(39);
4990
+var ReactElement = _dereq_(57);
4991
+var ReactErrorUtils = _dereq_(60);
4992
+var ReactInstanceMap = _dereq_(67);
4993
+var ReactLifeCycle = _dereq_(68);
4994
+var ReactPropTypeLocations = _dereq_(77);
4995
+var ReactPropTypeLocationNames = _dereq_(76);
4996
+var ReactUpdateQueue = _dereq_(86);
4997
+
4998
+var assign = _dereq_(27);
4999
+var invariant = _dereq_(135);
This file is too large to show in full.
grunt/config/copy.js
deleted
-16
@@ -1,16 +0,0 @@
1
-'use strict';
2
-/*eslint-disable camelcase*/
3
-module.exports = {
4
-
5
- react_docs: {
6
- files: [
7
- {
8
- src: ['react.js', 'JSXTransformer.js'],
9
- dest: 'docs/js/',
10
- cwd: 'build/',
11
- expand: true
12
- }
13
- ]
14
- }
15
-
16
-};
grunt/tasks/release.js
+4
-2
@@ -111,13 +111,15 @@ function bower() {
111
function docs() {
112
var done = this.async();
113
114
+ grunt.file.copy('build/react-' + VERSION + '.zip', 'docs/downloads/react-' + VERSION + '.zip');
115
+ grunt.file.copy('build/react.js', 'docs/js/react.js');
116
+ grunt.file.copy('build/JSXTransformer.js', 'docs/js/JSXTransformer.js');
117
+
118
var files = grunt.file.expand(GH_PAGES_GLOB);
119
files.forEach(function(file) {
120
grunt.file.delete(file, {force: true});
121
});
122
119
- grunt.file.copy('build/react-' + VERSION + '.zip', 'docs/downloads/react-' + VERSION + '.zip');
120
-
123
// Build the docs with `rake release`, which will compile the CSS & JS, then
124
// build jekyll into GH_PAGES_PATH
125
var rakeOpts = {
package.json
-1
@@ -48,7 +48,6 @@
48
"grunt-contrib-clean": "^0.6.0",
49
"grunt-contrib-compress": "^0.13.0",
50
"grunt-contrib-connect": "~0.6.0",
51
- "grunt-contrib-copy": "^0.8.0",
51
"grunt-contrib-jshint": "^0.10.0",
52
"grunt-jest": "^0.1.2",
53
"gzip-js": "~0.3.2",